Вопрос

I am trying to format the tag [[value]] in a balloonText using amCharts and jquery. I need to show the number tag [[value]] without decimals and with thousand comma separator, for example 64578 as 64,578. How can I format the balloonText?

Thanks!.

 // Creates graph and adds it to actual chart
var createGraph = function (title, valueField, color, unit) {
    try {
        var graph = new AmCharts.AmGraph();
        graph.title = title;
        graph.labelText = "[[value]]";
        graph.balloonText = title + " of [[value]] " + unit + " \nRepresents [[percents]]% of total [[category]]";
        graph.valueField = valueField;
        graph.type = "column";
        graph.lineAlpha = 1;
        graph.fillAlphas = 0.6;
        graph.lineColor = color;
        chart.addGraph(graph);
    } catch (err) { showModalMessage("Error in createGraph() method: " + err); }
}
Это было полезно?

Решение

You should set chart.numberFormatter = {precision:0, decimalSeparator:'.', thousandsSeparator:','}

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top