import { memo } from 'react'; import { PieChart, Pie, Cell, Tooltip, Legend, ResponsiveContainer } from 'recharts'; import { EmptyState } from '@/components/ui'; import { CHART_COLORS } from './chartColors'; export interface AlertSlice { name: string; value: number; color: string; } interface AlertSeverityDonutProps { data: AlertSlice[]; } const tooltipStyle = { backgroundColor: '#FFFFFF', border: `1px solid ${CHART_COLORS.tooltipBorder}`, borderRadius: '8px', fontSize: '12px', }; function AlertSeverityDonutComponent({ data }: AlertSeverityDonutProps) { const hasData = data.some((d) => d.value > 0); return (
预警严重度分布
{hasData ? (
{data.map((entry) => ( ))} [value, name]} /> {value}} />
) : ( )}
); } export const AlertSeverityDonut = memo(AlertSeverityDonutComponent);