Package | ardisia.charts.sparklines |
Class | public class SparklineBase |
Inheritance | SparklineBase spark.components.Group |
Subclasses | SparklineBar, SparklineLine |
It is typical to display large numbers of sparklines at once. As a result, these controls are not skinned to increase performance. Visual indicators are also drawn instead of displaying UI elements to increase performance.
Sparklines display data points from the minY to the maxY values. Values that are not within the minY and maxY are not displayed. "minY" and "maxY" can be explicitly set, or will be calculated from the values in the dataProvider if the "autoRange" property is true.
The axis is a optional horizontal line to provide a visual cue as to the median value or some threshold for the data. If "autoAxis" is true, the axis will be drawn along the middle displayed value.
The normal range is an optional drawn rectangle that can be used to indicate to the viewer if a data point is within the normal range of values.
Default MXML PropertydataProvider
Property | Defined By | ||
---|---|---|---|
autoAxis : Boolean
True to automatically set the axis value to the mean of the calculated
maximum and minimum y values. | SparklineBase | ||
autoNormalRange : Boolean
If true, the normal range height and y position will be automatically
calculated and displayed in the center of the control. | SparklineBase | ||
autoNormalRangePercent : Number
If "autoNormalRange" is true, this is the percentage of the height of
the chart covered by the normal range. | SparklineBase | ||
autoRange : Boolean
If true, the minY and maxY values will be automatically calculated from
the data provider. | SparklineBase | ||
axisValue : Number
The data value at which to display the axis. | SparklineBase | ||
dataProvider : IList
The data used to populate the spark line. | SparklineBase | ||
dataTipDefaultPrecision : Number = 2
Default numerical precision for the number formatter if a
dataTipFormatFunction or dataTipField is not provided. | SparklineBase | ||
dataTipField : String
Field name on the data to pull the node's data tip string. | SparklineBase | ||
dataTipFormatFunction : Function
User provided function that gets the string to display with the data
tip. | SparklineBase | ||
dataTipHideDelay : Number = 250
Delay before the data tip is hidden. | SparklineBase | ||
maxY : Number
The maximum displayed y value. | SparklineBase | ||
minY : Number
The minimum displayed y value. | SparklineBase | ||
normalRangeMaxY : Number
If "autoNormalRange" is false, this is the maximum value contained within
the normal range. | SparklineBase | ||
normalRangeMinY : Number
If "autoNormalRange" is false, this is the minimum value contained within
the normal range. | SparklineBase | ||
showAxis : Boolean
True to display the axis. | SparklineBase | ||
showDataTip : Boolean = true
True to display a data tip on hover. | SparklineBase | ||
showNormalRange : Boolean
True to display a rectangular region used to represent the "normal value
range". | SparklineBase | ||
yField : String
Specifies the field on the objects in the dataProvider that contains
the y value, or the data value to visually represent. | SparklineBase |
Method | Defined By | ||
---|---|---|---|
SparklineBase | |||
hideDataTip():void
Hide the data tip. | SparklineBase |
Method | Defined By | ||
---|---|---|---|
collectionChangeHandler(event:CollectionEvent):void
Handles the collection events on the dataProvider. | SparklineBase | ||
drawAxis(xOffset:Number, yOffset:Number, width:Number, height:Number):void
Draws the axis line. | SparklineBase | ||
drawBackground(width:Number, height:Number):void
Draws the background and the border. | SparklineBase | ||
drawNormalRange(xOffset:Number = 0, yOffset:Number = 0, width:Number = 0, height:Number = 0):void
Draws the normal range. | SparklineBase | ||
eventHandler(event:Event):void
Handles events on the component. | SparklineBase | ||
getDataTipContent(item:Object):Object
Returns the contents for the data tip. | SparklineBase | ||
getYValue(value:Object):Number
Returns the y value for display. | SparklineBase | ||
mouseHandler(event:Event):void
Handles the mouse events used to display the data tip. | SparklineBase | ||
processDataProvider():void
Processes the data provider and gets the required values necessary for
display. | SparklineBase | ||
setupDataTip(data:Object):void
Setup the data tip. | SparklineBase |
autoAxis | property |
autoAxis:Boolean
True to automatically set the axis value to the mean of the calculated maximum and minimum y values.
If true, then the "axisValue" property is ignored.
The default value is true
.
public function get autoAxis():Boolean
public function set autoAxis(value:Boolean):void
autoNormalRange | property |
autoNormalRange:Boolean
If true, the normal range height and y position will be automatically calculated and displayed in the center of the control.
The height of the normal range will be determined by the "autoNormalRangePercent" property if this property is true.
"normalRangeMinY" and "normalRangeMaxY" are only relevant if this property is false.
This property is only relevant if "showNormalRange" is true.
The default value is true
.
public function get autoNormalRange():Boolean
public function set autoNormalRange(value:Boolean):void
autoNormalRangePercent | property |
autoNormalRangePercent:Number
If "autoNormalRange" is true, this is the percentage of the height of the chart covered by the normal range.
This property is only relevant if "showNormalRange" is true.
The default value is 0.33
.
public function get autoNormalRangePercent():Number
public function set autoNormalRangePercent(value:Number):void
autoRange | property |
autoRange:Boolean
If true, the minY and maxY values will be automatically calculated from the data provider. "minY" and "maxY" are only relevant if this property is false.
Slightly better performance if this property is "false".
The default value is true
.
public function get autoRange():Boolean
public function set autoRange(value:Boolean):void
axisValue | property |
axisValue:Number
The data value at which to display the axis. Only relevant if the "autoAxis" property is false.
The default value is 0
.
public function get axisValue():Number
public function set axisValue(value:Number):void
dataProvider | property |
dataProvider:IList
The data used to populate the spark line. Can either be (A) a list of flat numerical data, or (B) objects with the data value or "y" value defined on a property named in the "yField" property.
The default value is null
.
This property can be used as the source for data binding.
public function get dataProvider():IList
public function set dataProvider(value:IList):void
dataTipDefaultPrecision | property |
public var dataTipDefaultPrecision:Number = 2
Default numerical precision for the number formatter if a dataTipFormatFunction or dataTipField is not provided.
The default value is 2
.
dataTipField | property |
public var dataTipField:String
Field name on the data to pull the node's data tip string.
If neither this property nor "dataTipFunction" are defined, the tip will display the y value.
The default value is ""
.
dataTipFormatFunction | property |
public var dataTipFormatFunction:Function
User provided function that gets the string to display with the data tip. The function takes an object as an argument and either a TextFlow or a String for the data tip contents.
If neither this property nor "dataTipFunction" are defined, the tip will display the y value.
The function has the following signature:
funcName(value:Object):Object
The default value is null
.
dataTipHideDelay | property |
public var dataTipHideDelay:Number = 250
Delay before the data tip is hidden.
The default value is 250
.
maxY | property |
maxY:Number
The maximum displayed y value. Only relevant if the "autoRange" property is false.
The default value is -100
.
public function get maxY():Number
public function set maxY(value:Number):void
minY | property |
minY:Number
The minimum displayed y value. Only relevant if the "autoRange" property is false.
The default value is -100
.
public function get minY():Number
public function set minY(value:Number):void
normalRangeMaxY | property |
normalRangeMaxY:Number
If "autoNormalRange" is false, this is the maximum value contained within the normal range.
This property is only relevant if "showNormalRange" is true.
The default value is -50
.
public function get normalRangeMaxY():Number
public function set normalRangeMaxY(value:Number):void
normalRangeMinY | property |
normalRangeMinY:Number
If "autoNormalRange" is false, this is the minimum value contained within the normal range.
This property is only relevant if "showNormalRange" is true.
The default value is -50
.
public function get normalRangeMinY():Number
public function set normalRangeMinY(value:Number):void
showAxis | property |
showAxis:Boolean
True to display the axis.
The default value is true
.
public function get showAxis():Boolean
public function set showAxis(value:Boolean):void
showDataTip | property |
public var showDataTip:Boolean = true
True to display a data tip on hover.
The default value is true
.
showNormalRange | property |
showNormalRange:Boolean
True to display a rectangular region used to represent the "normal value range".
The default value is true
.
public function get showNormalRange():Boolean
public function set showNormalRange(value:Boolean):void
yField | property |
yField:String
Specifies the field on the objects in the dataProvider that contains the y value, or the data value to visually represent. If not set, this class will assume all data values are flat numerical data.
The default value is ""
.
public function get yField():String
public function set yField(value:String):void
SparklineBase | () | Constructor |
public function SparklineBase()
collectionChangeHandler | () | method |
protected function collectionChangeHandler(event:CollectionEvent):void
Handles the collection events on the dataProvider.
Parameters
event:CollectionEvent — The CollectionEvent that triggered the handler
|
drawAxis | () | method |
protected function drawAxis(xOffset:Number, yOffset:Number, width:Number, height:Number):void
Draws the axis line.
Parameters
xOffset:Number — the Number of pixels to offset the drawing on the x axis
| |
yOffset:Number — the Number of pixels to offset the drawing on the y axis
| |
width:Number — the width of the axis line
| |
height:Number — the height of the axis line
|
drawBackground | () | method |
protected function drawBackground(width:Number, height:Number):void
Draws the background and the border.
Parameters
width:Number — the width
| |
height:Number — the height
|
drawNormalRange | () | method |
protected function drawNormalRange(xOffset:Number = 0, yOffset:Number = 0, width:Number = 0, height:Number = 0):void
Draws the normal range.
Parameters
xOffset:Number (default = 0 ) — the Number of pixels to offset the drawing on the x axis
| |
yOffset:Number (default = 0 ) — the Number of pixels to offset the drawing on the y axis
| |
width:Number (default = 0 ) — the width of the drawing
| |
height:Number (default = 0 ) — the height of the drawing
|
eventHandler | () | method |
protected function eventHandler(event:Event):void
Handles events on the component.
Parameters
event:Event — Event
|
getDataTipContent | () | method |
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.
Returns either a TextFlow or a String.
Parameters
item:Object — the Object to format
|
Object — Object
|
getYValue | () | method |
protected function getYValue(value:Object):Number
Returns the y value for display.
Parameters
value:Object — the Object
|
Number — Number
|
hideDataTip | () | method |
public function hideDataTip():void
Hide the data tip.
mouseHandler | () | method |
protected function mouseHandler(event:Event):void
Handles the mouse events used to display the data tip. Override in sub-classes.
Parameters
event:Event — the Event that triggered the handler
|
processDataProvider | () | method |
protected function processDataProvider():void
Processes the data provider and gets the required values necessary for display.
setupDataTip | () | method |
protected function setupDataTip(data:Object):void
Setup the data tip. Must be positioned elsewhere.
Parameters
data:Object — Object the data to setup the content of the data tip
|