Adobe® Flex® 4 Language Reference
Show Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
mx.charts 
LinearAxis 
Packagemx.charts
Classpublic class LinearAxis
InheritanceLinearAxis Inheritance NumericAxis Inheritance AxisBase Inheritance EventDispatcher Inheritance Object

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

The LinearAxis class maps numeric values evenly between a minimum and maximum value along a chart axis. By default, it determines minimum, maximum, and interval values from the charting data to fit all of the chart elements on the screen. You can also explicitly set specific values for these properties.

The auto-determination of range values works as follows:

  1. Flex determines a minimum and maximum value that accomodates all the data being displayed in the chart.
  2. If the autoAdjust and baseAtZero properties are set to true, Flex makes the following adjustments:
    • If all values are positive, Flex sets the minimum property to zero.
    • If all values are negative, Flex sets the maximum property to zero.
  3. If the autoAdjust property is set to true, Flex adjusts values of the minimum and maximum properties by rounding them up or down.
  4. Flex checks if any of the elements displayed in the chart require extra padding to display properly (for example, for labels). It adjusts the values of the minimum and maximum properties accordingly.
  5. Flex determines if you have explicitly specified any padding around the minimum and maximum values, and adjusts their values accordingly.

MXML SyntaxexpandedHide MXML Syntax

The <mx:LinearAxis> tag inherits all the properties of its parent classes and adds the following properties:

  <mx:LinearAxis
    Properties
    interval="null"
    maximum="null"
    maximumLabelPrecision="null"
    minimum="null"
    minorInterval="null"
  />
  

View the examples

See also



Public Properties
 PropertyDefined By
 InheritedautoAdjust : Boolean
Specifies whether Flex rounds values.
NumericAxis
 InheritedbaseAtZero : Boolean
Specifies whether Flex tries to keep the minimum and maximum values rooted at zero.
NumericAxis
 Inheritedbaseline : Number
[read-only] The computed minimum value for the axis as long as this value is greater than 0.
NumericAxis
 InheritedchartDataProvider : Object
[write-only] The data provider assigned to the enclosing chart.
AxisBase
 InheritedcomputedMaximum : Number
The computed maximum value represented by this axis.
NumericAxis
 InheritedcomputedMinimum : Number
The computed minimum value represented by this axis.
NumericAxis
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheriteddirection : String
Determines the direction in which the axis is rendered.
NumericAxis
 InheriteddisplayName : String
The name of the axis.
AxisBase
  interval : Number
Specifies the numeric difference between label values along the axis.
LinearAxis
 InheritedlabelFunction : Function
Called to format axis values for display as labels.
NumericAxis
  maximum : Number
Specifies the maximum value for an axis label.
LinearAxis
  maximumLabelPrecision : Number
Specifies the maximum number of decimal places for representing fractional values on the labels generated by this axis.
LinearAxis
  minimum : Number
Specifies the minimum value for an axis label.
LinearAxis
  minorInterval : Number
Specifies the numeric difference between minor tick marks along the axis.
LinearAxis
 InheritedminorTicks : Array
[read-only] An Array of minor tick marks generated to represent this axis.
NumericAxis
 Inheritedpadding : Number
Specifies padding that Flex adds to the calculated minimum and maximum values for the axis when rendering the values on the screen.
NumericAxis
 InheritedparseFunction : Function
Specify a parseFunction to customize how the values rendered by your chart are converted into numeric values.
NumericAxis
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
 Inheritedtitle : String
The text for the title displayed along the axis.
AxisBase
 InheritedunitSize : Number
[read-only] The size of one unit of data as represented by this axis.
AxisBase
Protected Properties
 PropertyDefined By
 InheritedassignedMaximum : Number
The explicitly assigned maximum value.
NumericAxis
 InheritedassignedMinimum : Number
The explicitly assigned minimum value.
NumericAxis
 InheritedcomputedInterval : Number
The computed interval represented by this axis.
NumericAxis
 InheriteddataDescriptions : Array
[read-only] An Array of DataDescription structures describing the data being represented by the chart.
NumericAxis
 InheritedlabelCache : Array
The most recent set of AxisLabel objects generated to represent this axis.
NumericAxis
 InheritedlabelMaximum : Number
The maximum value where a label should be placed.
NumericAxis
 InheritedlabelMinimum : Number
The minimum value where a label should be placed.
NumericAxis
 InheritedminorTickCache : Array
The most recent set of minor tick marks generated to represent this axis.
NumericAxis
 InheritedrequiredDescribedFields : uint
[read-only] The fields of the DescribeData structure that this axis is interested in.
NumericAxis
 Inheritedticks : Array
[read-only] An Array of tick marks for this axis.
NumericAxis
Public Methods
 MethodDefined By
  
Constructor.
LinearAxis
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
 Inherited
Triggers events that inform the range object when the chart data has changed.
AxisBase
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
filterCache(cache:Array, field:String, filteredField:String):void
Filters a set of values of arbitrary type to a set of numbers that can be mapped.
NumericAxis
 Inherited
Formats values for display in DataTips.
NumericAxis
 Inherited
Determines the range to estimate what the axis labels should be.
NumericAxis
 Inherited
getLabels(minimumAxisLength:Number):AxisLabelSet
Gets the labels text that is rendered.
NumericAxis
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Maps a position along the axis back to a numeric data value.
NumericAxis
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
mapCache(cache:Array, field:String, convertedField:String, indexValues:Boolean = false):void
Converts a set of values of arbitrary type to a set of numbers that can be transformed into screen coordinates.
NumericAxis
 Inherited
