我可能只是很累,但是,我似乎無法拉動Google Charts API DataTable中單個單元格的價值。我猜想它是這樣的:在Google Charts API中如何獲取DataTable中單元格的值?
DataTable.getCell(row,col);
我只是忽略了一些非常天真的東西?
這是我一直在使用的API參考:http://code.google.com/apis/chart/interactive/docs/reference.html
我可能只是很累,但是,我似乎無法拉動Google Charts API DataTable中單個單元格的價值。我猜想它是這樣的:在Google Charts API中如何獲取DataTable中單元格的值?
DataTable.getCell(row,col);
我只是忽略了一些非常天真的東西?
這是我一直在使用的API參考:http://code.google.com/apis/chart/interactive/docs/reference.html
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["table"]});
google.setOnLoadCallback(drawTable);
function drawTable() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Name');
data.addColumn('number', 'Salary');
data.addColumn('number', 'Full Time Employee');
data.addRows([
['Mike', {v: 10000, f: '$10,000'}, 10],
['Jim', {v:8000, f: '$8,000'}, 20],
['Alice', {v: 12500, f: '$12,500'}, 38],
['Bob', {v: 7000, f: '$7,000'}, 20]
]);
var table = new google.visualization.Table(document.getElementById('table_div'));
table.draw(data, { showRowNumber: true });
$("#table_div table tbody tr td").click(function() {
alert($(this).html());
});
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<div id="table_div">
</div>
這似乎是*繪製*表格,但似乎沒有解決OP問的問題。 – o11c
啊哈!一定很累。感謝您指出顯而易見的... – Jonathan
您知道,我也有過這樣的日子。 –