Legend doesn't seem to update on first call to chart.update()
See original GitHub issueExpected Behavior
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.
Current Behavior
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.
Steps to Reproduce (for bugs)
Environment
Using the CDN for version 2.9.3:
https://cdn.jsdelivr.net/npm/chart.js@2.9.3/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!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Chart.js: Legend doesn't update on first call to chart.update()
I've tried looking at how to explicitly set the colors within the legend so that I can just manually update them in the...
Read more >Chart.Js: Legend Doesn't Update On First Call To ... - ADocLib
Js: Legend Doesn't Update On First Call To Chart.Update(). Now when you click the legend in this chart, the visibility of the first...
Read more >Show or hide a chart legend or data table - Microsoft Support
Point to Legend and select the arrow next to it. Choose where you want the legend to appear in your chart. Hide a...
Read more >Troubleshoot—ArcGIS Online Help | Documentation
For solutions related to creating an account, signing in, or updating your account, ... My elevation layer doesn't display correctly in the scene....
Read more >Origin Help - Graph Legends - OriginLab
Before proceeding to customize the data plot legend, you should know the difference between "updating" a legend and "reconstructing" a legend: Updating will ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Alright, you’re the man @etimberg. Thanks again - this library is just terrific.
@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 ofupdateChart()
but that can have performance implications