Black Lives Matter. Please consider donating to Black Girls Code today.

How can i create a custom legend in plotly js?

When i set showlegend: true in my layout options

var layout=  {
showlegend: true,

i get a legend. But i would like to create my own legend inside the plot.
How can i include my own legend inside my plot, or how can i bind custom listener on the legend?

This is an old post but were you ever able to find a solution (I want to do the same thing)