图表组件接入 显示成功

This commit is contained in:
mmc
2026-05-14 15:15:50 +08:00
parent abe5631642
commit adf4c37b95
9 changed files with 673 additions and 487 deletions

View File

@@ -11,7 +11,7 @@ import {
SelectOutlined, FireOutlined, WarningOutlined, ExclamationCircleOutlined
} from '@ant-design/icons';
import { Line, Area } from '@ant-design/charts';
import { UniversalBarChart, UniversalLineChart } from "../components/recharts"
import { UniversalLineChart } from "../components/recharts"
const { Title, Text } = Typography;
@@ -39,82 +39,101 @@ const thermalImagingData = [
{ name: '方阵 C-07', temp: '67.2℃', id: 'C07', status: 'warning' },
];
// 图表配置
const degradationConfig = {
data: [
{ date: '2024-01', type: '平均衰减率', value: 0 },
{ date: '2024-04', type: '平均衰减率', value: -1.2 },
{ date: '2024-07', type: '平均衰减率', value: -2.5 },
{ date: '2024-10', type: '平均衰减率', value: -3.8 },
{ date: '2025-01', type: '平均衰减率', value: -4.5 },
{ date: '2025-05', type: '平均衰减率', value: -5.32 },
{ date: '2024-01', type: '最佳组件', value: 0 },
{ date: '2024-04', type: '最佳组件', value: -0.5 },
{ date: '2024-07', type: '最佳组件', value: -1.0 },
{ date: '2024-10', type: '最佳组件', value: -1.5 },
{ date: '2025-01', type: '最佳组件', value: -2.0 },
{ date: '2025-05', type: '最佳组件', value: -2.5 },
{ date: '2024-01', type: '最差组件', value: -1.0 },
{ date: '2024-04', type: '最差组件', value: -2.5 },
{ date: '2024-07', type: '最差组件', value: -4.0 },
{ date: '2024-10', type: '最差组件', value: -6.5 },
{ date: '2025-01', type: '最差组件', value: -8.0 },
{ date: '2025-05', type: '最差组件', value: -10.2 },
],
xField: 'date',
yField: 'value',
seriesField: 'type',
color: ['#165DFF', '#00B42A', '#F53F3F'],
smooth: true,
lineStyle: (type: string) => {
if (type === '最差组件') return { lineDash: [4, 4] };
return { lineWidth: 2 };
const degradationData = [
{
date: '2024-01',
average: 0,
best: 0,
worst: -1.0,
},
legend: { position: 'top' },
yAxis: { label: { formatter: (v: string) => `${v}%` } },
};
{
date: '2024-04',
average: -1.2,
best: -0.5,
worst: -2.5,
},
{
date: '2024-07',
average: -2.5,
best: -1.0,
worst: -4.0,
},
{
date: '2024-10',
average: -3.8,
best: -1.5,
worst: -6.5,
},
{
date: '2025-01',
average: -4.5,
best: -2.0,
worst: -8.0,
},
{
date: '2025-05',
average: -5.32,
best: -2.5,
worst: -10.2,
},
];
const generationPerformanceConfig = {
data: [
{ time: '00:00', type: '实际发电', value: 0 },
{ time: '03:00', type: '实际发电', value: 0 },
{ time: '06:00', type: '实际发电', value: 100 },
{ time: '09:00', type: '实际发电', value: 800 },
{ time: '12:00', type: '实际发电', value: 1400 },
{ time: '15:00', type: '实际发电', value: 1200 },
{ time: '18:00', type: '实际发电', value: 400 },
{ time: '21:00', type: '实际发电', value: 0 },
{ time: '24:00', type: '实际发电', value: 0 },
{ time: '00:00', type: '预测发电', value: 0 },
{ time: '03:00', type: '预测发电', value: 0 },
{ time: '06:00', type: '预测发电', value: 150 },
{ time: '09:00', type: '预测发电', value: 950 },
{ time: '12:00', type: '预测发电', value: 1650 },
{ time: '15:00', type: '预测发电', value: 1350 },
{ time: '18:00', type: '预测发电', value: 550 },
{ time: '21:00', type: '预测发电', value: 0 },
{ time: '24:00', type: '预测发电', value: 0 },
{ time: '00:00', type: '理论发电', value: 0 },
{ time: '03:00', type: '理论发电', value: 0 },
{ time: '06:00', type: '理论发电', value: 200 },
{ time: '09:00', type: '理论发电', value: 1100 },
{ time: '12:00', type: '理论发电', value: 1800 },
{ time: '15:00', type: '理论发电', value: 1500 },
{ time: '18:00', type: '理论发电', value: 650 },
{ time: '21:00', type: '理论发电', value: 0 },
{ time: '24:00', type: '理论发电', value: 0 },
],
xField: 'time',
yField: 'value',
seriesField: 'type',
color: ['#165DFF', '#00B42A', '#86909C'],
smooth: true,
lineStyle: (type: string) => {
if (type === '理论发电') return { lineDash: [4, 4] };
return { lineWidth: 2 };
const generationPerformanceData = [
{
time: '00:00',
actual: 0,
predict: 0,
theory: 0,
},
legend: { position: 'top' },
};
{
time: '03:00',
actual: 0,
predict: 0,
theory: 0,
},
{
time: '06:00',
actual: 100,
predict: 150,
theory: 200,
},
{
time: '09:00',
actual: 800,
predict: 950,
theory: 1100,
},
{
time: '12:00',
actual: 1400,
predict: 1650,
theory: 1800,
},
{
time: '15:00',
actual: 1200,
predict: 1350,
theory: 1500,
},
{
time: '18:00',
actual: 400,
predict: 550,
theory: 650,
},
{
time: '21:00',
actual: 0,
predict: 0,
theory: 0,
},
{
time: '24:00',
actual: 0,
predict: 0,
theory: 0,
},
];
export default function AIDiagnosisPage() {
@@ -369,8 +388,35 @@ export default function AIDiagnosisPage() {
<span>衰减率趋势 (%)</span>
<span style={{ color: '#F53F3F', fontWeight: 600 }}>当前均值: -5.32%</span>
</div>
<Line {...degradationConfig} height={240} autoFit />
<div style={{ marginTop: 16, padding: '12px', background: '#FFF7E8', borderRadius: 8, border: '1px solid #FFE4BA' }}>
<UniversalLineChart
data={degradationData}
xKey="date"
height={240}
smooth
dot
showGrid
showLegend
series={[
{
key: 'average',
name: '平均衰减率',
color: '#165DFF',
strokeWidth: 3,
},
{
key: 'best',
name: '最佳组件',
color: '#00B42A',
strokeWidth: 2,
},
{
key: 'worst',
name: '最差组件',
color: '#F53F3F',
strokeWidth: 2,
},
]}
/> <div style={{ marginTop: 16, padding: '12px', background: '#FFF7E8', borderRadius: 8, border: '1px solid #FFE4BA' }}>
<div style={{ fontSize: 12, color: '#86909C', display: 'flex', alignItems: 'center' }}>
<ExclamationCircleOutlined style={{ color: '#FF7D00', marginRight: 6 }} />
<span style={{ color: '#1D2129', fontWeight: 600 }}>衰减预警:</span>
@@ -390,8 +436,35 @@ export default function AIDiagnosisPage() {
<div style={{ display: 'flex', gap: 20 }}>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 12, color: '#86909C', marginBottom: 16 }}>发电量对比分析 (kWh)</div>
<Line {...generationPerformanceConfig} height={240} autoFit />
</div>
<UniversalLineChart
data={generationPerformanceData}
xKey="time"
height={240}
smooth
dot={false}
showGrid
showLegend
series={[
{
key: 'actual',
name: '实际发电',
color: '#165DFF',
strokeWidth: 3,
},
{
key: 'predict',
name: '预测发电',
color: '#00B42A',
strokeWidth: 2,
},
{
key: 'theory',
name: '理论发电',
color: '#86909C',
strokeWidth: 2,
},
]}
/> </div>
<div style={{ width: 120, display: 'flex', flexDirection: 'column', justifyContent: 'center', gap: 16, flexShrink: 0, paddingLeft: 16, borderLeft: '1px solid #f0f0f0' }}>
{[
{ label: '当日实际发电', value: '4,752', unit: 'kWh', color: '#165DFF' },