Zoom Event Binding

I would like to be able to bind a JavaScript function to all zooming on a plot. I looked at the docs for events, and although they mention the zoom event, there is no link anywhere on the page. I looked into the Click and Hover events, and found that they both use the same syntax. (Hover is $('#myDiv').bind('plotly_hover', function(event,data){...). However, when I replace plotly_hover with plotly_zoom, I get no output whatsoever.
Any help would be greatly appreciated.

Sorry about that, here is an example: http://codepen.io/plotly/pen/dogexw?editors=101

How do you distinguish a zoom event from other layout events?

Hello, i tried your example code but seems that it doesen’t work. It’s changed somethings?
Because i don’t recieve the alert.

Thanks you!

@Narghast I just updated the aforementioned codepen: http://codepen.io/plotly/pen/dogexw (it was still using our old jQuery events system, but is now fixed).

There’s no way to distinguish between relayout and simple zoom events at the moment. That said, we’re are planning on adding a zoom event soon. Subscribe to Exposing more events · Issue #145 · plotly/plotly.js · GitHub to get info about the latest development.

1 Like

Thank you for your fast response!

Hiya! Plotly now has improved and consolidated Plotly.js event documentation here:

Please feel free to suggest documentation improvements in a pull request:

https://github.com/plotly/documentation/tree/source-design-merge/_posts/plotly_js/events