使用amCharts.AmGraph jquery格式化BalloonText

时间:2013-07-17 12:45:13

标签: jquery asp.net-mvc amcharts

我正在尝试使用amCharts和jquery格式化balloonText中的标签[[value]]。我需要显示没有小数的数字标签[[value]]和千位逗号分隔符,例如64578为64,578。 如何格式化balloonText?

谢谢!

 // 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); }
}

1 个答案:

答案 0 :(得分:1)

你应该设置chart.numberFormatter = {precision:0,decimalSeparator:'。',thousandsSeparator:','}