Вопрос

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:''},
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top