Packageardisia.charts.treeMap
Classpublic class TreeMap
InheritanceTreeMap Inheritance ChartBase Inheritance spark.components.supportClasses.SkinnableComponent

TreeMap chart. Uses the squarified layout scheme. See http://www.win.tue.nl/~vanwijk/stm.pdf for an explanation of how the squarified layout works.

TreeMap only accepts a dataProvider that has a single root node. Should also be of a format that is understood by the DefaultDataDescriptor class. See the Flex docs for the Tree class and the DefaultDataDescriptor.

TreeMaps can have huge numbers of renderers. To improve performance, focus on the itemRenderers. Reduce nested containers, filters, and text layout if possible.

View the technical documentation on the Ardisia Labs website for more information.

Default MXML PropertydataProvider



Public Properties
 PropertyDefined By
 InheritedcolorField : String
Field name on the data to pull the node's color.
ChartBase
 InheritedcolorFormatFunction : Function
User provided function that returns the color for the series when passed the series data object.
ChartBase
  dataDescriptor : ITreeDataDescriptor2
Data descriptor to use with the tree data.
TreeMap
  dataProvider : ListCollectionView
[override] User provided data.
TreeMap
 InheriteddataTipField : String
Field name on the data to pull the node's data tip string.
ChartBase
 InheriteddataTipFormatFunction : Function
User provided function that gets the message to display with the data tip.
ChartBase
 InheriteddataTipHideDelay : Number = 350
Delay before the data tip is hidden.
ChartBase
 InheriteddataTipInstance : IDataRenderer
Instance of the data tip.
ChartBase
  labelField : String
Field name on the data to pull the node's label.
TreeMap
  labelFunction : Function
User provided function that gets the label string for the node renderer.
TreeMap
  nodeGap : Number
Gap between nodes in pixels.
TreeMap
  showBranchHeaders : Boolean
True to display the branch header descriptive text.
TreeMap
 InheritedshowDataTip : Boolean = true
True to display a data tip on hover.
ChartBase
  totalWeight : Number
[read-only] The summed weight of all nodes.
TreeMap
  weightField : String
Field name on the data to pull the node's weight.
TreeMap
  weightFunction : Function
User provided function that returns the weight for the node object.
TreeMap
Protected Properties
 PropertyDefined By
 InheritednumberFormatter : NumberFormatter
Default number formatter.
ChartBase
Public Methods
 MethodDefined By
  
dispose():void
Call to remove this element from the display list, remove the item renderers, and the event listeners.
TreeMap
  
Returns the color for each node.
TreeMap
 Inherited
Hide the data tip.
ChartBase
  
Update the local store.
TreeMap
Protected Methods
 MethodDefined By
  
buildBranchStore(branch:Object, parentNode:TreeMapData = null):Number
Add the branch to the internal dataProvider.
TreeMap
  
[override]
TreeMap
  
[override]
TreeMap
  
eventHandler(event:Event):void
[override] Handles mouse events over the control.
TreeMap
  
getDataTipContent(item:Object):Object
[override] Returns the contents for the data tip.
TreeMap
  
getLabel(node:Object):String
Returns the label for data node.
TreeMap
  
Get a node renderer.
TreeMap
  
getWeight(node:Object):Number
Returns the weight for the node.
TreeMap
  
layoutBranch(nodes:Array, rect:Rectangle):void
Lays out the renderers for the child nodes of the passed branch.
TreeMap
  
layoutRow(nodeIndices:Array, childNodes:Array, rowWeight:Number, shorterSide:Number, totalBranchWeight:Number, rect:Rectangle, branchBounds:Rectangle):Rectangle
Lays out a row of nodes.
TreeMap
 Inherited
setupDataTip(data:Object):void
Setup the data tip.
ChartBase
  
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
[override]
TreeMap
  
worst(nodeIndices:Array, childNodes:Array, shorterSide:Number, totalBranchWeight:Number, rect:Rectangle):Number
Returns the greatest aspect ratio of the nodes in the passed row using the squarify equation.
TreeMap
Events
 Event Summary Defined By
  Dispatched when a renderer is clicked.TreeMap
  Dispatched when a renderer is rolled out of.TreeMap
  Dispatched when a renderer is rolled over.TreeMap
 InheritedDispatched when the chart's legend should be updated.ChartBase
Styles
 Style Description Defined By
  
backgroundAlpha
Type: Number CSS Inheritance: no
The alpha of the background. The default value is 1.
TreeMap
  
backgroundColor
Type: uint Format: Color CSS Inheritance: no
The color of the background. The default value is #000000.
TreeMap
Skin Parts

This component uses skins made up of skin parts. Do not set the skin parts directly. The component's skin sets the skin parts.


 Skin Part Description Defined By
  
branchRendererFactoryPart:mx.core.IFactory
Required: false Part Type: Dynamic
Factory for the tree map nodes.

The IFactory must return an object of type ITreeMapItemRenderer
TreeMap
 Inherited
dataTipFactoryPart:mx.core.IFactory
Required: false Part Type: Dynamic
Displays the data tip when a node is hovered.

The IFactory must return an object of type IDataRenderer
ChartBase
  
nodeRendererFactoryPart:mx.core.IFactory
Required: true Part Type: Dynamic
Factory for the tree map nodes.

The IFactory must return an object of type ITreeMapItemRenderer
TreeMap
 InheritedRequired: false Part Type: Dynamic
Container for the content added to the skin.
ChartBase
Skin States

To skin the component, implement a skin that defines the following states. Although you must implement all skin states, a skin state can be empty. An empty skin state specifies no changes to the default skin state.


 Skin State Description Defined By
 InheritedChartBase
 InheritedChartBase
Property Detail
dataDescriptorproperty
dataDescriptor:ITreeDataDescriptor2

Data descriptor to use with the tree data. Defaults to the Flex SDK's DefaultDataDescriptor class.

The default value is DefaultDataDescriptor.


Implementation
    public function get dataDescriptor():ITreeDataDescriptor2
    public function set dataDescriptor(value:ITreeDataDescriptor2):void
dataProviderproperty 
dataProvider:ListCollectionView[override]

User provided data. Must be an ICollection, must have a single root node, and must be understood by the Flex SDK default data descriptor.

The default data descriptor is the DefaultDataDescriptor class from the Flex SDK.

The default value is null.


Implementation
    public function get dataProvider():ListCollectionView
    public function set dataProvider(value:ListCollectionView):void
labelFieldproperty 
labelField:String

Field name on the data to pull the node's label.

The default value is "label".


Implementation
    public function get labelField():String
    public function set labelField(value:String):void
labelFunctionproperty 
labelFunction:Function

User provided function that gets the label string for the node renderer. The function takes the raw user provided node data and returns a String.

The function has the following signature:

	  funcName(value:Object):String
	  

The default value is null.


Implementation
    public function get labelFunction():Function
    public function set labelFunction(value:Function):void
nodeGapproperty 
nodeGap:Number

Gap between nodes in pixels.

The default value is 1.


Implementation
    public function get nodeGap():Number
    public function set nodeGap(value:Number):void
showBranchHeadersproperty 
showBranchHeaders:Boolean

True to display the branch header descriptive text. If true, the height of the header is determined from the measuredHeight of the treemap renderers.

The default value is true.


Implementation
    public function get showBranchHeaders():Boolean
    public function set showBranchHeaders(value:Boolean):void
totalWeightproperty 
totalWeight:Number  [read-only]

The summed weight of all nodes.

The default value is 0.


Implementation
    public function get totalWeight():Number
weightFieldproperty 
weightField:String

Field name on the data to pull the node's weight.

The default value is "weight".


Implementation
    public function get weightField():String
    public function set weightField(value:String):void
weightFunctionproperty 
weightFunction:Function

User provided function that returns the weight for the node object. The function takes the raw user provided node data as an argument and returns a weight expressed as a number.

The function has the following signature:

	  funcName(value:Object):Number
	  

The default value is null.


Implementation
    public function get weightFunction():Function
    public function set weightFunction(value:Function):void
Method Detail
buildBranchStore()method
protected function buildBranchStore(branch:Object, parentNode:TreeMapData = null):Number

Add the branch to the internal dataProvider. Called recursively.

Parameters

branch:Object
 
parentNode:TreeMapData (default = null)

