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

scale.high/low #258

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

scale.high/low #258

wants to merge 3 commits into from

Conversation

Fil
Copy link
Member

@Fil Fil commented Jan 5, 2022

scale.low and scale.high define what to do with values higher or lower than the bounds of the domain. If undefined, we do the usual (ie. interpolate or clamp).

  • add tests
  • generalize to other scales (diverging, etc)
  • should it be possible to distinguish N/A and invalid with different "unknown"?

demo https://observablehq.com/@d3/scale-high-low-258

@Fil Fil requested a review from mbostock January 5, 2022 11:11
@Fil Fil changed the title Fil/extremes scale.high/low Jan 5, 2022
@visnup
Copy link

visnup commented Jan 7, 2022

Is this interpretable for a categorical scale too?

I assume it'd work for an ordinal scale, but what does "high" vs. "low" mean for a categorical one?

@Fil
Copy link
Member Author

Fil commented Jan 7, 2022

Good question! (for now it's only designed for continuous scales, and implemented in just one class of them).

thinking out loud:

  • On a categorical scale I guess you would only use scale.unknown("oops") — and if you want specific values for undefined/NaN, you can already define them in the domain.
  • On an ordinal scale, where the domain is made of comparable values (e.g. ["B", "C", "D"]), and the value is comparable, it can make sens to implment high, low, or even in-between domain elements. (I'm not proposing to implement that.)

@visnup
Copy link

visnup commented Jan 11, 2022

in between 🤯 hadn't thought of that one.

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

Successfully merging this pull request may close these issues.

2 participants