-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
gl2d data-referenced annotations #1301
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
dc90d13
unskip gl2d data-ref annotation in supplyDefaults
etpinard b29b3b2
rewrite relayoutCallback as func declaration
etpinard 4ba7551
add handleAnnotations method to scene proto
etpinard bbac99b
make sure gl2d axis scale updates on interactions
etpinard 38b8a92
update _fullLayout ref on updateFx
etpinard 28c255c
add gl2d annotations mock
etpinard 33e7c60
fix lint
etpinard 631d7a4
add drag/pan tests for annotations on gl2d graphs
etpinard afaa4cb
rm now useless Fx.layoutAttribute def
etpinard ee6d7d8
rm useless Fx.supplyDefaults call in doModeBar subroutine
etpinard ce1cc44
replace scene2d.updateFx with scene2d.updateRefs
etpinard 5a4f945
Merge branch 'master' into annotations-gl2d
etpinard c8b53dd
attach scene2d relayoutCallback onto proto
etpinard 5f36071
Merge pull request #1319 from plotly/gl2d-tmpper
etpinard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"data":[{ | ||
"type": "scattergl", | ||
"x":[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5], | ||
"y":[1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5], | ||
"mode":"markers" | ||
}], | ||
"layout": { | ||
"yaxis":{"autorange":false,"range":[1,5],"showgrid":false,"zeroline":false,"showticklabels":false}, | ||
"xaxis":{"autorange":false,"range":[1,5],"showgrid":false,"zeroline":false,"showticklabels":false}, | ||
"height":500, | ||
"width":800, | ||
"margin": {"l":100,"r":100,"top":80,"bottom":80,"pad":0}, | ||
"showlegend":false, | ||
"annotations":[ | ||
{"text":"left top","showarrow":false,"xref":"paper","yref":"paper","xanchor":"left","yanchor":"top","x":0,"y":1}, | ||
{"text":"center middle","showarrow":false,"xref":"paper","yref":"paper","xanchor":"center","yanchor":"middle","x":0.25,"y":1}, | ||
{"text":"right bottom","showarrow":false,"xref":"paper","yref":"paper","xanchor":"right","yanchor":"bottom","x":0.5,"y":1}, | ||
{"text":"move with page","xref":"paper","yref":"paper","x":0.75,"y":1}, | ||
{"text":"opacity","opacity":0.5,"x":5,"y":5}, | ||
{"text":"not-visible", "visible": false}, | ||
{"text":"left<br>justified","showarrow":false,"align":"left","x":1,"y":4}, | ||
{"text":"center<br>justified","showarrow":false,"x":2,"y":4}, | ||
{"text":"right<br>justified","showarrow":false,"align":"right","x":3,"y":4}, | ||
{"text":"no arrow<br>page auto TR","showarrow":false,"xref":"paper","yref":"paper","x":0.75,"y":0.75}, | ||
{"text":"no arrow<br>page auto ML","showarrow":false,"xref":"paper","yref":"paper","x":0.25,"y":0.5}, | ||
{"text":"no arrow<br>page auto BC","showarrow":false,"xref":"paper","yref":"paper","x":0.5,"y":0.25}, | ||
{"text":"default"}, | ||
{"text":"no arrow","x":5,"y":4,"showarrow":false}, | ||
{"text":"border","showarrow":false,"bordercolor":"rgb(148, 103, 189)","x":4,"y":3}, | ||
{"text":"border width","showarrow":false,"bordercolor":"rgb(0, 0, 255)","borderwidth":3,"x":5,"y":3}, | ||
{"text":"background","showarrow":false,"bgcolor":"rgb(255, 127, 14)","x":4,"y":2}, | ||
{"text":"padding","showarrow":false,"bordercolor":"rgb(0, 0, 0)","borderpad":3,"x":5,"y":2}, | ||
{"text":"angle<br>Bottom R","showarrow":false,"textangle":40,"x":1,"y":1,"xanchor":"right","yanchor":"bottom"}, | ||
{"text":"angle<br>Middle C","showarrow":false,"textangle":-70,"x":2,"y":1,"xanchor":"center","yanchor":"middle"}, | ||
{"text":"angle<br>Top L","showarrow":false,"textangle":160,"x":3,"y":1,"xanchor":"left","yanchor":"top"}, | ||
{ | ||
"text":"arrowhead styling","arrowcolor":"rgb(214, 39, 40)","arrowwidth":4.1,"arrowhead":7, | ||
"ax":-34,"ay":37,"arrowsize":2,"x":4,"y":1 | ||
}, | ||
{ | ||
"text":"All together<br>with<sup style=\"font-family:raleway;fill:rgb(0,255,255)\">STYLE</sup>", | ||
"opacity":0.6,"arrowwidth":5,"arrowhead":3,"ax":-77,"ay":-5, | ||
"bordercolor":"rgb(255, 0, 0)","borderwidth":4,"bgcolor":"rgba(255,255,0,0.5)", | ||
"font":{"color":"rgb(0, 0, 255)","size":20}, | ||
"arrowcolor":"rgb(166, 28, 0)","borderpad":3,"textangle":50,"x":5,"y":1 | ||
}, | ||
{"text":"","showarrow":true,"borderwidth":1.2,"arrowhead":2,"axref":"x","ayref":"y","x":5,"y":3,"ax":4,"ay":5}, | ||
{"text":"","showarrow":true,"borderwidth":1.2,"arrowhead":2,"axref":"x","ayref":"y","x":6,"y":2,"ax":3,"ay":3} | ||
] | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems a bit scary - why is this necessary? I'm just worried that if
gd._fullLayout
andscene.fullLayout
have diverged, there could somehow be changes ingd._fullLayout
that this will throw away.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the problem is in the
doModebar
relayout shortcut.I'll double-check why the
_fullLayout
gets lost. Thanks for the headsup!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be an option to not use
this.fullLayout
at all, but only to usethis.graphDiv._fullLayout
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an idea.
So, the
_fullLayout
gets lost inPlots.supplyDefaults
. We could add a block handling refs on scene objects similar to this one for cartesian axes. But I think we could do better.The reason the lost of reference only affects
dragmode
relayouts is because all other relayout calls pass throughscene2d.plot
which update thefullLayout
ref here on every pass.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright, well I'm not entirely sure what would happen, but the test would be something like:
gd._fullLayout
to be constructed bysupplyDefaults
but DOESN'T result in a newscene2d.plot
(like what? change legend background color? change something cosmetic on an axis of a different subplot?)Plotly.redraw(gd)
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the cleanest way (I think) of updating
gd._fullLayout._plots.xy._scene2d.fullLayout
b50b7e9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, that seems better, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
full solution in #1319