Skip to content
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

Better number formatting #342

Closed
wants to merge 3 commits into from
Closed

Conversation

Dlurak
Copy link
Collaborator

@Dlurak Dlurak commented Jun 1, 2024

Optimize the formatting of big numbers.
Previously:
image
Now:
image
Here is an example

Copy link

vercel bot commented Jun 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
osmapp ✅ Ready (Inspect) Visit Preview Jun 3, 2024 10:26pm

@zbycz
Copy link
Owner

zbycz commented Jun 3, 2024

In osm there are a lot of numbers which have to be shown exactly, eg. reference numbers, or start_year, i guess there will be more. I don't this it is a good idea to use compact format, because it makes it unreadable.

btw, if you considering what to do next, there is your Layer index PR #298 which i am really looking forward to 🙂 🤞

@Dlurak
Copy link
Collaborator Author

Dlurak commented Jun 3, 2024

I will probably work on the layer index this or next weekend.
Now the formatted number is only displayed for the tag population without creating a custom renderer.
Maybe there are even more tags which should have a formatted number. E.g. capacity. Do you have more ideas?

Refrence code
Start date
Population

@zbycz
Copy link
Owner

zbycz commented Jun 7, 2024

@Dlurak

ad layer-index) no worries, i just wanted to know you didnt forget about it :)

ad only poplutaion) I have one more issue with this. When i check "show tags" option, I would prefer to see the exact value. As it would be ugly to pass the context, I suggest changing the formatter to the basic one (which just adds thousands delimiter). Do you think the population will be readable enough that way?
(In case you implement it, would it work to pass intl.lang to show correct delimiters for different languages?)

Please also remove the comment (the code is clear) and fix typo in foratter.

ad capacity) I don't think it is good idea to round the number to k/M/G suffix. Not all users understand it anyway. If you only add the basic one with delimiters, then capacity is fine.. Please find examples for more tags.

@Dlurak Dlurak closed this Sep 20, 2024
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.

2 participants