Add Dygraph.Interaction.nonInteractiveModel. This disables pan/zoom interactions...
[dygraphs.git] / tests / interaction.html
index 8389ae7..58f3dac 100644 (file)
@@ -25,7 +25,9 @@
     <tr><td>
     <b>No interaction model</b>
     <div id="div_g2" style="width:600px; height:300px;"></div>
-    </td><td>Click and drag all you like, it won't do anything!</td></tr>
+    </td><td>Click and drag all you like, it won't do anything!
+    <div id="g2_console"></div>
+    </td></tr>
     <tr><td>
     <b>Custom interaction model</b>
 
       Dygraph.addEvent(document, "click", function() { lastClickedGraph = null; });
       var g = new Dygraph(document.getElementById("div_g"),
            NoisyData, { errorBars : true });
+      var s = document.getElementById("g2_console");
       var g2 = new Dygraph(document.getElementById("div_g2"),
-           NoisyData, { errorBars : true, interactionModel : {} });
+           NoisyData,
+           {
+             errorBars : true,
+             interactionModel: Dygraph.Interaction.nonInteractiveModel,
+             clickCallback: function(e, x, pts) {
+               s.innerHTML += "<b>Click</b> " + pts[0].name + ": " + pts[0].x + "<br/>";
+             },
+             pointClickCallback: function(e, p) {
+               s.innerHTML += "<b>Point Click</b> " + p.name + ": " + p.x + "<br/>";
+             },
+           });
       var g3 = new Dygraph(document.getElementById("div_g3"),
            NoisyData, { errorBars : true, interactionModel : {
         'mousedown' : downV3,