Merge pull request #192 from kberg/master
[dygraphs.git] / tests / interaction.html
CommitLineData
54425b14 1<!DOCTYPE html>
885c13e4
RK
2<html>
3 <head>
10494b48 4 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
885c13e4
RK
5 <title>interaction model</title>
6 <!--[if IE]>
7 <script type="text/javascript" src="../excanvas.js"></script>
8 <![endif]-->
7e5ddc94
DV
9 <!--
10 For production (minified) code, use:
11 <script type="text/javascript" src="dygraph-combined.js"></script>
12 -->
13 <script type="text/javascript" src="../dygraph-dev.js"></script>
14
885c13e4 15 <script type="text/javascript" src="data.js"></script>
9e9ca2eb 16 <script type="text/javascript" src="interaction.js"></script>
885c13e4
RK
17 </head>
18 <body>
19 <table border='1'>
20 <tr><td>
21 <b>Default interaction model</b>
22 <div id="div_g" style="width:600px; height:300px;"></div>
23 </td><td>Zoom: click-drag<br/>Pan: shift-click-drag<br/>Restore zoom level: double-click<br/>
24 </td></tr>
25 <tr><td>
26 <b>No interaction model</b>
27 <div id="div_g2" style="width:600px; height:300px;"></div>
027e9e9b
DV
28 </td><td>Click and drag all you like, it won't do anything!
29 <div id="g2_console"></div>
30 </td></tr>
885c13e4
RK
31 <tr><td>
32 <b>Custom interaction model</b>
33
b4012e63 34 <input type="button" value="Restore position" onclick="restorePositioning(g3)">
885c13e4
RK
35 <div id="div_g3" style="width:600px; height:300px;"></div>
36 </td><td>
37 Zoom in: double-click, scroll wheel<br/>
38 Zoom out: ctrl-double-click, scroll wheel<br/>
1f237ed6
RK
39 Standard Zoom: shift-click-drag
40 Standard Pan: click-drag<br/>
885c13e4
RK
41 Restore zoom level: press button<br/>
42 </td></tr>
43 <tr><td>
44 <b>Fun model!</b>
45 <div id="div_g4" style="width:600px; height:300px;"></div>
46 </td><td>
47 Keep the mouse button pressed, and hover over all points
48 to mark them.
49 </td></tr>
50
51 </table>
1f237ed6 52
885c13e4 53 <script type="text/javascript">
9d10bca3
RK
54 Dygraph.addEvent(document, "mousewheel", function() { lastClickedGraph = null; });
55 Dygraph.addEvent(document, "click", function() { lastClickedGraph = null; });
885c13e4
RK
56 var g = new Dygraph(document.getElementById("div_g"),
57 NoisyData, { errorBars : true });
027e9e9b 58 var s = document.getElementById("g2_console");
885c13e4 59 var g2 = new Dygraph(document.getElementById("div_g2"),
027e9e9b
DV
60 NoisyData,
61 {
62 errorBars : true,
0290d079 63 interactionModel: {}
027e9e9b 64 });
885c13e4
RK
65 var g3 = new Dygraph(document.getElementById("div_g3"),
66 NoisyData, { errorBars : true, interactionModel : {
67 'mousedown' : downV3,
68 'mousemove' : moveV3,
69 'mouseup' : upV3,
9d10bca3 70 'click' : clickV3,
885c13e4
RK
71 'dblclick' : dblClickV3,
72 'mousewheel' : scrollV3
73 }});
74 var g4 = new Dygraph(document.getElementById("div_g4"),
75 NoisyData, { errorBars : true, drawPoints : true, interactionModel : {
76 'mousedown' : downV4,
77 'mousemove' : moveV4,
78 'mouseup' : upV4,
79 'dblclick' : dblClickV4,
80 },
81 underlayCallback : captureCanvas
82 });
885c13e4
RK
83 </script>
84
85 </body>
86</html>