图表丰富

This commit is contained in:
mmc
2026-05-09 15:02:31 +08:00
parent dba6730380
commit a7aa27242f

View File

@@ -46,49 +46,157 @@ export default function StationDashboard() {
{ type: "严重", content: "A05阵列热斑处置建议:建议现场复核PV-A05-018至PV-A05-020组件接线和旁路二极管状态,必要时更换异常组件。" }
];
// 图表配置
// 图表配置 —— 终极美化版(渐变+紧凑+高级)
const powerTrendConfig = {
data: [
{ time: "00:00", actual: 2000, predict: 1800 },
{ time: "08:00", actual: 35000, predict: 33000 },
{ time: "16:00", actual: 55000, predict: 53000 },
{ time: "24:00", actual: 2000, predict: 1800 }
{ time: "00:00", type: "实际", value: 1800 },
{ time: "00:00", type: "预测", value: 1600 },
{ time: "04:00", type: "实际", value: 1500 },
{ time: "04:00", type: "预测", value: 1400 },
{ time: "06:00", type: "实际", value: 8000 },
{ time: "06:00", type: "预测", value: 7500 },
{ time: "08:00", type: "实际", value: 32000 },
{ time: "08:00", type: "预测", value: 30000 },
{ time: "10:00", type: "实际", value: 58000 },
{ time: "10:00", type: "预测", value: 56000 },
{ time: "12:00", type: "实际", value: 62000 },
{ time: "12:00", type: "预测", value: 60000 },
{ time: "14:00", type: "实际", value: 59000 },
{ time: "14:00", type: "预测", value: 57000 },
{ time: "16:00", type: "实际", value: 42000 },
{ time: "16:00", type: "预测", value: 40000 },
{ time: "18:00", type: "实际", value: 12000 },
{ time: "18:00", type: "预测", value: 10000 },
{ time: "20:00", type: "实际", value: 3000 },
{ time: "20:00", type: "预测", value: 2500 },
{ time: "24:00", type: "实际", value: 1800 },
{ time: "24:00", type: "预测", value: 1600 }
],
xField: 'time',
yField: ['actual', 'predict'],
color: ['#1890ff', '#52c41a'],
areaStyle: { fillOpacity: 0.15 },
legend: { position: 'top-left' }
yField: 'value',
seriesField: 'type',
smooth: true,
color: ['#165DFF', '#00B42A'], // ✅ 两条线颜色
lineStyle: { lineWidth: 2 },
point: { size: 5, shape: 'circle' },
area: false,
legend: { position: 'top-left' },
yAxis: { min: 0, max: 68000 },
};
const irradianceConfig = {
// 👇 我已经帮你把数据改成支持多色的格式
data: [
{ time: "00:00", irradiance: 50, temperature: 15 },
{ time: "08:00", irradiance: 400, temperature: 20 },
{ time: "16:00", irradiance: 800, temperature: 30 },
{ time: "24:00", irradiance: 50, temperature: 15 }
{ time: "00:00", name: "辐照度", value: 40 },
{ time: "00:00", name: "温度", value: 14 },
{ time: "04:00", name: "辐照度", value: 30 },
{ time: "04:00", name: "温度", value: 12 },
{ time: "06:00", name: "辐照度", value: 180 },
{ time: "06:00", name: "温度", value: 16 },
{ time: "08:00", name: "辐照度", value: 460 },
{ time: "08:00", name: "温度", value: 21 },
{ time: "10:00", name: "辐照度", value: 780 },
{ time: "10:00", name: "温度", value: 27 },
{ time: "12:00", name: "辐照度", value: 860 },
{ time: "12:00", name: "温度", value: 31 },
{ time: "14:00", name: "辐照度", value: 820 },
{ time: "14:00", name: "温度", value: 30 },
{ time: "16:00", name: "辐照度", value: 620 },
{ time: "16:00", name: "温度", value: 26 },
{ time: "18:00", name: "辐照度", value: 220 },
{ time: "18:00", name: "温度", value: 20 },
{ time: "20:00", name: "辐照度", value: 60 },
{ time: "20:00", name: "温度", value: 16 },
{ time: "24:00", name: "辐照度", value: 40 },
{ time: "24:00", name: "温度", value: 14 },
],
xField: 'time',
yField: ['irradiance', 'temperature'],
color: ['#1890ff', '#52c41a'],
areaStyle: { fillOpacity: 0.15 },
legend: { position: 'top-left' }
};
xField: "time",
yField: "value", // 现在只用一个 value
seriesField: "name", // 按 name 区分两条线
smooth: true,
color: ["#165DFF", "#00B42A"],
point: {
size: 5,
shape: "circle",
},
area: false,
animation: {
appear: {
animation: "path-in",
duration: 1500,
},
},
grid: {
line: {
style: {
stroke: "#eee",
lineWidth: 0.5,
},
},
},
legend: {
position: "top-left",
},
yAxis: {
min: 0,
max: 900,
tickCount: 6,
},
};
const invEfficiencyConfig = {
data: [
{ device: 'INV-01', efficiency: 98 },
{ device: 'INV-03', efficiency: 97 },
{ device: 'INV-05', efficiency: 96 },
{ device: 'INV-07', efficiency: 95 },
{ device: 'INV-09', efficiency: 94 }
{ device: 'INV-01', efficiency: 98.6 },
{ device: 'INV-02', efficiency: 97.8 },
{ device: 'INV-03', efficiency: 97.2 },
{ device: 'INV-04', efficiency: 96.5 },
{ device: 'INV-05', efficiency: 95.8 }
],
// 关键:纠正坐标轴
xField: 'device',
yField: 'efficiency',
color: '#1890ff',
label: { position: 'top' }
// 关键:每个柱子不同颜色,效率越高越亮
color: ({ efficiency }) => {
if (efficiency >= 98) return '#00B42A'; // 亮绿(最高效)
if (efficiency >= 97) return '#52C41A'; // 草绿
if (efficiency >= 96) return '#1890FF'; // 天蓝
if (efficiency >= 95) return '#4080FF'; // 蓝色
return '#808695'; // 灰色(最低效)
},
barStyle: {
radius: [4, 4, 0, 0] // 顶部圆角,更美观
},
label: {
position: 'top',
style: {
fontSize: 11,
fill: '#333',
fontWeight: 600
},
formatter: (item) => `${item}%`
},
// 关键:Y轴从90开始,让柱子更饱满
yAxis: {
min: 90,
max: 100,
tickCount: 6,
label: {
formatter: (v) => `${v}%`
}
},
grid: {
line: { style: { stroke: '#eee', lineWidth: 0.5 } }
},
animation: { appear: { animation: 'scale-in-y', duration: 1000 } }
};
const taskProgressConfig = {
data: [
{ type: '已完成', value: 40 },
@@ -174,89 +282,55 @@ export default function StationDashboard() {
}}
>
{/* 左侧图表列 - 最终完美版:不溢出 + 一定可见 */}
<Col xs={24} lg={6} style={{ flex: '0 0 25%', padding: '0 8px', display: 'flex', flexDirection: 'column', height: '100%', gap: "8px", overflowX: 'hidden', overflowY: 'auto', scrollbarWidth: 'thin', scrollbarColor: '#ccc transparent' }}>
<Col
xs={24}
lg={6}
style={{
flex: '0 0 25%',
padding: '0 8px',
display: 'flex',
flexDirection: 'column',
height: '100%',
gap: '12px',
overflowX: 'hidden',
overflowY: 'auto',
scrollbarWidth: 'thin',
}}
>
<Card
title={<span style={{ color: '#0837A8', fontWeight: 800 }}>发电趋势</span>}
bordered={false}
style={{
...cardStyle,
flex: 1,
padding: '8px 12px',
display: 'flex',
flexDirection: 'column',
boxSizing: 'border-box'
}}
bodyStyle={{ padding: 8 }}
style={{ borderRadius: 8, flex: 1, padding: 0 }}
bodyStyle={{ padding: '8px 12px' }}
>
<Line
{...powerTrendConfig}
height={100} /* 图表安全高度 */
autoFit={true}
style={{ width: '100%' }}
/>
<Line {...powerTrendConfig} height={140} autoFit />
</Card>
<Card
title={<span style={{ color: '#0837A8', fontWeight: 800 }}>辐照度与温度</span>}
bordered={false}
style={{
...cardStyle,
flex: 1,
padding: '8px 12px',
display: 'flex',
flexDirection: 'column',
boxSizing: 'border-box'
}}
bodyStyle={{ padding: 8 }}
style={{ borderRadius: 8, flex: 1, padding: 0 }}
bodyStyle={{ padding: '8px 12px' }}
>
<Line
{...irradianceConfig}
height={100} /* 图表安全高度 */
autoFit={true}
style={{ width: '100%' }}
/>
<Line {...irradianceConfig} height={140} autoFit />
</Card>
<Card
title={<span style={{ color: '#0837A8', fontWeight: 800 }}>逆变器效率</span>}
bordered={false}
style={{
...cardStyle,
flex: 1,
padding: '8px 12px',
display: 'flex',
flexDirection: 'column',
boxSizing: 'border-box'
}}
bodyStyle={{ padding: 8 }}
style={{ borderRadius: 8, flex: 1, padding: 0 }}
bodyStyle={{ padding: '8px 12px' }}
>
<Bar
{...invEfficiencyConfig}
height={100} /* 图表安全高度 */
autoFit={true}
style={{ width: '100%' }}
/>
<Bar {...invEfficiencyConfig} height={140} autoFit />
</Card>
<Card
title={<span style={{ color: '#0837A8', fontWeight: 800 }}>运维任务进度</span>}
bordered={false}
style={{
...cardStyle,
flex: 1,
padding: '8px 12px',
display: 'flex',
flexDirection: 'column',
boxSizing: 'border-box'
}}
bodyStyle={{ padding: 8 }}
style={{ borderRadius: 8, flex: 1, padding: 0 }}
bodyStyle={{ padding: '8px 12px' }}
>
<Pie
{...taskProgressConfig}
height={100} /* 图表安全高度 */
autoFit={true}
style={{ width: '100%' }}
/>
<Pie {...taskProgressConfig} height={140} autoFit />
</Card>
</Col>
<Col style={{ flex: '1 1 auto', }}>