ChartsContainer API
API reference docs for the React ChartsContainer component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { ChartsContainer } from '@mui/x-charts/ChartsContainer';
// or
import { ChartsContainer } from '@mui/x-charts';
// or
import { ChartsContainer } from '@mui/x-charts-pro/ChartsContainer';
// or
import { ChartsContainer } from '@mui/x-charts-pro';
// or
import { ChartsContainer } from '@mui/x-charts-premium/ChartsContainer';
// or
import { ChartsContainer } from '@mui/x-charts-premium';Learn about the difference by reading this guide on minimizing bundle size.
| Name | Type | Default | Description |
|---|---|---|---|
| axesGap | number | 0 | A gap added between axes when multiple axes are rendered on the same side of the chart. |
| brushConfig | { enabled?: bool, preventHighlight?: bool, preventTooltip?: bool } | - | Configuration for the brush interaction. |
| colors | Array<string> | func | rainbowSurgePalette | Color palette used to colorize multiple series. |
| dataset | Array<DatasetElementType | - | An array of objects that can be used to populate series and axes data using their |
| desc | string | - | The description of the chart. Used to provide an accessible description for the chart. |
| disableAxisListener | bool | false | If |
| disableHitArea | bool | - | If true, the hit area interaction is disabled and falls back to hover events. |
| disableKeyboardNavigation | bool | - | If |
| experimentalFeatures | any | - | Options to enable features planned for the next major. |
| height | number | - | The height of the chart in px. If not defined, it takes the height of the parent element. |
| highlightedAxis | Array<{ axisId: number | string, dataIndex: number }> | - | The controlled axis highlight. Identified by the axis id, and data index. |
| highlightedItem | any | any | - | The highlighted item. Used when the highlight is controlled. |
| hitAreaRadius | 'item' | number | - | Defines the maximum distance between a scatter point and the pointer that triggers the interaction.
If set to |
| id | string | - | This prop is used to help implement the accessibility logic. If you don't provide this prop. It falls back to a randomly generated id. |
| initialHiddenItems | Array<any | { seriesId: any, type?: any }> | - | List of initially hidden series and/or items.
Used for uncontrolled state. |
| localeText | Partial | - | Localized text for chart components. |
| margin | number | { bottom?: number, left?: number, right?: number, top?: number } | - | The margin between the SVG and the drawing area.
It's used for leaving some space for extra information such as the x- and y-axis or legend. |
| onAxisClick | func | - | The function called for onClick events. The second argument contains information about all line/bar elements at the current mouse position. Signature: function(event: MouseEvent, data: null | ChartsAxisData) => void
|
| onHiddenItemsChange | func | - | Callback fired when any hidden identifiers change. Signature: function(hiddenItems: Array<VisibilityIdentifierWithType>) => void
|
| onHighlightChange | func | - | The callback fired when the highlighted item changes. Signature: function(highlightedItem: HighlightItemIdentifierWithType<SeriesType> | null) => void
|
| onHighlightedAxisChange | func | - | The function called when the pointer position corresponds to a new axis data item.
This update can either be caused by a pointer movement, or an axis update.
In case of multiple axes, the function is called if at least one axis is updated.
The argument contains the identifier for all axes with a Signature: function(axisItems: Array<AxisItemIdentifier>) => void
|
| onItemClick | func | - | Callback fired when clicking close to an item. This is only available for scatter plot for now. Signature: function(event: MouseEvent, scatterItemIdentifier: ScatterItemIdentifier) => void
|
| onTooltipAxisChange | func | - | The function called when the pointer position corresponds to a new axis data item.
This update can either be caused by a pointer movement, or an axis update.
In case of multiple axes, the function is called if at least one axis is updated.
The argument contains the identifier for all axes with a Signature: function(axisItems: Array<AxisItemIdentifier>) => void
|
| onTooltipItemChange | func | - | The callback fired when the tooltip item changes. Signature: function(tooltipItem: SeriesItemIdentifier<SeriesType> | null) => void
|
| plugins | {} | - | Array of plugins used to add features to the chart. |
| radiusAxis | Array<AxisConfig<'linear', any, ChartsRadiusAxisProps>> | - | The configuration of the radial-axes. If not provided, a default axis config is used. An array of AxisConfig objects. |
| rotationAxis | Array<AxisConfig<'band', any, ChartsRotationAxisProps> | AxisConfig<'linear', any, ChartsRotationAxisProps> | AxisConfig<'log', any, ChartsRotationAxisProps> | AxisConfig<'point', any, ChartsRotationAxisProps> | AxisConfig<'pow', any, ChartsRotationAxisProps> | AxisConfig<'sqrt', any, ChartsRotationAxisProps> | AxisConfig<'symlog', any, ChartsRotationAxisProps> | AxisConfig<'time', any, ChartsRotationAxisProps> | AxisConfig<'utc', any, ChartsRotationAxisProps>> | - | The configuration of the rotation-axes. If not provided, a default axis config is used. An array of AxisConfig objects. |
| series | Array<BarSeriesType | LineSeriesType | ScatterSeriesType | PieSeriesType | - | The array of series to display. Each type of series has its own specificity. Please refer to the appropriate docs page to learn more about it. |
| seriesConfig | ChartSeriesConfig | - | The configuration for the series types. This is used to define how each series type should be processed, colored, and displayed. |
| skipAnimation | bool | - | If |
| slotProps | Partial | - | The props for the slots. |
| slots | Partial | - | Slots to customize charts' components. See Slots API below for more details. |
| title | string | - | The title of the chart. Used to provide an accessible label for the chart. |
| tooltipAxis | Array<{ axisId: number | string, dataIndex: number }> | - | The controlled axis tooltip. Identified by the axis id, and data index. |
| tooltipItem | any | any | - | The tooltip item. Used when the tooltip is controlled. |
| width | number | - | The width of the chart in px. If not defined, it takes the width of the parent element. |
| xAxis | Array<MakeOptional | MakeOptional | MakeOptional | MakeOptional | MakeOptional | MakeOptional | MakeOptional | MakeOptional | MakeOptional | - | The configuration of the x-axes. If not provided, a default axis config is used. An array of AxisConfig objects. |
| yAxis | Array<MakeOptional | MakeOptional | MakeOptional | MakeOptional | MakeOptional | MakeOptional | MakeOptional | MakeOptional | MakeOptional | - | The configuration of the y-axes. If not provided, a default axis config is used. An array of AxisConfig objects. |
| zAxis | Array<{ colorMap?: { color: any | any, max?: any | any, min?: any | any, type: 'continuous' } | { colors: Array<any>, thresholds: Array<any>, type: 'piecewise' } | { colors: Array<any>, type: 'ordinal', unknownColor?: string, values?: Array<any> }, data?: Array<any>, dataKey?: string, id?: string, max?: number, min?: number, valueGetter?: func }> | - | The configuration of the z-axes. |
| Slot name | Class name | Default component | Description |
|---|---|---|---|
| baseButton | |||
| baseIconButton |
Source code
If you did not find the information in this page, consider having a look at the implementation of the component for more detail.