Skip to content

opacity legend #587

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

Merged
merged 2 commits into from
Nov 25, 2021
Merged

opacity legend #587

merged 2 commits into from
Nov 25, 2021

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Oct 29, 2021

A ramp with increasing opacity.

We need to test various possibilities; maybe a checkered background would be nicer; maybe swatches might be useful for some types of opacity scales.

@Fil Fil changed the base branch from main to fil/legends-2 October 29, 2021 14:33
@Fil Fil mentioned this pull request Oct 29, 2021
9 tasks
Comment on lines +11 to +12
if (!interpolate) throw new Error(`${type} opacity scales are not supported`);
if (`${legend}`.toLowerCase() !== "ramp") throw new Error(`${legend} opacity legends are not supported`);
Copy link
Member

Choose a reason for hiding this comment

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

I added some explicit limitations here; I imagine we’ll add support for other opacity scale types in the future.

@mbostock mbostock marked this pull request as ready for review November 25, 2021 21:11
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.

Seems like a useful start to me, even if limited!

@mbostock mbostock merged commit 6db63fc into fil/legends-2 Nov 25, 2021
@mbostock mbostock deleted the fil/legend-opacity branch November 25, 2021 21:12
Fil added a commit that referenced this pull request Nov 29, 2021
* legends

* Plot.legend takes a scale and options

* Remove Plot.legend, use chart.legend instead.

* reinstate Plot.legend

* unused code

* allow legend: "ramp" as an option

* snapshot test for a lot of color legends

* no random in unit tests

* remove redundant color tests

* accept a label on swatches

* className for legendSwatches

* remove radius and opacity legends for now

* more scope

* only color is available in this branch

* do not expose any class

* error on unknown legend type

* categorical is normalized to ordinal

* show unknown legend type in error

* prEtTieR

* prioritize type; avoid unnecessary default

* non-nullish, not truthy

* div.append(…nodes)

* legends

* Plot.legend takes a scale and options

* Remove Plot.legend, use chart.legend instead.

* reinstate Plot.legend

* unused code

* allow legend: "ramp" as an option

* snapshot test for a lot of color legends

* no random in unit tests

* remove redundant color tests

* accept a label on swatches

* className for legendSwatches

* remove radius and opacity legends for now

* more scope

* only color is available in this branch

* do not expose any class

* error on unknown legend type

* categorical is normalized to ordinal

* show unknown legend type in error

* prEtTieR

* prioritize type; avoid unnecessary default

* non-nullish, not truthy

* div.append(…nodes)

* less duck typing

* remove entity filtering

* reduce duck-typing

* add a test for Plot.legend with options

* styles

* clear up some confusion between scale options and legend options

* className

* apply() rather than color()

* Update README

* revert figure changes

* avoid closure

* applyInlineStyles

* revert diverging scale changes

* inline styles; fix diverging; separate tests

* stringify and lowercase legend option

* normalizeScale

* inherit scale options

* fix ordinal tickFormat function

* explicit ordinal ticks

* use pushState for tests

* round option

* fix for truncated schemes

* opacity legend (#587)

* opacity legend

* add color option

* legend: true

* fix test determinism

* fix inline opacity legends

* arrow key navigation

* ignore style if null

Co-authored-by: Mike Bostock <[email protected]>
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.

2 participants