Commit | Line | Data |
---|---|---|
22587203 DV |
1 | <html> |
2 | <head> | |
3 | <title>crosshairs</title> | |
4 | <!--[if IE]> | |
5 | <script type="text/javascript" src="excanvas.js"></script> | |
6 | <![endif]--> | |
d37dca40 DV |
7 | <script type="text/javascript" src="../strftime/strftime-min.js"></script> |
8 | <script type="text/javascript" src="../rgbcolor/rgbcolor.js"></script> | |
22587203 DV |
9 | <script type="text/javascript" src="../dygraph-canvas.js"></script> |
10 | <script type="text/javascript" src="../dygraph.js"></script> | |
11 | <script type="text/javascript" src="data.js"></script> | |
12 | </head> | |
13 | <body> | |
14 | <p>Hover, click and zoom to test the callbacks:</p> | |
d16579a0 | 15 | <div id="div_g" style="width:600px; height:300px; position:relative;"> |
22587203 DV |
16 | </div> |
17 | ||
18 | <script type="text/javascript"> | |
19 | var lines = []; | |
20 | var xline; | |
21 | g = new Dygraph( | |
d16579a0 | 22 | document.getElementById("div_g"), |
22587203 DV |
23 | NoisyData, { |
24 | rollPeriod: 7, | |
25 | showRoller: true, | |
26 | errorBars: true, | |
27 | ||
28 | highlightCallback: function(e, x, pts) { | |
29 | for (var i = 0; i < pts.length; i++) { | |
30 | var y = pts[i].canvasy; | |
31 | lines[i].style.top = y + "px"; | |
32 | if (i == 0) xline.style.left = pts[i].canvasx + "px"; | |
33 | } | |
34 | ||
d16579a0 | 35 | } |
22587203 DV |
36 | } |
37 | ); | |
38 | ||
39 | for (var i = 0; i < 2; i++) { | |
40 | var line = document.createElement("div"); | |
41 | line.style.width = "100%"; | |
42 | line.style.height = "1px"; | |
43 | line.style.backgroundColor = "black"; | |
44 | line.style.position = "absolute"; | |
d16579a0 | 45 | document.getElementById("div_g").appendChild(line); |
22587203 DV |
46 | lines.push(line); |
47 | } | |
48 | ||
49 | xline = document.createElement("div"); | |
50 | xline.style.width = "1px"; | |
51 | xline.style.height = "100%"; | |
52 | xline.style.top = "0px"; | |
53 | xline.style.backgroundColor = "black"; | |
54 | xline.style.position = "absolute"; | |
d16579a0 | 55 | document.getElementById("div_g").appendChild(xline); |
22587203 DV |
56 | </script> |
57 | </body> | |
58 | </html> |