Closed
Description
Hi, I have a single page application which contains a plotly chart with click event handler in it. I have another function which removes the chart and plot a new chart after certain events.
Plotly.newPlot(plotSpace, data, layout)
plotSpace.on('plotly_click', click => {
listAllTransactions(town, click.points[0].data.name, click.points[0].x)
})
Each time the plot is replaced with a new one, the event handler from the previous chart is carried over to the new chart, so a click on the new chart will trigger listAllTransactions
twice: first with town
from the first chart and second with town
from the second chart.
How can I remove the event handler from the first chart? I've tried removeEventHandler to no avail.