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 <style type=
"text/css">
13 background-color: #dddddd
18 <div style=
"position:absolute; left:100px; top: 200px;" id=
"g"></div>
19 <div style=
"position:absolute; left:600px; top: 200px;" id=
"list"></div>
21 <script type=
"text/javascript">
23 document.getElementById(
"g"),
25 var zp = function(x) { if (x <
10) return
"0"+x; else return x; };
26 var r =
"date,parabola,line,another line,sine wave\n";
27 for (var i=
1; i<=
31; i++) {
28 r +=
"200610" + zp(i);
29 r +=
"," +
10*(i*(
31-i));
31 r +=
"," +
10*(
250 -
8*i);
32 r +=
"," +
10*(
125 +
125 * Math.sin(
0.3*i));
42 drawCallback: function(g) {
43 var ann = g.annotations();
45 for (var i =
0; i < ann.length; i++) {
46 html +=
"(" + ann[i].series +
", " + ann[i].x +
"): " + ann[i].shortText +
" -> " + ann[i].text +
"<br/>";
48 document.getElementById(
"list").innerHTML = html;
55 for (var x =
10; x <
15; x +=
2) {
60 text: 'Stock Market Crash ' + x
65 series: 'another line',
69 cssClass: 'annotation',
70 clickHandler: function() {
71 document.getElementById(
"events").innerHTML +=
"special handler<br/>";
74 g.setAnnotations(annotations);
78 var annnotations = g.annotations();
86 g.setAnnotations(annotations);
90 annotationClickHandler: function(ann, point, dg, event) {
91 document.getElementById(
"events").innerHTML +=
"click: (" + ann.series +
", " + ann.x +
")<br/>";
96 <input type=
"button" value=
"Add Annotation" onclick=
"add()" />
97 <div id=
"events"> </div>