Packagecom.amcharts.axes
Classpublic class ValueAxis
InheritanceValueAxis Inheritance AxisBase Inheritance mx.core.UIComponent

ValueAxis is the class which displays value axis for the chart. The chart can have any number of value axes. For Serial chart one value axis is created automatically. For XY Chart two value axes (horizontal and vertical) are created automatically.

View the examples.



Public Properties
 PropertyDefined by
  baseCoord : Number
[read-only] Returns coordinate of the base value.
ValueAxis
  baseValue : Number
Specifies base value of the axis.
ValueAxis
 Inheritedguides : Array
The array of guides belonging to this axis.
AxisBase
 InheritedignoreAxisWidth : Boolean
If autoMargins property of a chart is set to true but you don't want this axis to be measured when calculating margin width, set ignoreAxisWidth to true
AxisBase
  includeGuidesInMinMax : Boolean
Specifies whether guide values should be included when calculating min and max of the axis
ValueAxis
  includeHidden : Boolean
[write-only] If true, the axis will include hidden graphs when calculating min and max values
ValueAxis
  initialValueWhenRecalculating : Number
Initial value of selected period when values are recalculated to percents.
ValueAxis
 Inheritedinside : Boolean
Whether values should be placed inside or outside plot area.
AxisBase
  integersOnly : Boolean
Specifies whether values on axis can only be integers or both integers and doubles
ValueAxis
 InheritedlabelFunction : Function
Label function.
AxisBase
  logarithmic : Boolean
True if Value axis is logarithmic, false otherwise.
ValueAxis
  max : Number
Maximum value of the axis.
ValueAxis
 InheritedmaxLabelLength : Number
Maximum length (number of symbols) of a label.
AxisBase
 InheritedmaxLabelWidth : Number
returns max width of values
AxisBase
  min : Number
Minimum value of the axis.
ValueAxis
 Inheritedoffset : Number
The distance of the axis to the plot area, in pixels.
AxisBase
 Inheritedposition : String
Position of the axis.
AxisBase
  precision : Number
precision of values.
ValueAxis
  recalculateToPercents : Boolean
specifies if graphs's values should be recalculated to percents
ValueAxis
  reversed : Boolean
True if value axis is reversed (smaller values on top), false otherwise.
ValueAxis
  synchronizationMultiplyer : Number
Synchronization multiplyer.
ValueAxis
  synchronizeWithAxis : ValueAxis
[write-only] One value axis can be synchronized with another value axis.
ValueAxis
  stackType : String
Stacking mode of the axis.
ValueAxis
  step : Number
[read-only] Value difference between two grid lines.
ValueAxis
 Inheritedtitle : String
Axis title will be displayed next to axis.
AxisBase
 InheritedtitleAlignment : String
Alignment of axis title.
AxisBase
 InheritedtitleTextColor : Number
Text color of axis title Will use default axis color style value if not set
AxisBase
 InheritedtitleTextSize : Number
Text size of axis title
AxisBase
  unit : String
Unit which will be added to the value label
ValueAxis
  unitPosition : String
Position of the unit.
ValueAxis
  usePrefixes : Boolean
If true, prefixes will be used for big and small numbers.
ValueAxis
  useScientificNotation : Boolean
if true, values will always be formatted using scientific notation (5e8, 5e-8...) Otherwise only values bigger then 1e21 and smaller then 1e-7 will be displayed in scientific notation
ValueAxis
 InheritedvalueClickHandler : Function
Method which will be called when user clicks on the axis label
AxisBase
Public Methods
 MethodDefined by
  
Constructor.
ValueAxis
 Inherited
Adds guide to the axis
AxisBase
  
coordinateToValue(coordinate:Number):Number
Returns value of the coordinate.
ValueAxis
  
formatValue(value:Number):String
ValueAxis
  
getCoordinate(value:Number):Number
Returns coordinate of the value in pixels.
ValueAxis
 Inherited
removeGuide(guide:Guide):void
Removes guide from the axis
AxisBase
  
zoomToValues(startValue:Number, endValue:Number):void
zooms value axis from startValue to endValue (XY chart only).
ValueAxis
Events
 EventSummaryDefined by
   Dispatched when valueAxis is updated with a new data ValueAxis
 Inherited Dispatched every time when axis is rebuild.AxisBase
   Dispatched when valueAxis is zoomed (XY chart only) ValueAxis
   Dispatched when valueAxis is logarithmic and values equal or less then zero were found in data.ValueAxis
Styles
 StyleDescriptionDefined by
 Inherited Type: Boolean   CSS Inheritance: no
Specifies whether number of gridCount is specified automatically, acoarding to the axis size.
AxisBase
 Inherited Type: Number   CSS Inheritance: no