Returns
Number — int the calculated weight of all children in the branch
commitProperties()method 
override protected function commitProperties():void

createChildren()method 
override protected function createChildren():void

dispose()method 
public function dispose():void

Call to remove this element from the display list, remove the item renderers, and the event listeners.

eventHandler()method 
override protected function eventHandler(event:Event):void

Handles mouse events over the control. Better performance to add only a few listeners to this class and search for what nodes are hovered instead of adding listeners to each node.

Parameters

event:Event — the Event that triggered the handler.

getColor()method 
public function getColor(item:TreeMapData):uint

Returns the color for each node. First applies the color via the colorFormatFunction, next uses an optional colorField, and finally uses a default coloring scheme.

The function has the following signature:

	  funcName(value:TreeMapData):uint
	  

Parameters

item:TreeMapData

Returns
uint
getDataTipContent()method 
override protected function getDataTipContent(item:Object):Object

Returns the contents for the data tip. Uses the "dataTipField" first, then the "dataTipFormatFunction" function, then the class default.

Can return a TextFlow or a String.

Parameters

item:Object — Object

Returns
Object — Object
getLabel()method 
protected function getLabel(node:Object):String

Returns the label for data node.

Parameters

node:Object — the object to format

Returns
String — a formatted String
getRenderer()method 
protected function getRenderer(data:TreeMapData):ITreeMapItemRenderer

Get a node renderer.

Parameters

data:TreeMapData

Returns
ITreeMapItemRenderer — ITreeMapItemRenderer
getWeight()method 
protected function getWeight(node:Object):Number

Returns the weight for the node. Will use the weightFunction is available.

Parameters

node:Object — the Object to return the weight for

Returns
Number — the weight
layoutBranch()method 
protected function layoutBranch(nodes:Array, rect:Rectangle):void

Lays out the renderers for the child nodes of the passed branch.

Parameters

nodes:Array — the Array of nodes to layout
 
rect:Rectangle — the Rectangle of the layout region

layoutRow()method 
protected function layoutRow(nodeIndices:Array, childNodes:Array, rowWeight:Number, shorterSide:Number, totalBranchWeight:Number, rect:Rectangle, branchBounds:Rectangle):Rectangle

Lays out a row of nodes. Assumes a renderer exists for each node.

Parameters

nodeIndices:Array — the indices of the nodes in row
 
childNodes:Array — the TreeMapData nodes
 
rowWeight:Number — the dimension of the shortest side
 
shorterSide:Number — the total weight of the branch
 
totalBranchWeight:Number — the Rectangle of the branch bounds
 
rect:Rectangle — height of branch header nodes
 
branchBounds:Rectangle

Returns
Rectangle — Rectangle updated branch dimensions
updateDisplayList()method 
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void

Parameters

unscaledWidth:Number
 
unscaledHeight:Number

updateStore()method 
public function updateStore():void

Update the local store.

worst()method 
protected function worst(nodeIndices:Array, childNodes:Array, shorterSide:Number, totalBranchWeight:Number, rect:Rectangle):Number

Returns the greatest aspect ratio of the nodes in the passed row using the squarify equation.

Parameters

nodeIndices:Array — the indices of the nodes in row
 
childNodes:Array — the TreeMapData nodes
 
shorterSide:Number — the dimension of the shortest side
 
totalBranchWeight:Number — the Rectangle of the branch's bounds
 
rect:Rectangle — the total weight of the branch

Returns
Number — a Number the aspect ratio
Event Detail
itemClick Event
Event Object Type: ardisia.charts.treeMap.events.TreeMapEvent
TreeMapEvent.type property = ardisia.charts.treeMap.events.TreeMapEvent

Dispatched when a renderer is clicked.

itemRollOut Event  
Event Object Type: ardisia.charts.treeMap.events.TreeMapEvent
TreeMapEvent.type property = ardisia.charts.treeMap.events.TreeMapEvent

Dispatched when a renderer is rolled out of.

itemRollOver Event  
Event Object Type: ardisia.charts.treeMap.events.TreeMapEvent
TreeMapEvent.type property = ardisia.charts.treeMap.events.TreeMapEvent

Dispatched when a renderer is rolled over.