Bump version to 2.0.1
[dygraphs.git] / tests / annotation.html
index 0e25fb7..c180070 100644 (file)
@@ -1,19 +1,9 @@
 <!DOCTYPE html>
 <html>
   <head>
-    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
+    <link rel="stylesheet" href="../dist/dygraph.css">
     <title>demo</title>
-    <!--[if IE]>
-    <script type="text/javascript" src="../excanvas.js"></script>
-    <![endif]-->
-    <!--
-    <script type="text/javascript" src="dygraph-combined.js"></script>
-    -->
-    <!--
-    For production (minified) code, use:
-    <script type="text/javascript" src="dygraph-combined.js"></script>
-    -->
-    <script type="text/javascript" src="../dygraph-dev.js"></script>
+    <script type="text/javascript" src="../dist/dygraph.js"></script>
 
     <style type="text/css">
     .annotation {
@@ -35,6 +25,9 @@
         return "(" + ann.series + ", " + ann.x + ")";
       }
 
+      annotations = [];
+      var graph_initialized = false;
+
       g = new Dygraph(
               document.getElementById("g_div"),
               function() {
                 showRoller: true,
                 width: 480,
                 height: 320,
-                drawCallback: function(g) {
+                drawCallback: function(g, is_initial) {
+                  if (is_initial) {
+                    graph_initialized = true;
+                    if (annotations.length > 0) {
+                      g.setAnnotations(annotations);
+                    }
+                  }
+
                   var ann = g.annotations();
                   var html = "";
                   for (var i = 0; i < ann.length; i++) {
@@ -70,7 +70,6 @@
           );
 
       var last_ann = 0;
-      annotations = [];
       for (var x = 10; x < 15; x += 2) {
         annotations.push( {
           series: 'sine wave',
@@ -87,6 +86,8 @@
         width: 18,
         height: 23,
         tickHeight: 4,
+        tickColor: 'indianred',
+        tickWidth: 2,
         text: 'Another one',
         cssClass: 'annotation',
         clickHandler: function() {
         shortText: 'P',
         text: 'Parabola Annotation at same x-coord'
       } );
-      g.setAnnotations(annotations);
+
+      if (graph_initialized) {
+        g.setAnnotations(annotations);
+      }
 
       function add() {
         var x = last_ann + 2;