Get&Set on selected traces

I want to allow my users to save their selection of visible traces. How can I access this information & is it possible to initialize the chart in this way?

e.g.
they press a save button somewhere --> next time they open the page, chart is shown with only trace0 selected
afbeelding

Yes, we store that info on your graph’s div element:

var gd = document.getElementById('graph')

var traceVisibility = gd.data.map(trace => trace.visible);
2 Likes