5 title
: "Hover, click and zoom to test the callbacks.",
6 setup
: function(parent
) {
8 "<div id='div_g' style='width:600px; height:300px;'></div>" +
9 "<button id='clear'>Clear list<Button>" +
10 "<input type='checkbox' id='highlight' checked><label for='highlight'> Show 'highlight' events</label>" +
11 "<input type='checkbox' id='unhighlight' checked><label for='unhighlight'>Show 'unhighlight' events</label>" +
12 "<input type='checkbox' id='showLabels' checked>" +
13 "<label for='showLabels'> Show Labels on highlight</label>" +
14 "<div id='status' style='width:100%; height:200px;'></div>";
17 var showLabels
= document
.getElementById('showLabels');
18 showLabels
.onclick
= function() {
19 g
.updateOptions({showLabelsOnHighlight
: showLabels
.checked
});
22 var s
= document
.getElementById("status");
23 var clearStatus
= function() {
26 document
.getElementById('clear').onclick
= clearStatus
;
29 pts_info
= function(e
, x
, pts
, row
) {
30 var str
= "(" + x
+ ") ";
31 for (var i
= 0; i
< pts
.length
; i
++) {
34 str
+= p
.name
+ ": " + p
.yval
;
39 var dataXY
= g
.toDataCoords(x
, y
);
40 str
+= ", (" + x
+ ", " + y
+ ")";
41 str
+= " -> (" + dataXY
[0] + ", " + dataXY
[1] + ")";
48 document
.getElementById("div_g"),
54 highlightCallback
: function(e
, x
, pts
, row
) {
55 if (document
.getElementById('highlight').checked
) {
56 s
.innerHTML
+= "<b>Highlight</b> " + pts_info(e,x,pts,row) + "<br/>";
60 unhighlightCallback
: function(e
) {
61 if (document
.getElementById('unhighlight').checked
) {
62 s
.innerHTML
+= "<b>Unhighlight</b><br/>";
66 clickCallback
: function(e
, x
, pts
) {
67 s
.innerHTML
+= "<b>Click</b> " + pts_info(e,x,pts) + "<br/>";
70 pointClickCallback
: function(e
, p
) {
71 s
.innerHTML
+= "<b>Point Click</b> " + p.name + ": " + p.x + "<br/>";
74 zoomCallback
: function(minX
, maxX
, yRanges
) {
75 s
.innerHTML
+= "<b>Zoom</b> [" + minX + ", " + maxX + ", [" + yRanges + "]]<br/>";
78 drawCallback
: function(g
) {
79 s
.innerHTML
+= "<b>Draw</b> [" + g.xAxisRange() + "]<br/>";