4 <meta http-equiv=
"X-UA-Compatible" content=
"IE=EmulateIE7; IE=EmulateIE9">
5 <title>callbacks
</title>
7 <script type=
"text/javascript" src=
"../excanvas.js"></script>
9 <script type=
"text/javascript" src=
"../strftime/strftime-min.js"></script>
10 <script type=
"text/javascript" src=
"../rgbcolor/rgbcolor.js"></script>
11 <script type=
"text/javascript" src=
"../dygraph-canvas.js"></script>
12 <script type=
"text/javascript" src=
"../dygraph.js"></script>
13 <script type=
"text/javascript" src=
"data.js"></script>
14 <style type=
"text/css">
27 <p>Hover, click and zoom to test the callbacks:
</p>
28 <div id=
"div_g" style=
"width:600px; height:300px;"></div>
30 <input type=
"button" value=
"Clear list" onclick=
"javascript:document.getElementById('status').innerHTML=''" />
31 <input type=
"checkbox" id=
"highlight" checked
><label for=
"highlight"> Show 'highlight' events
</label>
32 <input type=
"checkbox" id=
"unhighlight" checked
><label for=
"unhighlight">Show 'unhighlight' events
</label>
33 <input type=
"checkbox" id=
"showLabels" checked
34 onclick='g.updateOptions({showLabelsOnHighlight: this.checked});'
>
35 <label for=
"showLabels"> Show Labels on highlight
</label>
36 <div id=
"status" style=
"width:100%; height:200px;"></div>
38 <script type=
"text/javascript">
39 s = document.getElementById(
"status");
41 pts_info = function(e, x, pts, row) {
42 var str =
"(" + x +
") ";
43 for (var i =
0; i < pts.length; i++) {
46 str += p.name +
": " + p.yval;
51 var dataXY = g.toDataCoords(x, y);
52 str +=
", (" + x +
", " + y +
")";
53 str +=
" -> (" + dataXY[
0] +
", " + dataXY[
1] +
")";
60 document.getElementById(
"div_g"),
66 highlightCallback: function(e, x, pts, row) {
67 if (document.getElementById('highlight').checked) {
68 s.innerHTML +=
"<b>Highlight</b> " + pts_info(e,x,pts,row) +
"<br/>";
72 unhighlightCallback: function(e) {
73 if (document.getElementById('unhighlight').checked) {
74 s.innerHTML +=
"<b>Unhighlight</b><br/>";
78 clickCallback: function(e, x, pts) {
79 s.innerHTML +=
"<b>Click</b> " + pts_info(e,x,pts) +
"<br/>";
82 pointClickCallback: function(e, p) {
83 s.innerHTML +=
"<b>Point Click</b> " + p.name +
": " + p.x +
"<br/>";
86 zoomCallback: function(minX, maxX, yRanges) {
87 s.innerHTML +=
"<b>Zoom</b> [" + minX +
", " + maxX +
", [" + yRanges +
"]]<br/>";
90 drawCallback: function(g) {
91 s.innerHTML +=
"<b>Draw</b> [" + g.xAxisRange() +
"]<br/>";