-
Notifications
You must be signed in to change notification settings - Fork 185
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
opacity legend #587
Conversation
42a7526
to
30ed257
Compare
if (!interpolate) throw new Error(`${type} opacity scales are not supported`); | ||
if (`${legend}`.toLowerCase() !== "ramp") throw new Error(`${legend} opacity legends are not supported`); |
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 added some explicit limitations here; I imagine we’ll add support for other opacity scale types in the future.
aded8a6
to
273df90
Compare
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.
Seems like a useful start to me, even if limited!
* 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]>
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.