I want to specify colors for certain piece for my pie chart.
I wrote some code like this, but it seems not working. Anyone got clue how to work around with this?
{
name: data[i].status,
color: function() {
if (data[i].status === "Working") {
return '#60a57c';
} else if (data[i].status === "Stopped \/ Idle") {
return '#e7494d';
} else if (data[i].status === "Transport") {
return '#fac101';
} else if (data[i].status === "Headland Turning") {
return '#66cc13';
}
},
y: data[i].val
}
Basically what I want is if the status is "Working", then we specify color as "#60a57c", etc. I don’t want HighChart auto-generate colors for me.
Thank you.
colorhave to be a string.So try the following:
Hope this help you.
Reference