Skip to content

Commit

Permalink
Fix broken error bars in horizontal bar charts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Mackler authored and Adam Mackler committed Feb 17, 2017
1 parent 5fbe9db commit 7969397
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/models/multiBarHorizontal.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ nv.models.multiBarHorizontal = function() {
var xerr = getYerr(d,i)
, mid = 0.8 * x.rangeBand() / ((stacked ? 1 : data.length) * 2);
xerr = xerr.length ? xerr : [-Math.abs(xerr), Math.abs(xerr)];
xerr = xerr.map(function(e) { return y(e) - y(0); });
xerr = xerr.map(function(e) { return y(e + ((getY(d,i) < 0) ? 0 : getY(d,i))) - y(0); });
var a = [[xerr[0],-mid], [xerr[0],mid], [xerr[0],0], [xerr[1],0], [xerr[1],-mid], [xerr[1],mid]];
return a.map(function (path) { return path.join(',') }).join(' ');
})
.attr('transform', function(d,i) {
var mid = x.rangeBand() / ((stacked ? 1 : data.length) * 2);
return 'translate(' + (getY(d,i) < 0 ? 0 : y(getY(d,i)) - y(0)) + ', ' + mid + ')'
return 'translate(0, ' + mid + ')';
});
}

Expand Down

0 comments on commit 7969397

Please sign in to comment.