X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Fannotation.html;h=097605266c9a838c38ab149201e132cd542e0217;hb=33030f33c02e30364172a94b0dd7bdb6528b0f17;hp=60062bc74874c254fdbe9dfb6d74183365c4c885;hpb=2ad87eaa004e722037fba951f4fe418d09c209cc;p=dygraphs.git diff --git a/tests/annotation.html b/tests/annotation.html index 60062bc..0976052 100644 --- a/tests/annotation.html +++ b/tests/annotation.html @@ -4,6 +4,9 @@ + @@ -14,7 +17,10 @@ +

Annotations Demo

+

Click any point to add an annotation to it or click "Add Annotation".

+
@@ -25,7 +31,7 @@ return "(" + ann.series + ", " + ann.x + ")"; } - g = new DateGraph( + g = new Dygraph( document.getElementById("g"), function() { var zp = function(x) { if (x < 10) return "0"+x; else return x; }; @@ -74,8 +80,8 @@ series: 'another line', x: "20061013", icon: 'dollar.png', - iconWidth: 18, - iconHeight: 23, + width: 18, + height: 23, tickHeight: 4, text: 'Another one', cssClass: 'annotation', @@ -99,6 +105,23 @@ g.setAnnotations(annotations); } + function bottom(el) { + var to_bottom = true; + if (el.value != 'Shove to bottom') to_bottom = false; + + var anns = g.annotations(); + for (var i = 0; i < anns.length; i++) { + anns[i].attachAtBottom = to_bottom; + } + g.setAnnotations(anns); + + if (to_bottom) { + el.value = 'Lift back up'; + } else { + el.value = 'Shove to bottom'; + } + } + var saveBg = ''; var num = 0; g.updateOptions( {