X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=src%2Fplugins%2Fannotations.js;h=87153c8152795d602ec76b2b8173fb7b01b68a06;hb=6ed703fd07b53ca7e51526407661f3bce416dcc0;hp=46d08918ef99128420dc59d34ade8cda2af1a406;hpb=6ecc073934b76e5076f917112a24ff7094857730;p=dygraphs.git diff --git a/src/plugins/annotations.js b/src/plugins/annotations.js index 46d0891..87153c8 100644 --- a/src/plugins/annotations.js +++ b/src/plugins/annotations.js @@ -56,12 +56,6 @@ annotations.prototype.didDrawChart = function(e) { if (!points || points.length === 0) return; var containerDiv = e.canvas.parentNode; - var annotationStyle = { - "position": "absolute", - "fontSize": g.getOption('axisLabelFontSize') + "px", - "zIndex": 10, - "overflow": "hidden" - }; var bindEvt = function(eventName, classEventName, pt) { return function(annotation_event) { @@ -75,7 +69,7 @@ annotations.prototype.didDrawChart = function(e) { }; // Add the annotations one-by-one. - var area = e.dygraph.plotter_.area; + var area = e.dygraph.getArea(); // x-coord to sum of previous annotation's heights (used for stacking). var xToUsedHeight = {}; @@ -93,18 +87,18 @@ annotations.prototype.didDrawChart = function(e) { tick_height = a.tickHeight; } + // TODO: deprecate axisLabelFontSize in favor of CSS var div = document.createElement("div"); - for (var name in annotationStyle) { - if (annotationStyle.hasOwnProperty(name)) { - div.style[name] = annotationStyle[name]; - } - } + div.style['fontSize'] = g.getOption('axisLabelFontSize') + "px"; + var className = 'dygraph-annotation'; if (!a.hasOwnProperty('icon')) { - div.className = "dygraphDefaultAnnotation"; + // camelCase class names are deprecated. + className += ' dygraphDefaultAnnotation dygraph-default-annotation'; } if (a.hasOwnProperty('cssClass')) { - div.className += " " + a.cssClass; + className += " " + a.cssClass; } + div.className = className; var width = a.hasOwnProperty('width') ? a.width : 16; var height = a.hasOwnProperty('height') ? a.height : 16;