Browse Source

Allowed for negative bar charts

v3_develop
Alex de Mulder 10 years ago
parent
commit
06b0de03f9
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      lib/DOMutil.js

+ 6
- 2
lib/DOMutil.js View File

@ -160,12 +160,16 @@ exports.drawPoint = function(x, y, group, JSONcontainer, svgContainer) {
* @param className * @param className
*/ */
exports.drawBar = function (x, y, width, height, className, JSONcontainer, svgContainer) { 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); var rect = exports.getSVGElement('rect',JSONcontainer, svgContainer);
rect.setAttributeNS(null, "x", x - 0.5 * width); rect.setAttributeNS(null, "x", x - 0.5 * width);
rect.setAttributeNS(null, "y", y); rect.setAttributeNS(null, "y", y);
rect.setAttributeNS(null, "width", width); rect.setAttributeNS(null, "width", width);
rect.setAttributeNS(null, "height", height); rect.setAttributeNS(null, "height", height);
rect.setAttributeNS(null, "class", className); rect.setAttributeNS(null, "class", className);
// }
}
}; };

Loading…
Cancel
Save