跳到主要內容

BarPlotAPI

React BarPlot 組件的 API 參考文件。了解此匯出模組的屬性、CSS 和其他 API。

示範

匯入

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

閱讀這份關於最小化 bundle size 的指南,以了解差異。

屬性

名稱類型預設值描述
barLabel'value'
| 函式
-

如果提供,此函式將用於格式化長條圖的標籤。可以設定為 'value' 以顯示目前的值。

borderRadius數字-

定義長條元素的邊框半徑。

onItemClick函式-

當長條項目被點擊時觸發的回呼函數。

簽名:function(event: React.MouseEvent, barItemIdentifier: BarItemIdentifier) => void
  • event 回呼函數的事件來源。
  • barItemIdentifier 長條項目識別符。
skipAnimation布林值未定義

如果為 true,則跳過動畫。

slotProps物件{}

用於每個組件插槽的屬性。

slots物件{}

可覆寫的組件插槽。

請參閱下方的 Slots API 以了解更多詳細資訊。

此組件無法持有 ref。

插槽

插槽名稱類別名稱預設組件描述
barBarElementPath渲染長條的組件。
barLabelBarLabel渲染長條標籤的組件。

原始碼

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