| Package | flare.vis.operator.label |
| Class | public class Labeler |
| Inheritance | Labeler Operator |
| Subclasses | RadialLabeler, StackedAreaLabeler |
Labelers support two different approaches for adding labels:
CHILD mode (the default) and LAYER mode.
CHILD mode, labels are added as children of
DataSprite instances and so become part of the data
sprite itself. In this mode, labels will automatically change
position as data sprites are re-positioned.LAYER mode, labels are instead added to a separate
layer of the visualization above the
Visualization.marks layer that contains the data
sprites. A new layer will be created as needed and can be accessed
through the Visualization.labels property. This mode
is particularly useful for ensuring that no labels can be occluded
by data marks. In LAYER mode, labels will not
automatically move along with the labeled DataSprite
instances if they are re-positioned. Instead, the labeler must be
re-run to keep the layout current.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.
| Property | Defined 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 | ||
![]() | enabled : 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 | ||
![]() | parameters : 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 | ||
![]() | visualization : 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 | ||
| Method | Defined by | ||
|---|---|---|---|
|
Labeler(source:* = null, group:String, format:TextFormat = null, filter:String = null, policy:*)
Creates a new Labeler.
| Labeler | ||
![]() |
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 | ||
| Method | Defined by | ||
|---|---|---|---|
|
Retrives and optionally creates a label TextSprite for the given
data sprite.
| Labeler | ||
|
getLabelText(d:DataSprite):String
Computes the label text for a given sprite.
| Labeler | ||
|
process(d:DataSprite):void
Performs label creation and layout for the given data sprite.
| Labeler | ||
| Constant | Defined 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 | ||
| access | property |
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
| cacheText | property |
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
| filter | property |
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
| group | property |
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
| horizontalAnchor | property |
public var horizontalAnchor:int = 1The horizontal alignment for labels.
See also
| labelPolicy | property |
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
| labels | property |
labels:Sprite [read-only]A sprite containing the labels, if a layer policy is used.
Implementation public function get labels():Sprite
| source | property |
source:String [read-write] The source property that provides the label text. This
property will be ignored if the textFunction
property is non-null.
public function get source():String
public function set source(value:String):void
| textFormat | property |
public var textFormat:TextFormatThe text format to apply to labels.
| textFunction | property |
public var textFunction:Function = nullOptional function for determining label text.
| textMode | property |
public var textMode:int = 2The text mode to use for the TextSprite labels.
See also
| verticalAnchor | property |
public var verticalAnchor:int = 1The vertical alignment for labels.
See also
| xOffset | property |
public var xOffset:Number = 0 The default x value for labels.
| yOffset | property |
public var yOffset:Number = 0 The default y value for labels.
| Labeler | () | constructor |
public function Labeler(source:* = null, group:String, format:TextFormat = null, filter:String = null, policy:*)Creates a new Labeler.
Parameterssource:* (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 |
|
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)
|
| getLabel | () | method |
protected function getLabel(d:DataSprite, create:Boolean = false, visible:Boolean = true):TextSpriteRetrives and optionally creates a label TextSprite for the given data sprite.
Parametersd: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
|
TextSprite —
the label
|
| getLabelText | () | method |
protected function getLabelText(d:DataSprite):StringComputes the label text for a given sprite.
Parametersd:DataSprite — the data sprite for which to produce label text
|
String — the label text
|
| operate | () | method |
public override function operate(t:Transitioner = null):voidPerforms an operation over the contents of a visualization.
Parameterst:Transitioner (default = null) — a Transitioner instance for collecting value updates.
|
| process | () | method |
protected function process(d:DataSprite):voidPerforms label creation and layout for the given data sprite. Subclasses should override this method to perform custom labeling.
Parametersd:DataSprite — the data sprite to process
|
| setup | () | method |
public override function setup():voidSetup method invoked whenever this operator's visualization property is set.
| CHILD | constant |
public static const CHILD:String = "child"Constant indicating that labels be added as children.
| LAYER | constant |
public static const LAYER:String = "layer"Constant indicating that labels be placed in their own layer.