I'm using a integer sequence of values in highcharts, but it's adding .00 after each result. Any tips on how to solve that?
You can see the code i'm using here: /
I'm using a integer sequence of values in highcharts, but it's adding .00 after each result. Any tips on how to solve that?
You can see the code i'm using here: http://jsfiddle/CAKQH/20425/
Share Improve this question edited Oct 10, 2011 at 22:34 Diego Gomes asked Oct 10, 2011 at 22:13 Diego GomesDiego Gomes 5651 gold badge6 silver badges15 bronze badges4 Answers
Reset to default 7The second argument for Highcharts.numberFormat
specifies how many decimals you want. This should work:
Highcharts.numberFormat(this.y, 0);
http://api.highcharts./highcharts#Highcharts.numberFormat()
Using Math.round
should solve your problem.
You were only missing one parameter for the .numberFormat()
method. Check it out here:
http://jsfiddle/CAKQH/20477/
First of all, this is how your data look like -
0, 0, 0, 0, 0, 0, 0, 0, 353.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7.0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ^^^^^ ^^^
and it does not look like a sequence of integers (only).
But, if it were really a sequence of integers as follows -
0, 0, 0, 0, 0, 0, 0, 0, 353, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
then you could just do -
formatter: function() {
return Highcharts.dateFormat("%B %e, %Y", this.x) + ': ' + this.y;
}
and Highcharts would never add that ".00".