スタートアップ時にGoogle棒グラフをアニメートしようとしています。グラフは表示されますが、アニメートされません。私は、チャートの棒グラフをゼロから最終値まで伸ばしたいと思っています。私はanimation.startupをtrueに設定しましたが、まだアニメーション化されません。私は間違って何をしていますか?Googleグラフのスタートアップアニメーションが機能しない
eh.html:
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="eh.js"></script>
</head>
<body>
<div id="chart_div"></div>
</body>
</html>
eh.js:
google.charts.load('current', {
packages: ['bar'], callback: drawChart
});
function drawChart() {
var choices = ["Banana", "Apple", "Orange"];
var votes = [1, 2, 3];
var name = "Favorite fruit";
var dataArray = [
['Choice', 'Votes']
];
for (var i = 0; i < choices.length; i++) {
dataArray.push([choices[i], votes[i]]);
}
var data = google.visualization.arrayToDataTable(dataArray);
var options = {
animation:{
duration: 1000,
easing: 'linear',
startup: true
},
vAxis: {minValue:0, maxValue:100000000},
title: "votes",
legend: { position: 'none' },
chart: { title: name,
subtitle: 'popularity by Votes' },
bars: 'horizontal', // Required for Material Bar Charts.
axes: {
x: {
0: { side: 'top', label: 'Votes'} // Top x-axis.
}
},
bar: { groupWidth: "90%" }
};
var chart = new google.charts.Bar(document.getElementById('chart_div'));
chart.draw(data, options);
}
...次の作業のスニペットを参照してくださいおかげで、これは動作しました! –