projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove dead code (#818)
[dygraphs.git]
/
src
/
plugins
/
annotations.js
diff --git
a/src/plugins/annotations.js
b/src/plugins/annotations.js
index
46d0891
..
f6dd68e
100644
(file)
--- 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;
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) {
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.
};
// 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 = {};
// 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;
}
tick_height = a.tickHeight;
}
+ // TODO: deprecate axisLabelFontSize in favor of CSS
var div = document.createElement("div");
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')) {
if (!a.hasOwnProperty('icon')) {
- div.className = "dygraphDefaultAnnotation";
+ // camelCase class names are deprecated.
+ className += ' dygraphDefaultAnnotation dygraph-default-annotation';
}
if (a.hasOwnProperty('cssClass')) {
}
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;
var width = a.hasOwnProperty('width') ? a.width : 16;
var height = a.hasOwnProperty('height') ? a.height : 16;
@@
-154,7
+148,8
@@
annotations.prototype.didDrawChart = function(e) {
var ctx = e.drawingContext;
ctx.save();
var ctx = e.drawingContext;
ctx.save();
- ctx.strokeStyle = g.colorsMap_[p.name];
+ ctx.strokeStyle = a.hasOwnProperty('tickColor') ? a.tickColor : g.colorsMap_[p.name];
+ ctx.lineWidth = a.hasOwnProperty('tickWidth') ? a.tickWidth : g.getOption('strokeWidth');
ctx.beginPath();
if (!a.attachAtBottom) {
ctx.moveTo(p.canvasx, p.canvasy);
ctx.beginPath();
if (!a.attachAtBottom) {
ctx.moveTo(p.canvasx, p.canvasy);