yaxis
Configuration Structure
yaxis: {}show
trueWhether to display the y-axis or not.
showAlways
falseWhether to hide y-axis when user toggles series through legend.
showForNullSeries
trueWhen turned off, it will hide the y-axis completely for a series which has no data or a series with all null values.
seriesName
undefinedIn a multiple y-axis chart, you can target the scale of a y-axis to a particular series by referencing through the seriesName. The series item which have the same name property will be used to calculate the scale of the y-axis.
Note: You can either map a single series to y-axis or multiple series to the same y-axis.
opposite
falseWhen enabled, will draw the yaxis on the right side of the chart
reversed
falseFlip the chart upside down making it inversed and draw the y-axis from bigger to smaller numbers.
logarithmic
falseA non-linear scale when there is a large range of values.
logBase
10Controls the logarithmic base. Default is 10
tickAmount
undefinedNumber of Tick Intervals to show
min
undefinedThe lowest number to be set for the y-axis. The graph drawing beyond this number will be clipped off
You can also pass a function here which should return a number. The function accepts an argument which by default is the smallest value in the y-axis. function(min) { return min }
max
undefinedThe highest number to be set for the y-axis. The graph drawing beyond this number will be clipped off.
You can also pass a function here which should return a number. The function accepts an argument which by default is the biggest value in the y-axis. function(max) { return max }
stepSize
undefinedstepSize refers to the interval between consecutive values on a y-axis. It determines how the values on the axis are spaced or displayed. If the step size is set to 10, the axis might display values like 0, 10, 20, 30, and so on.
forceNiceScale
falseIf set to true, the y-axis scales are forced to generate nice looking rounded numbers even when min/max are provided. Turn this off if you manually set min/max and want it to be unchanged.
floating
falseSetting this options takes the y-axis out of the plotting area. Much behaves like position: absolute property of CSS
decimalsInFloat
undefinedThe number of fractions to display when there are floating values in y-axis.
Note: If you have defined a custom formatter function in yaxis.labels.formatter, this won't have any effect.
show
trueShow labels on y-axis
showDuplicates
falseAllow duplicate labels on y-axis. Default is false
align
undefinedAvailable Options
- left
- center
- right
minWidth
0Minimum width for the y-axis labels
maxWidth
160Maximum width for the y-axis labels
style
colors
[]ForeColor for the y-axis label
fontSize
'11px'FontSize for the y-axis label
fontFamily
undefinedFont-family for the y-axis label.
fontWeight
400Font-weight for the y-axis label.
cssClass
''A custom Css Class to give to the label elements
offsetX
0Sets the left offset for label
offsetY
0Sets the top offset for label
rotate
0Rotate y-axis text label to a specific angle from it's center
formatter
undefinedApplies a custom function for the yaxis value.
yaxis: { labels: { /** * Allows users to apply a custom formatter function to yaxis labels. * * @param { String } value - The generated value of the y-axis tick * @param { index } index of the tick / currently executing iteration in yaxis labels array */ formatter: function(val, index) { return val.toFixed(2); } } }
Note: In horizantal bar charts, the second parameters also contains additional data like dataPointIndex & seriesIndex.
show
falseDraw a vertical border on the y-axis
color
'#e0e0e0'Color of the horizontal axis border
offsetX
0Sets the left offset of the axis border
offsetY
0Sets the top offset of the axis border
show
falseDraw ticks on the y-axis to specify intervals
borderType
Available Options
- solid
- dotted
color
'#e0e0e0'Color of the ticks
width
6Width of the ticks
offsetX
0Sets the left offset of the ticks
offsetY
0Sets the top offset of the ticks
tickAmount
undefinedNumber of Tick Intervals to show
min
undefinedLowest number to be set for the y-axis. The graph drawing beyond this number will be clipped off
max
undefinedHighest number to be set for the y-axis. The graph drawing beyond this number will be clipped off
range
range takes the max value of y-axis, subtracts the provided range value and gets the min value based on that. So, technically it helps to keep the same range when min and max values gets updated dynamically
floating
falseFloating takes y-axis is taken out of normal flow and places y-axis on svg element directly, similar to an absolutely positioned element. Set the offsetX and offsetY then to adjust the position manually
position
Setting this option allows you to change the y-axis position Available options
- bottom
- top
title
text
undefinedGive the y-axis a title which will be displayed below the axis labels by default.
rotate
-90Rotate the yaxis title either 90 or -90.
offsetX
0Sets the left offset for yaxis title.
offsetY
0Sets the top offset for the yaxis title.
style
color
undefinedForeColor of the y-axis title
fontSize
'11px'FontSize for the y-axis title
fontFamily
undefinedFontFamily for the y-axis title
fontWeight
900Font-weight for the y-axis title
cssClass
''A custom Css Class to give to the y-axis title
crosshairs
show
trueShow crosshairs on y-axis when user moves the mouse over chart area. Note: Make sure to have yaxis.tooltip.enabled: 'true' to make the crosshair visible.
position
'front'Possible Options
- back
- front
stroke
color
'#b6b6b6'Border Color of crosshairs
width
1Border Width of crosshairs
dashArray
0Creates dashes in borders of crosshairs. Higher number creates more space between dashes in the border.
tooltip
enabled
falseShow tooltip on y-axis
offsetY
Sets the top offset for y-axis tooltip