Merge branch 'master' of https://github.com/kberg/dygraphs
[dygraphs.git] / tests / interaction.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
5 <title>interaction model</title>
6 <!--[if IE]>
7 <script type="text/javascript" src="../excanvas.js"></script>
8 <![endif]-->
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
15 <script type="text/javascript" src="data.js"></script>
16 <script type="text/javascript" src="interaction.js"></script>
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>
28 </td><td>Click and drag all you like, it won't do anything!</td></tr>
29 <tr><td>
30 <b>Custom interaction model</b>
31
32 <input type="button" value="Restore position" onclick="restorePositioning(g3)">
33 <div id="div_g3" style="width:600px; height:300px;"></div>
34 </td><td>
35 Zoom in: double-click, scroll wheel<br/>
36 Zoom out: ctrl-double-click, scroll wheel<br/>
37 Standard Zoom: shift-click-drag
38 Standard Pan: click-drag<br/>
39 Restore zoom level: press button<br/>
40 </td></tr>
41 <tr><td>
42 <b>Fun model!</b>
43 <div id="div_g4" style="width:600px; height:300px;"></div>
44 </td><td>
45 Keep the mouse button pressed, and hover over all points
46 to mark them.
47 </td></tr>
48
49 </table>
50
51 <script type="text/javascript">
52 Dygraph.addEvent(document, "mousewheel", function() { lastClickedGraph = null; });
53 Dygraph.addEvent(document, "click", function() { lastClickedGraph = null; });
54 var g = new Dygraph(document.getElementById("div_g"),
55 NoisyData, { errorBars : true });
56 var g2 = new Dygraph(document.getElementById("div_g2"),
57 NoisyData, { errorBars : true, interactionModel : {} });
58 var g3 = new Dygraph(document.getElementById("div_g3"),
59 NoisyData, { errorBars : true, interactionModel : {
60 'mousedown' : downV3,
61 'mousemove' : moveV3,
62 'mouseup' : upV3,
63 'click' : clickV3,
64 'dblclick' : dblClickV3,
65 'mousewheel' : scrollV3
66 }});
67 var g4 = new Dygraph(document.getElementById("div_g4"),
68 NoisyData, { errorBars : true, drawPoints : true, interactionModel : {
69 'mousedown' : downV4,
70 'mousemove' : moveV4,
71 'mouseup' : upV4,
72 'dblclick' : dblClickV4,
73 },
74 underlayCallback : captureCanvas
75 });
76 </script>
77
78 </body>
79 </html>