xr0master/chartjs-react

tooltip Update?

Opened this issue · 4 comments

Hello, thank you for this wrapper. It's worked really well for me, and saved me a lot of space in my client bundle so far.

I saw notes about updating this library for something related to the tooltip, and I wondered of the status of that, and if it may be related to one last issue I have. I'm using an external tooltip, and though it renders correctly, the chart rerenders with it, rerunning the animation. The external callback also receives a third property along with the chart and tooltip, which is replay: true`. I can't find a way to stop this. Would the tooltip update fix this kind of issue?

Thank you again.
Screen Shot 2021-07-20 at 5 25 01 PM

@alimirakim I apologize for such a long delay in reply. To be honest, I do not quite understand what your problem is. Do you have an example?
On a note, there is no mistake, I just wanted to add the ability to use a React component as the tooltip.

Hello, thank you for getting back to me :) . I actually tried using pure chart.js and finally solved this problem recently, but as for what was wrong, it appeared to be the same issue as these people were having with react-chartjs-2: reactchartjs/react-chartjs-2#648 They made a 'test' branch with a WIP solution for their package, but it has a lot of its own bugs.

One cause was that any function-type values provided to things like backgroundColor was considered a 'changed' value to chart.js with every render, so I just removed those and calculated colors another way. I hope that helps if you ever run into it yourself :) .

If I understand you correctly, does each call to an external function trigger an animation for the entire chart? This is very strange, I use custom tooltips in one of my projects and have not seen this. I will check it.

Yes, that was the main bad behavior. I tried so many ways of fixing it, but if I did fix it one way, another strange bug took its place 😓 . Our app does have some complex logic, so I think it may depend on specific circumstances.