Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chart] Toggling legends in Stacked Bar Chart v2 does not update total values #20860

Closed
3 tasks done
ktmud opened this issue Jul 26, 2022 · 3 comments
Closed
3 tasks done
Labels
#bug Bug report good first issue Good first issues for new contributors viz:charts:bar Related to the Bar chart viz:charts:echarts Related to Echarts

Comments

@ktmud
Copy link
Member

ktmud commented Jul 26, 2022

Time-series Bar Chart v2 does not update total values for stacked bar chart when toggling legends.

How to reproduce the bug

  1. Create a "Time-series Bar Chart v2"
  2. Go to "Customize" and select "Show value", "Stack series" and "Only total"
  3. Toggle series in legends
  4. The total value should update but it doesn't

The legacy Time-series Bar Chart does not have this issue.

Screenshots

stacked-value-total-update.mp4

Environment

Latest master

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.
@ktmud ktmud added #bug Bug report viz:charts:echarts Related to Echarts viz:charts:bar Related to the Bar chart good first issue Good first issues for new contributors labels Jul 26, 2022
@RaymondBakerIBM
Copy link

Hi I've investigated this bug, from what I can tell there's no way to fix this without waiting for echarts to add the total value bar functionality or making our own legend

Since legend selection is handled by echarts the only way for superset to know what is selected is the legendselectchanged callback. This gets called after the label formatters get called. Causing issues with both useRef and useState solns.

In both the below I was overloading the label formatter for each series.

I tried using a react State in the formatter to hold the selected legend values, this caused the graph to render twice undoing the hidden bar in the process. Once before and once after the value update

I also tried using a react Ref in the formatter this cased the number to not reflect the actual data selected because legendselectchanged gets called after the label formatters.

I think one other option is to give EchartsTimeseries a way to give the newly selected legends to transformers.ts causing a redraw but with the current SuperChartCore.tsx I don't see a way to do that

@TonyBhargav
Copy link

@ktmud @RaymondBakerIBM If no one is assigned to this issue or no one is working on this issue, I would like to work on this.

@michael-s-molina
Copy link
Member

Fixed by #24477

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#bug Bug report good first issue Good first issues for new contributors viz:charts:bar Related to the Bar chart viz:charts:echarts Related to Echarts
Projects
None yet
Development

No branches or pull requests

4 participants