@youwen/ai-design-system
Version:
Enterprise AI-driven design system with comprehensive design tokens
78 lines (77 loc) • 1.72 kB
TypeScript
/**
* 环形图组件 - 无业务语义的通用环形进度图
* 基于v2 HVACDonutChart,移除业务逻辑
*/
import React from 'react';
export interface DonutChartProps {
/**
* 进度值(0-100)
*/
value: number;
/**
* 最大值
* @default 100
*/
maxValue?: number;
/**
* 图表尺寸(宽高相等)
* @default 195
*/
size?: number;
/**
* 环形线条粗细
* @default 12
*/
strokeWidth?: number;
/**
* 是否显示中心文本
* @default true
*/
showLabel?: boolean;
/**
* 中心文本格式
* @default 'value/max'
*/
labelFormat?: 'percent' | 'value' | 'value/max' | 'custom';
/**
* 自定义中心文本
*/
customLabel?: string;
/**
* 环形颜色(支持渐变)
* @default 使用默认的蓝色渐变
*/
color?: string;
/**
* 背景环形颜色
* @default rgba(255, 255, 255, 0.1)
*/
trackColor?: string;
/**
* 是否显示外圈边框
* @default true
*/
showOuterBorder?: boolean;
/**
* 是否显示动画
* @default true
*/
animated?: boolean;
/**
* 多层环形数据
*/
multiLayers?: Array<{
value: number;
color?: string;
strokeWidth?: number;
}>;
/**
* 自定义类名
*/
className?: string;
/**
* 自定义样式
*/
style?: React.CSSProperties;
}
export default function DonutChart({ value, maxValue, size, strokeWidth, showLabel, labelFormat, customLabel, color, trackColor, showOuterBorder, animated, multiLayers, className, style }: DonutChartProps): JSX.Element;