Reputation: 25396
I have a highcharts scatter plot, and I want to customize the locations of the tick marks. I see that I can do this with the tickPositioner
callback function for each axis. This seems to work fine, but...
tickPositioner
on the y-axis, it also seems to reset the chart's max and min to the range of my ticks.Why is there this different behavior between x and y axis? How can I correctly set the tick positions in my y-axis without affecting the overall range of my axis?
Below is the relevant section of my chart config, and also there's a fiddle demonstrating this at https://jsfiddle.net/cfarmerga/a6mvgbcf/
{
// The positioner in the x axis sets the ticks and preserves the displayed range
xAxis: {
tickPositioner: function () { return [2, 4, 6, 8] }
},
// The positioner in the y axis sets the ticks but changes the displayed range
yAxis: [{
tickPositioner: function () { return [2, 4, 6, 8] }
}],
}
Upvotes: 1
Views: 878
Reputation: 1560
The difference between the X and Y axes is the default value for endOnTick and startOnTick.
yAxis: [{
gridLineWidth: 1,
startOnTick: false,
endOnTick: false
}],
Demo: https://jsfiddle.net/BlackLabel/u7gthrnL/
Upvotes: 1