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

label on color swatches #1885

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

label on color swatches #1885

wants to merge 3 commits into from

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Sep 29, 2023

closes #834
supersedes #621

@Fil Fil requested a review from mbostock September 29, 2023 15:15
@Fil Fil mentioned this pull request Sep 29, 2023
Copy link
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the other changes necessary here to support the label? Can you explain those a bit?

@Fil
Copy link
Contributor Author

Fil commented Oct 12, 2023

When there is a label (which now defaults to the scale label), the swatches (color rect + color label) are now wrapped into their own div (.plot-swatch). We don't wrap if there is no label.

The div containing the swatches still gets the proper .plot-swatches-columns or .plot-swatches-swatches className depending on the columns option, the only change here is that it is decided a bit later in the code.

The CSS ensures that the label is close to the swatches (also is a bit simpler than what we had before), with the same vertical gap between them as with the ramp.

Here are two representative examples:

"bad" "ok"
quantile-bad quantile-ok
title-bad title-ok

I suppressed the automatic label on some of the charts, either when it didn't seem useful (because it would be obvious from reading the tick labels), or simply for aesthetic reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Swatches legends should support the label option
2 participants