I have a number of traces that are displayed overtop each other. I would like to be able to send highlight some of them by clicking on the legend, with the others still being displayed in the background. I can install my own click handler for the legend that will highlight an individual trace by changing the color, as shown in this codepen, but the draw order results in the highlighted trace being behind many of the non-highlighted traces, whereas I would like it to be on top of everything.
I have found this stack overflow answer which gets most of the way there, but it has the side effect of rearranging the legend. Since the highlighting would be done by interacting with the legend, I feel that this rearrangement would be very confusing for a use.
Any suggestions would be appreciated.