How can I use getVisibleChartRange() from AnnotatedTimeline in GWT?

43 views
Skip to first unread message

rxin

unread,
Jul 2, 2009, 6:36:07 PM7/2/09
to Google Visualization API
I realized that the Java GWT API does not expose the
getVisibleChartRange() for AnnotatedTimeline object. I am trying to
create a wrapper Java method so I would be able to get the range in my
RangeChange event. The reason is the range values returned from
RangeChange event is not accurate.

In my TimeSlider class, I have a member timeline that is an instance
of the AnnotatedTimeline object, and in TimeSlider, I also defines the
following two methods:

public native Date getVisibleChartStartDate(AnnotatedTimeLine
timeline) /*-{
obj =
timeline.@com.google.gwt.visualization.client.visualizations.Visualization::jso.getVisibleChartRange
();
return obj.start;
}-*/;

public native Date getVisibleChartEndDate(AnnotatedTimeLine
timeline) /*-{
obj =
timeline.@com.google.gwt.visualization.client.visualizations.Visualization::jso.getVisibleChartRange
();
return obj.end;
}-*/;

However, I am getting an "Uncaught exception escaped" error. Could you
please take a look and let me know what I should change to make this
working?

Thanks.



Eric Ayers

unread,
Jul 3, 2009, 1:25:37 PM7/3/09
to Google Visualization API


On Jul 2, 6:36 pm, rxin <reyno...@gmail.com> wrote:
> I realized that the Java GWT API does not expose the
> getVisibleChartRange() for AnnotatedTimeline object. I am trying to
> create a wrapper Java method so I would be able to get the range in my
> RangeChange event. The reason is the range values returned from
> RangeChange event is not accurate.
>
> In my TimeSlider class, I have a member timeline that is an instance
> of the AnnotatedTimeline object, and in TimeSlider, I also defines the
> following two methods:
>
>         public native Date getVisibleChartStartDate(AnnotatedTimeLine
> timeline) /*-{
>                 obj =
> timeli...@com.google.gwt.visualization.client.visualizations.Visualization::jso.getV isibleChartRange
> ();
>                 return obj.start;
>         }-*/;
>
>         public native Date getVisibleChartEndDate(AnnotatedTimeLine
> timeline) /*-{
>                 obj =
> timeli...@com.google.gwt.visualization.client.visualizations.Visualization::jso.getV isibleChartRange
> ();
>                 return obj.end;
>         }-*/;

Try something like this:

public static Date getVisibleChartStartDate(AnnotatedTimeLine
timeline) {
JsDate result = nativeGetVisibleChartStartDate(timeline.getJso());
return JsDate.toJava(result);
}

private static JsDate nativeGetVisibleChartStartDate
(JavaScriptObject jso) /*-{
return jso.getVisibleChartRange();
}-*/;


The JsDate class is in the latest gwt-ajaxloader SVN repo at
http://code.google.com/p/gwt-google-apis
Reply all
Reply to author
Forward
0 new messages