-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
add entrywidth
and entrywidthmode
to legend
#6202
add entrywidth
and entrywidthmode
to legend
#6202
Conversation
37c771d
to
05b6d77
Compare
LGTM - aside from the revised name as suggested by @archmoj in #6202 (comment) I think we just want to use the new attributes in an image test. |
entrywidth
and entrywidthmode
to legend
@@ -74,6 +74,19 @@ module.exports = { | |||
'Sets the amount of vertical space (in px) between legend groups.' | |||
].join(' ') | |||
}, | |||
entrywidth: { | |||
valType: 'number', | |||
min: 0, |
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 think we should provide a dflt
for this attribute.
However using zero looks confusing.
@alexcjohnson
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 actually think it's nice to use zero to mean "automatic - use the text width," if we document that.
Alternatively, we could have a third value for entrywidthmode
, perhaps 'auto'
, that means we use the text width. Then the logic would be:
- If a nonzero
entrywidth
is provided,entrywidthmode
defaults to'pixel'
. If not, it defaults to'auto'
. - If
entrywidthmode
is'auto'
we don't coerceentrywidth
.
That feels unnecessarily cumbersome to me though. Only reason I can think of that would justify this is if we want to actually support a width of zero. Any reason someone would want that?
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.
If we want to use zero as the auto default the min
namely for the pixel
mode should be a value greater or equal 1 not zero IMHO.
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 would be confusing, wouldn't it? We'd document "Use 0 to size the entry based on the text width" but document a min of 1... yet if you explicitly set it to 0 it would work, because we'd throw out the 0 and replace it with the default 0.
Let's keep this simple, and consistent with colorbar.len
and colorbar.thickness
- min: 0
and no max
regardless of entrywidthmode
, the only difference being that 0
has a special meaning we'll document. If it turns out that certain values (either very small or very large) cause problems worse than "it looks bad," we can address that during the drawing process when we know more than we do at the supplyDefaults step.
Thanks for the PR @nickmelnikov82 🎖️ |
…lotly.js#6202), reflect changes in Chart.withLayoutStyle
The positioning options for legendgroups need to be improved. It should especially be possible to position legends horizontally further apart from each other. This PR adds a parameter
legendtextwidth
for trace and legend.