How do you set the google charts' tooltips number format to 'scientific'? I have tried the google.visualization.NumberFormat but did not have any luck. I can set the vAxis fine as shown here: 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);
}
});
Copyright Notice:Content Author:「Thomas Freiling」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/42211758/google-charts-tooltips-number-format-scientific