From: Dan Vanderkam Date: Wed, 13 Oct 2010 14:35:27 +0000 (-0400) Subject: add annotation CSS rule lazily X-Git-Tag: v1.0.0~631 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;ds=sidebyside;h=3c51ab748119e70ad44691d062a38c7e026158eb;p=dygraphs.git add annotation CSS rule lazily --- diff --git a/dygraph.js b/dygraph.js index 522533d..6396ef2 100644 --- a/dygraph.js +++ b/dygraph.js @@ -233,8 +233,6 @@ Dygraph.prototype.__init__ = function(div, file, attrs) { // Make a note of whether labels will be pulled from the CSV file. this.labelsFromCSV_ = (this.attr_("labels") == null); - Dygraph.addAnnotationRule(); - // Create the containing DIV and other interactive elements this.createInterface_(); @@ -2446,6 +2444,8 @@ Dygraph.prototype.setVisibility = function(num, value) { * Update the list of annotations and redraw the chart. */ Dygraph.prototype.setAnnotations = function(ann, suppressDraw) { + // Only add the annotation CSS rule once we know it will be used. + Dygraph.addAnnotationRule(); this.annotations_ = ann; this.layout_.setAnnotations(this.annotations_); if (!suppressDraw) {