Axis opacity.
AxisBase
 Inherited Type: uint   Format: Color   CSS Inheritance: no
Axis color.
AxisBase
 Inherited Type: Number   CSS Inheritance: no
Thickness of the axis.
AxisBase
 Inherited Type: Number   CSS Inheritance: no
Specifies the distance from Radar axis end to the axis title
AxisBase
 Inherited Type: uint   Format: Color   CSS Inheritance: yes
Color of text in the component, including the component label.
AxisBase
 Inherited Type: Number   CSS Inheritance: no
length of a dash.
AxisBase
 Inherited Type: uint   Format: Color   CSS Inheritance: yes
Color of text in the component if it is disabled.
AxisBase
 Inherited Type: Number   CSS Inheritance: no
Fill opacity.
AxisBase
 Inherited Type: Number   CSS Inheritance: no
Fill color.
AxisBase
 Inherited Type: String   CSS Inheritance: yes
Sets the antiAliasType property of internal TextFields.
AxisBase
 Inherited Type: String   CSS Inheritance: yes
Name of the font to use.
AxisBase
 Inherited Type: String   CSS Inheritance: yes
Sets the gridFitType property of internal TextFields that represent text in Flex controls.
AxisBase
 Inherited Type: Number   CSS Inheritance: yes
Sets the sharpness property of internal TextFields that represent text in Flex controls.
AxisBase
 Inherited Type: Number   Format: Length   CSS Inheritance: yes
Height of the text, in pixels.
AxisBase
 Inherited Type: String   CSS Inheritance: yes
Determines whether the text is italic font.
AxisBase
 Inherited Type: Number   CSS Inheritance: yes
Sets the thickness property of internal TextFields that represent text in Flex controls.
AxisBase
 Inherited Type: String   CSS Inheritance: yes
Determines whether the text is boldface.
AxisBase
 Inherited Type: Number   CSS Inheritance: no
Opacity of grid lines.
AxisBase
 Inherited Type: uint   Format: Color   CSS Inheritance: no
Color of grid lines.
AxisBase
 Inherited Type: Number   CSS Inheritance: no
Number of grid lines.
AxisBase
 Inherited Type: Number   CSS Inheritance: no
Thickness of grid lines.
AxisBase
 Inherited Type: String   CSS Inheritance: no
Grid type, used by Radar chart only.
AxisBase
 Inherited Type: Boolean   CSS Inheritance: yes
A Boolean value that indicates whether kerning is enabled (true) or disabled (false).
AxisBase
 Inherited Type: Number   CSS Inheritance: yes
Label background opacity.
AxisBase
 Inherited Type: Number   Format: Color   CSS Inheritance: yes
Label background color.
AxisBase
 Inherited Type: Number   CSS Inheritance: no
Frequency at which labels should be placed.
AxisBase
 Inherited Type: Number   CSS Inheritance: no
Rotation angle of a label.
AxisBase
 Inherited Type: Boolean   CSS Inheritance: no
Specifies whether axis displays category axis' labels and value axis' values
AxisBase
 Inherited Type: Number   CSS Inheritance: yes
The number of additional pixels to appear between each character.
AxisBase
 Inherited Type: Boolean   CSS Inheritance: no
Specifies whether Radar chart displays categories at the end of the axis
AxisBase
 Inherited Type: Boolean   CSS Inheritance: no
Whether to show first axis label or not.
AxisBase
 Inherited Type: Boolean   CSS Inheritance: no
Whether to show last axis label or not.
AxisBase
 Inherited Type: String   CSS Inheritance: yes
Alignment of text within a container.
AxisBase
 Inherited Type: String   CSS Inheritance: yes
Determines whether the text is underlined.
AxisBase
 Inherited Type: Number   Format: Length   CSS Inheritance: yes
Offset of first line of text from the left side of the container, in pixels.
AxisBase
 Inherited Type: Number   CSS Inheritance: no
Tick length.
AxisBase
 Inherited Type: uint   Format: Color   CSS Inheritance: no
value roll over color (only works if valueClickHandler is set)
AxisBase
Property detail
baseCoordproperty
baseCoord:Number  [read-only]

Returns coordinate of the base value.

Implementation
    public function get baseCoord():Number
baseValueproperty 
baseValue:Number  [read-write]

Specifies base value of the axis.

The default value is 0.

Implementation
    public function get baseValue():Number
    public function set baseValue(value:Number):void
includeGuidesInMinMaxproperty 
includeGuidesInMinMax:Boolean  [read-write]

Specifies whether guide values should be included when calculating min and max of the axis

The default value is false.

Implementation
    public function get includeGuidesInMinMax():Boolean
    public function set includeGuidesInMinMax(value:Boolean):void
includeHiddenproperty 
includeHidden:Boolean  [write-only]

If true, the axis will include hidden graphs when calculating min and max values

