11

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!

orafaelreis
  • 2,855
  • 2
  • 28
  • 31

3 Answers3

18

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": ""
        }
    });
Jorge Ferreira
  • 96,051
  • 25
  • 122
  • 132
orafaelreis
  • 2,855
  • 2
  • 28
  • 31
2

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).

Zvezdochka
  • 1,128
  • 12
  • 8
1

Put this, it will remove, from thousands (refer docs)

"numberFormatter": {precision:-1, decimalSeparator:',', thousandsSeparator:''},
Samuel Philipp
  • 10,631
  • 12
  • 36
  • 56
Shobha
  • 9
  • 3