Formatting large numbers #1942
              
                Unanswered
              
          
                  
                    
                      Hvass-Labs
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment 5 replies
-
| If you use  Otherwise, you'll need to write a custom function that takes the maximum value, derives the symbol for the top tick, and formats each tick accordingly. The tickFormat function receives all the necessary information in its arguments. To display the unit suffixes in lowercase, you could use CSS (simplest method), or explore a custom function maybe based on Intl.NumberFormat.formatToParts. But note that it could introduce ambiguities: 3m is supposed to represent 3 milli, not 3 mega, if you're using SI. | 
Beta Was this translation helpful? Give feedback.
                  
                    5 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
I have a plot with very large numbers on the y-axis that I want shown with denominators like K for Kilo, M for Million, B for Billion, etc. This can be done using the following number-formatter:
But I would like to use the same denominator for all numbers on the y-axis so it doesn't mix e.g. M and B. The denominator could be determined e.g. from the max number shown on the y-axis. Is this possible?
Side question if you just happen to know the answer: Is it possible to get
Intl.NumberFormatto write small letters instead of capital letters e.g. "3b" instead of "3B"?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions