Skip to content

Tooltip mode x on pie chart gives error #11870

@teodorachiosa

Description

@teodorachiosa

Expected behavior

The library lets me add scales and tooltip mode X on a pie/doughnut chart... which is odd in the first place.
If I don't get a compilation error when using TS, I would at least expect it to fail silently and do nothing. Instead I get console errors.

I also tried to use the chart as:

chartOptions: ChartOptions<'pie'> = { ... }

hoping to get some useful compilation errors for properties that don't make sense to be applied on a pie chart, but I run into this bug instead: #10896

Current behavior

Errors in the console:

Uncaught TypeError: t[a] is not a function
at chart.umd.js:13:36114
at Hi (chart.umd.js:13:34956)
at Ui (chart.umd.js:13:36090)
at x (chart.umd.js:13:37004)
at An.getElementsAtEventForMode (chart.umd.js:13:98586)
at Va._getActiveElements (chart.umd.js:13:195021)
at Va.handleEvent (chart.umd.js:13:194589)
at Object.afterEvent (chart.umd.js:13:195693)
at d (chart.umd.js:7:1113)
at sn._notify (chart.umd.js:13:83179)

Reproducible sample

https://codepen.io/teodorachiosa/pen/OJeQQgj

Optional extra steps/info to reproduce

  1. Hover over the chart in the reproducible sample
  2. Check the console errors

Possible solution

No response

Context

We're working on a wrapper component over Chart.js which has a few look & feel customizations.
While testing the component out, we found that we can combine some properties even if they don't make sense (e.g. cartesian grid on pie/doughnuts charts).

chart.js version

4.4.3

Browser name and version

Chrome 127.0.6533.120

Link to your project

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions