The example you wrote is not going to work because getState() is not a
global function, but chart.getState() should work.

Are the chart and the stateHandler defined in the same scope as your snippet
seems to suggest (that, if you put a breakpoint inside the stateHandler
function, is 'chart' defined? ).

If you could post a larger snippet showing how you create the motion chart
and set up the listener, that would help in troubleshooting the issue.

-- R.

On 29 September 2011 18:57, Cristian <[email protected]> wrote:

> Hi Riccardo,
> Thank you for the clarification and the link.
> now I'm having trouble getting the listener to work. I added this code
> toward the end.
>
> google.visualization.events.addListener(chart, 'statechange',
> stateHandler);
>
> function stateHandler() {
>        if(!getState())
>        {       alert(getState());
>        }
>
> but nothing happens. if I don't check for null and just alert a
> message then I see my alert message called several times and when i
> change graphs. I'm having trouble retrieving the state. I also tried
> chart.getState() but no lock.
> Any tips?
>
> Again Thank you.. your help is deeply appreciated.
>
> -C
>
>
>
> On Sep 29, 4:24 am, Riccardo Govoni ☢ <[email protected]> wrote:
> > I don't think the motionchart was ever designed to let you tweak its
> state
> > at runtime. According to this
> > paragraph<
> http://code.google.com/apis/chart/interactive/docs/gallery/motionchar...>
> > the
> > state should be treated as a sort of black box which you configure once.
> >
> > To still do what you're trying to, you could listen for
> > statechange<
> http://code.google.com/apis/chart/interactive/docs/gallery/motionchar..
> .>events.
> > When they fire, extract the current state from the motionchart,
> > parse it to figure out if the chart turned into a BUBBLE one, tweak the
> > state setting the xAxisOption as you need it and redraw the motion chart
> > with the altered state. Being a flash chart, I suspect the redraw might
> > cause some ugly flickering, though.
> >
> > -- R.
> >
> > On 29 September 2011 05:43, Cristian <[email protected]> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi,
> > > I am using options['state'] to set my default setting in my Motion
> > > Chart visualization. [VBAR, _UNIQUE_COLOR, _ALPHABETICAL, etc] {that
> > > part is working great}
> >
> > > When I select a BUBBLE graph instead of a BAR graph I want it to
> > > default to "xAxisOption":"_TIME". I am at a lost here. I have no idea
> > > where to begin to look
> > > .
> > > I'm thinking that there might be a way to add a listener to know when
> > > a different graph is selected and then assign the defaults o force the
> > > property I need then, but I can't find anything about it.
> >
> > > I would appreciate any help you guys give me or point me in the right
> > > direction.
> >
> > > Thanks,
> >
> > > -Cristian
> >
> > > PS: I'm loading my points from a CSV file. In Mozilla, Safari, Chrome
> > > everything works, but when I try it in IE nothing... any ideas? I'm
> > > posting this question in another thread.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Google Visualization API" group.
> > > 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.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> 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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
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