Skip to content

Commit

Permalink
bar chart draw bounds enclosing old and new domain
Browse files Browse the repository at this point in the history
to avoid the gap

technically we could remove what's outside the drawing area afterward
  • Loading branch information
gordonwoodhull committed Sep 12, 2016
1 parent df6aefa commit dd94478
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/bar-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ dc.barChart = function (parent, chartGroup) {
}, false);

_chart.plotData = function (params) {
var bounds = _chart.isOrdinal() ? null : params.fullBounds();
var stackData = _chart.computeStacks(bounds);
var layers = _chart.chartBodyG().selectAll('g.stack')
.data(_chart.data());
.data(stackData);
params.preBarWidth = calculateBarWidth(params.preXScale);
params.postBarWidth = calculateBarWidth(params.postXScale);

Expand Down
8 changes: 7 additions & 1 deletion src/coordinate-grid-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,13 @@ dc.coordinateGridMixin = function (_chart) {
preXScale: _lastXScale || _x,
preYScale: _lastYScale || _y,
postXScale: _x,
postYScale: _y
postYScale: _y,
fullBounds: function () {
return [
Math.min(this.preXScale.domain()[0], this.postXScale.domain()[0]),
Math.max(this.preXScale.domain()[1], this.postXScale.domain()[1])
];
}
});

if (_chart.elasticX() || _resizing || render) {
Expand Down

0 comments on commit dd94478

Please sign in to comment.