如何在谷歌图表中格式化印度格式的金额

时间:2016-06-27 10:55:46

标签: asp.net google-visualization data-visualization number-formatting column-chart

我的图表是这样的:

enter image description here

我希望显示像印度格式的金额 而不是百万/十亿我想要显示千/拉克斯/克鲁尔 以及“27,98,99,811.34”

的工具提示

提前感谢..

1 个答案:

答案 0 :(得分:0)

To load a chart formatted for a specific locale,使用语言参数:

google.charts.load('current', {
  callback: function () {//},
  language: 'hi_IN',
  packages:['corechart']
});

参见以下示例......

google.charts.load('current', {
  callback: function () {
    var dataTable = new google.visualization.DataTable({
      cols: [
        {label: 'Month', type: 'string'},
        {label: 'Amount', type: 'number'}
      ],
      rows: [
        {c:[{v: 'April'}, {v: 279899811.34}]},
        {c:[{v: 'May'}, {v: 205855811}]},
        {c:[{v: 'June'}, {v: 10009811}]},
        {c:[{v: 'July'}, {v: 79979811}]},
        {c:[{v: 'August'}, {v: 175789911}]},
        {c:[{v: 'September'}, {v: 99899811}]},
        {c:[{v: 'October'}, {v: 149899811}]},
        {c:[{v: 'November'}, {v: 80899811}]},
        {c:[{v: 'December'}, {v: 60899811}]},
        {c:[{v: 'January'}, {v: 225899811}]},
        {c:[{v: 'February'}, {v: 148899811}]},
        {c:[{v: 'March'}, {v: 150899811}]}
      ]
    });

    var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
    chart.draw(dataTable, {
      vAxis: {
        format: 'short'
      },
      legend: 'none'
    });
  },
  language: 'hi_IN',
  packages:['corechart']
});
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>