copy over dygraph-utils.js changes
[dygraphs.git] / docs / gwt.html
CommitLineData
14403441
DV
1<!--#include virtual="header.html" -->
2
3<h2 id="gwt">Notes on GWT</h2>
4<p>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:</p>
5
6<pre>
7&lt;inherits name=&quot;org.danvk.dygraphs&quot;/&gt;
8</pre>
9
10<p>Call org.danvk.Dygraphs.install() when your application starts to install the JavaScript code into the browser. You can use <a href="http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html">JSNI</a> to call Dygraphs from your GWT code, as in the example below. The example uses the <a href="http://code.google.com/p/gwt-google-apis/wiki/VisualizationGettingStarted">Visualization API for GWT</a> and the <a href="#gviz">Dygraphs GViz API.</a></p>
11
12<pre>
13public static native JavaScriptObject drawDygraph(
14 Element element, DataTable dataTable, double minY, double maxY) /*-{
15 var chart = new $wnd.Dygraph.GVizChart(element);
16 chart.draw(dataTable,
17 {
18 valueRange: [minY, maxY]
19 });
20 return chart;
21}-*/;
22</pre>
23
24
25<!--#include virtual="footer.html" -->