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.