Problem with getState() in motion chart: suddenly it always returns "null´"

211 views
Skip to first unread message

LonelyWolf

unread,
Jul 19, 2011, 11:28:11 AM7/19/11
to Google Visualization API
Before July 13th, method "getState" called from within my motion chart
always returned a valid result.
Now, it always returns "null".
Is it a bug, or did the API change?

Thanx for any hint

visigoth

unread,
Jul 24, 2011, 3:36:38 AM7/24/11
to google-visua...@googlegroups.com
Sounds like a potential bug.
Could you please send us a simple HTML page demonstrating the problem?

Thanks,
Visigoth

Austin Griffith

unread,
Jul 25, 2011, 11:40:00 AM7/25/11
to Google Visualization API
I'm running into the same problem. It's probably me being dumb, but
here is a dead simple example or two:

Using the motion chart right from the website and then
calling .getState() on it after it draws:
http://media.affectsensing.com/auprocessor/getstate.html

Another thing I tried was calling getState() every time the
statechange event fires:
http://media.affectsensing.com/auprocessor/getstate2.html

In this example you can see that the getState function is set for the
chart object but calling it still returns null.

What am I doing wrong?
I tried both chrome and firefox on a mac.

-austin

Austin Griffith

unread,
Jul 25, 2011, 11:45:03 AM7/25/11
to Google Visualization API

I am having the exact same problem... did you find a solution?

here are some simple examples:

http://media.affectsensing.com/auprocessor/getstate.html

and

http://media.affectsensing.com/auprocessor/getstate2.html

Tao Klerks

unread,
Jul 25, 2011, 3:24:31 PM7/25/11
to Google Visualization API
Hi,

I encountered the same issue today and stumbled across the solution
(for our problem at least, which appeared exactly as above) while
trying to create a nice simple reproduction case.

The issues were:
- In the latest release, a new "statechange" event is being fired
early in setup, and in that initial event, "getState()" always returns
null.
- If an error occurs in the custom "statechange" event handler you
specify, then execution just halts, silently. Chrome refuses to break,
so does firebug - the error just disappears and code stops executing
(if you think this is bad, wait for the next one).
- If an error occurs in the FIRST execution of your custom
"statechange" event handler (or possibly in any handler?), then
"getState()" always returns null for all subsequent calls to that
event handler!

So: our handler code wasn't checking for null and was failing on the
first (new) statechange, and all subsequent calls to getState() were
also returning null because of this first null-handling error.

Now, I've looked at Austin Griffith's example linked above, and the
behaviour is slightly different: on the first call to getState() we
now get a null, as expected I guess - on subsequent calls, however,
the calls getState() errors out and execution of the handler halts
(silently). I can't see any obvious reason why the later getState()
calls are erroring out. Even in my case when we failed to handle null,
it caused getError() to later return null, not to fail.

Sorry I can't help more with this specific scenario, but hopefully
this helps someone else who was getting consistent nulls from
getState() due to an error-handling failure somewhere.

-Tao

LonelyWolf

unread,
Aug 8, 2011, 9:22:11 AM8/8/11
to google-visua...@googlegroups.com
Hi Tao,

thank you very much for your hint.
It helped me to identify the problem and to implement a workaorund for it.
Basically, it's just a matter of checking if the return value of the getState() function call is null or not.
If it 's not null, then everything works as fine as it did before.

Thanks also to visigoth and Austin for their help.

LonelyWolf

nfgusedautoparts

unread,
Aug 15, 2011, 2:33:58 PM8/15/11
to Google Visualization API


On Aug 8, 9:22 am, LonelyWolf <w.heli...@triagens.de> wrote:
> It helped me to identify the problem and to implement a workaorund for it.
> Basically, it's just a matter of checking if the return value of the
> getState() function call is null or not.
> If it 's not null, then everything works as fine as it did before.

i'm encountering this and don't really see a workaround for my issue.

i have some buttons which are supposed to allow me to adjust the
graph; they do getState(), some manipulation, and setState().
right now, they get null from getState() every time they're called. in
the internet exploder javascript debugger, i get "Unspecified error"
at line 49
in what looks like a piece that wires flash to javascript:

function __flash__addCallback(instance, name) {
instance[name] = function () {
return eval(instance.CallFunction("<invoke name=\""+name+"\"
returntype=\"javascript\">" + __flash__argumentsToXML(arguments,0) +
"</invoke>"));
}
}

line 49 being the line starting with "return eval ..."

any suggestions?

thanks,
richard

LonelyWolf

unread,
Aug 23, 2011, 5:04:51 AM8/23/11
to Google Visualization API
Hi Richard,

please read carefully what Tao says:

The first "statechange" event will be fired early in setup, and if
your private statechange method produces any error during this phase,
it will be blocked also for the future calls.

So, if you perform your actions only when getState() does _not_ return
"null", you might be succesful.
For me, it helped just to ask if getState() returns "null" or not
"null":
- If it returns "null", my statechange method simply does nothing.
- If it returns the real chart state, I can proceed with my actions.

Please try...

LonelyWolf

On 15 Aug., 20:33, nfgusedautoparts <nfgusedautopa...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages