The default tickFormat with a collapsed domain lacks sufficient precision

Open
#286 2 comments 3 reactions 0 assignees View on GitHub

@Fil is already working on this.

Since Jun 17, 2024.

  • #287 by @Fil — open
  • #294 by @Fil — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript

Research direction

Start by reading the default tickFormat implementation and its tests in d3-scale; the issue gives a reproduction for a collapsed domain, where the tick step is zero. Check how the formatter chooses precision in that case, then add a regression test showing the desired output for the example. Done means the test confirms sufficient precision for a collapsed domain.

Written by the indexing model from the issue text.

Description

d3.scaleLinear().domain([5.5, 5.5]).tickFormat(7.5)(5.5) // "6"

We don’t handle the tick step being zero well.

(originally https://github.com/observablehq/plot/issues/2076#issuecomment-2172184218)

Dominant language
JavaScript
Stars
1.6k
Forks
288
Avg merge
6h 41m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from d3/d3-scale

All issues in d3/d3-scale

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.