跳到内容

ResponsiveChartContainerProAPI

React ResponsiveChartContainerPro 组件的 API 参考文档。了解此导出模块的 props、CSS 和其他 API。

演示

导入

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

通过阅读关于最小化 bundle size 的指南,了解它们之间的区别。

Props

原生组件的 Props 也可用。

名称类型默认值描述
series*Array<object>-

要显示的 series 数组。每种类型的 series 都有其特殊性。请参阅相应的文档页面以了解更多信息。

colorsArray<string>
| func
blueberryTwilightPalette

用于着色多个 series 的调色板。

datasetArray<object>-

一个对象数组,可用于使用其 dataKey 属性填充 series 和坐标轴数据。

disableAxisListenerboolfalse

如果为 true,图表将不会监听鼠标移动事件。它可能会破坏交互功能,但会提高性能。

heightnumber-

图表的高度,单位为 px。如果未定义,则采用父元素的高度。

highlightedItem{ dataIndex?: number, seriesId?: number
| string }
-

当前高亮的项目。将高亮变成受控 prop。

margin{ bottom?: number, left?: number, right?: number, top?: number }object 取决于图表类型。

SVG 和绘图区域之间的边距。它用于为额外信息(例如 x 轴和 y 轴或图例)留出一些空间。接受具有可选属性的对象:topbottomleftright

onHighlightChangefunc-

当高亮项目更改时触发的回调。

签名:function(highlightedItem: HighlightItemData | null) => void
  • highlightedItem 新高亮的项目。
onZoomChangefunc-

当缩放已更改时触发的回调。

签名:function(zoomData: Array) => void
  • zoomData 更新后的缩放数据。
pluginsArray<object>-

一个插件数组,用于定义如何预处理数据。如果未提供,则容器支持折线图、柱状图、散点图和饼图。

resolveSizeBeforeRenderboolfalse

图表将尝试等待父容器解析其大小,然后再首次渲染。
在某些情况下,当图表在首次渲染后显得增大时(例如在网格内使用时),这可能很有用。

skipAnimationbool-

如果为 true,则跳过动画。如果未设置或为 false,则动画会遵循用户的 prefers-reduced-motion 设置。

widthnumber-

图表的宽度,单位为 px。如果未定义,则采用父元素的宽度。

xAxisArray<{ classes?: object, colorMap?: { colors: Array<string>, type: 'ordinal', unknownColor?: string, values?: Array<Date
| number
| string> }
| { color: Array<string>
| func, max?: Date
| number, min?: Date
| number, type: 'continuous' }
| { colors: Array<string>, thresholds: Array<Date
| number>, type: 'piecewise' }, data?: array, dataKey?: string, disableLine?: bool, disableTicks?: bool, domainLimit?: 'nice'
| 'strict'
| func, fill?: string, hideTooltip?: bool, id?: number
| string, label?: string, labelFontSize?: number, labelStyle?: object, max?: Date
| number, min?: Date
| number, position?: 'bottom'
| 'top', reverse?: bool, scaleType?: 'band'
| 'linear'
| 'log'
| 'point'
| 'pow'
| 'sqrt'
| 'time'
| 'utc', slotProps?: object, slots?: object, stroke?: string, sx?: Array<func
| object
| bool>
| func
| object, tickFontSize?: number, tickInterval?: 'auto'
| array
| func, tickLabelInterval?: 'auto'
| func, tickLabelPlacement?: 'middle'
| 'tick', tickLabelStyle?: object, tickMaxStep?: number, tickMinStep?: number, tickNumber?: number, tickPlacement?: 'end'
| 'extremities'
| 'middle'
| 'start', tickSize?: number, valueFormatter?: func, zoom?: { filterMode?: 'discard'
| 'keep', maxEnd?: number, maxSpan?: number, minSpan?: number, minStart?: number, panning?: bool, step?: number }
| bool }>
-

x 轴的配置。如果未提供,则使用默认轴配置。 AxisConfig 对象的数组。

yAxisArray<{ classes?: object, colorMap?: { colors: Array<string>, type: 'ordinal', unknownColor?: string, values?: Array<Date
| number
| string> }
| { color: Array<string>
| func, max?: Date
| number, min?: Date
| number, type: 'continuous' }
| { colors: Array<string>, thresholds: Array<Date
| number>, type: 'piecewise' }, data?: array, dataKey?: string, disableLine?: bool, disableTicks?: bool, domainLimit?: 'nice'
| 'strict'
| func, fill?: string, hideTooltip?: bool, id?: number
| string, label?: string, labelFontSize?: number, labelStyle?: object, max?: Date
| number, min?: Date
| number, position?: 'left'
| 'right', reverse?: bool, scaleType?: 'band'
| 'linear'
| 'log'
| 'point'
| 'pow'
| 'sqrt'
| 'time'
| 'utc', slotProps?: object, slots?: object, stroke?: string, sx?: Array<func
| object
| bool>
| func
| object, tickFontSize?: number, tickInterval?: 'auto'
| array
| func, tickLabelInterval?: 'auto'
| func, tickLabelPlacement?: 'middle'
| 'tick', tickLabelStyle?: object, tickMaxStep?: number, tickMinStep?: number, tickNumber?: number, tickPlacement?: 'end'
| 'extremities'
| 'middle'
| 'start', tickSize?: number, valueFormatter?: func, zoom?: { filterMode?: 'discard'
| 'keep', maxEnd?: number, maxSpan?: number, minSpan?: number, minStart?: number, panning?: bool, step?: number }
| bool }>
-

y 轴的配置。如果未提供,则使用默认轴配置。 AxisConfig 对象的数组。

zAxisArray<{ colorMap?: { colors: Array<string>, type: 'ordinal', unknownColor?: string, values?: Array<Date
| number
| string> }
| { color: Array<string>
| func, max?: Date
| number, min?: Date
| number, type: 'continuous' }
| { colors: Array<string>, thresholds: Array<Date
| number>, type: 'piecewise' }, data?: array, dataKey?: string, id?: string, max?: number, min?: number }>
-

z 轴的配置。

zoomArray<{ axisId: number
| string, end: number, start: number }>
-

与每个轴相关的缩放数据列表。

该组件无法保持 ref。

源代码

如果您在此页面中找不到信息,请考虑查看组件的实现以获取更多详细信息。