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(axis): fix error when showing tick only #3882

Merged
merged 1 commit into from
Sep 20, 2024
Merged
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
3 changes: 2 additions & 1 deletion src/ChartInternal/Axis/AxisRendererHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ export default class AxisRendererHelper {
w: 5.5,
h: 11.5
};
const text = node?.select("text");

!node.empty() && node.select("text")
!text.empty() && text
.text("0")
.call(el => {
try {
Expand Down
6 changes: 3 additions & 3 deletions test/api/export-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ describe("API export", () => {

// pattern for local: preserveFontStyle=true
[
"byuVSgeSACZuGnZIBBJFgAQwUbjZWVoQIAFMi6UoZ1gEhoeHzxORj7",
"gEMwIYvjgilxAsgoYFymZLtEoI4ACaBlzpB5Aqh4u1HAwik2LwOTAFo2",
"n3KPP7RFhvxMH97ZLyZpsgzMpjX2Qk8O3IUePj1WqYqk0kYkwz"
"i2iAoIcLvwVDzzAQUBmuodjmOmu+NeryqrOrq4jsyozKyLzy99vftNVcb343ou",
"JXSOKRvoLXeaeBnwyQ3q5TJIDtEMpaehdeQBLArBlL9P1Ni",
"iDzpkxgBoCd9qkExwC4O8qSCPVk3lyWshNuFqQAdJNm6rb+GVkH2CdOcenYIgj5Cy"
],

// pattern for webdriverio
Expand Down
39 changes: 39 additions & 0 deletions test/internals/axis-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2281,6 +2281,45 @@ describe("AXIS", function() {
expect(axis.selectAll(".tick line").size()).to.be.equal(0);
});
});

it("set options", () => {
args = {
data: {
columns: [
["data1", 90, 100, 140, 200, 100]
],
type: "bar",
},
axis: {
x: {
tick: {
show: false,
text: {
show: false
}
}
},
y: {
tick: {
show: false,
text: {
show: false
}
}
}
}
};
});

it("should show tick without error", () => {
expect(
chart.config("axis.y.tick.show", true, true)
).to.not.throw;

expect(
chart.internal.$el.axis.y.selectAll(".tick").size() > 0
).to.be.true;
});
});

describe("axis text on 'binary floating point'", () => {
Expand Down
Loading