eraka
Posts: 123
Joined: Thu Apr 28, 2022 6:55 am

Different colors to the different points of same row ?

Hi All,

Can you please tell me if we can have different colors for different points in the same row, when row are created dynamically and data points are created dynamically from backend api?
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Different colors to the different points of same row ?

Hi eraka!
Actually, this is not possible to set different colors to points in the same rows/axes directly by API, so if you want to achieve this you have to use some custom JS code. I have prepared two demos for you because you can do it in different ways. The first demo relies on a callback function called on a load of the chart, just loop through all series and all points and set colors. The second demo is changing the prototype of one core function in Highcharts - if you want to use it, just copy-paste the IIFE function to your project, but if you have multiple charts on your page all charts will be affected by this function.

Demo with forEach: https://jsfiddle.net/BlackLabel/bx7fa8zv/
Demo with changing prototype: https://jsfiddle.net/BlackLabel/vtr7bm0p/

Let me know if that was what you were looking for.
Kind regards!
Hubert Kozik
Highcharts Developer

Return to “Highcharts Gantt”