Mark
Mark

Reputation: 47

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 colour too? If so, how? I've been playing for ages and can't get it right!

Upvotes: 0

Views: 4487

Answers (2)

malonso
malonso

Reputation: 2295

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/

Upvotes: 0

NT3RP
NT3RP

Reputation: 15370

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
})

Upvotes: 3

Related Questions