0
這裏谷歌圖表折線圖是我的數據:選項來創建具有註釋
dataToDisplay=[[156,"2013-12-01","note one"],
[206,"2013-12-02","note two"],
[280,"2013-12-03","note three"],
[320,"2013-12-04","note four"],
[0,"2013-12-05",""]]
這裏是做一個折線圖的代碼:
chartData = new google.visualization.DataTable();
chartData.addColumn('number', 'Miles');
chartData.addColumn('string', 'Date');
chartData.addColumn({type:'string', role:'annotationText'});
chartData.addRows(dataToDisplay);
graphTitle = 'Mileage'
var options = {
title: graphTitle,
height:600
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(chartData, options);
和錯誤:
"Data column(s) for axis #0 cannot be of type string"
我不知道發生了什麼。哪一列是軸#0?
此外,有沒有建立與使用類似的註釋折線圖的方式:
var chartData = google.visualization.arrayToDataTable(dataArray);
如果是這樣,怎麼會dataArray中必須構建?
工作就像一個魅力!謝謝。 – user1126515