3π
To anyone else having this issue, the mistake was quite silly. Since the custom tooltip configuration is happening on the { Chart }
class, and not on each individual { Pie }
instance, you need to make sure that you handle this as a global configuration, and not inside of the reusable component. If you do this configuration in a reusable component, every time you instantiate the component, the configuration will run and fire for the # of times you use that component. This is because the pie chart (and other ChartJS components) extend the { Chart }
class in the react-chartjs-2 library.
- [Chartjs]-React-chartjs-2 time scale dates not formatting
- [Chartjs]-Chart.js color change of the data points
Source:stackexchange.com