-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Unbind click event #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
A workaround I used was to completely remove Appreciate if anyone has a more elegant solution |
@caalberts Thanks for writing in. I'd vote for making @mdtusz @alexcjohnson @cldougl thoughts? |
👍 |
👍 sounds like a good idea |
@caalberts should be in the next release after this pr: #117 |
👌 looking forward to it. |
Fixed in #117 |
Is there any other way to remove or rebind existing handlers without calling |
I don't see that we document or test this anywhere, but we do support removeListener and removeAllListeners from the npm function logIt(e) { console.log(e) }
gd.on('plotly_relayout', logIt)
Plotly.relayout(gd, {'xaxis.range': [-1,5]})
// here the listener is invoked
> Object {xaxis.range: Array[2]}
> Promise {[[PromiseStatus]]: "resolved", [[PromiseValue]]: div#graph.dashboard-plot.js-plotly-plot}
gd.removeListener('plotly_relayout', logIt)
Plotly.relayout(gd, {'xaxis.range': [-2,6]})
// now the listener is not invoked
> Promise {[[PromiseStatus]]: "resolved", [[PromiseValue]]: div#graph.dashboard-plot.js-plotly-plot} |
* Add definitions for removeAllListeners funtion as detailed plotly/plotly.js#107 (comment) * adding automargin property as per the documentation: https://plot.ly/javascript/reference/#layout-xaxis-automargin * making the colorbar property optional * Fix lint warnings * updating tests * create ColorBar interface
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.
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 withtown
from the first chart and second withtown
from the second chart.How can I remove the event handler from the first chart? I've tried removeEventHandler to no avail.
The text was updated successfully, but these errors were encountered: