Motion chart statechange event

110 views
Skip to first unread message

Landryraccoon

unread,
Nov 24, 2009, 4:48:16 PM11/24/09
to Google Visualization API
I have a google motion chart and I'd like to have a title that
dynamically updates if the user changes the quantities displayed. The
way I thought I'd do this is by capturing the statechange event for
the chart and then using javascript to change the title, for example
something like this:

<script type="text/javascript" src="http://www.google.com/jsapi"></
script>
<script type="text/javascript">
google.load('visualization', '1', {'packages':
['motionchart']});
google.setOnLoadCallback(function() {
... code snipped here ...
var chart = new google.visualization.MotionChart
(document.getElementById('divId'));
chart.draw(data, config);
var onstatechange = function() {
alert("chart state changed");
document.getElementById('div_debug').innerHTML =
chart.getState();
};
chart.statechange = onstatechange;
});
</script>

However, this code doesn't do what I expect. I get a very pretty
motion chart, but the onstatechange callback function doesn't get
called. What should I be doing here?

Thanks in advance.

ChartMan

unread,
Nov 24, 2009, 5:33:56 PM11/24/09
to google-visua...@googlegroups.com
This is not how you are supposed to listen to the event.
Use the following
google.visualization.events.addListener(chart, 'statechange', handler);
 

--

You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.



Reply all
Reply to author
Forward
0 new messages