Merge pull request #3941 from stormpython/fix/groupedBars

Fixes issue with incorrect offset for grouped bars
This commit is contained in:
Lukas Olson 2015-05-26 13:51:09 -07:00
commit 5c1d319fbc
3 changed files with 7 additions and 29 deletions

View file

@ -335,9 +335,9 @@ define(function (require) {
var line = svg.append('line')
.attr('class', 'base-line')
.attr('x1', 0)
.attr('y1', height)
.attr('y1', yScale(0))
.attr('x2', width)
.attr('y2', height)
.attr('y2', yScale(0))
.style('stroke', '#ddd')
.style('stroke-width', 1);

View file

@ -215,16 +215,7 @@ define(function (require) {
return yScale(d.y);
})
.attr('height', function (d) {
if (d.y < 0) {
return Math.abs(yScale(0) - yScale(d.y));
}
// if there is a negative yMin value, use yScale(0) instead of height
if (yMin < 0) {
return yScale(0) - yScale(d.y);
}
return height - yScale(d.y);
return Math.abs(yScale(0) - yScale(d.y));
});
return bars;
@ -315,25 +306,12 @@ define(function (require) {
var line = svg.append('line')
.attr('class', 'base-line')
.attr('x1', 0)
.attr('y1', height)
.attr('y1', yScale(0))
.attr('x2', width)
.attr('y2', height)
.attr('y2', yScale(0))
.style('stroke', '#ddd')
.style('stroke-width', 1);
if (yMin < 0) {
// Draw line at yScale 0 value
svg.append('line')
.attr('class', 'zero-line')
.attr('x1', 0)
.attr('y1', yScale(0))
.attr('x2', width)
.attr('y2', yScale(0))
.style('stroke', '#ddd')
.style('stroke-width', 1);
}
if (addTimeMarker) {
timeMarker.render(svg);
}

View file

@ -334,9 +334,9 @@ define(function (require) {
.append('line')
.attr('class', 'base-line')
.attr('x1', startLineX)
.attr('y1', height)
.attr('y1', yScale(0))
.attr('x2', width)
.attr('y2', height)
.attr('y2', yScale(0))
.style('stroke', '#ddd')
.style('stroke-width', lineStrokeWidth);