我是谷歌图表来绘制表格。我有一列数字,但数字打印为“1,222,322”,但我不想在数字之间分组符号(逗号)。 我试过了
var formatter = new google.visualization.NumberFormat({ groupingSymbol: ' '});
formatter.format(data, 1);
但它不起作用
答案 0 :(得分:0)
似乎在这里工作正常
确保在绘制图表之前格式化列
请参阅以下工作代码段...
google.charts.load('current', {
callback: drawChart,
packages:['controls', 'table']
});
function drawChart() {
var data = google.visualization.arrayToDataTable([
['date', 'count'],
[new Date('2016-09-29 06:47:47'), 1000001],
[new Date('2016-09-29 14:48:42'), 1222322],
[new Date('2016-10-29 06:47:47'), 3250805],
[new Date('2016-11-29 06:48:42'), 1110588],
]);
var formatter = new google.visualization.NumberFormat({
groupingSymbol: ' '
});
formatter.format(data, 1);
var table = new google.visualization.ChartWrapper({
chartType: 'Table',
containerId: 'table_div',
dataTable: data
});
table.draw();
}
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="table_div"></div>