Packageardisia.charts.sparklines
Classpublic class SparklineBase
InheritanceSparklineBase Inheritance spark.components.Group
Subclasses SparklineBar, SparklineLine

Base class for the sparkline charts.

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



Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined By
  
SparklineBase
  
Hide the data tip.
SparklineBase
Protected Methods
 MethodDefined 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
  
Processes the data provider and gets the required values necessary for display.
SparklineBase
  
setupDataTip(data:Object):void
Setup the data tip.
SparklineBase
Styles
 Style Description Defined By
  
axisAlpha
Type: Number CSS Inheritance: no
The alpha of the axis stroke. The default value is 1.
SparklineBase
  
axisColor
Type: uint Format: Color CSS Inheritance: no
The color of the axis stroke. The default value is 0.
SparklineBase
  
axisThickness
Type: Number CSS Inheritance: no
The thickness of the axis stroke. The default value is 1.
SparklineBase
  
backgroundAlpha
Type: Number CSS Inheritance: no
The alpha of the background. The default value is 1.
SparklineBase
  
backgroundColor
Type: uint Format: Color CSS Inheritance: no
The color of the background. The default value is #FFFFFF.
SparklineBase
  
firstLastColor
Type: uint Format: Color CSS Inheritance: no
The displayed color for the first and last data points. The default value is #0099FF.
SparklineBase
  
minMaxColor
Type: uint Format: Color CSS Inheritance: no
The displayed color for the maximum and minimum value data points. The default value is #DE3914.
SparklineBase
  
normalRangeAlpha
Type: Number CSS Inheritance: no
The alpha of the normal range. The default value is 0.5.
SparklineBase
  
normalRangeColor
Type: uint Format: Color CSS Inheritance: no
The color of the normal range. The default value is #EBEAEA.
SparklineBase
Property Detail
autoAxisproperty
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.


Implementation
    public function get autoAxis():Boolean
    public function set autoAxis(value:Boolean):void
autoNormalRangeproperty 
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.


Implementation
    public function get autoNormalRange():Boolean
    public function set autoNormalRange(value:Boolean):void
autoNormalRangePercentproperty 
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.


Implementation
    public function get autoNormalRangePercent():Number
    public function set autoNormalRangePercent(value:Number):void
autoRangeproperty 
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.


Implementation
    public function get autoRange():Boolean
    public function set autoRange(value:Boolean):void
axisValueproperty 
axisValue:Number

The data value at which to display the axis. Only relevant if the "autoAxis" property is false.

The default value is 0.


Implementation
    public function get axisValue():Number
    public function set axisValue(value:Number):void
dataProviderproperty 
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.


Implementation
    public function get dataProvider():IList
    public function set dataProvider(value:IList):void
dataTipDefaultPrecisionproperty 
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.

dataTipFieldproperty 
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 "".

dataTipFormatFunctionproperty 
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.

dataTipHideDelayproperty 
public var dataTipHideDelay:Number = 250

Delay before the data tip is hidden.

The default value is 250.

maxYproperty 
maxY:Number

The maximum displayed y value. Only relevant if the "autoRange" property is false.

The default value is -100.


Implementation
    public function get maxY():Number
    public function set maxY(value:Number):void
minYproperty 
minY:Number

The minimum displayed y value. Only relevant if the "autoRange" property is false.

The default value is -100.


Implementation
    public function get minY():Number
    public function set minY(value:Number):void
normalRangeMaxYproperty 
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.


Implementation
    public function get normalRangeMaxY():Number
    public function set normalRangeMaxY(value:Number):void
normalRangeMinYproperty 
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.


Implementation
    public function get normalRangeMinY():Number
    public function set normalRangeMinY(value:Number):void
showAxisproperty 
showAxis:Boolean

True to display the axis.

The default value is true.


Implementation
    public function get showAxis():Boolean
    public function set showAxis(value:Boolean):void
showDataTipproperty 
public var showDataTip:Boolean = true

True to display a data tip on hover.

The default value is true.

showNormalRangeproperty 
showNormalRange:Boolean

True to display a rectangular region used to represent the "normal value range".

The default value is true.


Implementation
    public function get showNormalRange():Boolean
    public function set showNormalRange(value:Boolean):void
yFieldproperty 
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 "".


Implementation
    public function get yField():String
    public function set yField(value:String):void
Constructor Detail
SparklineBase()Constructor
public function SparklineBase()



Method Detail
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

Returns
Object — Object
getYValue()method 
protected function getYValue(value:Object):Number

Returns the y value for display.

Parameters

value:Object — the Object

Returns
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