The default value is false.

Implementation
    public function set includeHidden(value:Boolean):void
initialValueWhenRecalculatingproperty 
initialValueWhenRecalculating:Number  [read-write]

Initial value of selected period when values are recalculated to percents.

The default value is 0.

Implementation
    public function get initialValueWhenRecalculating():Number
    public function set initialValueWhenRecalculating(value:Number):void
integersOnlyproperty 
integersOnly:Boolean  [read-write]

Specifies whether values on axis can only be integers or both integers and doubles

The default value is false.

Implementation
    public function get integersOnly():Boolean
    public function set integersOnly(value:Boolean):void
logarithmicproperty 
logarithmic:Boolean  [read-write]

True if Value axis is logarithmic, false otherwise.

The default value is false.

Implementation
    public function get logarithmic():Boolean
    public function set logarithmic(value:Boolean):void
maxproperty 
max:Number  [read-write]

Maximum value of the axis. By default, this value is calculated automatically.

Implementation
    public function get max():Number
    public function set max(value:Number):void
minproperty 
min:Number  [read-write]

Minimum value of the axis. By default, this value is calculated automatically.

Implementation
    public function get min():Number
    public function set min(value:Number):void
precisionproperty 
precision:Number  [read-write]

precision of values.

The default value is undefined.

Implementation
    public function get precision():Number
    public function set precision(value:Number):void
recalculateToPercentsproperty 
recalculateToPercents:Boolean  [read-write]

specifies if graphs's values should be recalculated to percents

The default value is false.

Implementation
    public function get recalculateToPercents():Boolean
    public function set recalculateToPercents(value:Boolean):void
reversedproperty 
reversed:Boolean  [read-write]

True if value axis is reversed (smaller values on top), false otherwise.

The default value is false.

Implementation
    public function get reversed():Boolean
    public function set reversed(value:Boolean):void
synchronizationMultiplyerproperty 
synchronizationMultiplyer:Number  [read-write]

Synchronization multiplyer. In case you synchronize one value axis with another, you need to set the synchronization multiplyer.

The default value is NaN.

Implementation
    public function get synchronizationMultiplyer():Number
    public function set synchronizationMultiplyer(value:Number):void
synchronizeWithAxisproperty 
synchronizeWithAxis:ValueAxis  [write-only]

One value axis can be synchronized with another value axis. You should set synchronizationMultiplyer in order for this to work.

Implementation
    public function set synchronizeWithAxis(value:ValueAxis):void
stackTypeproperty 
stackType:String  [read-write]

Stacking mode of the axis. Possible values are: none, regular, 100%, 3d

The default value is none.

Implementation
    public function get stackType():String
    public function set stackType(value:String):void
stepproperty 
step:Number  [read-only]

Value difference between two grid lines.

Implementation
    public function get step():Number
unitproperty 
unit:String  [read-write]

Unit which will be added to the value label

The default value is undefined.

Implementation
    public function get unit():String
    public function set unit(value:String):void
unitPositionproperty 
unitPosition:String  [read-write]

Position of the unit. Possible values are "left" and "right".

The default value is right.

Implementation
    public function get unitPosition():String
    public function set unitPosition(value:String):void
usePrefixesproperty 
usePrefixes:Boolean  [read-write]

If true, prefixes will be used for big and small numbers. You can set arrays of prefixes directly to the chart object via prefixesOfSmallNumbers and prefixesOfBigNumbers default value is the same as chart's usePrefixes value.

Implementation
    public function get usePrefixes():Boolean
    public function set usePrefixes(value:Boolean):void
useScientificNotationproperty 
useScientificNotation:Boolean  [read-write]

if true, values will always be formatted using scientific notation (5e8, 5e-8...) Otherwise only values bigger then 1e21 and smaller then 1e-7 will be displayed in scientific notation

The default value is false.

Implementation
    public function get useScientificNotation():Boolean
    public function set useScientificNotation(value:Boolean):void
Constructor detail
ValueAxis()constructor
public function ValueAxis()

Constructor.

Method detail
coordinateToValue()method
public function coordinateToValue(coordinate:Number):Number

Returns value of the coordinate.

Parameters
coordinate:Number

Returns
Number
formatValue()method 
public function formatValue(value:Number):StringParameters
value:Number

Returns
String
getCoordinate()method 
public function getCoordinate(value:Number):Number

Returns coordinate of the value in pixels.

Parameters
value:Number

Returns
Number
zoomToValues()method 
public function zoomToValues(startValue:Number, endValue:Number):void

zooms value axis from startValue to endValue (XY chart only). startValue and endValue must be within min and max of the value axis.

Parameters
startValue:Number
 
endValue:Number
Event detail
axisChangedevent 
Event object type: com.amcharts.events.ValueAxisEvent

