<script src=”https://www.google.com/jsapi”></script> <!– google chart api–>
google.load(“visualization”, “1”, {packages:[“corechart”]});
// Draw column chart function
function drawChart(rowsArr) {
var data = new google.visualization.DataTable();
data.addColumn(“string”, “data”);
data.addColumn(“number”, “第1個欄位”);
data.addColumn(“number”, “第2個欄位”);
data.addRows(rowsArr);
//設定ColumnChart options
var options = {
title: (‘標題’, titleTextStyle: { color:”#006459″, fontSize:16},
width: 760, height: 400, fontSize: 16, fontName: ‘微軟正黑體’,
chartArea: { width: 500, height: 200},
hAxis: { textPosition: “out”, slantedText: true}
};
//Draw ColumnChart
var chart = new google.visualization.ColumnChart($(‘#chart_div’)[0]);
chart.draw(data, options);
// 繪製表格
drawChart(rowsArr);
google.setOnLoadCallback(drawChart);