Hiding Legend in Bubble chart

Hi there,

I’m using a bubble chart which has multiple traces. So after zooming the graph to a particular time range of the graph, in the legend I see the traces that are unrelated to the bubbles that I see on the graph. Is there any way to dynamically load the legends to see the traces that are being shown in the graph? .

You can try listening to plotly_relayout (which is emitting on zoom) and then call:

Plotly.restyle(/* graph div */, 'showlegend', false, [/* indices of the traces to hide *])