Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responsive X-Axis #856

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 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