Discrete Values

One of the features of TreeMap is to display discrete value for example to display elements by categories. Categories can be for examples A, B, C, D or category can be years if you want to display elements by year 2007, 2008, 2009.

Discrete String Values

To display a TreeMap with discrete values the colorField property should be a string. For example the name of a category in our example it is the name of the continents. colorField="continent"

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:treemap="fr.kapit.components.treemap.*">
	
	<mx:XML id="myData">
		<world>
			<country name="Albania" code="AL" continent="Europe" region="Southern Europe" area="28750" population="3249136" population_growth="1.34" infant_mortality="49.2" gdp_total="4100" inflation="16"/>
			<country name="Greece" code="GR" continent="Europe" region="Southern Europe" area="131940" population="10538594" population_growth="0.42" infant_mortality="7.4" gdp_total="101700" inflation="8.1"/>
			<country name="Macedonia" code="MK" continent="Europe" region="Southern Europe" area="25333" population="2104035" population_growth="0.46" infant_mortality="29.7" gdp_total="1900" inflation="14.8"/>
			<country name="Serbia and Montenegro" code="YU" continent="Europe" region="Southern Europe" area="102350" population="10614558" population_growth="0.08" infant_mortality="6.03" gdp_total="20600" inflation="20"/>
			<country name="Andorra" code="AND" continent="Europe" region="Southern Europe" area="450" population="72766" population_growth="2.96" infant_mortality="2.2" gdp_total="1000" inflation="3.2"/>
			<country name="France" code="F" continent="Europe" region="Western Europe" area="547030" population="58317450" population_growth="0.34" infant_mortality="5.3" gdp_total="1173000" inflation="1.7"/>
			<country name="Pakistan" code="PK" continent="Asia" region="South-central Asia" area="803940" population="129275660" population_growth="2.24" infant_mortality="96.8" gdp_total="274200" inflation="13"/>
			<country name="Tajikistan" code="TAD" continent="Asia" region="South-central Asia" area="143100" population="5916373" population_growth="1.54" infant_mortality="113.1" gdp_total="6400" inflation="28"/>
			<country name="Turkmenistan" code="TM" continent="Asia" region="South-central Asia" area="488100" population="4149283" population_growth="1.82" infant_mortality="81.6" gdp_total="11500" inflation="25"/>
			<country name="Uzbekistan" code="UZB" continent="Asia" region="South-central Asia" area="447400" population="23418381" population_growth="1.87" infant_mortality="79.6" gdp_total="54700" inflation="7.7"/>
		</world>
	</mx:XML>
	
	<treemap:TreeMap  id="myTree" width="100%"  height="100%"
					  labelField="id" areaField="@area" colorField="@continent" 
					  filterPath="{['@continent', '@region', '@name']}"
					  dataProvider="{myData}"/>
	
</mx:Application>

Discrete Number Values

The current release of TreeMap does not handle the discrete number values. This feature will be added in a future release.