开发者

jQuery HighCharts colour by column

I notice there is the option colorByPoint, which I have enabled in my chart, but how do I specify a colour for every single point in my data?

Do I have to specify every bit of data sepoerately with it's colou开发者_开发问答r too? If so, how? I've been playing for ages and can't get it right!


If you know which data point you want to change the colour of, you can change the colour of a data point on the fly by doing something like the following:

yourchart.series[yourSeriesIndex].data[yourDataPointIndex].update({
    color: "#123456" //your colour value
})


If you want to specify the color for each point as you are populating the series you can do the following:

fakeSerioesName.data.push({y : yourYValue,color:yourYColor});

Where yourYColor is a hex color. See example:

http://jsfiddle.net/Dabr3/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