Highcharts个别数据点颜色

3

可能是重复问题:
Highstock/Highchart无法设置单个数据点颜色

目前使用addPoint函数更新highcharts图表,有些数据点需要高亮显示或者不同颜色...我在API参考中找不到相应的方法,是否有可能实现?

//exampleA - Series arrayId
//exampleB - Point value 
//exampleC when not null would has extra tooltip info, these points need to be a different color.

addPoint: function(exampleA, exampleB, exampleC) 
{
    mcjs.chart.series[exampleA].addPoint({ y: exampleB, exampleC });
}

请访问以下链接以获取有关在Highcharts中为每列设置不同颜色的信息:https://dev59.com/-msz5IYBdhLWcg3wrJwx#7739047 - Ricardo Alvaro Lohmann
2个回答

5

是的,这是可能的。

您需要更改Data属性内部的Marker中的fillColor属性。

Data中的color属性对我没有效果。

如果您想要绿点,可以看看我做的这个例子


2
是的——在传递给addPoint方法的options对象中,可以选择颜色。这是addPoint API的参考文档,这里有可用选项的描述。
如果您想要一个绿点,则您的代码应该看起来像这样:
mcjs.chart.series[exampleA].addPoint({ fillColor: "#659355", y: exampleB, exampleC });

目前,你传递的对象似乎不完整 - 你需要为每个值匹配一个键;例如,exampleC没有键。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接