Skip to content

eventdata content consistency #168

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
aderidder opened this issue Jan 7, 2016 · 6 comments
Closed

eventdata content consistency #168

aderidder opened this issue Jan 7, 2016 · 6 comments
Labels
feature something new
Milestone

Comments

@aderidder
Copy link

aderidder commented Jan 7, 2016

Hi,

In order to capture the points in my scatterplot, I'm currently using plotly_relayout. After playing around with this for a bit, I found that the eventdata is somewhat unpredictable, making it hard/confusing to work with:

  • autoscale button clicked: Object {xaxis.autorange: true, yaxis.autorange: true}
  • zoom button clicked: Object {xaxis.range: Array[2], yaxis.range: Array[2]}
  • drag zoom: Object {xaxis.range[0]: , xaxis.range[1]: , yaxis.range[0]: , yaxis.range[1]: }
  • drag zoom, but leave your plot at the left side: Object {xaxis.range[1]: , yaxis.range[0]: , yaxis.range[1]: }
  • pan: similar to drag zoom, but if you drag along an axis (e.g. don't change the y, only the x), the eventdata only contains information about the x

It would be very useful if the eventdata's content would be consistent, e.g. always provide Object {xaxis.range: Array[2], yaxis.range: Array[2]}

Thanks,
Sander

@etpinard
Copy link
Contributor

etpinard commented Jan 7, 2016

@aderidder great suggestion. Thanks!

The plotly_relayout event is in dire need of a redesign. Maybe the solution lies in #145 where each axis interaction would emit an event with a similar data object.

@chrisgervang
Copy link

chrisgervang commented Dec 12, 2016

It appears the rangeslider pan and zoom is consistently {xaxis.range: [number, number], yaxis.range: [number, number]}. So to handle relayout event I now do this:

const newSliderRange: [number, number] = e['xaxis.range']; //Plotly format for zooming with the slider
const newZoomRange0: number = e['xaxis.range[0]'];
const newZoomRange1: number = e['xaxis.range[1]']; //Plotly format for zooming within the graph
if (!!newSliderRange || !!newZoomRange0 || !!newZoomRange1) {
    const newRange = !!newZoomRange0 || !!newZoomRange1 ? [newZoomRange0, newZoomRange1] : newSliderRange;
    console.log("EVENT", e, newRange);
}

It seems like it would take little effort to emit a consistent type of {xaxis.range: [number, number], yaxis.range: [number, number]} where number is still nullable like the current implementation.

@jackparmer
Copy link
Contributor

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

https://plot.ly/javascript/plotlyjs-events/

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

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

@etpinard
Copy link
Contributor

Pie and Sankey event data should be refactor during the v2 push to look more like the other traces.

See #1875

@JacobJNilsson
Copy link

JacobJNilsson commented Jul 31, 2018

Hi, not sure if this is the right place to bring this up, please feel free to remove this if this is not the propper channel.
Today the update information of plotly_relayout only contain the y and x axis.autorange: bool in the case of autorange, but should not the axis.range[] also be included? Such as in the case of other resizing updates.

@gvwilson
Copy link
Contributor

gvwilson commented Jun 5, 2024

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

@gvwilson gvwilson closed this as completed Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

No branches or pull requests

6 participants