Given the structure of your code, you need to pass init to setOnLoadCallback, 
not drawChart:

google.setOnLoadCallback(init);

Also, your button click event sets the new value to (800 - the current 
value).  If you want to set it to 800, you need to change this:

var newValue = 800 - data.getValue(0, 1);


to this:

var newValue = 800;



On Monday, November 25, 2013 5:03:58 AM UTC-5, Chundy wrote:
>
>
> I'm trying to do a transition animation for a column chart, but can't get 
> it to work. I want the column to go from 200 to 800. If someone could look 
> over what I've done and point to any obvious mistakes, please do so. 
>
> Thanks,
> Chundy
>
> I copied the column chart example below: 
>
> <script src="https://www.google.com/jsapi"; 
> type="text/javascript"></script>
> <script type="text/javascript">// <![CDATA[google.load("visualization", 
> "1", {packages:["corechart"]});
>       google.setOnLoadCallback(drawChart);
>
>     function init() {
>     var data = new google.visualization.DataTable();
>     data.addColumn('string', 'N');
>     data.addColumn('number', 'Value');
>     data.addRow(['V', 200]);
>
>      var options = {
>         title: 'Random Numbers',
>         hAxis: {title: 'Year', titleTextStyle: {color: 'red'}},
>         vAxis: {title: 'Number',
>                 gridlines:  {color: '#333', count: 3},
>                 minValue: 0,
>                 maxValue: 1500,       
>                 },
>         animation:{
>                 duration: 1000,
>                 easing: 'out',
>                 },
>         };
>
> var chart = new google.visualization.ColumnChart(
>
>         document.getElementById('visualization'));
>     var button = document.getElementById('b1');
>
>     function drawChart() {
>       // Disabling the button while the chart is drawing.
>       button.disabled = true;
>       google.visualization.events.addListener(chart, 'ready',
>           function() {
>             button.disabled = false;
>           });
>       chart.draw(data, options);
>     }
>
>     button.onclick = function() {
>       var newValue = 800 - data.getValue(0, 1);
>       data.setValue(0, 1, newValue);
>       drawChart();
>     }
>     drawChart();
>   }
>
>     
> // ]]></script>
>
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to