question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Legend doesn't seem to update on first call to chart.update()

See original GitHub issue

Expected Behavior

Here is a GIF of the bar chart updating. Watch the legend: GIF of Bar Chart

Here is a sandbox to review

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)

Here is a sandbox to review

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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ZachariahRosenbergcommented, Jun 3, 2020

Alright, you’re the man @etimberg. Thanks again - this library is just terrific.

1reaction
etimbergcommented, Jun 2, 2020

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found