when data is: [[0, 0.34], [1, 4.4], [2, 1.74], [3, -3.34], [4, 20], [5, 6]]
How can I have the yAxis intervals be all 0.5 (or less) for when data is up to 10 lets say, and the bigger intervals (in my example 6 to 20).?
I cant do it with tickintervals (even if it wasnt supposed to be dynamic but always 0.5), I cant make it work. When I specify
yAxis: {
allowDecimals: true,
tickInterval: 0.5,
}
I have intervals of 1 instead of 0.5. If I want to make it dynamic, I believe I have to use the formatter function, but Im not sure how to. Thanks!
You also need to set the step
option because excess labels are hidden to avoid overlapping.
yAxis: {
labels: {
enabled: true,
step: 1
},
allowDecimals: true,
tickInterval: diff > 10 ? 1 : 0.5,
...
}
Live demo: https://jsfiddle.net/BlackLabel/371f9vd2/
API Reference: https://api.highcharts.com/highcharts/yAxis.labels.step