From 06b0de03f904e28a74564919bccff6fb8daf654f Mon Sep 17 00:00:00 2001 From: Alex de Mulder Date: Wed, 1 Oct 2014 13:35:34 +0200 Subject: [PATCH] Allowed for negative bar charts --- lib/DOMutil.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/DOMutil.js b/lib/DOMutil.js index 02b4ba85..38b35c7e 100644 --- a/lib/DOMutil.js +++ b/lib/DOMutil.js @@ -160,12 +160,16 @@ exports.drawPoint = function(x, y, group, JSONcontainer, svgContainer) { * @param className */ exports.drawBar = function (x, y, width, height, className, JSONcontainer, svgContainer) { -// if (height != 0) { + if (height != 0) { + if (height < 0) { + height *= -1; + y -= height; + } var rect = exports.getSVGElement('rect',JSONcontainer, svgContainer); rect.setAttributeNS(null, "x", x - 0.5 * width); rect.setAttributeNS(null, "y", y); rect.setAttributeNS(null, "width", width); rect.setAttributeNS(null, "height", height); rect.setAttributeNS(null, "class", className); -// } + } }; \ No newline at end of file