Details
This function modifies a plotly plot to allow clicking on traces to highlight them.
Clicking on a trace will highlight it in orange (default) and dim all other traces.
Clicking on the same trace again will deselect it and restore the original colors.
Clicking on the background will also restore all traces to their original colors.
The function uses the htmlwidgets::onRender function from the htmlwidgets package to add
JavaScript code that handles the click events on the plotly plot.