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

Display annotations only if single trace is visible

I would like to display trace-specific annotations on a busy line plot ONLY when a single trace is visible. I know that the number of visible traces can be determined inside a callback (via visible:legendonly), but I am wondering if a callback can be triggered by clicking on the legend? Alternatively, could something be baked in at the time of figure creation (without having to rely on a callback)? Thanks.

Hi @tks

Check out restyleData property in dcc.Graph. It looks like it might work.