I have a highchart column graph, in that at some time the y axis data are displaying as [1000,2000,3000,4000] and some times as [1k, 2k, 3k, 4k].
How can I fix it to single type of data.
Regards, Navin Leon
I have a highchart column graph, in that at some time the y axis data are displaying as [1000,2000,3000,4000] and some times as [1k, 2k, 3k, 4k].
How can I fix it to single type of data.
Regards, Navin Leon
Share Improve this question asked Feb 29, 2012 at 19:53 Navin LeonNavin Leon 1,1665 gold badges22 silver badges45 bronze badges3 Answers
Reset to default 11Compare http://jsfiddle.net/BNFe5/
The difference is here:
yAxis: {
labels: {
formatter: function() {
return this.value;
}
}
},
For Converting your yaxis values into 1k,2k,3k,4k,etc:
yAxis:
{
labels:
{
formatter: function()
{
return Math.round(this.value/1000) + 'k';
}
}
},
If you are using thousands and millions in one chart, check this out.
yAxis: {
labels: {
formatter: function () {
if (this.value.toFixed(0) >= 1000000) {
return '$' + this.value.toFixed(0) / 1000000 + 'M';
} else {
return '$' + this.value.toFixed(0) / 1000 + 'K';
}
}
},
title: {
text: ''
}
},