Number Scaling |
|
FusionMaps can also use the concept of number scaling like FusionCharts v3. Number scaling lets you define your own scales for numbers and then apply it to all numbers on the map. |
Basic Example |
Let's start with the most basic example which is already defined in FusionMaps - thousands and millions scale. If your numbers on the map are greater than 1000, FusionMaps can scale them to K (Thousands) or M (Millions) if you set <map formatNumberScale='1' ...>, as shown below: |
As you can see above, FusionMaps has scaled the numbers down to K. By default, FusionMaps has the K,M (1000,1000) scaling defined for each map. You can, however, change it to anything you wish. Let's see it in the next example. |
Adding billions to default scaling |
FusionMaps, by default, has 1000,1000 (K,M) scaling defined for all maps. It doesn't have the scaling for billions defined. Let's modify the number scaling to add billion so that the final scale looks like 1000,1000,1000 (K,M,B). This scale, in human terms, would look something as under: 1000 = 1 K Now, to convert this scale into FusionMaps XML format, you'll have to do the following:
When you now view a map containing data in billions, you'll see as under. Note that the map now contains figure both in millions and billions. |
The XML for this map can be listed as under: <map formatNumberScale='1' numberScaleValue='1000,1000,1000' numberScaleUnit='K,M,B' numberPrefix='$'> |
Another Example - Putting time in scale |
Let's consider another example where we intend to plot time related figures on the map. Say we're plotting a map which indicates the average time taken by people in a certain activity in each continent. The time taken by each person can range from a few seconds to few days. And we've the average time stored in our database in seconds itself. Now, if we were to show all the data on the map in seconds only, it won't appear too legible. What we can do is build a scale indicating time and then specify it to the map. This scale, in human terms, would look something as under: 60 seconds = 1 minute Now, to convert this scale into FusionMaps XML format, you'll have to do it as under:
The entire XML looks as under: <map formatNumberScale='1' defaultNumberScale='s' numberScaleValue='60,60,24,7' numberScaleUnit='min,hr,day,wk'> When you now view the map, you'll see that all the data has been automatically scaled to the best value. Like: 38 was converted to 38s |
Storage Size Example |
Take another example, where you're plotting a map indicating bandwidth usage by county/county/continent. The usage can be from few bits to a few gigabytes. Again, you've all your data in bits - so we can render the range as under: 8 bits = 1 Byte And the XML can be written as under: <map formatNumberScale='1' defaultNumberScale='bits' numberScaleValue='8,1024,1024,1024,1024' numberScaleUnit='bytes,KB,MB,GB,TB' > |
Length/Distance Example |
Let's consider another length/distance example. The standard length/distance range can be rendered as under (with inches being the default unit): 12 inches = 1 feet So, we can write the XML as under: |