Skip to content

Commit

Permalink
fix(axis): fix hidden axis rescale on dynamic load
Browse files Browse the repository at this point in the history
Remove conditional added from #2523

Fix #2571
  • Loading branch information
netil authored Feb 25, 2022
1 parent 82f1058 commit 5418853
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ChartInternal/Axis/Axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ class Axis {
const prefix = `axis_${key}_`;
const axisScale = scale[key];

if (config[`${prefix}show`] && axisScale) {
if (axisScale) {
const tickValues = config[`${prefix}tick_values`];
const tickCount = config[`${prefix}tick_count`];

Expand Down
20 changes: 20 additions & 0 deletions test/internals/axis-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2291,6 +2291,26 @@ describe("AXIS", function() {
expect(main.select(`.bb-axis-${v}`).style("visibility")).to.be.equal("hidden");
});
});

it("y Axis domain should update even is hidden", done => {
const yDomain = chart.internal.scale.y.domain();

// when
chart.load({
columns: [
['data1', 500, 600, 500, 4000, 750, 2000],
['data2', 123, 444, 555, 112, 3321, 232],
],
done: function() {
// after dynamic data load, y axis domain should be updated
expect(yDomain).to.not.be.deep.equal(
this.internal.scale.y.domain()
);

done();
}
});
});
});

describe("Multi axes", () => {
Expand Down

0 comments on commit 5418853

Please sign in to comment.