observablehq / observablehq/plot
Better support for dates in the raster mark
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 5.4k
- Forks
- 244
- PR merge metrics
- No merged PRs in 30d
Description
The naive implementation does not work because it has banding issues due to quantization on the date axis.
In the example below we have monthly data. Even with the correct width (corresponding to the number of different months), some months are rounded down to the pixel on their left hand side. This happens because the rounding in InterpolateNone is made by flooring the date divided by the average length of a month. (And months expressed in milliseconds are not uniform.)
An easy way to fix this would be to allow changing the interpolator to use Math.round instead of Math.floor:
We could call this interpolator: "round". However we might want more control on x vs y, so maybe we need more options. It would also be nice to auto-apply rounding when the dimension is temporal?
Notebook exploration: https://observablehq.com/@observablehq/plot-raster-dates-2351
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.
Research direction
Start in src/marks/raster.js at InterpolateNone and review the linked Observable notebook for the monthly-date examples. Compare the proposed rounding behavior with the need for separate x and y controls or automatic temporal handling. Done means the chosen behavior is specified and monthly dates render without visible banding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- d3
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100