Using Color Range to define data range and colors | ||||||||
In our previous population example, when we were providing data for each entity of the world map, we were not distinguishing each entity based on colors. Effectively, this didn't enhance the visual interpretation of data. But, FusionMaps allows you to use color ranges to distinguish various entities based on their data. Using color range, you can classify your data into sections, with each section having a different name and color to differentiate from each other. These sections are called color ranges. For each color range, you'll have to specify the minimum and maximum values, and the hex color code for the range. Let's say we wanted to divide the World Continent Population into three groups as under: |
||||||||
|
||||||||
From our above table, we can clearly define three color ranges as under:
|
||||||||
Now, for each color range, we can select the following properties:
Each color range should have its own unique range value, displayValue and color. Let's now implement the color range concept in our World Population Map. We'll follow the above defined range and color "Sparsely Populated" continents in green, "Well Populated" continents in yellow and "Densely Populated" continents in red. To do so, create a new XML file named as ColorRange.xml, with the following XML data: |
||||||||
<map borderColor='005879' fillColor='D7F4FF' numberSuffix='
Mill.' includeValueInLabels='1' labelSepChar=': ' baseFontSize='9'> |
||||||||
The only difference in this data (from the previous one) is the introduction of new <colorRange> and <color> elements. The <colorRange> element encapsulates the definition of all color range. And, individual color ranges are defined using the <color> element which can assume the following attributes:
|
||||||||
Here, we've defined our 3 color ranges in the XML. When you now view the map, you'll see the following results: | ||||||||
Bingo! - As you can see above, each continent has been colored according to its data value (which falls in one of the defined ranges). Also, a legend has now appeared on the map indicating the string representation of each color range. You can customize the properties of this legend using various attributes of <map> element described in "XML Attributes" section. |
||||||||
Note: If any entity's data doesn't fall into any of the defined color range, it takes the color defined in fillColor attribute of <map> element (or it's default value if this attribute is also not defined). |
||||||||