javascript HIghcharts 个人绘图点颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14328154/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HIghcharts individual plot point color
提问by Adrian
Possible Duplicate:
Highstock/Highchart cannot set Individual Point color
Currently use the addPoint function to update the highcharts graph, certain points need to be highlighted/different color... I can't find a method to do this in the api reference, is it possible?
目前使用 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 });
}
回答by Felipe Fonseca
Yes, it is possible.
对的,这是可能的。
You have the change the fillColor
attribute inside the Marker
inside the Data
Attribute.
你有改变的fillColor
内部属性Marker
里面的Data
属性。
The color
attribute inside data
did not worked for me.
color
里面的属性data
对我不起作用。
If you want the a green dot, you can look at this example I made.
如果你想要一个绿点,你可以看看我做的这个例子。
回答by Bubbles
Yes - color is an option in the options object you are passing to addPoint. Here's the API refernence for addPoint, and here'sthe description of the options available to you.
是 - 颜色是您传递给 addPoint 的选项对象中的一个选项。下面是该API refernence addPoint,和这里的提供给您的选项的说明。
Your code should end up looking more or less like this, if you say wanted a green point -
如果您说想要一个绿点,您的代码最终应该或多或少看起来像这样 -
mcjs.chart.series[exampleA].addPoint({ fillColor: "#659355", y: exampleB, exampleC });
Right now though the object you're passing doesn't quite look valid - you need to match a key to each value; exampleC has no key.
现在虽然您传递的对象看起来不太有效 - 您需要为每个值匹配一个键;exampleC 没有键。