3 <title>crosshairs
</title>
5 <script type=
"text/javascript" src=
"excanvas.js"></script>
7 <script type=
"text/javascript" src=
"../strftime/strftime-min.js"></script>
8 <script type=
"text/javascript" src=
"../rgbcolor/rgbcolor.js"></script>
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>
14 <p>Hover, click and zoom to test the callbacks:
</p>
15 <div id=
"div_g" style=
"width:600px; height:300px; position:relative;">
18 <script type=
"text/javascript">
22 document.getElementById(
"div_g"),
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.display =
"";
32 lines[i].style.top = y +
"px";
33 if (i ==
0) xline.style.left = pts[i].canvasx +
"px";
35 xline.style.display =
"";
38 unhighlightCallback: function(e) {
39 for (var i =
0; i <
2; i++) {
40 lines[i].style.display =
"none";
42 xline.style.display =
"none";
47 for (var i =
0; i <
2; i++) {
48 var line = document.createElement(
"div");
49 line.style.display =
"none";
50 line.style.width =
"100%";
51 line.style.height =
"1px";
52 line.style.backgroundColor =
"black";
53 line.style.position =
"absolute";
54 document.getElementById(
"div_g").appendChild(line);
58 xline = document.createElement(
"div");
59 xline.style.display =
"none";
60 xline.style.width =
"1px";
61 xline.style.height =
"100%";
62 xline.style.top =
"0px";
63 xline.style.backgroundColor =
"black";
64 xline.style.position =
"absolute";
65 document.getElementById(
"div_g").appendChild(xline);