I need to set the color for a array of point.name and y individually.
What i have so far:
(function(H) {
H.wrap(H.Series.prototype, 'getColor', function(proceed) {
this.color = generateColorForString(this.name);
});
}(Highcharts));
This is working for the following data-structure:
{
"data": [
[
[
"2018",
"02",
"16",
"00",
"00"
],
4.9
],
...
],
"name": "MySeriesName"
}
but not for this data structure for a pie chart:
{
"type": "pie",
"name": "MySeriesName",
"data": [
[
"foo",
27
],
[
"foox",
112
],
[
"fooy",
4
]
...
]
}
Is it possible to set a color for every point by name?
Here is my fiddle: http://jsfiddle.net/2nd8561k/2/
You need to wrap resolveColor
method from Highcharts.Point.prototype
:
(function(H) {
H.wrap(H.Point.prototype, 'resolveColor', function(proceed) {
this.color = generateColorForString(this.name);
});
}(Highcharts));
Live demo: http://jsfiddle.net/BlackLabel/y4ro69dq/