Axis
23 Sep 202511 minutes to read
The Axis class configures the axes in the chart. It provides various properties to customize the appearance and behavior of chart axes, including settings for labels, grid lines, ticks, and more.
Properties
border LabelBorderModel
Configures the appearance of the border around multi-level labels, including the color, width, and type of the border.
coefficient number
The coefficient value adjusts the size of the polar radar chart’s radius. A higher value increases the radius size, while a smaller value decreases it.
Defaults to 100
columnIndex number
Specifies the index of the column where the axis is associated when the chart area is divided into multiple plot areas using columns.
<div id='Chart'></div>let chart: Chart = new Chart({
...
columns: [{ width: '50%' },
{ width: '50%' }],
axes: [{
name: 'xAxis 1',
columnIndex: 1
}],
...
});
chart.appendTo('#Chart');Defaults to 0
crossesAt Object
Specifies the value at which the axis line intersects with the vertical axis or vice versa.
Defaults to null
crossesInAxis string
Specifies the name of the axis with which the axis line should intersect.
Defaults to null
crosshairTooltip CrosshairTooltipModel
Options to customize the appearance and behavior of the crosshair tooltip that appears when hovering over the chart.
description string
A description for the axis that provides additional information about its content for screen readers.
Defaults to null
desiredIntervals number
The desiredIntervals property allows the axis to calculate intervals that are roughly equal to the specified number, promoting a more readable and evenly spaced axis.
Defaults to null
edgeLabelPlacement EdgeLabelPlacement
The edgeLabelPlacement property ensures that labels positioned at the edges of the axis do not overlap with the axis boundaries or other chart elements, offering several options to improve chart readability by managing edge labels effectively.
Available options are:
- None: No action will be performed on edge labels.
- Hide: Edge labels will be hidden to prevent overlap.
- Shift: Edge labels will be shifted to fit within the axis bounds without overlapping.
Defaults to ‘Shift’
enableAutoIntervalOnZooming boolean
If set to true, the axis interval will be calculated automatically based on the zoomed range.
Defaults to true
enableScrollbarOnZooming boolean
If set to true, a scrollbar will appear while zooming to help navigate through the zoomed content.
Defaults to true
enableTrim boolean
If set to true, axis labels will be trimmed based on the maximumLabelWidth.
Defaults to false
enableWrap boolean
Specifies whether the axis labels should be wrapped based on the specified maximumLabelWidth.
When set to true, the axis labels will automatically wrap to fit within the available width defined by maximumLabelWidth.
Defaults to false
interval number
Specifies the interval for the axis.
Defaults to null
intervalType IntervalType
The intervalType property defines how the intervals on a date-time axis are calculated and displayed.
Available options are:
- Auto: Automatically determines the interval type based on the data and chart settings.
- Years: Sets the interval of the axis in years.
- Months: Sets the interval of the axis in months.
- Days: Sets the interval of the axis in days.
- Hours: Sets the interval of the axis in hours.
- Minutes: Sets the interval of the axis in minutes.
Defaults to ‘Auto’
isIndexed boolean
If set to true, data points are rendered based on their index.
Defaults to false
isInversed boolean
If set to true, the axis will be rendered in an inversed manner.
Defaults to false
labelFormat string
Used to format the axis label. This property accepts global string formats such as C, n1, P, etc.
It also accepts placeholders like {value}°C, where {value} represents the axis label (e.g., 20°C).
Defaults to ’’
labelIntersectAction LabelIntersectAction
Specifies the action to take when axis labels intersect with each other.
The available options are:
- None: Shows all labels without any modification.
- Hide: Hides the label if it intersects with another label.
- Trim: Trims the label text to fit within the available space.
- Wrap: Wraps the label text to fit within the available space.
- MultipleRows: Displays the label text in multiple rows to avoid intersection.
- Rotate45: Rotates the label text by 45 degrees to avoid intersection.
- Rotate90: Rotates the label text by 90 degrees to avoid intersection.
Defaults to Trim
labelPadding number
The labelPadding property adjusts the distance to ensure a clear space between the axis labels and the axis line.
Defaults to 5
labelPlacement LabelPlacement
The labelPlacement property controls where the category axis labels are rendered in relation to the axis ticks.
Available options are:
- BetweenTicks: Renders the label between the axis ticks.
- OnTicks: Renders the label directly on the axis ticks.
Defaults to ‘BetweenTicks’
labelPosition AxisPosition
The labelPosition property determines where the axis labels are rendered in relation to the axis line.
Available options are:
- Inside: Renders the labels inside the axis line.
- Outside: Renders the labels outside the axis line.
Defaults to ‘Outside’
labelRotation number
The angle to which the axis label gets rotated.
Defaults to 0
labelStyle FontModel
This property allows defining various font settings to control how the labels are displayed on the axis.
lineBreakAlignment TextAlignment
Determines the alignment of labels when a line break occurs in the axis labels.
Defaults to ‘Center’
lineStyle AxisLineModel
Options for customizing the axis lines.
logBase number
Specifies the base value for a logarithmic axis.
Note that
valueTypemust be set toLogarithmicfor this feature to work.
Defaults to 10
majorGridLines MajorGridLinesModel
Options for customizing major grid lines on the axis.
majorTickLines MajorTickLinesModel
Options for customizing major tick lines on the axis.
maximum Object
Specifies the maximum value of the axis range, which sets the upper bound of the axis and defines the largest value displayed on the chart, helping to control the visible range of data.
Defaults to null
maximumLabelWidth number
Specifies the maximum width of an axis label.
Defaults to 34.
maximumLabels number
Specifies the maximum number of labels per 100 pixels relative to the axis length.
Defaults to 3
minimum Object
Specifies the minimum value of the axis range, which sets the lower bound of the axis and defines the smallest value that will be displayed on the chart to control the visible range of data.
Defaults to null
minorGridLines MinorGridLinesModel
Options for customizing minor grid lines on the axis.
minorTickLines MinorTickLinesModel
Options for customizing minor tick lines on the axis.
minorTicksPerInterval number
Specifies the number of minor ticks per interval.
Defaults to 0
multiLevelLabels MultiLevelLabelsModel[]
Multi-level labels are used to display hierarchical or grouped labels on the axis, allowing for a more detailed and structured data representation.
name string
A unique identifier for an axis. To associate an axis with a series, set this name to the xAxisName or yAxisName properties of the series.
Defaults to ’’
opposedPosition boolean
If set to true, the axis will render on the opposite side of its default position.
Defaults to false
placeNextToAxisLine boolean
Specifies whether axis elements, such as axis labels and the axis title, should be crossed by the axis line.
Defaults to true
plotOffset number
Specifies the padding on the top, bottom, left and right sides of the chart area, in pixels.
Defaults to 0
plotOffsetBottom number
Specifies the bottom padding for the chart area, in pixels.
Defaults to null
plotOffsetLeft number
Specifies the left padding for the chart area, in pixels.
Defaults to null
plotOffsetRight number
Specifies the right padding for the chart area, in pixels.
Defaults to null
plotOffsetTop number
Specifies the top padding for the chart area, in pixels.
Defaults to null
rangePadding ChartRangePadding
The rangePadding property determines how padding is applied to the axis range, affecting the appearance of the chart by adjusting the minimum and maximum values of the axis.
Available options are:
- None: No padding is applied to the axis.
- Normal: Padding is applied based on the range calculation.
- Additional: The interval of the axis is added as padding to both the minimum and maximum values of the range.
- Round: The axis range is rounded to the nearest possible value that is divisible by the interval.
Defaults to ‘Auto’
rowIndex number
Specifies the index of the row where the axis is associated when the chart area is divided into multiple plot areas using rows.
<div id='Chart'></div>let chart: Chart = new Chart({
...
rows: [{ height: '50%' },
{ height: '50%' }],
axes: [{
name: 'yAxis 1',
rowIndex: 1
}],
...
});
chart.appendTo('#Chart');Defaults to 0
scrollbarSettings ScrollbarSettingsModel
Configures the scrollbar with options for customization, including appearance, behavior, and lazy loading settings.
skeleton string
Specifies the skeleton format used for processing date-time values.
Defaults to ’’
skeletonType SkeletonType
Specifies the format type to be used in date-time formatting.
Defaults to ‘DateTime’
span number
Specifies the number of columns or rows that an axis spans horizontally or vertically.
Defaults to 1
startAngle number
Specifies the start angle for the series in a polar or radar chart, measured in degrees from the horizontal axis, determining the initial angle from which the series begins.
Defaults to 0
startFromZero boolean
If set to true, the axis starts from zero.
If set to false, the axis starts from the minimum value of the data.
Defaults to true
stripLines StripLineSettingsModel[]
Specifies the collection of strip lines for the axis, which are visual elements used to mark or highlight specific ranges.
tabIndex number
The tabIndex value for the axis, determining its position in the tab order.
Defaults to 2
tickPosition AxisPosition
The tickPosition property determines where the axis ticks are rendered in relation to the axis line.
Available options are:
- Inside: Renders the ticks inside the axis line.
- Outside: Renders the ticks outside the axis line.
Defaults to ‘Outside’
title string
Specifies the title of an axis, displayed along the axis to provide context about the represented data.
Defaults to ’’
titlePadding number
Specifies the padding between the axis title and the axis labels.
Defaults to 5
titleRotation number
Defines an angle for rotating the axis title. By default, the angle is calculated based on the position and orientation of the axis.
Defaults to null
titleStyle FontModel
Options for customizing the appearance of the axis title, including font family, size, style, weight, and color.
valueType ValueType
The valueType property defines the type of data that the axis can manage, ensuring correct rendering based on the data type. This property supports multiple data types, each suited for different kinds of data visualization.
Available options include:
- Double: Used for rendering a numeric axis to accommodate numeric data.
- DateTime: Utilized for rendering a date-time axis to manage date-time data.
- Category: Employed for rendering a category axis to manage categorical data.
- Logarithmic: Applied for rendering a logarithmic axis to handle a wide range of values.
- DateTimeCategory: Used to render a date-time category axis for managing business days.
Defaults to ‘Double’
visible boolean
If set to true, axis labels will be visible in the chart. By default, axis labels are enabled.
Defaults to true
zoomFactor number
The axis is scaled by this factor. When zoomFactor is 0.5, the chart is scaled by 200% along this axis.
Note the value ranges from 0 to 1.
Defaults to 1
zoomPosition number
Sets the position of the zoomed axis on the chart, with the zoomPosition property specifying the position within the zoomed range, from 0 (start) to 1 (end).
Defaults to 0