Skip to content

AxisConfig API

Extended documentation for the AxisConfig interface with detailed information on the module's properties and available APIs.

Demos

Import

import { AxisConfig } from '@mui/x-charts-premium'
// or
import { AxisConfig } from '@mui/x-charts-pro'
// or
import { AxisConfig } from '@mui/x-charts'


Use this type for advanced typing. For basic usage, use XAxis or YAxis.

Properties

ID used to identify the axis.

The ID must be unique across all axes in this chart.

Type:AxisId


Optional

The direction of the axis.

Type:'x' | 'y'


Optional

The ratio between the width of a bar, and the gap between two bars.
0 means no gap, and 1 no bar.

Only applies to scaleType: 'band'.

Type:number

Default:0.1


Optional

The ratio between the space allocated for padding between two categories and the category width.
0 means no gap, and 1 no data.

Only applies to scaleType: 'band'.

Type:number

Default:0.2


Optional

Override or extend the styles applied to the component.

Type:Partial<ChartsAxisClasses>


Optional

A CSS class name applied to the root element.

Type:string


Optional

Type:ContinuousColorConfig<number | Date> | OrdinalColorConfig<string | number | Date> | PiecewiseColorConfig<number | Date>


Optional

The constant used to define the zero point of the symlog scale.

Only applies to scaleType: 'symlog'.

Type:number

Default:1


Optional

The data used by 'band' and 'point' scales.

Type:readonly V[]


Optional

The key used to retrieve data from the dataset prop.

Type:string


Optional

If true, the axis line is disabled.

Type:boolean

Default:false


Optional

If true, the ticks are disabled.

Type:boolean

Default:false


Optional

Defines the axis scale domain based on the min/max values of series linked to it.
- 'nice': Rounds the domain at human friendly values.
- 'strict': Set the domain to the min/max value provided. No extra space is added.
- function: Receives the calculated extremums as parameters, and should return the axis domain.

Type:'nice' | 'strict' | ((min: NumberValue, max: NumberValue) => { min: NumberValue; max: NumberValue })


Optional

Defines the series used to compute the axis domain.

Type:'all' | 'visible'

Default:"all"


Optional

Each group will have a label that is the stringified value of the group.

Only applies to scaleType: 'band' | 'point'.

Type:AxisGroup[]


Optional

The height of the axis.
Set to 'auto' to automatically calculate the height based on tick label measurements.

Only applies to axis: 'x'.

Type:'auto' | number

Default:45 if an axis label is provided, 25 otherwise.


Optional

If true, hide this value in the tooltip

Type:boolean


Optional

If true, the axis will be ignored by the tooltip with trigger='axis'.

Type:boolean


Optional

The label of the axis.

Type:string


Optional

The style applied to the axis label.

Type:ChartsTextProps['style']


Optional

The maximal value of the domain.
If not provided, it gets computed to display the entire chart data.

Only applies to scaleType: 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc'.

Type:NumberValue | number


Optional

The minimal value of the domain.
If not provided, it gets computed to display the entire chart data.

Only applies to scaleType: 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc'.

Type:NumberValue | number


Optional

The offset of the axis in pixels. It can be used to move the axis from its default position.
X-axis: A top axis will move up, and a bottom axis will move down.
Y-axis: A left axis will move left, and a right axis will move right.

Type:number

Default:0


Optional

Definition of the tick placements with date data.

Only applies to scaleType: 'band' | 'point'.

Type:OrdinalTimeTicks


Optional

Position of the axis.

When set, the space for the axis is reserved, even if the axis is not displayed due to missing data.

Set to 'none' to hide the axis.

The first axis in the list will always have a default position.

Type:'bottom' | 'left' | 'none' | 'right' | 'top'


Optional

If true, Reverse the axis scaleBand.

Type:boolean


Optional

Type:'band' | 'linear' | 'log' | 'point' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc'


Optional

The props used for each component slot.

Type:Partial<ChartsAxisSlotProps>

Default:{}


Optional

Overridable component slots.

Type:Partial<ChartsAxisSlots>

Default:{}


Optional

The system prop that allows defining system overrides as well as additional CSS styles.

Type:SxProps


Optional

Defines which ticks are displayed.
Its value can be:
- 'auto' In such case the ticks are computed based on axis scale and other parameters.
- a filtering function of the form (value, index) =&gt; boolean which is available only if the axis has "point" scale.
- an array containing the values where ticks should be displayed.

Type:'auto' | ((value: any, index: number) => boolean) | any[]

Default:'auto'


Optional

Defines which ticks get its label displayed. Its value can be:
- 'auto' In such case, labels are displayed if they do not overlap with the previous one.
- a filtering function of the form (value, index) => boolean. Warning: the index is tick index, not data ones.

Type:'auto' | ((value: any, index: number) => boolean)

Default:'auto'


Optional

The minimum gap in pixels between two tick labels.
If two tick labels are closer than this minimum gap, one of them will be hidden.

Only applies to axis: 'x'.

Type:number

Default:4


Optional

The placement of ticks label. Can be the middle of the band, or the tick position.
Only used if scale is 'band'.

Type:'middle' | 'tick'

Default:'middle'


Optional

The style applied to ticks text.

Type:ChartsTextProps['style']


Optional

Maximal step between two ticks.
When using time data, the value is assumed to be in ms.
Not supported by categorical axis (band, points).

Type:number


Optional

Minimal step between two ticks.
When using time data, the value is assumed to be in ms.
Not supported by categorical axis (band, points).

Type:number


Optional

The number of ticks. This number is not guaranteed.
Not supported by categorical axis (band, points).

Type:number


Optional

The placement of ticks in regard to the band interval.
Only used if scale is 'band'.

Type:'start' | 'end' | 'middle' | 'extremities'

Default:'extremities'


Optional

The size of the ticks.

Type:number

Default:6


Optional

The minimum space between ticks when using an ordinal scale. It defines the minimum distance in pixels between two ticks.

Type:number

Default:0


Optional

Formats the axis value.

Type:<TScaleName extends S>(value: V, context: AxisValueFormatterContext<TScaleName>) => string


Optional

A function to extract and transform the value from the dataset item.
It receives the full dataset item and should return the axis value.
Can be used as an alternative to dataKey.

Type:(item: DatasetElementType<unknown>) => V


Optional

The width of the axis.
Set to 'auto' to automatically calculate the width based on tick label measurements.

Only applies to axis: 'y'.

Type:'auto' | number

Default:65 if an axis label is provided, 45 otherwise.


Optional

Type:boolean | ZoomOptions