Skip to content

Commit

Permalink
Fix x-axis position on chart redraw
Browse files Browse the repository at this point in the history
Conflicts:
	dc.min.js
	dc.min.js.map
  • Loading branch information
Rob Hardwick authored and gordonwoodhull committed Aug 5, 2015
1 parent 4d195d1 commit c3d9ee9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions dc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dc.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dc.min.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions spec/coordinate-grid-chart-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ describe('dc.coordinateGridChart', function() {
expect(chart.select("g.x").attr("transform")).toMatchTranslate(0,150);
});

it('should update x axis position when the chart height is changed', function() {
chart.elasticX(true).height(400).redraw();
expect(chart.select("g.x").attr("transform")).toMatchTranslate(0,400);
});

describe("labels", function() {
beforeEach(function() {
expect(chart.effectiveHeight()).toBe(130);
Expand Down
4 changes: 2 additions & 2 deletions src/coordinate-grid-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,7 @@ dc.coordinateGridMixin = function (_chart) {

if (axisXG.empty()) {
axisXG = g.append('g')
.attr('class', 'axis x')
.attr('transform', 'translate(' + _chart.margins().left + ',' + _chart._xAxisY() + ')');
.attr('class', 'axis x');
}

var axisXLab = g.selectAll('text.' + X_AXIS_LABEL_CLASS);
Expand All @@ -447,6 +446,7 @@ dc.coordinateGridMixin = function (_chart) {
}

dc.transition(axisXG, _chart.transitionDuration())
.attr('transform', 'translate(' + _chart.margins().left + ',' + _chart._xAxisY() + ')')
.call(_xAxis);
};

Expand Down

0 comments on commit c3d9ee9

Please sign in to comment.