Skip to content

Automatically transform to thousands etc. for shorter tick labels. #395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mbostock opened this issue May 12, 2021 · 2 comments
Open

Automatically transform to thousands etc. for shorter tick labels. #395

mbostock opened this issue May 12, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@mbostock
Copy link
Member

For large powers of ten, tick labels are often truncated by default:

untitled-74

It’d be nice if we could detect this sort of powers-of-ten ticks and automatically applied a suitable scale transform, such as converting to billions (y: {transform: d => d / 1e9}):

untitled-75

@mbostock mbostock added the enhancement New feature or request label May 12, 2021
@mbostock mbostock changed the title Detect thousands/millions/billions/etc. and automatically transform for shorter tick labels. Automatically transform to thousands etc. for shorter tick labels. May 12, 2021
@Fil
Copy link
Contributor

Fil commented Mar 30, 2023

This looks quite feasible now, but where would we show ("millions")?

@mbostock
Copy link
Member Author

We’d add (millions) to the end of the scale label. Which wouldn’t look great if there was already a parenthetical, but it’s fine because you can always customize the label yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants