| Package | flare.analytics.optimization |
| Class | public class AspectRatioBanker |
| Inheritance | AspectRatioBanker Operator |
OperatorList before the AxisLayout
operator, and set the dataField property to be the
same as the axis data field that should be banked. For example, in
a time series chart with time on the x-axis, the data field for this
operator should be the same as the data field used for the y-axis.
By default this class assumes that the data field is being laid out
on the y-axis. If this is not the case (e.g., you have a vertically
oriented line chart), be sure to set the bankYAxis
property to false.
| Property | Defined by | ||
|---|---|---|---|
| banker : Function The banking function to use.
| AspectRatioBanker | ||
| bankYAxis : Boolean = true Indicates if the data field is on the y-axis (default true).
| AspectRatioBanker | ||
| dataField : String The data field of the values to bank.
| AspectRatioBanker | ||
![]() | enabled : Boolean Indicates if the operator is enabled or disabled.
| Operator | |
| maxHeight : Number = 500 The maximum height for the visualization bounds.
| AspectRatioBanker | ||
| maxWidth : Number = 500 The maximum width for the visualization bounds.
| AspectRatioBanker | ||
![]() | parameters : Object
Sets parameter values for this operator.
| Operator | |
![]() | visualization : Visualization
The visualization processed by this operator.
| Operator | |
| Method | Defined by | ||
|---|---|---|---|
|
AspectRatioBanker(dataField:String = null, bankYAxis:Boolean = true, maxWidth:Number = 500, maxHeight:Number = 500)
Creates a new AspectRatioBanker.
| AspectRatioBanker | ||
![]() |
applyParameters(op:IOperator, params:Object):void
[static]
Static method that applies parameter settings to an operator.
| Operator | |
|
averageAbsoluteAngle(a:Array):Number
[static]
Bank the average absolute orientation to 45 degrees.
| AspectRatioBanker | ||
|
medianAbsoluteSlope(a:Array):Number
[static]
Bank the median absolute slope to 45 degrees.
| AspectRatioBanker | ||
|
operate(t:Transitioner = null):void
Performs an operation over the contents of a visualization.
| AspectRatioBanker | ||
![]() |
setup():void
Setup method invoked whenever this operator's visualization
property is set.
| Operator | |
| banker | property |
public var banker:Function The banking function to use. This is a function that takes an
array of Numbers as input and returns an aspect ratio. It is
expected that this function will be one of the static functions of
this class. The default is averageAbsoluteAngle.
| bankYAxis | property |
public var bankYAxis:Boolean = trueIndicates if the data field is on the y-axis (default true).
| dataField | property |
dataField:String [read-write]The data field of the values to bank.
Implementation public function get dataField():String
public function set dataField(value:String):void
| maxHeight | property |
public var maxHeight:Number = 500The maximum height for the visualization bounds.
| maxWidth | property |
public var maxWidth:Number = 500The maximum width for the visualization bounds.
| AspectRatioBanker | () | constructor |
public function AspectRatioBanker(dataField:String = null, bankYAxis:Boolean = true, maxWidth:Number = 500, maxHeight:Number = 500)Creates a new AspectRatioBanker.
ParametersdataField:String (default = null) — the data field from which pull numeric values from
NodeSprites. These values are then used to determine the optimal
aspect ratio.
|
|
bankYAxis:Boolean (default = true) |
|
maxWidth:Number (default = 500) |
|
maxHeight:Number (default = 500) |
| averageAbsoluteAngle | () | method |
public static function averageAbsoluteAngle(a:Array):NumberBank the average absolute orientation to 45 degrees. "Slopeless" lines are culled before the banking is computed. Solved using Newton-Raphson iteration.
a = aspect ratio (as height / width)
ci = normalized slope = N abs(y_i+1 - y_i) / range(y)
x = a ci
f(a) = sum(atan(x)) / N - pi/4
f'(a) = sum(ci/(1 + x^2)) / N
Parameters
a:Array — an array of data values to be banked. It is assumed that
values on the opposite axis are evenly spaced.
|
Number — the optimized aspect ratio
|
| medianAbsoluteSlope | () | method |
public static function medianAbsoluteSlope(a:Array):NumberBank the median absolute slope to 45 degrees. "Slopeless" lines are culled before the banking is computed.
Parametersa:Array — an array of data values to be banked. It is assumed that
values on the opposite axis are evenly spaced.
|
Number — the optimized aspect ratio
|
| 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.
|