Important version information!

You are browsing a class reference for deprecated Version 2 of the JavaScript Charts.

Documentation for other versions: amCharts 4 (current) or amCharts 3.

ValueAxis

Inheritance: ValueAxisAxisBase

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.

Properties Hide inherited

PropertyTypeDefaultDescription
autoGridCountBooleantrueSpecifies whether number of gridCount is specified automatically, acoarding to the axis size.
axisAlphaNumber1Axis opacity. Value range is 0 - 1.
axisColorString#000000Axis color.
axisThicknessNumber1Thickness of the axis.
axisTitleOffsetNumber10Radar chart only. Specifies distance from axis to the axis title (category)
baseCoordNumber Read-only. Coordinate of the base value.
baseValueNumber0Specifies base value of the axis.
colorString Color of axis value labels. Will use chart's color if not set.
dashLengthNumber0Length of a dash. 0 means line is not dashed.
durationString If your values represents time units, and you want value axis labels to be formatted as duration, you have to set the duration unit. Possible values are: "ss", "mm", "hh" and "DD".
durationUnitsObject{DD:"d. ", hh:":", mm:":",ss:""}If duration property is set, you can specify what string should be displayed next to day, hour, minute and second.
fillAlphaNumber0Fill opacity. Every second space between grid lines can be filled with color. Set fillAlpha to a value greater than 0 to see the fills.
fillColorString#FFFFFFFill color. Every second space between grid lines can be filled with color. Set fillAlpha to a value greater than 0 to see the fills.
fontSizeNumber Size of value labels text. Will use chart's fontSize if not set.
gridAlphaNumber0.2Opacity of grid lines.
gridColorString#000000Color of grid lines.
gridCountNumber5Number of grid lines. In case this is value axis, or your categoryAxis parses dates, the number is approximate. The default value is 5. If you set autoGridCount to true, this property is ignored.
gridThicknessNumber1Thickness of grid lines.
gridTypeStringpolygonsRadar chart only. Possible values are: "polygons" and "circles". Set "circles" for polar charts.
guidesArray The array of guides belonging to this axis.
ignoreAxisWidthBooleanfalseIf autoMargins of a chart is set to true, but you want this axis not to be measured when calculating margin, set ignoreAxisWidth to true.
includeGuidesInMinMaxBooleanfalseSpecifies whether guide values should be included when calculating min and max of the axis.
includeHiddenBooleanfalseIf true, the axis will include hidden graphs when calculating min and max values.
insideBooleanfalseSpecifies whether values should be placed inside or outside plot area.
integersOnlyBooleanfalseSpecifies whether values on axis can only be integers or both integers and doubles.
labelFrequencyNumber1Frequency at which labels should be placed. Doesn't work for CategoryAxis if parseDates is set to true.
labelFunctionFunctionYou can use this function to format Value axis labels. This function is called and these parameters are passed: labelFunction(value, valueText, valueAxis);
Where value is numeric value, valueText is formatted string and valueAxis is a reference to valueAxis object. Your function should return string.
labelRotationNumber0Rotation angle of a label. Only horizontal axis' values can be rotated. If you set this for vertical axis, the setting will be ignored.
labelsEnabledBooleantrueSpecifies whether axis displays category axis' labels and value axis' values.
logarithmicBooleanfalseSpecifies if this value axis' scale should be logarithmic.
maxNumber Read-only. Maximum value of the axis.
maximumNumber If you don't want max value to be calculated by the chart, set it using this property. This value might still be adjusted so that it would be possible to draw grid at rounded intervals.
minNumber Read-only. Minimum value of the axis.
minimumNumber If you don't want min value to be calculated by the chart, set it using this property. This value might still be adjusted so that it would be possible to draw grid at rounded intervals.
minMaxMultiplierNumber If set value axis scale (min and max numbers) will be multiplied by it. I.e. if set to 1.2 the scope of values will increase by 20%.
offsetNumber0The distance of the axis to the plot area, in pixels. Negative values can also be used.
positionString Possible values are: "top", "bottom", "left", "right". If axis is vertical, default position is "left". If axis is horizontal, default position is "bottom".
precisionNumber Precision (number of decimals) of values.
radarCategoriesEnabledBooleantrueRadar chart only. Specifies if categories (axes' titles) should be displayed near axes)
recalculateToPercentsBooleanfalsepecifies if graphs's values should be recalculated to percents.
reversedBooleanfalseSpecifies if value axis should be reversed (smaller values on top).
showFirstLabelBooleantrueWhether to show first axis label or not.
showLastLabelBooleantrueWhether to show last axis label or not.
stackTypeStringnoneStacking mode of the axis. Possible values are: "none", "regular", "100%", "3d".
Note, only graphs of one type will be stacked.
stepNumber Read-only. Value difference between two grid lines.
synchronizationMultiplierNumber In case you synchronize one value axis with another, you need to set the synchronization multiplier. Use synchronizeWithAxis method to set with which axis it should be synced.
tickLengthNumber5Length of the tick marks.
titleString Title of the axis.
titleBoldBooleantrueSpecifies if title should be bold or not.
titleColorString Color of axis title. Will use text color of chart if not set any.
titleFontSizeNumber Font size of axis title. Will use font size of chart plus two pixels if not set any.
totalTextString If this value axis is stacked and has columns, setting valueAxis.totalText = "[[total]]" will make it to display total value above the most-top column.
totalTextColorHex stringColor of total text.
unitString Unit which will be added to the value label.
unitPositionStringrightPosition of the unit. Possible values are "left" and "right".
usePrefixesBooleanfalseIf 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.
useScientificNotationBooleanfalseIf true, values will always be formatted using scientific notation (5e+8, 5e-8...) Otherwise only values bigger then 1e+21 and smaller then 1e-7 will be displayed in scientific notation.

Methods Hide inherited

NameParametersReturnsDescription
addGuide(guide)guide - instance of GuideAdds guide to the axis.
addListener(type, handler)type - string like 'axisChanged' (should be listed in 'events' section of this class or classes which extend this class). handler - function which is called when event happens Adds event listener to the object.
coordinateToValue(coordinate)coordinate - y or x coordinate, in pixels.Number, - value of coordinate.Returns value of the coordinate.
getCoordinate(value)value - NumberNumber - coordinateReturns coordinate of the value in pixels.
removeGuide(guide)guide - instance of GuideRemoves guide from the axis.
removeListener(obj, type, handler) Removes event listener from the object
synchronizeWithAxis(axis)axis - instance of ValueAxis. One value axis can be synchronized with another value axis. You should set synchronizationMultiplyer in order for this to work.
zoomToValues(startValue, endValue) XY Chart only. Zooms-in the axis to the provided values.

Events Hide inherited

NameEvent objectDescription
axisChanged{type:"axisChanged", chart:AmChart}Dispatched when value axis min/max values are changed.
axisZoomed{type:"axisZoomed", startValue:startValue, endValue:endValue, chart:AmChart}XY chart only. Dispatched when axis is zoomed.
logarithmicAxisFailed{type:"logarithmicAxisFailed", chart:AmChart}Dispatched when valueAxis is logarithmic and values equal or less then zero were found in data.