gpt4 book ai didi

javascript - Highcharts:根据 y 值更改样条线颜色

转载 作者:行者123 更新时间:2023-12-02 22:37:51 27 4
gpt4 key购买 nike

我的 yAxis 部分如下所示:

yAxis: {
title: {
text: 'Height of tide<br>in feet.'
},
gridLineColor: '#197F07',
gridLineWidth: 0,
lineWidth:1,
plotLines: [{
color: '#FF0000',
width: 1,
value: 0
}]
},

如何将 y = <0 的线条颜色更改为红色?

最佳答案

您可以使用negativeColor属性来改变颜色。图形部分或低于阈值的点的颜色。默认阈值为 0。

Highcharts.chart('container', {

series: [{
data: [-6.4, -5.2, -3.0, 0.2, 2.3, 5.5, 8.4, 8.3, 5.1, 0.9, -1.1, -4.0],
negativeColor: '#FF0000'
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>

<div id="container" style="height: 400px"></div>

API引用:https://api.highcharts.com/highcharts/plotOptions.line.negativeColor

关于javascript - Highcharts:根据 y 值更改样条线颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58684679/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com