跳到內容

ContinuousColorLegendAPI

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

範例

導入

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

閱讀這份關於最小化 bundle 大小的指南,以了解差異。reading this guide on minimizing bundle size

屬性

名稱類型預設描述
align'end'
| 'middle'
| 'start'
'middle'

文字與漸層條的對齊方式。

axisDirection'x'
| 'y'
| 'z'
'z'

包含要表示的顏色配置的軸向。

axisIdnumber
| string
第一個軸項目。

具有要表示的顏色配置的軸項目的 ID。

direction'column'
| 'row'
-

圖例版面配置的方向。預設值取決於圖表。

idstring自動產生的 ID

漸層的唯一識別符。

labelStyleobjecttheme.typography.subtitle1

應用於標籤的樣式。

lengthnumber
| string
'50%'

漸層條的長度。可以是數字(以 px 為單位)或帶有百分比的字串,例如 '50%'。'100%' 是 svg 的長度。

maxLabelfunc
| string
({ formattedValue }) => formattedValue

要在漸層最大側顯示的標籤。可以是字串或函式。如果未定義,則顯示格式化的最大值。

minLabelfunc
| string
({ formattedValue }) => formattedValue

要在漸層最小側顯示的標籤。可以是字串或函式。

position{ horizontal: 'left'
| 'middle'
| 'right', vertical: 'bottom'
| 'middle'
| 'top' }
-

圖例的位置。

scaleType'linear'
| 'log'
| 'pow'
| 'sqrt'
| 'time'
| 'utc'
'linear'

用於顯示漸層顏色的縮放。

spacingnumber4

漸層條和標籤之間的間距。

thicknessnumber5

漸層條的粗細。

元件無法持有 ref。

原始碼

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