Reputation: 565
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.net/CAKQH/20425/
Upvotes: 0
Views: 10088
Reputation: 339
The second argument for Highcharts.numberFormat
specifies how many decimals you want. This should work:
Highcharts.numberFormat(this.y, 0);
http://api.highcharts.com/highcharts#Highcharts.numberFormat()
Upvotes: 7
Reputation: 51030
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".
Upvotes: 0
Reputation: 4038
You were only missing one parameter for the .numberFormat()
method. Check it out here:
http://jsfiddle.net/CAKQH/20477/
Upvotes: 0