Skip to content

LineSeries API

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

Demos

Import

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

Properties

Type:'line'


Optional

If `true`, the series is rendered as an area instead of a line.

Type:boolean


Optional

The value of the line at the base of the series area. - `'min'` the area will fill the space **under** the line. - `'max'` the area will fill the space **above** the line. - `number` the area will fill the space between this value and the line

Type:'max' | 'min' | number

Default:0


Optional

Color to use when displaying the series. If `colorGetter` is provided, it will be used to get the color for each data point instead. Otherwise, this color will be used for all data points in the series.

Type:string


Optional

A function that returns a color based on the value and/or the data index of a point. The returned color is used when displaying the specific data point, e.g., a marker in a line chart. When the color of the entire series is required, e.g., in legends, the `color` property is used instead.

Type:(data: { value: number, dataIndex: number }) => string


Optional

If `true`, line and area connect points separated by `null` values.

Type:boolean

Default:false


Optional

The type of curve to use for the line. Read more about curves at [line interpolation](https://mui.com/x/react-charts/lines/#interpolation).

Type:'bumpX' | 'bumpY' | 'catmullRom' | 'linear' | 'monotoneX' | 'monotoneY' | 'natural' | 'step' | 'stepAfter' | 'stepBefore'

Default:'monotoneX'


Optional

Data associated to the line.

Type:readonly (number | null)[]


Optional

The key used to retrieve data from the dataset.

Type:string


Optional

Do not render the line highlight item if set to `true`.

Type:boolean

Default:false


Optional

The scope to apply when the series is highlighted.

Type:{ highlight?: 'item' | 'none' | 'series', fade?: 'global' | 'none' | 'series' }


Optional

The id of this series.

Type:string


Optional

The label to display on the tooltip or the legend. It can be a string or a function.

Type:(location: 'legend' | 'tooltip') => string | string


Optional

Defines the mark type for the series. There is a default mark type for each series type.

Type:'circle' | 'line' | 'line+mark' | 'square' | ComponentClass<ChartsLabelCustomMarkProps, any> | FunctionComponent<ChartsLabelCustomMarkProps>


Optional

The shape of the mark elements. Using 'circle' renders a `` element, while all other options render a `` instead. The path causes a small decrease in performance. By default, each series has a different shape, cycling through `'circle'`, `'square'`, `'diamond'`, `'cross'`, `'star'`, `'triangle'`, `'wye'`. If there are more than 7 series, the shapes will repeat.

Type:'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye'


Optional

Define which items of the series should display a mark. If can be a boolean that applies to all items. Or a callback that gets some item properties and returns true if the item should be displayed.

Type:(params: { index: number, x: number, y: number, position: Date | number, value: number }) => boolean | boolean


Optional

The key that identifies the stacking group. Series with the same `stack` property will be stacked together.

Type:string


Optional

Defines how stacked series handle negative values.

Type:'diverging' | 'expand' | 'none' | 'silhouette' | 'wiggle'

Default:'none'


Optional

The order in which series' of the same group are stacked together.

Type:'appearance' | 'ascending' | 'descending' | 'insideOut' | 'none' | 'reverse'

Default:'none'


Optional

If `true`, step curve starts and end at the first and last point. By default the line is extended to fill the space before and after.

Type:boolean


Optional

Formatter used to render values in tooltip or other data display.

Type:(value: number, context: { dataIndex: number }) => string


Optional

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

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


Optional

The id of the x-axis used to render the series.

Type:number | string


Optional

The id of the y-axis used to render the series.

Type:number | string