Handling tabulated data

CSV Files are organized in rows and columns using a CSV delimiter. A data field has a row index and column index, generally described in a String format while it can represent a Date, a Number or other content. TreeMap handles CSV parsing, reconstruction and data content interpretation via a set of options. In this part we will show how TreeMap meets the needs for CSV content visualization.

Kap Lab TreeMap provides some extra optional properties to provide an advanced CSV data input parsing. These properties and methods are following:

The following sample shows how can integrate TreeMap using the CSV data source.

CSV.txt:

name;continent;region;population;area
Albania;Europe;Southern Europe;28750;3249136
Greece;Europe;Southern Europe;131940;2104035
Macedonia;Europe;Southern Europe;25333;2104035
Serbia and Montenegro;Europe;Western Europe;102350;10614558
Andorra;Europe;Southern Europe;450;72766

Application:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:treemap="fr.kapit.components.treemap.*" creationComplete="onCreationComplete()">
	
	<mx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			
			[Embed(source="CSV.txt",mimeType="application/octet-stream")]
			private var CSV:Class;
			
			private function onCreationComplete():void
			{
				var byteArray:ByteArray = new CSV() as ByteArray;
				var content:Object=byteArray.readUTFBytes(byteArray.length);
				myTree.dataProvider = String(content);
			}
		]]>
	</mx:Script>
	
	<treemap:TreeMap  id="myTree" 
					  filterPath="{['continent', 'region', 'name']}" 
					  csvDelimiter=";"
					  labelField="id" 
					  areaField="are" 
					  colorField="population" 
					  width="100%" 
					  height="100%"/>
</mx:Application>