observablehq / observablehq/plot

select start (or end) point of an interval, rather than its midpoint?

Open
#1,179 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
HTML
Stars
5.4k
Forks
244
PR merge metrics
No merged PRs in 30d

Description

there should be a way to select the start point rather than midpoint of an interval? In particular when creating a lineY with missing days, we might still want the day to be shown at 00:00 rather than 12:00.

Plot.lineY({ length: 3 }, {
    x: ["2022-11-20T00:00:00.000Z", "2022-11-21T00:00:00.000Z", "2022-11-24T00:00:00.000Z"],
    interval: d3.utcDay
  }).initialize().channels.x.value

currently this returns dates as 2022-11-20T12:00:00.000Z, etc.

Reported by @yurivish (with this concrete use case).

See also #1182

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how Plot.lineY handles the interval option, using the provided d3.utcDay example and the linked missing-data use case. The work is done when callers can select an interval’s start or end point and the example places missing days at 00:00 rather than the midpoint.

Written by the indexing model from the issue text.

Assessment

Tech stack
d3js, javascript
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.