4 <title>crosshairs
</title>
6 For production (minified) code, use:
7 <script type=
"text/javascript" src=
"dygraph-combined.js"></script>
9 <script type=
"text/javascript" src=
"../dygraph-dev.js"></script>
11 <script type=
"text/javascript" src=
"data.js"></script>
12 <style type=
"text/css">
15 background-color: black;
17 pointer-events: none; /* let mouse events fall through to the chart */
30 <p>Hover, click and zoom to test the callbacks:
</p>
31 <div id=
"div_g" style=
"width:600px; height:300px; position:relative;">
34 <script type=
"text/javascript">
38 document.getElementById(
"div_g"),
44 highlightCallback: function(e, x, pts) {
45 for (var i =
0; i < pts.length; i++) {
46 var y = pts[i].canvasy;
47 lines[i].style.visibility =
"visible";
48 lines[i].style.top = y +
"px";
49 if (i ==
0) xline.style.left = pts[i].canvasx +
"px";
51 xline.style.visibility =
"visible";
54 unhighlightCallback: function(e) {
55 for (var i =
0; i <
2; i++) {
56 lines[i].style.visibility =
"hidden";
58 xline.style.visibility =
"hidden";
63 for (var i =
0; i <
2; i++) {
64 var line = document.createElement(
"div");
65 line.className =
"line yline";
66 document.getElementById(
"div_g").appendChild(line);
70 xline = document.createElement(
"div");
71 xline.className =
"line xline";
72 xline.style.top =
"0px";
73 document.getElementById(
"div_g").appendChild(xline);