You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/10/12 21:16:02 UTC

[GitHub] [superset] RaymondBakerIBM commented on issue #20860: [Chart] Toggling legends in Stacked Bar Chart v2 does not update total values

RaymondBakerIBM commented on issue #20860:
URL: https://github.com/apache/superset/issues/20860#issuecomment-1276745527

   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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org