Dispatched when valueAxis is updated with a new data

axisZoomedevent  
Event object type: com.amcharts.events.ValueAxisEvent

Dispatched when valueAxis is zoomed (XY chart only)

logarithmicAxisFailedevent  
Event object type: com.amcharts.events.ValueAxisEvent

Dispatched when valueAxis is logarithmic and values equal or less then zero were found in data.

Examples
ChartWithMultipleValueAxes
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                xmlns:amcharts="http://www.amcharts.com/com_internal"
                layout="absolute"
                backgroundColor="#FFFFFF"
                creationComplete="{generateChartData()}"
                width="100%"
                height="100%" viewSourceURL="srcview/index.html">
    
    <mx:Script>
        <![CDATA[
            import com.amcharts.chartClasses.AmGraph;
            import mx.collections.ArrayCollection;
            
            [Bindable]private var chartData:ArrayCollection = new ArrayCollection(); 
            // generate some random data, quite different range
            private function generateChartData():void{
                var firstDate:Date = new Date();
                firstDate.setDate(firstDate.getDate() - 100);
                
                for(var i:Number = 0; i < 100; i++){
                    var newDate:Date = new Date(firstDate);
                    newDate.setDate(newDate.getDate() + i);
                    
                    var visits:Number = Math.round(Math.random() * 40) + 100;
                    var hits:Number   = Math.round(Math.random() * 80) + 500;
                    var views:Number   = Math.round(Math.random() * 6000);
                    
                    chartData.addItem({date:newDate, visits:visits, hits:hits, views:views});
                }
            }
            
            private function zoom():void{
                chart.zoomToIndexes(0,20);
            }
            
            private var _newValueAxis:ValueAxis;
            
            private function addValueAxis():void{
                
                _newValueAxis = new ValueAxis();
                _newValueAxis.offset = 50;
                _newValueAxis.setStyle("gridAlpha", 0);
                _newValueAxis.setStyle("axisColor", 0xB0DE09);
                _newValueAxis.setStyle("axisThickness", 2);
                chart.addValueAxis(_newValueAxis);
                
                var graph:AmGraph = new AmGraph();
                graph.valueField = "views";
                graph.setStyle("bullet", "triangleUp");
                graph.setStyle("hideBulletsCount", 30);
                graph.type = "smoothedLine";
                graph.valueAxis = _newValueAxis;        
                chart.addGraph(graph);                
                
                addAxis.enabled = false;
                removeAxis.enabled = true;
            }
            
            private function removeValueAxis():void{
                chart.removeValueAxis(_newValueAxis);
                addAxis.enabled = true;
                removeAxis.enabled = false;            
            }
            
        ]]>
    </mx:Script>
    
    <mx:VBox width="100%" height="100%">
        <amcharts:AmSerialChart 
            dataUpdated="{zoom()}" 
            id="chart" 
            width="100%" 
            height="100%" 
            dataProvider="{chartData}" 
            categoryField="date">
            
            <amcharts:graphs>
                <!-- In case you have more then one value axis, you should set valueAxis for the graph -->
                <amcharts:AmGraph title="Visits" valueAxis="{v1}" valueField="visits" type="smoothedLine" bullet="round" hideBulletsCount="30"/>                        
                <amcharts:AmGraph title="Visits" valueAxis="{v2}" valueField="hits" type="smoothedLine"  bullet="square" hideBulletsCount="30"/>                        
            </amcharts:graphs>
            <!-- you can have any number of value axes. If you place value axes on the same side, you can move axis by setting "offset" property -->
            <amcharts:valueAxes>
                <amcharts:ValueAxis id="v1" axisColor="#FF6600" axisThickness="2"/>                    
                <amcharts:ValueAxis id="v2" position="right" axisColor="#FCD202" gridAlpha="0" axisThickness="2"/>                    
            </amcharts:valueAxes>
            
            <amcharts:categoryAxis>
                <amcharts:CategoryAxis parseDates="true" minPeriod="DD" gridCount="13"/>
            </amcharts:categoryAxis>
            
            <amcharts:chartCursor>
                <amcharts:ChartCursor cursorPosition="mouse"/>                        
            </amcharts:chartCursor>
            <amcharts:chartScrollbar>
                <amcharts:ChartScrollbar height="15"/>                        
            </amcharts:chartScrollbar>
        </amcharts:AmSerialChart>
        <mx:HBox>
            <mx:Spacer width="35"/>
            <mx:Button id="addAxis" label="add value axis" click="{addValueAxis()}"/>
            <mx:Button enabled="false" id="removeAxis" label="remove value axis" click="{removeValueAxis()}"/>
        </mx:HBox>
        <mx:Spacer height="15"/>
    </mx:VBox>    
</mx:Application>