Amchart give me amazing graphics into HTML but...
How to format the number axis? Currently it shows me 65,000 and I need value like 65000. No commas!
Thanks!
I solved the problem!
Into AmCharts.ready(function(){
put
chart.numberFormatter = {
precision:-1,decimalSeparator:",",thousandsSeparator:""
};
All Number Format happens there!
var chart = AmCharts.makeChart("chartdiv", {
[...]
"numberFormatter": {
"precision": -1,
"decimalSeparator": ",",
"thousandsSeparator": ""
}
});
If you need to format definite number:
var formatted = AmCharts.formatNumber(number,
{
precision: chart.precision,
decimalSeparator: chart.decimalSeparator,
thousandsSeparator: chart.thousandsSeparator
}, 2);
formatNumber(number, formatter, zeroCount)
Returns string formatter with the provided settings. Formatter is an object with precision, decimalSeparator and thousandsSeparator defined, like: {precision: 2, decimalSeparator: '.', thousandsSeparator: ','}; If you don't need to adjust precision set it to -1. zeroCount defines how many zeros should be added after comma (useful when formatting currencies).
Put this, it will remove, from thousands (refer docs)
"numberFormatter": {precision:-1, decimalSeparator:',', thousandsSeparator:''},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With