Is there any way to get information about state of given plotly chart? E.g. I have 4 line traces in a chart and the user has selected two of them, I want to fetch this information to know which two traces have been clicked.
.layout of the graph
var gd = document.getElementById('graph') gd.data // => current data gd.layout // => current layout
This gives me the entire data that was initially plotted and not only the one that is being displayed currently. E.g. I have 4 traces and I clicked on 2 traces in legend to display them. Now I want to know which traces are being displayed.
gd.data.filter(trace => trace.visible === true)