Search code examples
gwtuibindergwtpgwt-visualization

GWT Visualization API with UIbinders


I have tried out the visualization api using http://code.google.com/p/gwt-google-apis/wiki/VisualizationGettingStarted

But, I wanted to create charts with new visualization API like https://developers.google.com/chart/interactive/docs/gallery/piechart

Is it possible to achieve this using GWTP Uibinders or do I need to use any other ways to achieve this.

Thanks In Advance, Bennet.


Solution

  • It can be done exactl like in this question: How to integrate GWT UIBinder with Canvas?

    There is only one difference:

    You will need to load a Library at runtime first (I think it is a PlainJavaScript, wrapped by GWT):

    Runnable onLoadCallback = new Runnable() {
      public void run() {
        Panel panel = RootPanel.get();
    
        // Create a pie chart visualization.
        PieChart pie = new PieChart(createTable(), createOptions());
    
        pie.addSelectHandler(createSelectHandler(pie));
        panel.add(pie);
      }
    };
    VisualizationUtils.loadVisualizationApi(onLoadCallback, PieChart.PACKAGE);