ValueAxis
Type class
Extension for ValueAxis to create an axis for AmSerialChart, AmRadarChart, AmXYChart charts, multiple can be assigned.
Gets automatically populated, one for AmSerialChart and two for AmXYChart charts, if none has been specified.
Example
```js var chart = AmCharts.makeChart("chartdiv",{ ... "valueAxes": [ { "title": "Axis title" } ] });```Sources
This information about ValueAxis is provided for reference only and is not available through exported packages and thus should not be imported or used on its own.
Inheritance
ValueAxis extends AxisBase.
ValueAxis is not extended by any other symbol.
Properties
autoWrapType
booleanDefaultfalseIf this is set to true and the label does not fit, it will be wrapped. Works only on horizontal value axes.
axisFrequencyType
numberDefault1Works with Radar chart only. If you have a big number of axes, this property will help you to show every x axis only.
axisTitleOffsetType
numberDefault10Radar chart only. Specifies distance from axis to the axis title (category)
balloonTextFunctionType
objectYou can use this function to format balloon text of the axis. This function is called and balloon text or date (if axis is date-based) is passed as an argument. It should return string which will be displayed in the balloon.
baseValueType
numberDefault0Specifies base value of the axis.
durationType
stringIf 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".
durationUnitsType
objectDefault{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.
gridTypeType
stringDefaultpolygonsRadar chart only. Possible values are: "polygons" and "circles". Set "circles" for polar charts.
idType
stringUnique id of value axis. It is not required to set it, unless you need to tell the graph which exact value axis it should use.
includeAllValuesType
booleanDefaultfalseIf you set it to true, minimum and maximum of value axis will not change while zooming/scrolling.
includeGuidesInMinMaxType
booleanDefaultfalseSpecifies whether guide values should be included when calculating min and max of the axis.
includeHiddenType
booleanDefaultfalseIf true, the axis will include hidden graphs when calculating min and max values.
integersOnlyType
booleanDefaultfalseSpecifies whether values on axis can only be integers or both integers and doubles.
labelFunctionYou 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. If axis type is "date", labelFucntion will pass different arguments:
labelFunction(valueText, date, valueAxis) Your function should return string.
logarithmicType
booleanDefaultfalseSpecifies if this value axis' scale should be logarithmic.
maximumType
numberIf 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.
maximumDateType
dateIf your value axis is date-based, you can specify maximum date of the axis. Can be set as date object, timestamp number or string if dataDateFormat is set.
minimumType
numberIf 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.
minimumDateType
dateIf your value axis is date-based, you can specify minimum date of the axis. Can be set as date object, timestamp number or string if dataDateFormat is set.
minMaxMultiplierType
numberDefault1If 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%.
minPeriodType
stringDefaultDDSpecifies the shortest period of your data. This will work only if you set the
typeof your value axis to"date".Possible period values: fff - milliseconds, ss - seconds, mm - minutes, hh - hours, DD - days, MM - months, YYYY - years.
It's also possible to supply a number for increments, i.e. "15mm" which will instruct the chart that your data is supplied in 15 minute increments.
pointPositionType
stringDefaultaxisWorks with radar charts only. If you set it to “middle”, labels and data points will be placed in the middle between axes.
positionType
stringDefaultleftPossible values are: "top", "bottom", "left", "right". If axis is vertical, default position is "left". If axis is horizontal, default position is "bottom".
precisionType
numberPrecision (number of decimals) of values.
radarCategoriesEnabledType
booleanDefaulttrueRadar chart only. Specifies if categories (axes' titles) should be displayed near axes)
recalculateToPercentsType
booleanDefaultfalseSpecifies if graphs's values should be recalculated to percents.
Note, that this setting will work only on Serial chart (and Stock), not on any other charts that are using ValueAxis, like XY chart.
reversedType
booleanDefaultfalseSpecifies if value axis should be reversed (smaller values on top).
NOTE: If axis
typeis set to "date", this setting is ignored. Date-based axis cannot be reversed.stackTypeType
stringDefaultnoneStacking mode of the axis. Possible values are: "none", "regular", "100%", "3d".
Note, only graphs of one type will be stacked.
strictMinMaxType
booleanDefaultfalseIf you set minimum and maximum for your axis, chart adjusts them so that grid would start and end on the beginning and end of plot area and grid would be at equal intervals. If you set strictMinMax to true, the chart will not adjust minimum and maximum of value axis.
synchronizationMultiplierType
numberIn 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.
synchronizeWithType
ValueAxisOne value axis can be synchronized with another value axis. You can use both reference to your axis or id of the axis here. You should set synchronizationMultiplyer in order for this to work.
totalTextType
stringIf this value axis is stacked and has columns, setting valueAxis.totalText = "
total" will make it to display total value above the most-top column.totalTextColorType
colorColor of total text.
totalTextOffsetType
numberDefault0Distance from data point to total text.
treatZeroAsType
numberDefault0This allows you to have logarithmic value axis and have zero values in the data. You must set it to >0 value in order to work.
typeType
stringDefaultnumericType of value axis. If your values in data provider are dates and you want this axis to show dates instead of numbers, set it to "date".
unitType
stringUnit which will be added to the value label.
unitPositionType
stringDefaultrightPosition of the unit. Possible values are "left" and "right".
usePrefixesType
booleanDefaultfalseIf 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.
useScientificNotationType
booleanDefaultfalseIf 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.
zeroGridAlphaType
numberOpacity of a zero grid line. By default it is equal to 2 x gridAlpha.
45 inherited items
autoGridCountType
booleanDefaulttrueInherited fromAxisBaseSpecifies whether number of gridCount is specified automatically, acoarding to the axis size.
autoRotateAngleType
numberInherited fromAxisBaseAngle of label rotation, if the number of series exceeds autoRotateCount. Works on horizontal axis only. It is not recommended to use it with charts with zoom/scroll features, as chart adjusts margin only based on initial render.
autoRotateCountType
numberInherited fromAxisBaseIf the number of category axis items will exceed the autoRotateCount, the labels will be rotated by autoRotateAngle degree. Works on horizontal axis only. Not recommended with scrollable/zoomable charts.
axisAlphaType
numberDefault1Inherited fromAxisBaseAxis opacity. Value range is 0 - 1.
axisColorType
colorDefault#000000Inherited fromAxisBaseAxis color.
axisThicknessType
numberDefault1Inherited fromAxisBaseThickness of the axis.
boldLabelsType
booleanDefaultfalseInherited fromAxisBaseSpecifies if axis labels should be bold or not.
boldPeriodBeginningType
booleanDefaulttrueInherited fromAxisBaseWhen parse dates is on for the category axis, the chart will try to highlight the beginning of the periods, like month, in bold. Set this to false to disable the functionality.
centerLabelOnFullPeriodType
booleanDefaulttrueInherited fromAxisBaseThis setting works only when parseDates is set to true and equalSpacing is set to false. In case you set it to false, labels will never be centered between grid lines.
centerLabelsType
booleanDefaultfalseInherited fromAxisBaseForce-centers labels of date-based axis (in case it's category axis, equalSpacing must be false)
centerRotatedLabelsType
booleanDefaultfalseInherited fromAxisBaseIn case you have rotated labels on horizontal axis, you can force-center them using this property.
colorType
colorInherited fromAxisBaseColor of axis value labels. Will use chart's color if not set.
dashLengthType
numberDefault0Inherited fromAxisBaseLength of a dash. 0 means line is not dashed.
dateFormatsType
object[]Default[ { "period": "fff", "format": "JJ:NN:SS" }, { "period": "ss", "format": "JJ:NN:SS" }, { "period": "mm", "format": "JJ:NN" }, { "period": "hh", "format": "JJ:NN" }, { "period": "DD", "format": "MMM DD" }, { "period": "WW", "format": "MMM DD" }, { "period": "MM", "format": "MMM" }, { "period": "YYYY", "format": "YYYY" } ]Inherited fromAxisBaseDate formats of different periods. Possible period values: fff - milliseconds, ss - seconds, mm - minutes, hh - hours, DD - days, MM - months, WW - weeks, YYYY - years. Check this page for date formatting strings.
fillAlphaType
numberDefault0Inherited fromAxisBaseFill opacity. Every second space between grid lines can be filled with color. Set fillAlpha to a value greater than 0 to see the fills.
fillColorType
colorDefault#FFFFFFInherited fromAxisBaseFill color. Every second space between grid lines can be filled with color. Set fillAlpha to a value greater than 0 to see the fills.
firstDayOfWeekType
numberDefault1Inherited fromAxisBaseSets first day of the week. 0 is Sunday, 1 is Monday, etc.
fontSizeType
numberInherited fromAxisBaseSize of value labels text. Will use chart's fontSize if not set.
gridAlphaType
numberDefault0.15Inherited fromAxisBaseOpacity of grid lines.
gridColorType
colorDefault#000000Inherited fromAxisBaseColor of grid lines.
gridCountType
numberDefault5Inherited fromAxisBaseNumber 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.
gridThicknessType
numberDefault1Inherited fromAxisBaseThickness of grid lines.
guidesType
Guide[]Default[]Inherited fromAxisBaseThe array of guides belonging to this axis.
ignoreAxisWidthType
booleanDefaultfalseInherited fromAxisBaseIf autoMargins of a chart is set to true, but you want this axis not to be measured when calculating margin, set ignoreAxisWidth to true.
insideType
booleanDefaultfalseInherited fromAxisBaseSpecifies whether values should be placed inside or outside plot area.
labelFrequencyType
numberDefault1Inherited fromAxisBaseFrequency at which labels should be placed. Doesn't work for CategoryAxis if parseDates is set to true.
labelOffsetType
numberDefault0Inherited fromAxisBaseYou can use it to adjust position of axes labels. Works both with CategoryAxis and ValueAxis.
labelRotationType
numberDefault0Inherited fromAxisBaseRotation angle of a label. Only horizontal axis' values can be rotated. If you set this for vertical axis, the setting will be ignored. Possible values from -90 to 90.
labelsEnabledType
booleanDefaulttrueInherited fromAxisBaseSpecifies whether axis displays category axis' labels and value axis' values.
listenersType
object[]Inherited fromAxisBaseYou can add listeners of events using this property. Example: listeners = [{"event":"clickItem", "method":handleEvent}];
markPeriodChangeType
booleanDefaulttrueInherited fromAxisBaseIf you set it to false, the start of longer periods won't use a different date format and won't be bold.
minHorizontalGapType
numberDefault75Inherited fromAxisBaseThis property is used when calculating grid count (when autoGridCount is true). It specifies minimum cell width required for one span between grid lines.
minorGridAlphaType
numberDefault0.07Inherited fromAxisBaseOpacity of minor grid. In order minor to be visible, you should set minorGridEnabled to true.
minorGridEnabledType
booleanDefaultfalseInherited fromAxisBaseSpecifies if minor grid should be displayed.
NOTE: If equalSpacing is set to true, this setting will be ignored.
minorTickLengthType
numberDefault0Inherited fromAxisBaseLength of minor grid tick.
minVerticalGapType
numberDefault35Inherited fromAxisBaseThis property is used when calculating grid count (when autoGridCount is true). It specifies minimum cell height required for one span between grid lines.
offsetType
numberDefault0Inherited fromAxisBaseThe distance of the axis to the plot area, in pixels. Negative values can also be used.
showFirstLabelType
booleanDefaulttrueInherited fromAxisBaseWhether to show first axis label or not. This works properly only on ValueAxis. With CategoryAxis it wont work 100%, it depends on the period, zooming, etc. There is no guaranteed way to force category axis to show or hide first label.
showLastLabelType
booleanDefaulttrueInherited fromAxisBaseWhether to show last axis label or not. This works properly only on ValueAxis. With CategoryAxis it wont work 100%, it depends on the period, zooming, etc. There is no guaranteed way to force category axis to show or hide last label.
tickLengthType
numberDefault5Inherited fromAxisBaseLength of the tick marks.
titleType
stringInherited fromAxisBaseTitle of the axis.
titleBoldType
booleanDefaulttrueInherited fromAxisBaseSpecifies if title should be bold or not.
titleColorType
colorInherited fromAxisBaseColor of axis title. Will use text color of chart if not set any.
titleFontSizeType
numberInherited fromAxisBaseFont size of axis title. Will use font size of chart plus two pixels if not set any.
titleRotationType
numberInherited fromAxisBaseRotation of axis title. Useful if you want to make vertical axis title to be shown from top to down.
Methods
addListener()Returns
Adds event listener to the object.
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
coordinateToValue()Returns
Number, - value of coordinate.Returns value of the coordinate.
coordinate - y or x coordinate, in pixels.
getCoordinate()Returns
Number - coordinateReturns coordinate of the value in pixels.
value - Number
removeListener()Returns
Removes event listener from the object
synchronizeWithAxis()Returns
One value axis can be synchronized with another value axis. You should set synchronizationMultiplyer in order for this to work.
axis - instance of ValueAxis.
zoomOut()Returns
voidZooms out the value axis to full scale.
zoomToValues()Returns
Zooms-in the axis to the provided values.
2 inherited items
Events
axisChangedParam { type:
"axisChanged", target:ValueAxis} &{type:"axisChanged", chart:AmChart}Dispatched when value axis min/max values are changed.
axisZoomedParam { type:
"axisZoomed", target:ValueAxis} &{type:"axisZoomed", startValue:startValue, endValue:endValue, chart:AmChart}Dispatched when axis is zoomed.
logarithmicAxisFailedParam { type:
"logarithmicAxisFailed", target:ValueAxis} &{type:"logarithmicAxisFailed", chart:AmChart}Dispatched when valueAxis is logarithmic and values equal or less then zero were found in data.
clickGuideParam { type:
"clickGuide", target:ValueAxis} &{type: "clickGuide", guide:Guide, chart:AmRectangularChart}Dispatched when user clicks on a guide.
clickItemParam { type:
"clickItem", target:ValueAxis} &{type: "clickItem", value:value, serialDataItem:SerialDataItem, axis:AxisBase, target:label, chart:AmRectangularChart, event:MouseEvent}Fired if user clicks on axis label.
rollOutGuideParam { type:
"rollOutGuide", target:ValueAxis} &{type: "rollOutGuide", guide:Guide, chart:AmRectangularChart}Dispatched when user rolls-out of the guide.
rollOutItemParam { type:
"rollOutItem", target:ValueAxis} &{type: "rollOutItem", value:value, serialDataItem:SerialDataItem, axis:AxisBase, target:label, chart:AmRectangularChart, event:MouseEvent}Fired if user rolls-out of the axis label.
rollOverGuideParam { type:
"rollOverGuide", target:ValueAxis} &{type: "rollOverGuide", guide:Guide, chart:AmRectangularChart}Dispatched when user rolls-over some guide.
rollOverItemParam { type:
"rollOverItem", target:ValueAxis} &{type: "rollOverItem", value:value, serialDataItem:SerialDataItem, axis:AxisBase, target:label, chart:AmRectangularChart, event:MouseEvent}Fired if user rolls-over axis label.