vue-chartjs icon indicating copy to clipboard operation
vue-chartjs copied to clipboard

[Bug]: Pie Chart custom tooltip label callback not firing on first load

Open madebycaliper opened this issue 3 years ago • 1 comments

Would you like to work on a fix?

  • [ ] Check this if you would like to implement a PR, we are more than happy to help you go through the process.

Current and expected behavior

When the chart first loads it shows the standard label despite a custom pie tooltip being passed. If I modify the Vue component and save, the HMR / reload triggers the label to work as expected.

Things I've tried:

  • initializing the data / Chart in every Vue lifecycle hook
  • updating the chartData to try triggering a reload
  • updating the ChartJs overrides after registering the elements
  • a bunch of other random attempts to fix

Video (takes a few seconds for HMR to hit)

Screen Shot 2022-07-27 at 15 19 53

Reproduction

https://codesandbox.io/s/vue2-pie-chartjs-repro-y6kjrr?file=/src/components/Pie.vue

chart.js version

3.8.0

vue-chartjs version

4.1.1

Possible solution

No response

madebycaliper avatar Jul 27 '22 19:07 madebycaliper

Hi @madebycaliper 👋

Have you tried just passing the tooltip options to chartOptions.plugins? I've modified the original example to do it this way and it seems to be working just as expected (here's a link to code sandbox).

Arantiryo avatar Aug 28 '22 10:08 Arantiryo