update combined
[dygraphs.git] / docs / index.html
index 22730f6..c380ee2 100644 (file)
         </div>
       </div>
 
-      <p style="clear:both">In order to keep this example self-contained, the second parameter is raw CSV data. The dygraphs library parses this data (including column headers), resizes the its container to a reasonable default, calculates appropriate axis ranges and tick marks and draws the graph.</p>
+      <p style="clear:both">In order to keep this example self-contained, the second parameter is raw CSV data. The dygraphs library parses this data (including column headers), resizes its container to a reasonable default, calculates appropriate axis ranges and tick marks and draws the graph.</p>
 
       <p>In most applications, it makes more sense to include a CSV file instead. If the second parameter to the constructor doesn't contain a newline, it will be interpreted as the path to a CSV file. The Dygraph will perform an XMLHttpRequest to retrieve this file and display the data when it becomes available. Make sure your CSV file is readable and serving from a place that understands XMLHttpRequest's! In particular, you cannot specify a CSV file using <code>"file:///"</code>. Here's an example: (data from <a href="http://www.wunderground.com/history/airport/KNUQ/2007/1/1/CustomHistory.html?dayend=31&amp;monthend=12&amp;yearend=2007&amp;req_city=NA&amp;req_state=NA&amp;req_statename=NA">Weather Underground</a>)</p>
 
@@ -430,9 +430,16 @@ new Dygraph(el, data, {
     <p>This chart shows monthly closes of the Dow Jones Industrial Average, both in nominal and real (i.e. adjusted for inflation) dollars. The shaded areas show its monthly high and low. CPI values with a base from 1982-84 are used to adjust for inflation.</p>
 
     <div id="dow_chart" style="width:900px; height:350px;"></div>
+    <p><b>Display: </b>
+    <input type=checkbox id=0 onClick="stockchange(this)" checked>
+    <label for="0"> Nominal</label>
+    <input type=checkbox id=1 onClick="stockchange(this)" checked>
+    <label for="1"> Real</label>
+    </p>
+
     <script type="text/javascript">
     // From http://www.econstats.com/eqty/eq_d_mi_3.csv
-      new Dygraph(
+      stockchart = new Dygraph(
         document.getElementById('dow_chart'),
         "dow.txt",
         {
@@ -441,6 +448,10 @@ new Dygraph(el, data, {
           labelsKMB: true
         }
       );
+
+      function stockchange(el) {
+        stockchart.setVisibility(el.id, el.checked);
+      }
     </script>
 <!--