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

Implement layout.legend.orientation (closes #53) #535

Merged
merged 19 commits into from
May 17, 2016
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/components/legend/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ module.exports = {
font: extendFlat({}, fontAttrs, {
description: 'Sets the font used to text the legend items.'
}),
orientation: {
valType: 'enumerated',
values: ['v', 'h'],
Copy link
Contributor

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/h or vertical/horizontal?

Copy link
Contributor

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 bar orientation.

dflt: 'v',
role: 'info',
description: 'Sets the orientation of the legend.'
},
traceorder: {
valType: 'flaglist',
flags: ['reversed', 'grouped'],
Expand Down
1 change: 1 addition & 0 deletions src/components/legend/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) {
coerce('bordercolor');
coerce('borderwidth');
Lib.coerceFont(coerce, 'font', layoutOut.font);
coerce('orientation');
Copy link
Contributor

Choose a reason for hiding this comment

The 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 orientation to 'h', the default 'x' would be 0 (instead of 1.02).

Moreover, maybe we should make the default 'y' value 0 instead of 1 ? But that one is less obvious to me.

@mdtusz @chriddyp @jackparmer should the default horizontal legend start at the bottom-left or at the top-left corner of the plot area?

Copy link
Contributor

Choose a reason for hiding this comment

The 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.


coerce('traceorder', defaultOrder);
if(helpers.isGrouped(layoutOut.legend)) coerce('tracegroupgap');
Expand Down
Loading