Skip to content

Preserve precision of numeric interval axis labels - #2492

Open
Boulea7 wants to merge 1 commit into
observablehq:mainfrom
Boulea7:fix/numeric-interval-tick-labels
Open

Boulea7 wants to merge 1 commit into
observablehq:mainfrom
Boulea7:fix/numeric-interval-tick-labels

Conversation

@Boulea7

@Boulea7 Boulea7 commented Dec 3, 2026

Copy link
Copy Markdown

Fixes #1991.

The default formatter for a numeric interval scale can round different ticks to the same label. In the reported 0.05 interval, the ticks at 0.25 and 0.35 both read 0.3.

Use the precision of the built-in decimal interval to show the digits needed by the selected ticks. Preserve the default approximation for steps that would produce long labels, such as 2 / 3.

Verified the label text and SVG positions in Chromium at 640px and 420px. Added coverage for the reported interval, quarter steps, repeating thirds, and integer years. The full Node 24 test and typecheck run passed (1,362 passed, two skipped).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interval scale produces wrong ticks and labels

1 participant