跳到主要內容

ResponsiveChartContainerProAPI

React ResponsiveChartContainerPro 元件的 API 參考文件。瞭解此匯出模組的 props、CSS 和其他 API。

範例展示

匯入

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

閱讀關於最小化套件大小的指南,以了解更多差異。

屬性

原生元件的屬性也可用。

名稱類型預設值描述
series*Array<object>-

要顯示的系列陣列。每種系列類型都有其特殊性。請參考適當的文件頁面以了解更多資訊。

colorsArray<string>
| func
blueberryTwilightPalette

用於為多個系列著色的調色盤。

datasetArray<object>-

物件陣列,可用於使用其 dataKey 屬性來填充系列和座標軸資料。

disableAxisListenerboolfalse

如果為 true,圖表將不會監聽滑鼠移動事件。這可能會破壞互動功能,但會提高效能。

heightnumber-

圖表的 px 高度。如果未定義,則會採用父元素的高度。

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

目前醒目提示的項目。將醒目提示變成受控屬性。

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。

原始碼

如果您在此頁面中找不到資訊,請考慮查看元件的實作以取得更多詳細資訊。