| Package | flare.vis.axis |
| Class | public class Axis |
| Inheritance | Axis flash.display.Sprite |
| Implements | IScaleMap |
Axis labels can be configured both in terms of text formatting,
orientation, and position. Use the labelOffsetX or
labelOffsetY property to adjust label positioning. For
example, labelOffsetX = -10; places the anchor point for
the label ten pixels to the left of the data bounds, whereas
labelOffsetX = 10; will place the point 10 pixels to the
right of the data bounds. One could simultaneously adjust the
horizontalAnchor property to align the labels as desired.
Similarly, axis gridlines can also be configured. The
lineCapX1, lineCapX2, lineCapY1,
and lineCapY2 properties determine by how much the
grid lines should exceed the data bounds. For example,
lineCapX1 = 5 causes the grid line to extend an extra
5 pixels to the left. Each of these values should be greater than or
equal to zero.
| Property | Defined by | ||
|---|---|---|---|
| axisScale : Scale
The Scale used to map values to this axis.
| Axis | ||
| fixLabelOverlap : Boolean = true Flag indicating if labels should be removed in case of overlap.
| Axis | ||
| gridLines : Sprite [read-only] Sprite containing the axis grid lines.
| Axis | ||
| horizontalAnchor : int The horizontal anchor point for axis labels.
| Axis | ||
| labelAngle : Number The angle (orientation) of axis label text.
| Axis | ||
| labelColor : uint The color of axis label text.
| Axis | ||
| labelFormat : String String formatting pattern used for axis labels, overwrites any
formatting pattern used by the
axisScale. | Axis | ||
| labelOffsetX : Number = 0 X-dimension offset value for axis labels.
| Axis | ||
| labelOffsetY : Number = 0 Y-dimension offset value for axis labels.
| Axis | ||
| labels : Sprite [read-only] Sprite containing the axis labels.
| Axis | ||
| labelTextFormat : TextFormat TextFormat (font, size, style) for axis label text.
| Axis | ||
| labelTextMode : int The text rendering mode to use for label TextSprites.
| Axis | ||
| lineCapX1 : Number = 0 X offset for axis gridlines at the lower end of the axis.
| Axis | ||
| lineCapX2 : Number = 0 X offset for axis gridlines at the upper end of the axis.
| Axis | ||
| lineCapY1 : Number = 0 Y offset for axis gridlines at the lower end of the axis.
| Axis | ||
| lineCapY2 : Number = 0 Y offset for axis gridlines at the upper end of the axis.
| Axis | ||
| lineColor : uint The line color of axis grid lines.
| Axis | ||
| lineLengthX : Number = 0 X length of axis gridlines.
| Axis | ||
| lineLengthY : Number = 0 Y length of axis gridlines.
| Axis | ||
| lineWidth : Number The line width of axis grid lines.
| Axis | ||
| numLabels : int The number of labels and gridlines to generate by default.
| Axis | ||
| originX : Number [read-only] The x-coordinate of the axis origin.
| Axis | ||
| originY : Number [read-only] The y-coordinate of the axis origin.
| Axis | ||
| showLabels : Boolean = true Flag indicating if axis labels should be shown.
| Axis | ||
| showLines : Boolean = true Flag indicating if axis grid lines should be shown.
| Axis | ||
| verticalAnchor : int The vertical anchor point for axis labels.
| Axis | ||
| x1 : Number
Returns the x-coordinate corresponding to the lower end of the scale.
| Axis | ||
| x2 : Number
Returns the x-coordinate corresponding to the upper end of the scale.
| Axis | ||
| y1 : Number
Returns the y-coordinate corresponding to the lower end of the scale.
| Axis | ||
| y2 : Number
Returns the y-coordinate corresponding to the upper end of the scale.
| Axis | ||
| Method | Defined by | ||
|---|---|---|---|
|
Creates a new Axis.
| Axis | ||
|
clearPreviousScale():void
Clears the previous axis scale used, if cached.
| Axis | ||
|
offsetX(value:Object):Number
Returns the horizontal offset along the axis for the input value.
| Axis | ||
|
offsetY(value:Object):Number
Returns the vertical offset along the axis for the input value.
| Axis | ||
|
Updates this axis, performing filtering and layout as needed.
| Axis | ||
|
value(x:Number, y:Number, stayInBounds:Boolean = true):Object
Returns the scale value corresponding to a given coordinate.
| Axis | ||
|
X(value:Object):Number
Returns the x-coordinate corresponding to the given scale value
| Axis | ||
|
Y(value:Object):Number
Returns the y-coordinate corresponding to the given scale value
| Axis | ||
| Method | Defined by | ||
|---|---|---|---|
|
createGridLine(val:Object):AxisGridLine
Creates a new axis grid line.
| Axis | ||
|
createLabel(val:Object):AxisLabel
Creates a new axis label.
| Axis | ||
|
filter(trans:Transitioner):void
Performs filtering, determining which axis labels and grid lines
should be visible.
| Axis | ||
|
findGridLine(val:Object, len:uint):int
Returns the index of a grid lines in the line's container sprite
for a given data value.
| Axis | ||
|
findLabel(val:Object, len:uint):int
Returns the index of a label in the label's container sprite for a
given data value.
| Axis | ||
|
fixOverlap(trans:Transitioner):void
Eliminates overlap between labels along an axis.
| Axis | ||
|
initializeChildren():void
Initializes the child container sprites for labels and grid lines.
| Axis | ||
|
layout(trans:Transitioner):void
Performs layout, setting the position of labels and grid lines.
| Axis | ||
|
markRemovals(trans:Transitioner, keep:Array, con:Sprite):void
Marks all items slated for removal from this axis.
| Axis | ||
|
Computes the position of an axis grid line.
| Axis | ||
|
Computes the position of an axis label.
| Axis | ||
|
updateGridLine(gline:AxisGridLine):void
Updates an axis grid line's settings
| Axis | ||
|
updateGridLines():void
Updates all grid lines.
| Axis | ||
|
updateLabel(label:AxisLabel):void
Updates an axis label's settings
| Axis | ||
|
updateLabels():void
Updates all axis labels.
| Axis | ||
| axisScale | property |
public var axisScale:ScaleThe Scale used to map values to this axis.
| fixLabelOverlap | property |
public var fixLabelOverlap:Boolean = trueFlag indicating if labels should be removed in case of overlap.
| gridLines | property |
gridLines:Sprite [read-only]Sprite containing the axis grid lines.
Implementation public function get gridLines():Sprite
| horizontalAnchor | property |
horizontalAnchor:int [read-write]The horizontal anchor point for axis labels.
Implementation public function get horizontalAnchor():int
public function set horizontalAnchor(value:int):void
See also
| labelAngle | property |
labelAngle:Number [read-write]The angle (orientation) of axis label text.
Implementation public function get labelAngle():Number
public function set labelAngle(value:Number):void
| labelColor | property |
labelColor:uint [read-write]The color of axis label text.
Implementation public function get labelColor():uint
public function set labelColor(value:uint):void
| labelFormat | property |
labelFormat:String [read-write] String formatting pattern used for axis labels, overwrites any
formatting pattern used by the axisScale. If null,
the formatting pattern for the axisScale is used.
public function get labelFormat():String
public function set labelFormat(value:String):void
| labelOffsetX | property |
public var labelOffsetX:Number = 0X-dimension offset value for axis labels. If negative or zero, this value indicates how much to offset to the left of the data bounds. If positive, the offset is made to the right of the data bounds.
| labelOffsetY | property |
public var labelOffsetY:Number = 0Y-dimension offset value for axis labels. If negative or zero, this value indicates how much to offset above the data bounds. If positive, the offset is made beneath the data bounds.
| labels | property |
labels:Sprite [read-only]Sprite containing the axis labels.
Implementation public function get labels():Sprite
| labelTextFormat | property |
labelTextFormat:TextFormat [read-write]TextFormat (font, size, style) for axis label text.
Implementation public function get labelTextFormat():TextFormat
public function set labelTextFormat(value:TextFormat):void
| labelTextMode | property |
labelTextMode:int [read-write]The text rendering mode to use for label TextSprites.
Implementation public function get labelTextMode():int
public function set labelTextMode(value:int):void
See also
| lineCapX1 | property |
public var lineCapX1:Number = 0X offset for axis gridlines at the lower end of the axis.
| lineCapX2 | property |
public var lineCapX2:Number = 0X offset for axis gridlines at the upper end of the axis.
| lineCapY1 | property |
public var lineCapY1:Number = 0Y offset for axis gridlines at the lower end of the axis.
| lineCapY2 | property |
public var lineCapY2:Number = 0Y offset for axis gridlines at the upper end of the axis.
| lineColor | property |
lineColor:uint [read-write]The line color of axis grid lines.
Implementation public function get lineColor():uint
public function set lineColor(value:uint):void
| lineLengthX | property |
public var lineLengthX:Number = 0X length of axis gridlines.
| lineLengthY | property |
public var lineLengthY:Number = 0Y length of axis gridlines.
| lineWidth | property |
lineWidth:Number [read-write]The line width of axis grid lines.
Implementation public function get lineWidth():Number
public function set lineWidth(value:Number):void
| numLabels | property |
numLabels:int [read-write]The number of labels and gridlines to generate by default. If this number is zero or less (default -1), the number of labels will be automatically determined from the current scale and size.
Implementation public function get numLabels():int
public function set numLabels(value:int):void
| originX | property |
originX:Number [read-only]The x-coordinate of the axis origin.
Implementation public function get originX():Number
| originY | property |
originY:Number [read-only]The y-coordinate of the axis origin.
Implementation public function get originY():Number
| showLabels | property |
public var showLabels:Boolean = trueFlag indicating if axis labels should be shown.
| showLines | property |
public var showLines:Boolean = trueFlag indicating if axis grid lines should be shown.
| verticalAnchor | property |
verticalAnchor:int [read-write]The vertical anchor point for axis labels.
Implementation public function get verticalAnchor():int
public function set verticalAnchor(value:int):void
See also
| x1 | property |
x1:Number [read-write]Returns the x-coordinate corresponding to the lower end of the scale.
Implementation public function get x1():Number
public function set x1(value:Number):void
| x2 | property |
x2:Number [read-write]Returns the x-coordinate corresponding to the upper end of the scale.
Implementation public function get x2():Number
public function set x2(value:Number):void
| y1 | property |
y1:Number [read-write]Returns the y-coordinate corresponding to the lower end of the scale.
Implementation public function get y1():Number
public function set y1(value:Number):void
| y2 | property |
y2:Number [read-write]Returns the y-coordinate corresponding to the upper end of the scale.
Implementation public function get y2():Number
public function set y2(value:Number):void
| Axis | () | constructor |
public function Axis(axisScale:Scale = null)Creates a new Axis.
ParametersaxisScale:Scale (default = null) — the axis scale to use. If null, a linear scale
is assumed.
|
| clearPreviousScale | () | method |
public function clearPreviousScale():voidClears the previous axis scale used, if cached.
| createGridLine | () | method |
protected function createGridLine(val:Object):AxisGridLineCreates a new axis grid line.
Parametersval:Object — the value to create the grid lines for
|
AxisGridLine —
an AxisGridLine
|
| createLabel | () | method |
protected function createLabel(val:Object):AxisLabelCreates a new axis label.
Parametersval:Object — the value to create the label for
|
AxisLabel —
an AxisLabel
|
| filter | () | method |
protected function filter(trans:Transitioner):voidPerforms filtering, determining which axis labels and grid lines should be visible.
Parameterstrans:Transitioner — a Transitioner for collecting value updates.
|
| findGridLine | () | method |
protected function findGridLine(val:Object, len:uint):intReturns the index of a grid lines in the line's container sprite for a given data value.
Parametersval:Object — the data value to find
|
|
len:uint — the number of grid lines to check
|
int — the index of a grid line with matching value, or -1 if no
grid line was found
|
| findLabel | () | method |
protected function findLabel(val:Object, len:uint):intReturns the index of a label in the label's container sprite for a given data value.
Parametersval:Object — the data value to find
|
|
len:uint — the number of labels to check
|
int — the index of a label with matching value, or -1 if no label
was found
|
| fixOverlap | () | method |
protected function fixOverlap(trans:Transitioner):voidEliminates overlap between labels along an axis.
Parameterstrans:Transitioner — a transitioner, potentially storing label positions
|
| initializeChildren | () | method |
protected function initializeChildren():voidInitializes the child container sprites for labels and grid lines.
| layout | () | method |
protected function layout(trans:Transitioner):voidPerforms layout, setting the position of labels and grid lines.
Parameterstrans:Transitioner — a Transitioner for collecting value updates.
|
| markRemovals | () | method |
protected function markRemovals(trans:Transitioner, keep:Array, con:Sprite):voidMarks all items slated for removal from this axis.
Parameterstrans:Transitioner — a Transitioner for collecting value updates.
|
|
keep:Array — a Boolean array indicating which items to keep
|
|
con:Sprite — a container Sprite whose contents should be marked
for removal
|
| offsetX | () | method |
public function offsetX(value:Object):NumberReturns the horizontal offset along the axis for the input value.
Parametersvalue:Object — an input data value
|
Number — the horizontal offset along the axis corresponding to the
input value. This is the x-position minus x1.
|
| offsetY | () | method |
public function offsetY(value:Object):NumberReturns the vertical offset along the axis for the input value.
Parametersvalue:Object — an input data value
|
Number — the vertical offset along the axis corresponding to the
input value. This is the y-position minus y1.
|
| positionGridLine | () | method |
protected function positionGridLine(gline:AxisGridLine, scale:Scale):PointComputes the position of an axis grid line.
Parametersgline:AxisGridLine — the axis grid line to layout
|
|
scale:Scale — the scale used to map values to the axis
|
Point — a Point with x,y coordinates for the axis grid line
|
| positionLabel | () | method |
protected function positionLabel(label:AxisLabel, scale:Scale):PointComputes the position of an axis label.
Parameterslabel:AxisLabel — the axis label to layout
|
|
scale:Scale — the scale used to map values to the axis
|
Point — a Point with x,y coordinates for the axis label
|
| update | () | method |
public function update(trans:Transitioner):TransitionerUpdates this axis, performing filtering and layout as needed.
Parameterstrans:Transitioner — a Transitioner for collecting value updates
|
Transitioner —
the input transitioner.
|
| updateGridLine | () | method |
protected function updateGridLine(gline:AxisGridLine):voidUpdates an axis grid line's settings
Parametersgline:AxisGridLine — the grid line to update
|
| updateGridLines | () | method |
protected function updateGridLines():voidUpdates all grid lines.
| updateLabel | () | method |
protected function updateLabel(label:AxisLabel):voidUpdates an axis label's settings
Parameterslabel:AxisLabel — the label to update
|
| updateLabels | () | method |
protected function updateLabels():voidUpdates all axis labels.
| value | () | method |
public function value(x:Number, y:Number, stayInBounds:Boolean = true):ObjectReturns the scale value corresponding to a given coordinate.
Parametersx:Number — the x-coordinate
|
|
y:Number — the y-coordinate
|
|
stayInBounds:Boolean (default = true) — if true, x,y values outside the current layout
bounds will be snapped to the bounds. If false, the value lookup
will attempt to extrapolate beyond the scale bounds. This value
is true be default.
|
Object — the scale value corresponding to the given coordinate.
|
| X | () | method |
public function X(value:Object):NumberReturns the x-coordinate corresponding to the given scale value
Parametersvalue:Object — the scale value to lookup
|
Number — the x-coordinate at which that scale value is placed
|
| Y | () | method |
public function Y(value:Object):NumberReturns the y-coordinate corresponding to the given scale value
Parametersvalue:Object — the scale value to lookup
|
Number — the y-coordinate at which that scale value is placed
|