-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visual glitches when updating charts #13
Comments
ChartJsBarChart.cshtml
Here's the method in the interop class
Here's the js function
As you can see, we remove the chart object from the global array with this line when the component is destroyed |
Also update methods of
However they should pass the local property instead like this:
The user should always modify the local property instead of passing new objects. This is important because otherwise he/she can pass a new object with new canvasId which would be wrong.
|
I am closing this now, as this should be fixed by release 0.4.0. If you still have issues let me know and I can reopen. |
I noticed visual glitches on the chart when using the update button from the example. It turns out that the cause for that is because you haven't destroyed the old chart object before setting with new one.
In BlazorComponents.js, for every update function you should add
if (myChartIndex !== -1) { myChart.chart.destroy(); }
right before
myChart.chart = {};
Another thing I noticed is that in your Initialize functions you create a new chart object even if you don't add it to the collection. So I think you can improve it by changing the code from this:
to this
The text was updated successfully, but these errors were encountered: