I want to add start up animation in google Column chart on starting the chart in Android
Application. I tried to run the code given at GoogleChart that is
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['bar']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses', 'Profit'],
['2014', 1000, 400, 200],
['2015', 1170, 460, 250],
['2016', 660, 1120, 300],
['2017', 1030, 540, 350]
]);
var options = {
chart: {
title: 'Company Performance',
subtitle: 'Sales, Expenses, and Profit: 2014-2017',
animation:{
duration: 1000,
easing: 'linear',
startup: true
},
}
};
var chart = new google.charts.Bar(document.getElementById('columnchart_material'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="columnchart_material" style="width: 900px; height: 500px;"></div>
</body>
</html>
I have added the animation properties as:
animation: {
duration: 1000,
easing: 'linear',
startup: true
},
But the chart is not animating in Android App on the start. I also tried to run the code in browser, the chart is working fine but is not animating.
there are several options Material charts do not support, including
animation
see --> Tracking Issue for Material Chart Feature Parity #2143
Material charts -->
google.charts.Bar
--packages: ['bar']
Core charts -->
google.visualization.ColumnChart
--packages: ['corechart']
using a Core chart with the following option will display similar to Material
when using
animation
, the option is not part of any otherthe code in the question has
animation
as part ofchart
-- (chart.animation
)it would be more like...
see following working snippet for
animation
using Core chart...note: Core chart does not have option for
chart