TreeMap Legend

To make it easier to read the value of colors on TreeMap the user can instantiate a TreeMapLegend. The shape of the legend depends on values displayed by TreeMap (Discrete value or Continuous values). The legend gives the user the possibility to filter values. In case of continuous values two sliders will be added to the legend and in case of discrete value the filter is done by clicking on color of the legend.

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:treemap="fr.kapit.components.treemap.*">
	<mx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			
			[Bindable]
			private var myDataProvider:ArrayCollection = new ArrayCollection([ 
				{itemLabel:"Item 1", itemArea:500, itemColor:203, itemTooltip:"Tooltip 1"},  
				{itemLabel:"Item 2", itemArea:400, itemColor:382, itemTooltip:"Tooltip 2"},  
				{itemLabel:"Item 3", itemArea:100, itemColor:560, itemTooltip:"Tooltip 3"}, 
			]); 
			
		]]>
	</mx:Script>
	<treemap:TreeMap id="myTreeMap"
					 dataProvider="{myDataProvider}" 
					 labelField="itemLabel"
					 areaField="itemArea" 
					 colorField="itemColor" 
					 toolTipField="itemTooltip"
					 width="100%" height="80%"/>
	
	<treemap:TreeMapLegend treeMap="{myTreeMap}" width="100%" height="20%"/>
</mx:Application>