observablehq / observablehq/plot
Centered/aligned intervals?
@Fil is already working on this.
Since Jul 31, 2023.
- Dominant language
- HTML
- Stars
- 5.4k
- Forks
- 244
- PR merge metrics
- No merged PRs in 30d
Description
interval: 1 or interval: day respectively create [0, 1] and [monday 00:00, monday 23:59:59…] segments, that can be represented as, say, a barX. In some cases we'd prefer the bar to be centered on the value.
This can be done currently with a custom interval: {floor: d => Math.floor(d) - 0.5, offset: (d, n=1) => d + n}, but it could be nice to have a shorthand notation.
maybe intervalAlign: 0.5 (with a default being 0, or 1 depending on the semantics we'd want to give it).
For UTC intervals, we'd have to get a sense of what is an appropriate “day shifted by a fraction”—including when days are 23 or 25 hours-long, or months.
A typical use case: https://talk.observablehq.com/t/observable-plot-cell-and-date-label/8116
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.