1 /*global Gallery,Dygraph,data */
2 /*global NoisyData,downV3,moveV3,upV3,clickV3,dblClickV3,scrollV3,restorePositioning,downV4,moveV4,upV4,dblClickV4,captureCanvas */
7 name
: 'Custom interaction models',
9 setup
: function(parent
) {
11 "<h3>Default interaction model</h3>",
12 "<div style='width:600px;'>",
13 " <p style='text-align:center;'>",
14 " Zoom: click-drag, Pan: shift-click-drag, Restore: double-click",
16 " <div id='div_g' style='width:600px; height:300px;'></div>",
19 "<h3>Empty interaction model</h3>",
20 "<div style='width:600px;'>",
21 " <p style='text-align:center;'>",
22 " Click and drag all you like, it won't do anything!",
24 " <div id='div_g2' style='width:600px; height:300px;'></div>",
26 "<div id='g2_console'></div>", // what is this?
28 "<h3
>Custom interaction model
</h3
>",
29 "<div style
='width:600px;'>",
30 " <p style
='text-align:center;'>",
31 " Zoom
in: double-click
, scroll wheel
<br
/>",
32 " Zoom out
: ctrl
-double-click
, scroll wheel
<br
/>",
33 " Standard Zoom
: shift
-click
-drag
",
34 " Standard Pan
: click
-drag
<br
/>",
35 " Restore zoom level
: press button
<br
/>",
37 " <button id
='restore3'>Restore position
</button
>",
38 " <div id
='div_g3' style
='width:600px; height:300px;'></div
>",
40 "<h3
>Fun model
!</h3
>",
41 "<div style
='width:600px;'>",
42 " <p style
='text-align:center;'>",
43 " Keep the mouse button pressed
, and hover over all points
",
46 " <div id
='div_g4' style
='width:600px; height:300px;'></div
>",
53 // TODO(konigsberg): Add cleanup to remove callbacks.
54 Dygraph.addEvent(document, "mousewheel
", function() { lastClickedGraph = null; });
55 Dygraph.addEvent(document, "click
", function() { lastClickedGraph = null; });
56 new Dygraph(document.getElementById("div_g
"),
57 NoisyData, { errorBars : true });
58 new Dygraph(document.getElementById("div_g2
"),
64 var g3 = new Dygraph(document.getElementById("div_g3
"),
65 NoisyData, { errorBars : true, interactionModel : {
70 'dblclick' : dblClickV3,
71 'mousewheel' : scrollV3
73 document.getElementById("restore3
").onclick = function() {
74 restorePositioning(g3);
76 new Dygraph(document.getElementById("div_g4
"),
84 'dblclick' : dblClickV4
86 underlayCallback : captureCanvas