Skip to content

Commit

Permalink
Merge branch 'master' into nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
netil committed Oct 27, 2023
2 parents 769f00a + 5e80d9d commit b2d1a9b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ChartInternal/internals/size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,18 @@ export default {

getSvgLeft(withoutRecompute?: boolean): number {
const $$ = this;
const {config, $el} = $$;
const {config, state: {hasAxis}, $el} = $$;
const isRotated = config.axis_rotated;
const hasLeftAxisRect = isRotated || (!isRotated && !config.axis_y_inner);
const leftAxisClass = isRotated ? $AXIS.axisX : $AXIS.axisY;
const leftAxis = $el.main.select(`.${leftAxisClass}`).node();
const leftLabel = config[`axis_${isRotated ? "x" : "y"}_label`];
const leftLabel = hasAxis && config[`axis_${isRotated ? "x" : "y"}_label`];
let labelWidth = 0;

// if axis label position set to inner, exclude from the value
if (isString(leftLabel) || isString(leftLabel.text) || /^inner-/.test(leftLabel?.position)) {
if (hasAxis && (
isString(leftLabel) || isString(leftLabel.text) || /^inner-/.test(leftLabel?.position)
)) {
const label = $el.main.select(`.${leftAxisClass}-label`);

if (!label.empty()) {
Expand Down
10 changes: 10 additions & 0 deletions test/esm/donut-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,14 @@ describe("ESM donut", function() {
done();
}, 500);
});

it("shouldn't throw error on call of tooltip API.", () => {
delete chart.internal.config.axis_y_label;

expect(
chart.tooltip.show({x:0})
).to.not.throw;

chart.internal.config.axis_y_label = {};
});
});

0 comments on commit b2d1a9b

Please sign in to comment.