3 <title>crosshairs
</title>
5 <script type=
"text/javascript" src=
"excanvas.js"></script>
7 <script type=
"text/javascript" src=
"../dygraph-combined.js"></script>
8 <script type=
"text/javascript" src=
"../dygraph-canvas.js"></script>
9 <script type=
"text/javascript" src=
"../dygraph.js"></script>
10 <script type=
"text/javascript" src=
"data.js"></script>
13 <p>Hover, click and zoom to test the callbacks:
</p>
14 <div id=
"g" style=
"width:600px; height:300px; position:relative;">
17 <script type=
"text/javascript">
21 document.getElementById(
"g"),
27 highlightCallback: function(e, x, pts) {
28 for (var i =
0; i < pts.length; i++) {
29 var y = pts[i].canvasy;
30 lines[i].style.top = y +
"px";
31 if (i ==
0) xline.style.left = pts[i].canvasx +
"px";
36 // clickCallback: function(e, x, pts) {
37 // s.innerHTML +=
"<b>Click</b> " + pts_info(x,pts) +
"<br/>";
40 // zoomCallback: function(minX, maxX) {
41 // s.innerHTML +=
"<b>Zoom</b> [" + minX +
", " + maxX +
"]<br/>";
46 for (var i =
0; i <
2; i++) {
47 var line = document.createElement(
"div");
48 line.style.width =
"100%";
49 line.style.height =
"1px";
50 line.style.backgroundColor =
"black";
51 line.style.position =
"absolute";
52 document.getElementById(
"g").appendChild(line);
56 xline = document.createElement(
"div");
57 xline.style.width =
"1px";
58 xline.style.height =
"100%";
59 xline.style.top =
"0px";
60 xline.style.backgroundColor =
"black";
61 xline.style.position =
"absolute";
62 document.getElementById(
"g").appendChild(xline);