4 name
: 'Custom interaction models',
6 setup
: function(parent
) {
10 "<b>Default interaction model</b>" +
11 "<div id='div_g' style='width:600px; height:300px;'></div>" +
12 "</td><td>Zoom: click-drag<br/>Pan: shift-click-drag<br/>Restore zoom level: double-click<br/>" +
15 "<b>No interaction model</b>" +
16 "<div id='div_g2' style='width:600px; height:300px;'></div>" +
17 "</td><td>Click and drag all you like, it won't do anything!" +
18 "<div id='g2_console'></div>" +
21 "<b>Custom interaction model</b>" +
22 "<button id='restore3'>Restore Position</button>" +
23 "<div id='div_g3' style='width:600px; height:300px;'></div>" +
25 "Zoom in: double-click, scroll wheel<br/>" +
26 "Zoom out: ctrl-double-click, scroll wheel<br/>" +
27 "Standard Zoom: shift-click-drag" +
28 "Standard Pan: click-drag<br/>" +
29 "Restore zoom level: press button<br/>" +
33 "<div id='div_g4' style='width:600px; height:300px;'></div>" +
35 "Keep the mouse button pressed, and hover over all points" +
42 // TODO(konigsberg): Add cleanup to remove callbacks.
43 Dygraph
.addEvent(document
, "mousewheel", function() { lastClickedGraph
= null; });
44 Dygraph
.addEvent(document
, "click", function() { lastClickedGraph
= null; });
45 var g
= new Dygraph(document
.getElementById("div_g"),
46 NoisyData
, { errorBars
: true });
47 var s
= document
.getElementById("g2_console");
48 var g2
= new Dygraph(document
.getElementById("div_g2"),
54 var g3
= new Dygraph(document
.getElementById("div_g3"),
55 NoisyData
, { errorBars
: true, interactionModel
: {
60 'dblclick' : dblClickV3
,
61 'mousewheel' : scrollV3
63 document
.getElementById("restore3").onclick
= function() {
64 restorePositioning(g3
);
66 var g4
= new Dygraph(document
.getElementById("div_g4"),
67 NoisyData
, { errorBars
: true, drawPoints
: true, interactionModel
: {
71 'dblclick' : dblClickV4
,
73 underlayCallback
: captureCanvas