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

Added custom number formatting to better format the numbers on the chart #5104

Merged
merged 12 commits into from
Oct 10, 2024

Conversation

jryu01
Copy link
Contributor

@jryu01 jryu01 commented Oct 9, 2024

Description

  • Added Vega chart custom formatting function to better format small numbers.
  • Added and leverage an utility function to fix javascript floating point precision errors when applying formatting or showing display number.
  • All Vega charts will inherit this formatting by default but it can be also overriden by individual chart spec.
  • Added tests

Before: (lookt at the numbers on the y axis)
Screenshot 2024-10-09 at 12 33 54 PM

After
Screenshot 2024-10-09 at 11 44 17 AM

Other Examples
Y Axis with long numbers with many 0s
Screenshot 2024-10-09 at 12 04 38 PM

Formatting with numbers > 1 (this is same as existing behaviour)
Screenshot 2024-10-09 at 11 44 29 AM

Resolves #4947

@jryu01 jryu01 marked this pull request as ready for review October 9, 2024 16:40
@jryu01 jryu01 changed the title Added custom number formatting Added custom number formatting for better format the numbers on the chart Oct 9, 2024
@jryu01 jryu01 changed the title Added custom number formatting for better format the numbers on the chart Added custom number formatting to better format the numbers on the chart Oct 9, 2024
Copy link
Contributor

@Tom-Szendrey Tom-Szendrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet nice fix

@jryu01 jryu01 merged commit 59ae904 into main Oct 10, 2024
4 checks passed
@jryu01 jryu01 deleted the jryu/custom-number-formatting branch October 10, 2024 17:25
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.

[BUG]: simulation chart y axis does not handle small numbers very well
3 participants