Example usage for com.google.gwt.visualization.client.visualizations AnnotatedTimeLine addReadyHandler

List of usage examples for com.google.gwt.visualization.client.visualizations AnnotatedTimeLine addReadyHandler

Introduction

In this page you can find the example usage for com.google.gwt.visualization.client.visualizations AnnotatedTimeLine addReadyHandler.

Prototype

public final void addReadyHandler(ReadyHandler handler) 

Source Link

Usage

From source file:com.facebook.tsdb.tsdash.client.plot.InteractivePlot.java

License:Apache License

@Override
public void render(final Command onRendered) {
    if (!APILoaded) {
        GWT.log("Loading the API...");
        VisualizationUtils.loadVisualizationApi(new Runnable() {
            @Override/*from   w  ww . jav  a 2s . c  o  m*/
            public void run() {
                APILoaded = true;
                GWT.log("API loaded");
                render(onRendered);
            }
        }, AnnotatedTimeLine.PACKAGE);
        return;
    }
    if (timeSeriesJSON == null) {
        GWT.log("cannot render: null data");
        return;
    }
    DataTable dataTable = DataTable.create(timeSeriesJSON.getJavaScriptObject());
    Widget w = (Widget) container;
    final AnnotatedTimeLine newChart = new AnnotatedTimeLine(dataTable, getChartOptions(),
            (w.getOffsetWidth() - 10) + "px", (w.getOffsetHeight() - 10) + "px");
    newChart.addReadyHandler(new ReadyHandler() {
        @Override
        public void onReady(ReadyEvent event) {
            endRender(newChart);
            onRendered.execute();
        }
    });
    startRender(newChart);
}