From 156ce1c7244be1463174bf7c238137de169fd9c0 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Wed, 28 Aug 2013 23:32:00 -0400 Subject: [PATCH] all tests pass (without compilation) --- plugins/annotations.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/annotations.js b/plugins/annotations.js index 8576104..090f00d 100644 --- a/plugins/annotations.js +++ b/plugins/annotations.js @@ -92,7 +92,7 @@ annotations.prototype.didDrawChart = function(e) { var a = p.annotation; var tick_height = 6; - if (a.hasOwnProperty("tickHeight")) { + if (a.tickHeight) { tick_height = a.tickHeight; } @@ -102,22 +102,22 @@ annotations.prototype.didDrawChart = function(e) { div.style[name] = annotationStyle[name]; } } - if (!a.hasOwnProperty('icon')) { + if (!a.icon) { div.className = "dygraphDefaultAnnotation"; } - if (a.hasOwnProperty('cssClass')) { + if (a.cssClass) { div.className += " " + a.cssClass; } - var width = a.hasOwnProperty('width') ? a.width : 16; - var height = a.hasOwnProperty('height') ? a.height : 16; - if (a.hasOwnProperty('icon')) { + var width = a.width !== undefined ? a.width : 16; + var height = a.height !== undefined ? a.height : 16; + if (a.icon) { var img = document.createElement("img"); img.src = a.icon; img.width = width; img.height = height; div.appendChild(img); - } else if (p.annotation.hasOwnProperty('shortText')) { + } else if (p.annotation.shortText) { div.appendChild(document.createTextNode(p.annotation.shortText)); } var left = p.canvasx - width / 2; -- 2.7.4