I have been trying to populate yaxis values on my highchart as per defined by me and results should be shown accordingly but all my efforts are in vain i am not able to manually set this.value
of yaxis of highchart . Following is a link to my Jsfiddle . Kindly help..
In the following JS COde I have been trying to set the this.value
of yaxis to the arrayed values of yAxisLabels but values are not being labled and chart is not dislayed accordingly.
JS CODE FOR YAXIS
var yAxisLabels = ['5','10','20','30','40','50'];
yAxis: {
labels: {
formatter: function () {
for (i=0; i<=5; i++) {
this.value=yAxisLabels[i];
return this.value;
}
}
},
title: {
text: 'Total fruit consumption'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'blue'
}
}
}
you can also set like this
You can use the Tick Positioner to define your axis tick values:
See jsfiddle
The important parts are:
your axis label array containing numbers and not strings
and
the tickPositioner returning your array.
TickPositioner Documentation