0
看到下面的代碼,我使用內聯表格,並轉換爲添加列和添加行,所以我可以指定列類型 - 此代碼將不會顯示任何錯誤或呈現圖表...什麼是錯的 - 謝謝提前谷歌圖表addcolumn不工作
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", '1.1', {packages:['corechart', 'annotationchart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.DataTable();
data.addColumn('datetime', 'TimeStamp');
data.addColumn('number', 'Temp(F)');
data.addColumn('number', 'pH');
data.addRows([
[new Date(2014,02,04,15,15,14), 58.75, 7.97],
[new Date(2014,02,04,15,15,19), 58.78, 7.93],
[new Date(2014,02,04,15,23,08), 58.69, 7.94],
[new Date(2014,02,04,20,49,46), 58.10, 7.94],
[new Date(2014,02,04,21,14,15), 57.99, 7.92],
[new Date(2014,02,04,21,15,05), 57.99, 7.92]
]);
var options = {
title: 'Temperature compensated pH',
curveType: "function",
hAxis: {format: 'e hh:mm:ss a'},
vAxes: {0: {logScale: false, minValue: 40}, 1: {logScale: false}},
series: {0: {targetAxisIndex: 0}, 1: {targetAxisIndex: 1}}
};
var chart = new google.visualization.AnnotationChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<h1>pH Logger</h1>
<hr>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
你能做出的jsfiddle? –