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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 21:19:19  来源:igfitidea点击:

HIghcharts individual plot point color

javascriptjqueryhighcharts

提问by Adrian

Possible Duplicate:
Highstock/Highchart cannot set Individual Point color

可能重复:
Highstock/Highchart 无法设置单个点颜色

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 fillColorattribute inside the Markerinside the DataAttribute.

你有改变的fillColor内部属性Marker里面的Data属性。

The colorattribute inside datadid 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 没有键。