observablehq / observablehq/plot
Format tip pair as a single value when the two values are equal?
@Fil is already working on this.
Since Aug 15, 2024.
- Dominant language
- HTML
- Stars
- 5.4k
- Forks
- 244
- PR merge metrics
- No merged PRs in 30d
Description
By default when formatting pairs (y1, y2), we display ${format(a)}—${format(b)}. It does not feel terribly useful to repeat the value when a and b end up being formatted identically.
If for example you're showing a tip on an interval that is [3.1—3.2] with an integer format, showing "3" (read as "somewhere around 3 something") is as informative and slightly better than "3—3" ("between 3 something and 3 something").
This does not happen often, since hopefully the format discriminates between values, but when it happens we would be as happy with showing ${format(a)} alone.
I tried to think of a case where on the opposite, one might want to show a repetition; for example on a calendar where you want to show an interval that goes "from Sunday to Sunday", as "Sun—Sun". In that case, you would have to create a specific channel since the automatic tip format would now show "Sun" only.
This enhancement would incidentally help with the waffle tips (#2132), but is not necessary for them, and should be discussed on its own merits.
(Note: does not apply when the value is the difference — i.e. hint: {length: true}).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.