Skip to content

xref="x2 domain" type options for shape/annotation/image #4958

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
nicolaskruchten opened this issue Jun 25, 2020 · 5 comments · Fixed by #5014
Closed

xref="x2 domain" type options for shape/annotation/image #4958

nicolaskruchten opened this issue Jun 25, 2020 · 5 comments · Fixed by #5014
Assignees
Labels
feature something new

Comments

@nicolaskruchten
Copy link
Contributor

If we could specify x and y in terms of an axis domain rather than paper coordinates, this would greatly facilitate positioning of horizontal/vertical lines and annotations thereof. See plotly/plotly.py#2590 for more information.

@nicholas-esterer nicholas-esterer self-assigned this Jun 25, 2020
@nicholas-esterer
Copy link
Contributor

So this is progressing nicely: shapes, annotations and images can be placed relative to axes and will update their position relative to axis length and offset.
I'm just posting to get some feedback, to see what more needs to be done:

  • these new objects are still not draggable, looking into this
    Is there a list of specs that the new objects should have? Right now I'm looking through test/jasmine/tests/shapes_test.js to see what tests should be adapted for this new behaviour.

@nicolaskruchten
Copy link
Contributor Author

@alexcjohnson can you help orient Nick here plz?

@nicholas-esterer I don't think these shapes need to be draggable unless they've been created via the new shape-drawing system... can you elaborate about which objects are not draggable that you feel should be?

@nicholas-esterer
Copy link
Contributor

If you put shapes on the plot referring to axis domains and set config: { editable: true } then when you would drag these shapes, they move to strange locations. I have fixed this though now. I would just need to add it for annotations.
But my question is more: is there a list of specs that the shapes / annotations / images need to fulfill? Because I discovered the dragging just by playing around with some test plots I made, and probably my playing around will not discover all intended use cases :)

@alexcjohnson
Copy link
Collaborator

is there a list of specs that the shapes / annotations / images need to fulfill?

That's a good question - no, I don't think there is. But for shapes I can't think of anything besides the editable: true behavior that isn't visible in the original shapes mock or in the attributes for shapes. The same should be true of annotations and images, as long as each of the attributes they support do the expected thing (and annotations have editable: true dragging too) then we should be good.

@nicolaskruchten nicolaskruchten added the feature something new label Jul 9, 2020
@nicholas-esterer
Copy link
Contributor

Dragging shapes and annotations while referencing an axis domain is mostly working. My goal is to have them behave like paper shapes but just react when the domain changes. I mostly have this working, however, I can't figure out how to keep them from "clipping" when they move outside of the subplot area. For comparison, paper shapes are not clipped at all, but shapes that reference data coordinates are. However, the axis domain referenced shapes clip in a strange way, and the annotations disappear, see the video:
clipping

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

Successfully merging a pull request may close this issue.

4 participants