ChartGauge 仪表盘
仪表盘组件,用于展示单项指标数据的进度或状态。
基础用法
基础的仪表盘用法。
查看代码
自定义颜色和范围
支持自定义颜色段和数值范围。
查看代码
调整尺寸
通过 width 和 height 属性调整图表尺寸。
查看代码
完全自定义配置
通过 options 属性可以完全自定义 ECharts 配置项,实现更复杂的效果。
查看代码
API
Props
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| value | 当前值 | number | — | 0 |
| min | 最小值 | number | — | 0 |
| max | 最大值 | number | — | 100 |
| name | 仪表盘名称 | string | — | '仪表盘' |
| unit | 单位 | string | — | '%' |
| colors | 颜色配置 | Array<[number, string]> | — | [[0.3, '#67e0e3'], [0.7, '#37a2da'], [1, '#fd666d']] |
| height | 图表高度 | number | string | — | 400px |
| width | 图表宽度 | number | string | — | 100% |
| options | 自定义配置 | any | — | undefined |
Types
ChartGaugeProps
ts
interface ChartGaugeProps {
value?: number
min?: number
max?: number
name?: string
unit?: string
colors?: Array<[number, string]>
height?: number | string
width?: number | string
options?: any
}