Determines how the axis handles overlapping labels.
NumericAxis
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
reduceLabels(intervalStart:AxisLabel, intervalEnd:AxisLabel):AxisLabelSet
Invoked when an AxisRenderer is unable to cleanly render the labels without overlap, and would like the Axis object to reduce the set of labels.
NumericAxis
 Inherited
Each DataTransform that makes use of an axis registers itself with that axis.
AxisBase
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
transformCache(cache:Array, field:String, convertedField:String):void
Maps a set of values from data space to screen space.
NumericAxis
 Inherited
Each DataTransform that makes use of an axis registers itself with that axis.
AxisBase
 Inherited
Updates the chart.
NumericAxis
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Protected Methods
 MethodDefined By
 Inherited
adjustMinMax(minValue:Number, maxValue:Number):void
Adjusts the generated or assigned range of the axis's labels.
NumericAxis
 Inherited
Populates the labelCache property with labels representing the current values of the axis.
NumericAxis
 Inherited
Builds an Array of positions for the minor tick marks Array that is generated by this axis.
NumericAxis
 Inherited
describeData(requiredFields:uint):Array
Called by the governing DataTransform to obtain a description of the data represented by this IChartElement.
AxisBase
 Inherited
Protects the range against invalid values for this axis type.
NumericAxis
 Inherited
Invalidates the cached labels and tick marks that represent this axis's values.
NumericAxis
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
Property Detail

interval

property
interval:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

Specifies the numeric difference between label values along the axis. Flex calculates the interval if this property is set to NaN. The default value is NaN.



Implementation
    public function get interval():Number
    public function set interval(value:Number):void

maximum

property 
maximum:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

Specifies the maximum value for an axis label. If you set the autoAdjust property to true, Flex calculates this value. If NaN, Flex determines the maximum value from the data in the chart. The default value is NaN.



Implementation
    public function get maximum():Number
    public function set maximum(value:Number):void

maximumLabelPrecision

property 
maximumLabelPrecision:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

Specifies the maximum number of decimal places for representing fractional values on the labels generated by this axis. By default, the axis autogenerates this value from the labels themselves. A value of 0 rounds to the nearest integer value, while a value of 2 rounds to the nearest 1/100th of a value.



Implementation
    public function get maximumLabelPrecision():Number
    public function set maximumLabelPrecision(value:Number):void

minimum

property 
minimum:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

Specifies the minimum value for an axis label. If NaN, Flex determines the minimum value from the data in the chart. The default value is NaN.



Implementation
    public function get minimum():Number
    public function set minimum(value:Number):void

minorInterval

property 
minorInterval:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

Specifies the numeric difference between minor tick marks along the axis. Flex calculates the difference if this property is set to NaN.



Implementation
    public function get minorInterval():Number
    public function set minorInterval(value:Number):void
Constructor Detail

LinearAxis

()Constructor
public function LinearAxis()

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

Constructor.

HLOCChartExample.mxml
<?xml version="1.0"?>
<!-- Simple example to demonstrate the HLOCChart control. -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Script>
        <![CDATA[          
        import mx.collections.ArrayCollection;

        [Bindable]
        private var stockDataAC:ArrayCollection = new ArrayCollection( [
            { Date: "25-Jul", Open: 40.55,  High: 40.75, Low: 40.24, Close:40.31},
            { Date: "26-Jul", Open: 40.15,  High: 40.78, Low: 39.97, Close:40.34},
            { Date: "27-Jul", Open: 40.38,  High: 40.66, Low: 40, Close:40.63},
            { Date: "28-Jul", Open: 40.49,  High: 40.99, Low: 40.3, Close:40.98},
            { Date: "29-Jul", Open: 40.13,  High: 40.4, Low: 39.65, Close:39.95},
            { Date: "1-Aug", Open: 39.00,  High: 39.50, Low: 38.7, Close:38.6}, 
            { Date: "2-Aug", Open: 38.68,  High: 39.34, Low: 37.75, Close:38.84}, 
            { Date: "3-Aug", Open: 38.76,  High: 38.76, Low: 38.03, Close:38.12}, 
            { Date: "4-Aug", Open: 37.98,  High: 37.98, Low: 36.56, Close:36.69},                       
            { Date: "5-Aug", Open: 36.61,  High: 37, Low: 36.48, Close:36.86} ]); 
        ]]>
    </fx:Script>

    <fx:Declarations>
        <!-- Define custom Stroke for the wick and ticks. -->
        <mx:SolidColorStroke id="s1" color="0x000000" weight="5" joints="bevel" caps="square"/>
    </fx:Declarations>

    <mx:Panel title="HLOCChart Control Example" height="100%" width="100%">
        <mx:HLOCChart id="hlocchart" height="100%" width="100%"
            paddingRight="5" paddingLeft="5" 
            showDataTips="true" dataProvider="{stockDataAC}">
            
            <mx:verticalAxis>
                <mx:LinearAxis id="vaxis" baseAtZero="false" title="Price"/>
            </mx:verticalAxis>

            <mx:horizontalAxis>
                <mx:CategoryAxis id="haxis" categoryField="Date" title="Date"/>
            </mx:horizontalAxis>

            <mx:horizontalAxisRenderers>
                <mx:AxisRenderer axis="{haxis}" canDropLabels="true"/>
            </mx:horizontalAxisRenderers>

            <mx:series>
                <mx:HLOCSeries 
                    openField="Open" 
                    highField="High" 
                    lowField="Low" 
                    closeField="Close"
                    stroke="{s1}"
                    openTickStroke="{s1}"
                    closeTickStroke="{s1}"
                    openTickLength="7"
                    closeTickLength="7"
                />
            </mx:series>
        </mx:HLOCChart>
    </mx:Panel>
</s:Application>