admin管理员组文章数量:1336006
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".
本文标签: javascriptHow to remove the decimal 00 from the default highcharts configurationStack Overflow
版权声明:本文标题:javascript - How to remove the decimal .00 from the default highcharts configuration? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741799644a2398143.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论