Well this is a truly bizarre phenomenon: attempting to access any of the 
state properties appears to (retroactively, some how) render the entire 
object null.  I can't even begin to imagine what might be causing this.  I 
made a jsfiddle demonstrating the problem: 
http://jsfiddle.net/asgallant/HV6W3/, but I can't replicate it with any 
manually made JSON string.  According to JSONLint.com, the JSON returned by 
#getState is valid.  I'm stumped.  If it weren't for the fact that 
everything works correctly using a "ready" event handler, I would say it 
isn't even a problem with the Visualization API.

Searching the bug reports, this has already been filed 
(here<http://code.google.com/p/google-visualization-api-issues/issues/detail?id=716&q=motionchart&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary%20Stars>).
 
 I'll add my jsfiddle as supplemental information, but seeing as how that 
bug report goes back almost a year with no update from the dev team, I 
wouldn't hold my breath waiting for a fix.

On Thursday, September 6, 2012 2:46:03 PM UTC-4, Gallusz Abaligeti wrote:
>
> Hm, if i change 'ready' event to 'statechange' in Your code it wont work 
> again :S I'm getting really confused.
> Any suggestion?
>
> Thanks,
> gallusz
>
> 2012. szeptember 6., csütörtök 16:55:00 UTC+2 időpontban asgallant a 
> következőt írta:
>>
>> It works fine for me when I tried in on the Visualization 
>> Playground<https://code.google.com/apis/ajax/playground/?type=visualization#motion_chart>
>> .
>>
>> google.visualization.events.addListener(motionchart, 'ready', function (
>> ) {
>>     var my_state = JSON.parse(motionchart.getState());
>>     console.debug(my_state.iconType);
>> }); 
>>
>> On Thursday, September 6, 2012 10:24:43 AM UTC-4, Gallusz Abaligeti wrote:
>>>
>>> Dear All,
>>>
>>> I'm working on a motionchart, and i would like to get the "iconType" 
>>> property from the actual state of the chart if it changed. My code is the 
>>> following:
>>>
>>> google.visualization.events.addListener(motionchart, 'statechange', 
>>> statechangeHandler);
>>> function statechangeHandler() {
>>>      var my_state=JSON.parse(motionchart.getState());
>>>      console.debug(my_state.iconType);
>>> };
>>>
>>> Its not working, however if I ask just for the "my_state" object, then i 
>>> can see all of the properties on the console.
>>> Please help me, thanks a lot!
>>>
>>> regards,
>>> gallusz
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/INExxOgtKjIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to