Missing legend causes uncaught errors when updating data.
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:
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. 😊
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. :(