Anyone know why the yAxis still goes up to 15 despite the max value being set to 14? I tried playing around with startOnTick
and maxPadding
and didn't get very far.
http://jsfiddle.net/sag8W/
$(function () {
$('#container').highcharts({
chart: {
type: 'line'
},
yAxis: {
min: 0,
max: 14
},
startOnTick: true,
maxPadding: 0.02,
series: [
{name: "2013/10/10",
data: [5.0, 3.0, 2.5, 3.0, 3.0, 5.0]},
{name: "2014/01/10",
data: [4.0, 1.5, 2.0, 2.0, 2.0, 4.0]}
]
});
});
You need to set the tickInterval
. For some funky reason it is trying to divide the 15 points you have evenly into ticks (0 to 14 is 15 points) and it doesn't want to end on an odd value of ticks so it rounds up. This is all supposition. Anyway, try this:
yAxis: {
min: 0,
max: 14,
tickInterval: 2
},
This problem bugged me for days, and I kept hitting this page with Bing. Anwer here has been helpful, but the issue in my side was fixed following another sample, since I had static tick to set.
Here is something similar to my final result (though it can be set dynamic);
yAxis: {
tickPositioner: function () {
var positions = [0,1,2,3,4,5,6,7,8,9,10];
return positions;
}
},
Example: http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/xaxis/tickpositions-tickpositioner/
hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With