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
| }, | ||
| entrywidth: { | ||
| valType: 'number', | ||
| min: 0, |
There was a problem hiding this comment.
I think we should provide a dflt for this attribute.
However using zero looks confusing.
@alexcjohnson
There was a problem hiding this comment.
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
entrywidthis provided,entrywidthmodedefaults to'pixel'. If not, it defaults to'auto'. - If
entrywidthmodeis'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.
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.
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
legendtextwidthfor trace and legend.