Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2k
Implement layout.legend.orientation (closes #53)#535
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
ff16df1ddc6d71f40dbd492ff540869538cb2538e19dc2609f68344bc0dfc8ae5049c923e397225c29707d502fa107883a65aa6c08c6d47abc20390c1632d4313976dFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -21,7 +21,11 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { | ||
| containerOut = layoutOut.legend = {}; | ||
| var visibleTraces = 0, | ||
| defaultOrder = 'normal'; | ||
| defaultOrder = 'normal', | ||
| defaultX, | ||
| defaultY, | ||
| defaultXAnchor, | ||
| defaultYAnchor; | ||
| for(var i = 0; i < fullData.length; i++) { | ||
| var trace = fullData[i]; | ||
| @@ -58,12 +62,29 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { | ||
| coerce('borderwidth'); | ||
| Lib.coerceFont(coerce, 'font', layoutOut.font); | ||
| coerce('orientation'); | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add some smart default logic so that if a user set Moreover, maybe we should make the default @mdtusz@chriddyp@jackparmer should the default horizontal legend start at the bottom-left or at the top-left corner of the plot area? Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd think bottom left but if we do this, we will need to take into account the case where range sliders are present. The legend is currently rendered below it so it gets hidden if it is placed in the same place. | ||
| if(containerOut.orientation === 'h') { | ||
| var xaxis = layoutIn.xaxis; | ||
| if(xaxis && xaxis.rangeslider && xaxis.rangeslider.visible) { | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, that works. | ||
| defaultX = 0; | ||
| defaultXAnchor = 'left'; | ||
| defaultY = 1.1; | ||
| defaultYAnchor = 'bottom'; | ||
| } | ||
| else { | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @n-riesco can you add a few jasmine test cases in | ||
| defaultX = 0; | ||
| defaultXAnchor = 'left'; | ||
| defaultY = -0.1; | ||
| defaultYAnchor = 'top'; | ||
| } | ||
| } | ||
| coerce('traceorder', defaultOrder); | ||
| if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap'); | ||
| coerce('x'); | ||
| coerce('xanchor'); | ||
| coerce('y'); | ||
| coerce('yanchor'); | ||
| coerce('x', defaultX); | ||
| coerce('xanchor', defaultXAnchor); | ||
| coerce('y', defaultY); | ||
| coerce('yanchor', defaultYAnchor); | ||
| Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
@etpinard@cldougl@chriddyp
Do we want
v/horvertical/horizontal?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.
'v'/'h'gets my vote - for parity with barorientation.