-
Notifications
You must be signed in to change notification settings - Fork 7
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
Chart re-rendering seems to be broken #12
Comments
Dayum, could you give me an example of your code? I've never had to use update as I repaint my chart as required but I can see how it would be useful. Let me have a look into how feasible it is to add the update method :) |
Sure, actually the code is open. You can start with You can pay attention to the console log, after any change it will be triggered but not finished |
In fact, second render call fails with:
|
I'm working on a solution at the moment, I'll let you know when its ready for testing. |
Not sure if it may help, but I actually did such local patch: # body of `render_chart` js function
- var chart = new Chart(ctx, obj);
+ var chart = Chart.getChart(ctx);
+ if (chart) {
+ chart.data.datasets = v.data.datasets;
+ chart.options = v.options;
+ chart.update();
+ } else {
+ new Chart(ctx, obj);
+ } And it covered my needs pretty well - it dynamically re-renders the chart without destroying and jumps, but likely you have better idea how to support this. To make it more clear - draft PR: #13 |
Try checking out my code in #14 If this solves your situation I'll merge it in. |
I think this can be closed now. |
I'd like to update the chart on an event, approach with creating new chart seems broken:
Second call to
render
/render_mutate
doesn't update the chart and moreover, I noticed thatrender
call hangs. I.e it won't never finished.Additionally, introducing
update
method could be considered (https://www.chartjs.org/docs/latest/developers/updates.html)The text was updated successfully, but these errors were encountered: