Merge pull request #501 from danvk/options-link
authorDan Vanderkam <danvdk@gmail.com>
Sat, 29 Nov 2014 17:27:32 +0000 (12:27 -0500)
committerDan Vanderkam <danvdk@gmail.com>
Sat, 29 Nov 2014 17:27:32 +0000 (12:27 -0500)
Documentation tweaks

docs/ie.html
docs/per-axis.html
docs/site.css
docs/tutorial.html
gallery/index.html
gallery/synchronize.js
generate-documentation.py
tests/synchronize.html

index 9b0579f..0b1233b 100644 (file)
@@ -10,6 +10,8 @@
 
 <p>When IE9 is in HTML5 mode, dygraphs works just like in other modern browsers.</p>
 
+<p>You should seriously consider stopping here! Older versions of IE have a small market share that's decreasing by the day. Major web sites, like the <a href="http://www.nytimes.com/">New York Times</a>, have already dropped support for IE8. Future versions of dygraphs will do the same. But if you insist&hellip;</p>
+
 <p>If you want to support previous versions of Internet Explorer (IE6&ndash;IE8), you'll need to include the <a href="http://code.google.com/p/explorercanvas/">excanvas</a> library, which emulates the <code>&lt;canvas&gt;</code> tag using VML. You can add excanvas by including the following snippet:</p>
 
 <pre>
index df59a3d..09c6ebc 100644 (file)
@@ -39,11 +39,13 @@ write:</p>
                   ...,
                   {
                     strokeWidth: 5,  // default stroke width
-                    'Y1': {
-                      strokeWidth: 3  // Y1 gets a special value.
-                    },
-                    'Y3': {
-                      strokeWidth: 1  // so does Y3.
+                    series: {
+                      Y1: {
+                        strokeWidth: 3  // Y1 gets a special value.
+                      },
+                      Y3: {
+                        strokeWidth: 1  // so does Y3.
+                      }
                     }
                   });
 </pre>
index 3c81eba..58232d7 100644 (file)
@@ -131,17 +131,24 @@ pre{
 
 /* When you visit dygraphs.com/options.html#errorBars, the fixed top nav
  * obscures the top 100px of content for that anchor. This is a workaround.
- * See http://stackoverflow.com/questions/9047703/fixed-position-navbar-obscures-anchors
+ * See http://stackoverflow.com/questions/10732690/offsetting-an-html-anchor-to-adjust-for-fixed-header
  */
 a[name] {
-  padding-top: 100px;  /* matches body { padding-top } */
-  margin-top: -100px;  /* matches body { padding-top } */
-  display: inline-block; /* required for webkit browsers */
+  display: block;
+  position: relative;
+  top: -100px;
+  visibility: hidden;
 }
 @media screen and (min-width: 768px) and (max-width: 992px) {
   a[name] {
-    padding-top: 130px;  /* matches body { padding-top } */
-    margin-top: -130px;  /* matches body { padding-top } */
-    display: inline-block; /* required for webkit browsers */
+    top: -130px;
   }
 }
+a.link {
+  visibility: hidden;
+  text-decoration: none;
+  color: #777;
+}
+.option:hover a.link {
+  visibility: visible;
+}
index c4e4dc5..a8f84f0 100644 (file)
@@ -6,7 +6,7 @@
   }
 </style>
 
-<p>To use dygraphs, include the <code><a href="download.html">dygraph-combined.js</a></code> JavaScript file and instantiate a <code>Dygraph</code> object.</p>
+<p>To use dygraphs, include the <code><a href="download.html">dygraph-combined-dev.js</a></code> JavaScript file and instantiate a <code>Dygraph</code> object.</p>
 
 <p>Here's a basic example to get things started:</p>
 
@@ -17,7 +17,7 @@
 &lt;html&gt;
 &lt;head&gt;
 &lt;script type=&quot;text/javascript&quot;
-  src=&quot;dygraph-combined.js&quot;&gt;&lt;/script&gt;
+  src=&quot;dygraph-combined-dev.js&quot;&gt;&lt;/script&gt;
 &lt;/head&gt;
 &lt;body&gt;
 &lt;div id=&quot;graphdiv&quot;&gt;&lt;/div&gt;
@@ -69,7 +69,7 @@
 &lt;html&gt;
 &lt;head&gt;
 &lt;script type=&quot;text/javascript&quot;
-  src=&quot;dygraph-combined.js&quot;&gt;&lt;/script&gt;
+  src=&quot;dygraph-combined-dev.js&quot;&gt;&lt;/script&gt;
 &lt;/head&gt;
 &lt;body&gt;
 &lt;div id=&quot;graphdiv2&quot;
 &lt;html&gt;
 &lt;head&gt;
 &lt;script type=&quot;text/javascript&quot;
-  src=&quot;dygraph-combined.js&quot;&gt;&lt;/script&gt;
+  src=&quot;dygraph-combined-dev.js&quot;&gt;&lt;/script&gt;
 &lt;/head&gt;
 &lt;body&gt;
 &lt;div id=&quot;graphdiv3&quot;
index 9e661d4..9cf4791 100644 (file)
@@ -8,6 +8,8 @@
     <![endif]-->
 
     <script src="../dygraph-dev.js"></script>
+    <script src="../extras/synchronizer.js"></script>
+
     <script src="lib/jquery-1.4.2.js"></script>
     <script src="../common/textarea.js"></script>
     <script src="gallery.js"></script>
index ae92efb..233da0c 100644 (file)
@@ -8,14 +8,30 @@ Gallery.register(
     title: 'Multiple graphs in sync',
     setup: function(parent) {
       parent.innerHTML = [
-        "<p>Zooming and panning on any of the charts will zoom and pan all the",
-        "others.</p>",
-        "<p><aside>(zoom: Click and drag, pan: shift-click and drag, unzoom: double-click)</aside></p>",
-        "<table><tr>",
-        "<td><div id='div1' style='width:500px; height:300px;'></div></td>",
-        "<td><div id='div3' style='width:500px; height:300px;'></div></td></tr>",
-        "<tr><td><div id='div2' style='width:500px; height:300px;'></div></td>",
-        "<td><div id='div4' style='width:500px; height:300px;'></div></td></table>"].join("\n");
+        '<style>',
+        '  .chart { width: 500px; height: 300px; }',
+        '  .chart-container { overflow: hidden; }',
+        '  #div1 { float: left; }',
+        '  #div2 { float: left; }',
+        '  #div3 { float: left; clear: left; }',
+        '  #div4 { float: left; }',
+        '</style>',
+        '<p>Zooming and panning on any of the charts will zoom and pan all the',
+        'others. Selecting points on one will select points on the others.</p>',
+        '<p>To use this, source <a href="https://github.com/danvk/dygraphs/blob/master/extras/synchronizer.js"><code>extras/synchronizer.js</code></a> on your page.',
+        'See the comments in that file for usage.</p>',
+        '<div class="chart-container">',
+        '  <div id="div1" class="chart"></div>',
+        '  <div id="div2" class="chart"></div>',
+        '  <div id="div3" class="chart"></div>',
+        '  <div id="div4" class="chart"></div>',
+        '</div>',
+        '<p>',
+        '  Synchronize what?',
+        '  <input type=checkbox id="chk-zoom" checked><label for="chk-zoom"> Zoom</label>',
+        '  <input type=checkbox id="chk-selection" checked><label for="chk-selection"> Selection</label>',
+        '</p>'
+        ].join("\n");
     },
     run: function() {
       var gs = [];
@@ -27,23 +43,21 @@ Gallery.register(
             NoisyData, {
               rollPeriod: 7,
               errorBars: true,
-              drawCallback: function(me, initial) {
-                if (blockRedraw || initial) return;
-                blockRedraw = true;
-                var range = me.xAxisRange();
-                var yrange = me.yAxisRange();
-                for (var j = 0; j < 4; j++) {
-                  if (gs[j] == me) continue;
-                  gs[j].updateOptions( {
-                    dateWindow: range,
-                    valueRange: yrange
-                  } );
-                }
-                blockRedraw = false;
-              }
             }
           )
         );
       }
+      var sync = Dygraph.synchronize(gs);
+      
+      function update() {
+        var zoom = document.getElementById('chk-zoom').checked;
+        var selection = document.getElementById('chk-selection').checked;
+        sync.detach();
+        sync = Dygraph.synchronize(gs, {
+          zoom: zoom,
+          selection: selection
+        });
+      }
+      $('#chk-zoom, #chk-selection').change(update);
     }
   });
index d73fcc4..0d6760e 100755 (executable)
@@ -150,7 +150,7 @@ def urlify_gallery(f):
 
 
 for label in sorted(labels):
-  print '<a name="%s"><h3>%s</h3>\n' % (label, label)
+  print '<a name="%s"></a><h3>%s</h3>\n' % (label, label)
 
   for opt_name in sorted(docs.keys()):
     opt = docs[opt_name]
@@ -181,7 +181,9 @@ for label in sorted(labels):
     if not opt['description']: opt['description'] = '(missing)'
 
     print """
-  <div class='option'><a name="%(name)s"></a><b>%(name)s</b><br/>
+  <div class='option'><a name="%(name)s"></a><b>%(name)s</b>
+  <a class="link" href="#%(name)s">#</a>
+  <br/>
   <p>%(desc)s</p>
   <i>Type: %(type)s</i><br/>%(parameters)s
   <i>Default: %(default)s</i></p>
index b93a219..92a4e4a 100644 (file)
@@ -14,7 +14,7 @@
     <script type="text/javascript" src="../extras/synchronizer.js"></script>
 
     <script type="text/javascript" src="data.js"></script>
-    <style type="text/css">
+    <style>
       .chart { width: 500px; height: 300px; }
       .chart-container { overflow: hidden; }
       #div1 { float: left; }