Notes on GWT

There is currently no GWT wrapper around Dygraphs, however there is a class that can be used to easily load Dygraphs into the browser. To use it, include the generated dygraph-gwt.jar file in your classpath and add the following line to your GWT module:

<inherits name="org.danvk.dygraphs"/>    

Call org.danvk.Dygraphs.install() when your application starts to install the JavaScript code into the browser. You can use JSNI to call Dygraphs from your GWT code, as in the example below. The example uses the Visualization API for GWT and the Dygraphs GViz API.

public static native JavaScriptObject drawDygraph(
    Element element, DataTable dataTable, double minY, double maxY) /*-{
  var chart = new $wnd.Dygraph.GVizChart(element);
  chart.draw(dataTable,
    {
      valueRange: [minY, maxY]
    });
  return chart;
}-*/;