Add GWT Dygraphs loader class and supporting files.
[dygraphs.git] / docs / index.html
index c8ac16f..1a86ecc 100644 (file)
@@ -19,6 +19,7 @@
         <li><a href="#baseball">Baseball chart</a></li>
         <li><a href="#stock">Stock chart</a></li>
         <li><a href="#options">Options Reference</a></li>
+        <li><a href="#gwt">GWT Compatibility</a></li>
         <li><a href="#policy">Data Policy</a></li>
       </ul>
 
@@ -474,7 +475,7 @@ perl -ne 'BEGIN{print "Month,Nominal,Real\n"} chomp; ($m,$cpi,$low,$close,$high)
 
     <h2 id="options">Other Options</h2>
 
-    <p>These are the options that can be passed in through the optional third parameter of the Dygraph constructor. To see demonstrations of many of these options, browse the <a href="tests/">dygraphs tests</a> directory.</p>
+    <p>These are the options that can be passed in through the optional third parameter of the Dygraph constructor. Under each option is a set of links to tests which demonstrate its use. While we attempt to keep this list up-to-date, a more complete list can be found in the <code>Dygraph.DEFAULT_ATTRS</code> map in <code>dygraph.js</code> and the <code>this.options</code> map in <code>dygraph-canvas.js</code>.</p>
 
     <table class="thinborder" width="900">
       <thead>
@@ -699,6 +700,13 @@ perl -ne 'BEGIN{print "Month,Nominal,Real\n"} chomp; ($m,$cpi,$low,$close,$high)
           </td>
         </tr>
         <tr>
+          <td><strong>xAxisLabelFormatter</strong></td>
+          <td><code>function(date, granularity)</code></td>
+          <td><code>Dygraph.dateAxisFormatter</code></td>
+          <td>Function to call to format values along the x axis.
+            <div class="tests">Tests: <a href="tests/x-axis-formatter.html">xAxisLabelFormatter</a></div>
+          </td>
+        <tr>
           <td><strong>rightGap</strong></td>
           <td><code>integer</code></td>
           <td><code></code></td>
@@ -746,6 +754,65 @@ perl -ne 'BEGIN{print "Month,Nominal,Real\n"} chomp; ($m,$cpi,$low,$close,$high)
           <div class="tests">Tests: <a href="tests/custom-bars.html">custom-bars</a> <a href="tests/zero-series.html">zero-series</a> </div>
           </td>
         </tr>
+
+        <tr>
+          <td><strong>drawCallback</strong></td>
+          <td><code>function(dygraph, is_initial)</code></td>
+          <td><code>null</code></td>
+          <td>When set, this callback gets called every time the dygraph is drawn. This includes the initial draw, after zooming and repeatedly while panning. The first parameter is the dygraph being drawn. The second is a boolean value indicating whether this is the initial draw.
+          <div class="tests">Tests: <a href="tests/callback.html">callback</a> <a href="tests/synchronize.html">synchronize</a> </div>
+          </td>
+        </tr>
+
+        <tr>
+          <td><strong>gridLineColor</strong></td>
+          <td><code>red, blue</code></td>
+          <td><code>rgb(128,128,128)</code></td>
+          <td>The color of the gridlines.
+          <div class="tests">Tests: <a href="tests/grid_dot.html">grid_dot</a> </div>
+          </td>
+        </tr>
+
+        <tr>
+          <td><strong>highlightCallback</strong></td>
+          <td><code>function(event, x, points)</code></td>
+          <td><code>null</code></td>
+          <td>When set, this callback gets called every time a new point is highlighted. The parameters are the JavaScript mousemove event, the x-coordinate of the highlighted points and an array of highlighted points: <code>[ {name: 'series', yval: y-value}, &hellip; ]</code>
+          <div class="tests">Tests: <a href="tests/callback.html">callback</a> <a href="tests/crosshair.html">crosshair</a> </div>
+          </td>
+        </tr>
+
+        <tr>
+          <td><strong>unhighlightCallback</strong></td>
+          <td><code>function(event)</code></td>
+          <td><code>null</code></td>
+          <td>When set, this callback gets called every time the user stops highlighting any point by mousing out of the graph.  The parameter is the mouseout event.
+            <div class="tests">Tests: <a href="tests/callback.html">callback</a> <a href="tests/crosshair.html">crosshair</a> </div>
+          </td>
+        </tr>
+
+        <tr>
+          <td><strong>strokeWidth</strong></td>
+          <td><code>0.5, 2.0</code></td>
+          <td><code>1.0</code></td>
+          <td>The width of the lines connecting data points.
+          <div class="tests">Tests: <a href="tests/grid_dot.html">grid_dot</a> </div>
+          </td>
+        </tr>
+
+        <tr>
+          <td><strong>width</strong></td>
+          <td rowspan="2"><code>integer</code></td>
+          <td><code>480</code></td>
+          <td rowspan="2">Width/Height (in pixels) of the chart. If the container div has been explicitly sized, these attributes will be ignored.
+          <div class="tests">Tests: <a href="tests/demo.html">demo</a> <a href="tests/link-interaction.html">link-interaction</a> <a href="tests/no-range.html">no-range</a> </div>
+          </td>
+        </tr>
+        <tr>
+          <td><strong>height</strong></td>
+          <td><code>320</code></td>
+        </tr>
+
       </tbody>
     </table>
 
@@ -762,6 +829,26 @@ perl -ne 'BEGIN{print "Month,Nominal,Real\n"} chomp; ($m,$cpi,$low,$close,$high)
       <li>Make sure you don't have any trailing commas in your call to the Dygraph constructor or in the options parameter. Firefox, Chrome and Safari ignore these but they can cause a graph to not display in Internet Explorer.</li>
     </ul>
 
+    <h2 id="gwt">GWT Compatibility</h2>
+    <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>
+
+<pre>
+&lt;inherits name=&quot;org.danvk.dygraphs&quot;/&gt;    
+</pre>
+
+    <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>
+
+<pre>
+  public static native JavaScriptObject drawDygraph(Element element, DataTable data, double minY, double maxY) /*-{
+    var chart = new $wnd.Dygraph.GVizChart(element);
+    chart.draw(dataTable,
+      {
+        valueRange: [minY, maxY]
+      });
+    return chart;
+  }-*/;
+</pre>
+
     <h2 id="policy">Data Policy</h2>
     <p>dygraphs is purely client-side JavaScript. It does not send your data to any servers &ndash; the data is processed entirely in the client's browser.</p>