ChartsReferenceLine API
API reference docs for the React ChartsReferenceLine component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { ChartsReferenceLine } from '@mui/x-charts/ChartsReferenceLine';
// or
import { ChartsReferenceLine } from '@mui/x-charts';
Learn about the difference by reading this guide on minimizing bundle size.
Name | Type | Default | Description |
---|---|---|---|
axisId | number | string | The `id` of the first defined axis. | The id of the axis used for the reference value. |
classes | object | - | Override or extend the styles applied to the component. See CSS classes API below for more details. |
label | string | - | The label to display along the reference line. |
labelAlign | 'end' | 'middle' | 'start' | 'middle' | The alignment if the label is in the chart drawing area. |
labelStyle | object | - | The style applied to the label. |
lineStyle | object | - | The style applied to the line. |
spacing | number | { x?: number, y?: number } | 5 | Additional space arround the label in px. Can be a number or an object |
x | Date | number | string | - | The x value associated with the reference line. If defined the reference line will be vertical. |
y | Date | number | string | - | The y value associated with the reference line. If defined the reference line will be horizontal. |
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Class name | Rule name | Description |
---|---|---|
.MuiChartsReferenceLine-horizontal | horizontal | Styles applied to the root element if the reference line is horizontal. |
.MuiChartsReferenceLine-label | label | Styles applied to the reference label. |
.MuiChartsReferenceLine-line | line | Styles applied to the reference line. |
.MuiChartsReferenceLine-root | root | Styles applied to the root element. |
.MuiChartsReferenceLine-vertical | vertical | Styles applied to the root element if the reference line is vertical. |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.