Here is a GIF of the bar chart updating. Watch the legend:
GIF of Bar Chart
The expected behavior is the legend updating in sync with the graph.
The current behavior, as shown in the GIF is that the legend doesn't automatically update with the graph on the first update call, but does on subsequent calls.
Using the CDN for version 2.9.3:
https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.min.js
I also posted this same question on stack overflow:
https://stackoverflow.com/questions/62161090/chart-js-legend-doesnt-update-on-first-call-to-chart-update
If you have an answer here, please feel free to get some extra SO karma. I will certainly upvote any help!
Thank you!
@ZachariahRosenberg thanks for reporting this. I haven't seen this kind of issue before but I have some good news and bad news.
The good news is that this is fixed in v3.0.0-alpha https://codesandbox.io/s/tender-grass-ejlwm?file=/src/index.js
The bad news is that there are breaking changes between those versions so a simple upgrade is not possible.
A simple work around I did find was to call chart.update() twice at the end of updateChart() but that can have performance implications
@etimberg Thank you for looking into it!
Actually, that's good news all around for me - I just started with Chart, so if you suggest we go straight to 3.0, I'll start there.
Would you suggest we use 3.0 in production yet?
Thank you so much for your help here!
I am using v3 in production for a project. I would recommend trying it out first to see if it meets your needs. We're still making some breaking changes from the first alpha release, so I can't guarantee that nothing breaks if you start using it.
Alright, you're the man @etimberg. Thanks again - this library is just terrific.
Thanks! Glad it's helpful to you 😄