From a7aa27242f99894f067d80906a9130ba99d33bd2 Mon Sep 17 00:00:00 2001 From: mmc <1556375442@qq.com> Date: Sat, 9 May 2026 15:02:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E4=B8=B0=E5=AF=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Home.tsx | 248 +++++++++++++++++++++++++++++---------------- 1 file changed, 161 insertions(+), 87 deletions(-) diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 24e55de..6a0779e 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -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() { }} > {/* 左侧图表列 - 最终完美版:不溢出 + 一定可见 */} - + 发电趋势} 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' }} > - + 辐照度与温度} 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' }} > - + 逆变器效率} 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' }} > - + 运维任务进度} 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' }} > - +