| Package | com.amcharts.axes |
| Class | public class ValueAxis |
| Inheritance | ValueAxis AxisBase mx.core.UIComponent |
| Property | Defined by | ||
|---|---|---|---|
| baseCoord : Number [read-only]
Returns coordinate of the base value.
| ValueAxis | ||
| baseValue : Number
Specifies base value of the axis.
| ValueAxis | ||
![]() | guides : Array
The array of guides belonging to this axis.
| AxisBase | |
![]() | ignoreAxisWidth : 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 | ||
![]() | inside : 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 | ||
![]() | labelFunction : Function
Label function.
| AxisBase | |
| logarithmic : Boolean
True if Value axis is logarithmic, false otherwise.
| ValueAxis | ||
| max : Number
Maximum value of the axis.
| ValueAxis | ||
![]() | maxLabelLength : Number
Maximum length (number of symbols) of a label.
| AxisBase | |
![]() | maxLabelWidth : Number
returns max width of values
| AxisBase | |
| min : Number
Minimum value of the axis.
| ValueAxis | ||
![]() | offset : Number
The distance of the axis to the plot area, in pixels.
| AxisBase | |
![]() | position : 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 | ||
![]() | title : String
Axis title will be displayed next to axis.
| AxisBase | |
![]() | titleAlignment : String
Alignment of axis title.
| AxisBase | |
![]() | titleTextColor : Number
Text color of axis title
Will use default axis color style value if not set
| AxisBase | |
![]() | titleTextSize : 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 | ||
![]() | valueClickHandler : Function
Method which will be called when user clicks on the axis label
| AxisBase | |
| Method | Defined by | ||
|---|---|---|---|
|
Constructor.
| ValueAxis | ||
![]() |
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 | ||
![]() |
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 | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when valueAxis is updated with a new data | ValueAxis | |||
![]() | 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 | |||
| baseCoord | property |
baseCoord:Number [read-only]Returns coordinate of the base value.
Implementation public function get baseCoord():Number
| baseValue | property |
baseValue:Number [read-write]Specifies base value of the axis.
The default value is 0.
public function get baseValue():Number
public function set baseValue(value:Number):void
| includeGuidesInMinMax | property |
includeGuidesInMinMax:Boolean [read-write]Specifies whether guide values should be included when calculating min and max of the axis
The default value is false.
public function get includeGuidesInMinMax():Boolean
public function set includeGuidesInMinMax(value:Boolean):void
| includeHidden | property |
includeHidden:Boolean [write-only]If true, the axis will include hidden graphs when calculating min and max values
The default value is false.
public function set includeHidden(value:Boolean):void
| initialValueWhenRecalculating | property |
initialValueWhenRecalculating:Number [read-write]Initial value of selected period when values are recalculated to percents.
The default value is 0.
public function get initialValueWhenRecalculating():Number
public function set initialValueWhenRecalculating(value:Number):void
| integersOnly | property |
integersOnly:Boolean [read-write]Specifies whether values on axis can only be integers or both integers and doubles
The default value is false.
public function get integersOnly():Boolean
public function set integersOnly(value:Boolean):void
| logarithmic | property |
logarithmic:Boolean [read-write]True if Value axis is logarithmic, false otherwise.
The default value is false.
public function get logarithmic():Boolean
public function set logarithmic(value:Boolean):void
| max | property |
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
| min | property |
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
| precision | property |
precision:Number [read-write]precision of values.
The default value is undefined.
public function get precision():Number
public function set precision(value:Number):void
| recalculateToPercents | property |
recalculateToPercents:Boolean [read-write]specifies if graphs's values should be recalculated to percents
The default value is false.
public function get recalculateToPercents():Boolean
public function set recalculateToPercents(value:Boolean):void
| reversed | property |
reversed:Boolean [read-write]True if value axis is reversed (smaller values on top), false otherwise.
The default value is false.
public function get reversed():Boolean
public function set reversed(value:Boolean):void
| synchronizationMultiplyer | property |
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.
public function get synchronizationMultiplyer():Number
public function set synchronizationMultiplyer(value:Number):void
| synchronizeWithAxis | property |
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
| stackType | property |
stackType:String [read-write]Stacking mode of the axis. Possible values are: none, regular, 100%, 3d
The default value is none.
public function get stackType():String
public function set stackType(value:String):void
| step | property |
step:Number [read-only]Value difference between two grid lines.
Implementation public function get step():Number
| unit | property |
unit:String [read-write]Unit which will be added to the value label
The default value is undefined.
public function get unit():String
public function set unit(value:String):void
| unitPosition | property |
unitPosition:String [read-write]Position of the unit. Possible values are "left" and "right".
The default value is right.
public function get unitPosition():String
public function set unitPosition(value:String):void
| usePrefixes | property |
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
| useScientificNotation | property |
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.
public function get useScientificNotation():Boolean
public function set useScientificNotation(value:Boolean):void
| ValueAxis | () | constructor |
public function ValueAxis()Constructor.
| coordinateToValue | () | method |
public function coordinateToValue(coordinate:Number):NumberReturns value of the coordinate.
Parameterscoordinate:Number |
Number |
| formatValue | () | method |
public function formatValue(value:Number):StringParameters
value:Number |
String |
| getCoordinate | () | method |
public function getCoordinate(value:Number):NumberReturns coordinate of the value in pixels.
Parametersvalue:Number |
Number |
| zoomToValues | () | method |
public function zoomToValues(startValue:Number, endValue:Number):voidzooms value axis from startValue to endValue (XY chart only). startValue and endValue must be within min and max of the value axis.
ParametersstartValue:Number |
|
endValue:Number |
| axisChanged | event |
com.amcharts.events.ValueAxisEvent
Dispatched when valueAxis is updated with a new data
| axisZoomed | event |
com.amcharts.events.ValueAxisEvent
Dispatched when valueAxis is zoomed (XY chart only)
| logarithmicAxisFailed | event |
com.amcharts.events.ValueAxisEvent
Dispatched when valueAxis is logarithmic and values equal or less then zero were found in data.
<?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>