chartjs / Chart.js

Simple HTML5 Charts using the <canvas> tag
https://www.chartjs.org/
MIT License
64.33k stars 11.89k forks source link

Tooltip needs to be registered globally #11111

Open chkpnt opened 1 year ago

chkpnt commented 1 year ago

Expected behavior

The tooltip plugin can be added to a single chart by adding it the the plugins array:

const myChart = new Chart(ctx, {
  plugins: [..., Tooltip], 
  type: 'pie',
  ...
})

Current behavior

It isn't working. The tooltip plugin needs to be registered globally: Chart.register(..., Tooltip);

Reproducible sample

https://github.com/chkpnt/chartjs-issue11111/blob/main/js/main.js

Optional extra steps/info to reproduce

Just run npm run start.

Possible solution

No response

Context

No response

chart.js version

v4.2.0

Browser name and version

Firefox 109.0.1

Link to your project

https://github.com/chkpnt/chartjs-issue11111

chkpnt commented 1 year ago

Nice issue number!  🥳