Skip to content

ChartsYAxis API

API reference docs for the React ChartsYAxis component. Learn about the props, CSS, and other APIs of this exported module.

Demos

For examples and details on the usage of this React component, visit the component demo pages:

    Import

    import ChartsYAxis from '/packages/x-charts/src/ChartsYAxis';
    // or
    import { ChartsYAxis } from '/packages/x-charts/src';
    Learn about the difference by reading this guide on minimizing bundle size.

    Props

    axisIdRequired

    Id of the axis to render.

    Type:

    string

    classes

    Override or extend the styles applied to the component.

    See CSS API below for more details.

    Type:

    object

    disableLine

    If true, the axis line is disabled.

    Type:

    bool

    disableTicks

    If true, the ticks are disabled.

    Type:

    bool

    fill

    The fill color of the axis text.

    Type:

    string

    Default:

    'currentColor'

    label

    The label of the axis.

    Type:

    string

    labelFontSize

    The font size of the axis label.

    Type:

    number

    Default:

    14

    position

    Position of the axis.

    Type:

    'left' | 'right'

    slotProps

    The props used for each component slot.

    Type:

    object

    Default:

    {}

    slots

    Overridable component slots.

    Type:

    object

    Default:

    {}

    stroke

    The stroke color of the axis line.

    Type:

    string

    Default:

    'currentColor'

    tickFontSize

    The font size of the axis ticks text.

    Type:

    number

    Default:

    12

    tickMaxStep

    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

    tickMinStep

    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

    tickNumber

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

    Type:

    number

    tickSize

    The size of the ticks.

    Type:

    number

    Default:

    6

    The component cannot hold a ref.

    CSS

    The following class names are useful for styling with CSS (the state classes are marked).
    To learn more, visit the component customization page.


    .MuiChartsYAxis-rootroot

    Styles applied to the root element.


    .MuiChartsYAxis-lineline

    Styles applied to the main line element.


    .MuiChartsYAxis-tickContainertickContainer

    Styles applied to group ingruding the tick and its label.


    .MuiChartsYAxis-ticktick

    Styles applied to ticks.


    .MuiChartsYAxis-tickLabeltickLabel

    Styles applied to ticks label.


    .MuiChartsYAxis-labellabel

    Styles applied to the axis label.


    .MuiChartsYAxis-directionXdirectionX

    Styles applied to x axes.


    .MuiChartsYAxis-directionYdirectionY

    Styles applied to y axes.


    .MuiChartsYAxis-toptop

    Styles applied to the top axis.


    .MuiChartsYAxis-bottombottom

    Styles applied to the bottom axis.


    .MuiChartsYAxis-leftleft

    Styles applied to the left axis.


    .MuiChartsYAxis-rightright

    Styles applied to the right axis.


    You can override the style of the component using one of these customization options: