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

Fix(Legend): working with useless transition effect #41

Merged
merged 11 commits into from
Jul 6, 2017
1 change: 1 addition & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = function(config) {
"./spec/api.region-spec.js",
"./spec/api.zoom-spec.js",
"./spec/arc-spec.js",
"./spec/axis-spec.js",
"./spec/bb-spec.js",
"./spec/class-spec.js",
"./spec/core-spec.js",
Expand Down
34 changes: 34 additions & 0 deletions spec/axis-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -915,4 +915,38 @@ describe("AXIS", function() {
});
});
});

describe("axis.x.rotated", () => {
before(() => {
args = {
data: {
columns: [
["data1", 5, 10, 15]
],
types: {
data1: "bar"
}
},
axis: {
x: {
type: "category",
categories: ["text1", "text2", "text3"]
},
rotated: true
}
};
});

it("should render ticks of rotated axis inside bar position range", () => {
const barRects = chart.internal.main.select(".bb-event-rects").selectAll("rect.bb-event-rect");
const ticks = chart.internal.main.select(".bb-axis-x").selectAll("g.tick").nodes();

barRects.each(function(rect, idx){
const y = d3.select(this).attr("y");
const tick = d3.select(ticks[idx]);

expect(tick.attr("transform")).to.be.equal("translate(0,"+y+")");
});
});
});
});
2 changes: 1 addition & 1 deletion src/internals/legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ extend(ChartInternal.prototype, {
$$.updateLegendStep(step);
// Update size and scale
$$.updateSizes();
$$.updateScales();
$$.updateScales(!withTransition);
$$.updateSvgSize();
// Update g positions
$$.transformAll(withTransitionForTransform, transitions);
Expand Down