google.charts.load('current', {
callback: drawChart,
packages: ['corechart']
});
function drawChart() {
var data =new google.visualization.DataTable('{"cols":[{"id":"","label":"Age range","type":"string"},{"id":"","label":"2013","type":"number"},{"id":"","label":"2014","type":"number"},{"id":"","label":"2012","type":"number"},{"id":"","label":"2015","type":"number"},{"id":"","label":"2016","type":"number"}],"rows":[{"c":[{"v":"21-30"},{"v":89},{"v":187},{"v":0},{"v":0},{"v":0}]},{"c":[{"v":"31-40"},{"v":0},{"v":0},{"v":96},{"v":284},{"v":0}]},{"c":[{"v":"41-50"},{"v":210},{"v":0},{"v":0},{"v":0},{"v":92}]}]}');
var options = {
animation: {
duration: 300,
easing: 'out',
startup: true
},
title: 'Test'
};
var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div align="middle">
<div id="chart_div" style="width: 600px; height: 300px;"></div>
</div>
就解決它,謝謝 – Ant