kzoon
Posts: 281
Joined: Wed Aug 10, 2011 8:22 am

Color axis stops on axis values

When you use 3 stops on a color axis, it is impossible to give the right value to the middle stop if you want the middle stop at a specific value.
You need to express the stop position as a percentage of the color axis, but the automatic scaling of the color axis makes it impossible to know beforehand where that value will be exactly on the axis.

See this example: http://jsfiddle.net/kzoon/quzb14pa/
Here I want value 0 to be white, below 0 red and above 0 blue.
In my data 0 is at 0.3, but on the scale 0 is at 0.4. But I don't know that beforehand.

There could be 2 solutions:
1 Allow tying a stop to an actual value
2 Allow setting stops after render

Solution 1 is obviously not there.
Is there a way to set stops after render? I see methods like addPlotBand on axis, but not addStop...
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Color axis stops on axis values

Hello kzoon!

We appreciate you reaching out to us!

You're right, there are no methods to add stops after render, but we can update the whole colorAxis including stops in that. In the demo below you can see how it can be done.

API references:
https://api.highcharts.com/class-refere ... xis#update

Demo:

http://jsfiddle.net/BlackLabel/f09q7kes/

Let me know if that was what you were looking for!
Best regards!
Dominik Chudy
Highcharts Developer

Return to “Highcharts Maps”