Skip to content

Undefined zoom event data #339

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

Closed
Jodana opened this issue Mar 17, 2016 · 1 comment
Closed

Undefined zoom event data #339

Jodana opened this issue Mar 17, 2016 · 1 comment

Comments

@Jodana
Copy link

Jodana commented Mar 17, 2016

When you zoom, sometimes the data returned by 'plotly_relayout' callback is undefined for either x-axis start or x-axis end.

It happens every time you release the mouse button (to proceed zoom action) outside of the plot div.

How to reproduce:

  1. https://plot.ly/javascript/zoom-events/
  2. Zoom anywhere in the middle of the plot
  3. Zoom, starting from anywhere, but head left till you are out of the plot (release the mouse button on the plot left side)

Result: zoom did proceed, but you are not informed about the new range (atm I'm trying to bypass this issue by retrieving this information directly from the plot instead of the event data). I would have expected either for the data to be returned, or zoom canceled.

EDIT: retrieving chartDiv.layout.xaxis.range did the trick !

@etpinard
Copy link
Contributor

Thanks for the report.

I'd argue that this is the correct behaviour.

The plotly_relayout event intends to inform the listeners about the update object passed to Plotly.relayout. In the case where the mouse cursor goes off-plot-area to the left, 'xaxis.range[0]' does not need to be updated and is undefined in the update object.

Your report seem to asking for a more general on-change event. Or, more generally, an easier way to grab to current state of a plotly graph.

I'll reference:

for completeness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants