function drawChart() {
data = new google.visualization.DataTable();
data.addColumn('number', 'Time');
data.addColumn('number', 'Emotion');
rowlength=ID.length;
for(i=0; i<rowlength;i++)
{
data.addRow([Number(ID[i]), PosPerc[i]-NegPerc[i] ]);
}
options = {
title: 'Emotion Analysis',
curveType: 'function',
legend: {position: 'bottom' },
colors: ['blue'],
vAxis: {minValue:-100, maxValue:100},
animation: { "startup":true, duration: 1000, easing: 'in' }
};
view = new google.visualization.DataView(data);
view.setRows(data.getSortedRows({column: 0, desc: true}));
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(view, options);
}
This is how I have created a line chart using Google Charts. Now. Instead of loading the entire data at first. I want to have a animation such that the line extends when we add each data row into it. I tried calling the chart.draw(data options) inside the for loop. But that didn't work.