X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=9ec15080e2bdc114873d8b9ef6e213c7cb5f69b6;hb=af6e4ad59f1befcd2102a22e81dbfe0295432f3f;hp=1f558704c393c49e34bc4c59ef2b3df60dacd55a;hpb=4ff8c62e5e2e62e81e993fa1df626e62e385d28c;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 1f55870..9ec1508 100644 --- a/dygraph.js +++ b/dygraph.js @@ -3598,6 +3598,13 @@ Dygraph.prototype.setAnnotations = function(ann, suppressDraw) { // Only add the annotation CSS rule once we know it will be used. Dygraph.addAnnotationRule(); this.annotations_ = ann; + if (!this.layout_) { + this.warn("Tried to setAnnotations before dygraph was ready. " + + "Try setting them in a drawCallback. See " + + "dygraphs.com/tests/annotation.html"); + return; + } + this.layout_.setAnnotations(this.annotations_); if (!suppressDraw) { this.predraw_();