如何将Google图表的工具提示数字格式设置为“科学”?我试过google.visualization.NumberFormat,但没有任何运气。我可以将vAx设置为正常,如下所示:chart
$.ajax({
url: "GetAreaChartData",
type: "post",
data: formContainer.serialize(),
success: function (data) {
var tdata = new google.visualization.DataTable();
var rows = data.length;
var cols = data[0].length;
tdata.addColumn('datetime', 'DateTime');
tdata.addColumn('number', 'Frequency Offset');
tdata.addRows(data.length);
for (var i = 1; i < data.length; i++) {
tdata.setCell(i, 0, new Date(data[i][0]));
for (var j = 1; j < cols; j++) {
var value = parseFloat(data[i][j]);
tdata.setCell(i, j, value);
}
}
var options = {
width: 900,
height: 500,
lineWidth: 1,
pointSize: 0,
legend: 'none',
vAxis: {
title: "Frequency Offset",
format:"scientific"
},
};
var formatter = new google.visualization.NumberFormat({ format: 'scientific' });
formatter.format(tdata, 1);
var chart = new google.visualization.ScatterChart(document.getElementById('chart_div'));
chart.draw(tdata, options);
},
error: function (jqXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
答案 0 :(得分:0)
NumberFormat没有选项 - &gt; 'format'
使用 - &gt; 'pattern'
- 而不是......
var formatter = new google.visualization.NumberFormat({ pattern: 'scientific' });