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

Tooltip mode x on pie chart gives error #11870

Closed
teodorachiosa opened this issue Aug 19, 2024 · 1 comment · Fixed by #11873
Closed

Tooltip mode x on pie chart gives error #11870

teodorachiosa opened this issue Aug 19, 2024 · 1 comment · Fixed by #11873

Comments

@teodorachiosa
Copy link

teodorachiosa commented Aug 19, 2024

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

@LeeLenaleee
Copy link
Collaborator

You can combine properties because you can combine multiple chart types.

If you don't want this you can make it so that your wrapper component does not accept that kind of input.

In the version (4.4.4) that just got released it won't throw an error anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants