Packageflare.vis.operator.label
Classpublic class Labeler
InheritanceLabeler Inheritance Operator
SubclassesRadialLabeler, StackedAreaLabeler

Labeler that adds labels for items in a visualization. By default, this operator adds labels that are centered on each data sprite; this can be changed by configuring the offset and anchor settings.

Labelers support two different approaches for adding labels: CHILD mode (the default) and LAYER mode.

To access created labels after a Labeler has been run, use the props.label property of a DataSprite. To have labels stored under a different property name, set the access property of this class to the desired name.



Public Properties
 PropertyDefined by
  access : String
The name of the property in which to store created labels.
Labeler
  cacheText : Boolean
Boolean function indicating whether label text values should be cached or not.
Labeler
 Inheritedenabled : Boolean
Indicates if the operator is enabled or disabled.
Operator
  filter : Function
Boolean function indicating which items to process.
Labeler
  group : String
The name of the data group to label.
Labeler
  horizontalAnchor : int = 1
The horizontal alignment for labels.
Labeler
  labelPolicy : String
[read-only] The policy for how labels should be applied.
Labeler
  labels : Sprite
[read-only] A sprite containing the labels, if a layer policy is used.
Labeler
 Inheritedparameters : Object
Sets parameter values for this operator.
Operator
  source : String
The source property that provides the label text.
Labeler
  textFormat : TextFormat
The text format to apply to labels.
Labeler
  textFunction : Function = null
Optional function for determining label text.
Labeler
  textMode : int = 2
The text mode to use for the TextSprite labels.
Labeler
  verticalAnchor : int = 1
The vertical alignment for labels.
Labeler
 Inheritedvisualization : Visualization
The visualization processed by this operator.
Operator
  xOffset : Number = 0
The default x value for labels.
Labeler
  yOffset : Number = 0
The default y value for labels.
Labeler
Public Methods
 MethodDefined by
  
Labeler(source:* = null, group:String, format:TextFormat = null, filter:String = null, policy:*)
Creates a new Labeler.
Labeler
 Inherited
applyParameters(op:IOperator, params:Object):void
[static] Static method that applies parameter settings to an operator.
Operator
  
operate(t:Transitioner = null):void
Performs an operation over the contents of a visualization.
Labeler
  
setup():void
Setup method invoked whenever this operator's visualization property is set.
Labeler
Protected Methods
 MethodDefined by
  
getLabel(d:DataSprite, create:Boolean = false, visible:Boolean = true):TextSprite
Retrives and optionally creates a label TextSprite for the given data sprite.
Labeler
  
Computes the label text for a given sprite.
Labeler
  
Performs label creation and layout for the given data sprite.
Labeler
Public Constants
 ConstantDefined by
  CHILD : String = "child"
[static] Constant indicating that labels be added as children.
Labeler
  LAYER : String = "layer"
[static] Constant indicating that labels be placed in their own layer.
Labeler
Property detail
accessproperty
access:String  [read-write]

The name of the property in which to store created labels. The default is "props.label".

Implementation
    public function get access():String
    public function set access(value:String):void
cacheTextproperty 
cacheText:Boolean  [read-write]

Boolean function indicating whether label text values should be cached or not. If set to true then the label text is calculated only the first time it's needed and re-used from them on. If set to false then the label is recalculated at each update.

Implementation
    public function get cacheText():Boolean
    public function set cacheText(value:Boolean):void
filterproperty 
filter:Function  [read-write]

Boolean function indicating which items to process. Only items for which this function return true will be considered by the labeler. If the function is null, all items will be considered.

Implementation
    public function get filter():Function
    public function set filter(value:Function):void

See also

groupproperty 
group:String  [read-write]

The name of the data group to label.

Implementation
    public function get group():String
    public function set group(value:String):void
horizontalAnchorproperty 
public var horizontalAnchor:int = 1

The horizontal alignment for labels.

See also

labelPolicyproperty 
labelPolicy:String  [read-only]

The policy for how labels should be applied. One of LAYER (for adding a separate label layer) or CHILD (for adding labels as children of data objects).

Implementation
    public function get labelPolicy():String
labelsproperty 
labels:Sprite  [read-only]

A sprite containing the labels, if a layer policy is used.

Implementation
    public function get labels():Sprite
sourceproperty 
source:String  [read-write]

The source property that provides the label text. This property will be ignored if the textFunction property is non-null.

Implementation
    public function get source():String
    public function set source(value:String):void
textFormatproperty 
public var textFormat:TextFormat

The text format to apply to labels.

textFunctionproperty 
public var textFunction:Function = null

Optional function for determining label text.

textModeproperty 
public var textMode:int = 2

The text mode to use for the TextSprite labels.

See also

verticalAnchorproperty 
public var verticalAnchor:int = 1

The vertical alignment for labels.

See also

xOffsetproperty 
public var xOffset:Number = 0

The default x value for labels.

yOffsetproperty 
public var yOffset:Number = 0

The default y value for labels.

Constructor detail
Labeler()constructor
public function Labeler(source:* = null, group:String, format:TextFormat = null, filter:String = null, policy:*)

Creates a new Labeler.

Parameters
source:* (default = null) — the property from which to retrieve the label text. If this value is a string or property instance, the label text will be pulled directly from the named property. If this value is a Function or Expression instance, the value will be used to set the textFunction property and the label text will be determined by evaluating that function.
 
group:String — the data group to process
 
format:TextFormat (default = null) — optional text formatting information for labels
 
filter:String (default = null) — a Boolean-valued filter function determining which items will be given labels
 
policy:* — the label creation policy. One of LAYER (for adding a separate label layer) or CHILD (for adding labels as children of data objects)
Method detail
getLabel()method
protected function getLabel(d:DataSprite, create:Boolean = false, visible:Boolean = true):TextSprite

Retrives and optionally creates a label TextSprite for the given data sprite.

Parameters
d:DataSprite — the data sprite to process
 
create:Boolean (default = false) — if true, a new label will be created as needed
 
visible:Boolean (default = true) — indicates if new labels should be visible by default

Returns
TextSprite — the label
getLabelText()method 
protected function getLabelText(d:DataSprite):String

Computes the label text for a given sprite.

Parameters
d:DataSprite — the data sprite for which to produce label text

Returns
String — the label text
operate()method 
public override function operate(t:Transitioner = null):void

Performs an operation over the contents of a visualization.

Parameters
t:Transitioner (default = null) — a Transitioner instance for collecting value updates.
process()method 
protected function process(d:DataSprite):void

Performs label creation and layout for the given data sprite. Subclasses should override this method to perform custom labeling.

Parameters
d:DataSprite — the data sprite to process
setup()method 
public override function setup():void

Setup method invoked whenever this operator's visualization property is set.

Constant detail
CHILDconstant
public static const CHILD:String = "child"

Constant indicating that labels be added as children.

LAYERconstant 
public static const LAYER:String = "layer"

Constant indicating that labels be placed in their own layer.