[Chartjs]-Multiple Charts of the Same Type in ChartJS2 ReactJS – Buggy Tooltips

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.

Leave a comment