carbon-design-system / carbon-charts

:bar_chart: :chart_with_upwards_trend:⠀Robust dataviz framework implemented using D3 & typescript
https://charts.carbondesignsystem.com
Apache License 2.0
904 stars 184 forks source link

[Bug]: Selecting the legend on a StackedBarChart doesn't work if data is loaded in after the initial load #1859

Open molyholy opened 3 months ago

molyholy commented 3 months ago

Relevant package(s)

Carbon Charts Version

1.16.4

Which bundler are you using?

Webpack

What happened and what did you expect to happen?

See this stackblitz for reproduction. It simulates the conditions in our project, where we are calling API calls one after another to gradually update a StackedBarChart.

In the stackblitz, Dataset1 and Dataset2 are loaded in immediately. There is a setTimeout function to load in Dataset3 after 3 seconds. Once Dataset3 gets loaded in, notice how you can select the legend boxes for Dataset1 and Dataset2 to filter the graph, but selecting Dataset3's legend box doesn't work. It seems like any data loaded in after the initial load cannot be filtered by selecting the legend box.

Chart data and options (automatically formatted so no need for backticks)

No response

JavaScript console or build output (if relevant)

No response

StackBlitz repro

https://stackblitz.com/edit/react-3p1l1r-oixhm8?file=src%2Findex.js

IBM Application/Team (if relevant)

Cloud UI

What priority level would this be in your opinion?

P2 (Medium)