charts icon indicating copy to clipboard operation
charts copied to clipboard

Missing legend causes uncaught errors when updating data.

Open echobops opened this issue 2 years ago • 2 comments

Expected Behaviour

Replacing data on a bar chart that previusly had 1 data set item, with new data that has 2+ dataset items, the legend should appear and show the data.

Actual Behaviour

Replacing the datasets with 2+ items on a bar chart that only has 1 current dataset item will throw an error in the console and fail to render the chart:

Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'textContent')

This is likely caused by the fact that a single dataset item bar chart does not create a legend. When replacing the data with something that now needs a legend, the code assumes one is present and attempts to set the names on the legend.

Steps to Reproduce:

  • Create a bar chart with a single color, label, and dataset item.
  • Replace the datasets, colors, and labels with correct data represeting 2+ dataset items.

NOTE: Add a GIF/Screenshot if required.

Frappé Charts version: 1.6.2 Codepen / Codesandbox:

echobops avatar Apr 07 '23 21:04 echobops

Hey @echobops, could you please assign this issue to me? I'd love to work on it! Also, just wanted to confirm, is this project accepted for Hacktoberfest 2025? Just making sure before I start. 😊

rishu-7549 avatar Oct 09 '25 14:10 rishu-7549

Hey @echobops, could you please assign this issue to me? I'd love to work on it! Also, just wanted to confirm, is this project accepted for Hacktoberfest 2025? Just making sure before I start. 😊

I'm not the project owner and can't assign bugs. :(

echobops avatar Oct 09 '25 16:10 echobops