labels for swatches#621
Closed
Fil wants to merge 1 commit into
Closed
Conversation
mbostock
requested changes
Jan 7, 2022
Member
mbostock
left a comment
There was a problem hiding this comment.
I think my preference is that we show the scale’s label by default, consistently across legend types, but that you can disable it by setting label: null. That way we don’t need to special-case the behavior for swatches.
14492bd to
2eafe34
Compare
2eafe34 to
7dc8d9b
Compare
Contributor
Author
|
rebased |
7dc8d9b to
63b7013
Compare
mbostock
reviewed
Mar 30, 2022
| ? swatches.call(div => div.append("p") | ||
| .text(label) | ||
| .style("font-weight", "bold") | ||
| .style("width", "100%")) |
Member
There was a problem hiding this comment.
The parent element here has flex because the code expects that it contains the swatches. We need to change the styles to match the structure—we shouldn’t be setting the width style.
mbostock
reviewed
Mar 30, 2022
| `); | ||
|
|
||
| const palette = label | ||
| ? swatches.call(div => div.append("p") |
Member
Member
|
I’d like to revert the unrelated formatting changes… |
Contributor
Author
|
I'll do that. The goal of the formatting changes was to produce an output with consistent alignement. |
Contributor
Author
|
rebased—I still need to figure out why some alignments in the tests seem wrong |
abf5fdb to
d495760
Compare
Contributor
Author
|
superseded by #1885 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Note: the scale’s label is not shown for swatches, since most of the time it is obvious from the context. But it can be nice to write Plot.legend(…, label:"Industry"):
closes #834