Package | ardisia.charts.treeMap |
Class | public class TreeMap |
Inheritance | TreeMap ChartBase spark.components.supportClasses.SkinnableComponent |
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
Property | Defined By | ||
---|---|---|---|
colorField : String
Field name on the data to pull the node's color. | ChartBase | ||
colorFormatFunction : 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 | ||
dataTipField : String
Field name on the data to pull the node's data tip string. | ChartBase | ||
dataTipFormatFunction : Function
User provided function that gets the message to display with the
data tip. | ChartBase | ||
dataTipHideDelay : Number = 350
Delay before the data tip is hidden. | ChartBase | ||
dataTipInstance : 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 | ||
showDataTip : 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 |
Method | Defined By | ||
---|---|---|---|
dispose():void
Call to remove this element from the display list, remove the item
renderers, and the event listeners. | TreeMap | ||
getColor(item:TreeMapData):uint
Returns the color for each node. | TreeMap | ||
hideDataTip():void
Hide the data tip. | ChartBase | ||
updateStore():void
Update the local store. | TreeMap |
Method | Defined By | ||
---|---|---|---|
buildBranchStore(branch:Object, parentNode:TreeMapData = null):Number
Add the branch to the internal dataProvider. | TreeMap | ||
commitProperties():void [override]
| TreeMap | ||
createChildren():void [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 | ||
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 |
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 | |||
Dispatched when the chart's legend should be updated. | ChartBase |
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 | ||
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 | ||
Required: false Part Type: Dynamic Container for the content added to the skin. | ChartBase |
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.
dataDescriptor | property |
dataDescriptor:ITreeDataDescriptor2
Data descriptor to use with the tree data. Defaults to the Flex SDK's DefaultDataDescriptor class.
The default value is DefaultDataDescriptor
.
public function get dataDescriptor():ITreeDataDescriptor2
public function set dataDescriptor(value:ITreeDataDescriptor2):void
dataProvider | property |
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
.
public function get dataProvider():ListCollectionView
public function set dataProvider(value:ListCollectionView):void
labelField | property |
labelField:String
Field name on the data to pull the node's label.
The default value is "label"
.
public function get labelField():String
public function set labelField(value:String):void
labelFunction | property |
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
.
public function get labelFunction():Function
public function set labelFunction(value:Function):void
nodeGap | property |
nodeGap:Number
Gap between nodes in pixels.
The default value is 1
.
public function get nodeGap():Number
public function set nodeGap(value:Number):void
showBranchHeaders | property |
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
.
public function get showBranchHeaders():Boolean
public function set showBranchHeaders(value:Boolean):void
totalWeight | property |
totalWeight:Number
[read-only] The summed weight of all nodes.
The default value is 0
.
public function get totalWeight():Number
weightField | property |
weightField:String
Field name on the data to pull the node's weight.
The default value is "weight"
.
public function get weightField():String
public function set weightField(value:String):void
weightFunction | property |
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
.
public function get weightFunction():Function
public function set weightFunction(value:Function):void
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 )
|
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 |
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
|
Object — Object
|
getLabel | () | method |
protected function getLabel(node:Object):String
Returns the label for data node.
Parameters
node:Object — the object to format
|
String — a formatted String
|
getRenderer | () | method |
protected function getRenderer(data:TreeMapData):ITreeMapItemRenderer
Get a node renderer.
Parameters
data:TreeMapData |
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
|
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 |
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
|
Number — a Number the aspect ratio
|
itemClick | Event |
ardisia.charts.treeMap.events.TreeMapEvent
ardisia.charts.treeMap.events.TreeMapEvent
Dispatched when a renderer is clicked.
itemRollOut | Event |
ardisia.charts.treeMap.events.TreeMapEvent
ardisia.charts.treeMap.events.TreeMapEvent
Dispatched when a renderer is rolled out of.
itemRollOver | Event |
ardisia.charts.treeMap.events.TreeMapEvent
ardisia.charts.treeMap.events.TreeMapEvent
Dispatched when a renderer is rolled over.