algorithm ideas for number shorten with 1 Million = 1M, 1 Thousand = 1K etc.
Posted on 2012-09-11
I have a set of numbers to be plot as histogram chart. The Y scale need a short legend for divisor such as M = million, K = thousand .
I need a logic so that the y scale show a meaningful numbers - and also all data will be divided by that divisor.
The set of number changed randomly for each new plot - so algorithm need to work when there are large and small numbers plot together. - no log scale is necessary.
Numbers will not goes below 0 but can be as high as billions.
How should i calculate for divisor, e.g. using average number or max/min etc.