Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬 Register for the Oct 27 webinar.

How to access trace selections in stacked bar chart

I’m attempting to access the state of the traces in my chart so I can filter my dataframe based on the selections.

I only want to display the data that contains the selected traces, as opposed to leaving all the data (ie x values) in the chart.

I cannot find reference to being able to do this anywhere. Will I need to manually build checkboxes instead of using the built-in traces of graph_objs.Bar?

for example, I have a dataframe

Item    Status    Value
1        First    2000
1        Second   3490
1        Third    542    
2        First    641    
2        Second    564        
3        First      10

My traces are 3 values (first, Second, Third) pertaining to a linear process where each value is a status marking the advancement of an item.

My intention is to be able to select statuses from further down the progression so only those items that have advanced to a certain step are plotted.

As I select more advanced statuses in the trace legend, my plotted x-values should drop off since fewer advance that far, even though they all share the majority of the statuses. When ‘First’ is selected, all x values are plotted, ‘First’ and ‘Second’ item 1 and 2 are plotted, ‘First’, ‘Second’, ‘Third’ only the first item is plotted.

The only solution I can think of is to make checkboxes for each trace value and use those inputs in a callback, but that seems redundant to the select/de-select traces functionality built in.