Support line continuation in JSON format.
[dygraphs.git] / tests / crosshair.html
CommitLineData
54425b14 1<!DOCTYPE html>
22587203
DV
2<html>
3 <head>
10494b48 4 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
22587203
DV
5 <title>crosshairs</title>
6 <!--[if IE]>
a2b2c3a1 7 <script type="text/javascript" src="../excanvas.js"></script>
22587203 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
22587203
DV
15 <script type="text/javascript" src="data.js"></script>
16 </head>
17 <body>
18 <p>Hover, click and zoom to test the callbacks:</p>
d16579a0 19 <div id="div_g" style="width:600px; height:300px; position:relative;">
22587203
DV
20 </div>
21
22 <script type="text/javascript">
23 var lines = [];
24 var xline;
25 g = new Dygraph(
d16579a0 26 document.getElementById("div_g"),
22587203
DV
27 NoisyData, {
28 rollPeriod: 7,
29 showRoller: true,
30 errorBars: true,
31
32 highlightCallback: function(e, x, pts) {
33 for (var i = 0; i < pts.length; i++) {
34 var y = pts[i].canvasy;
a4c6a67c 35 lines[i].style.display = "";
22587203
DV
36 lines[i].style.top = y + "px";
37 if (i == 0) xline.style.left = pts[i].canvasx + "px";
38 }
a4c6a67c
AV
39 xline.style.display = "";
40 },
22587203 41
a4c6a67c
AV
42 unhighlightCallback: function(e) {
43 for (var i = 0; i < 2; i++) {
44 lines[i].style.display = "none";
45 }
46 xline.style.display = "none";
d16579a0 47 }
22587203
DV
48 }
49 );
50
51 for (var i = 0; i < 2; i++) {
52 var line = document.createElement("div");
a4c6a67c 53 line.style.display = "none";
22587203
DV
54 line.style.width = "100%";
55 line.style.height = "1px";
56 line.style.backgroundColor = "black";
57 line.style.position = "absolute";
d16579a0 58 document.getElementById("div_g").appendChild(line);
22587203
DV
59 lines.push(line);
60 }
61
62 xline = document.createElement("div");
a4c6a67c 63 xline.style.display = "none";
22587203
DV
64 xline.style.width = "1px";
65 xline.style.height = "100%";
66 xline.style.top = "0px";
67 xline.style.backgroundColor = "black";
68 xline.style.position = "absolute";
d16579a0 69 document.getElementById("div_g").appendChild(xline);
22587203
DV
70 </script>
71 </body>
72</html>