Skip to content
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

Emit Annotation Edit Events #722

Closed
mdfederici opened this issue Jul 6, 2016 · 7 comments
Closed

Emit Annotation Edit Events #722

mdfederici opened this issue Jul 6, 2016 · 7 comments
Labels
feature something new

Comments

@mdfederici
Copy link

It is desirable for my container to receive notifications when a user has edited an annotation in an editable graph by moving, rotating or changing length. These events could contain the relevant annotation's options as well as the delta which the user has applied. It would be desirable for the delta to be specified in original axis terms (ie if the relevant axis is of type date, the delta should be a date and not the millisecond equivalent).

I've taken a stab at implementing this. Here is the pull request.

@etpinard
Copy link
Contributor

etpinard commented Jul 6, 2016

Hmm. Can't you just listen to plotly_relayout ?

@etpinard
Copy link
Contributor

etpinard commented Jul 6, 2016

related: #145

@mdfederici
Copy link
Author

Yeah actually i didn't realize that relayout gave me those annotation changes so that is pebcak...

Still, as a user, I think I would prefer an api with more specific events over one with fewer but more general events. The trouble with relayout is that I need to write logic to discover what has actually happened via inspecting the new layout rather than explicitly being told (via event type) what has happened.

If you want to reject this though based on the fact that i can use relayout and your aforementioned 145, that is fine with me.

@mdfederici
Copy link
Author

Also, it looks like relayout only gives me the update which while obviously most of the benefit, if i want to get the full annotation, I need to look that up myself. It's just another example of work which I as the user need to do with a more generalized event.

@etpinard
Copy link
Contributor

etpinard commented Jul 6, 2016

I think I would prefer an api with more specific events over one with fewer but more general events.

Point taken.

The trouble with relayout is that I need to write logic to discover what has actually happened via inspecting the new layout rather than explicitly being told (via event type) what has happened.

True, but I'm not convinced associated all update type with an event name is the (most scalable) way to go either.

t looks like relayout only gives me the update which while obviously most of the benefit, if i want to get the full annotation, I need to look that up myself

That's correct. Maybe a general plotly_edit event (that would e.g. be triggered while dragging shapes too) could do the trick instead? Alternatively, maybe plotly_relayout could return the modified layout as part of its event data?

If you want to reject this though based on the fact that i can use relayout and your aforementioned 145, that is fine with me.

Ok. Yes I would prefer merging this issue with #145. So I'm closing this issue. We should spent some time discussing our event system before the v2.0.0 release.

@mdfederici
Copy link
Author

@etpinard yep fair enough thanks for the discourse. plotly rocks

@etpinard
Copy link
Contributor

etpinard commented Jul 6, 2016

@mbonaci No problem. Thanks you for your PR. 🍻

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

2 participants