Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f1ab4a79c |
@@ -26,7 +26,6 @@ import { Close, PlayArrow, Refresh, ShowChart, TableChart } from "@mui/icons-mat
|
|||||||
import { DataGrid, GridColDef } from "@mui/x-data-grid";
|
import { DataGrid, GridColDef } from "@mui/x-data-grid";
|
||||||
import { zhCN } from "@mui/x-data-grid/locales";
|
import { zhCN } from "@mui/x-data-grid/locales";
|
||||||
import ReactECharts from "echarts-for-react";
|
import ReactECharts from "echarts-for-react";
|
||||||
import * as echarts from "echarts";
|
|
||||||
import "dayjs/locale/zh-cn"; // 引入中文包
|
import "dayjs/locale/zh-cn"; // 引入中文包
|
||||||
import dayjs, { Dayjs } from "dayjs";
|
import dayjs, { Dayjs } from "dayjs";
|
||||||
import utc from "dayjs/plugin/utc";
|
import utc from "dayjs/plugin/utc";
|
||||||
@@ -587,8 +586,8 @@ const SCADADataPanel: React.FC<SCADADataPanelProps> = ({
|
|||||||
? "circle"
|
? "circle"
|
||||||
: metadata.source === "scada_raw"
|
: metadata.source === "scada_raw"
|
||||||
? "diamond"
|
? "diamond"
|
||||||
: "none",
|
: "circle",
|
||||||
symbolSize: isObserved ? 7 : 0,
|
symbolSize: isObserved ? 7 : 5,
|
||||||
showSymbol: isObserved,
|
showSymbol: isObserved,
|
||||||
sampling: "lttb",
|
sampling: "lttb",
|
||||||
connectNulls: false,
|
connectNulls: false,
|
||||||
@@ -602,22 +601,10 @@ const SCADADataPanel: React.FC<SCADADataPanelProps> = ({
|
|||||||
.map((point) => [
|
.map((point) => [
|
||||||
new Date(point.timestamp).getTime(), point.values[key] ?? null,
|
new Date(point.timestamp).getTime(), point.values[key] ?? null,
|
||||||
]),
|
]),
|
||||||
lineStyle: isObserved ? { width: 0 } : undefined,
|
lineStyle: {
|
||||||
areaStyle: isObserved
|
width: isObserved ? 0 : 2,
|
||||||
? undefined
|
type: metadata.source === "analysis_simulation" ? "dashed" : "solid",
|
||||||
: {
|
},
|
||||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
||||||
{
|
|
||||||
offset: 0,
|
|
||||||
color: colors[index % colors.length],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
offset: 1,
|
|
||||||
color: "rgba(255, 255, 255, 0)",
|
|
||||||
},
|
|
||||||
]),
|
|
||||||
opacity: 0.3,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
@@ -628,20 +615,34 @@ const SCADADataPanel: React.FC<SCADADataPanelProps> = ({
|
|||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: "axis",
|
trigger: "axis",
|
||||||
confine: true,
|
confine: true,
|
||||||
position: function (pt: any[]) {
|
axisPointer: { type: "line", lineStyle: { color: "#94a3b8", type: "dashed" } },
|
||||||
return [pt[0], "10%"];
|
valueFormatter: (value: number | string) => typeof value === "number"
|
||||||
},
|
? value.toLocaleString("zh-CN", { maximumSignificantDigits: 6, useGrouping: false })
|
||||||
|
: String(value ?? "--"),
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
top: "top",
|
type: "scroll",
|
||||||
|
top: 8,
|
||||||
|
left: 20,
|
||||||
|
width: "90%",
|
||||||
|
itemWidth: 20,
|
||||||
|
itemHeight: 8,
|
||||||
|
itemGap: 20,
|
||||||
|
textStyle: { color: "#475569", fontSize: 12 },
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
left: "5%",
|
top: 120,
|
||||||
right: "5%",
|
left: 20,
|
||||||
bottom: "11%",
|
right: 24,
|
||||||
|
bottom: 76,
|
||||||
containLabel: true,
|
containLabel: true,
|
||||||
},
|
},
|
||||||
toolbox: {
|
toolbox: {
|
||||||
|
top: 36,
|
||||||
|
right: 16,
|
||||||
|
itemSize: 15,
|
||||||
|
itemGap: 16,
|
||||||
|
iconStyle: { borderColor: "#64748b" },
|
||||||
feature: {
|
feature: {
|
||||||
dataZoom: {
|
dataZoom: {
|
||||||
yAxisIndex: "none",
|
yAxisIndex: "none",
|
||||||
@@ -659,7 +660,14 @@ const SCADADataPanel: React.FC<SCADADataPanelProps> = ({
|
|||||||
axisLabel: {
|
axisLabel: {
|
||||||
formatter: (value: number) => dayjs(value).tz("Asia/Shanghai").format("MM-DD\nHH:mm"),
|
formatter: (value: number) => dayjs(value).tz("Asia/Shanghai").format("MM-DD\nHH:mm"),
|
||||||
hideOverlap: true,
|
hideOverlap: true,
|
||||||
|
color: "#64748b",
|
||||||
|
fontSize: 12,
|
||||||
|
lineHeight: 16,
|
||||||
|
margin: 12,
|
||||||
},
|
},
|
||||||
|
splitNumber: 6,
|
||||||
|
axisLine: { lineStyle: { color: "#cbd5e1" } },
|
||||||
|
axisTick: { show: false },
|
||||||
},
|
},
|
||||||
yAxis: [
|
yAxis: [
|
||||||
...(hasFlowSeries
|
...(hasFlowSeries
|
||||||
@@ -668,6 +676,9 @@ const SCADADataPanel: React.FC<SCADADataPanelProps> = ({
|
|||||||
type: "value",
|
type: "value",
|
||||||
scale: true,
|
scale: true,
|
||||||
name: `流量 (${FLOW_DISPLAY_UNIT})`,
|
name: `流量 (${FLOW_DISPLAY_UNIT})`,
|
||||||
|
nameTextStyle: { color: "#64748b", fontSize: 12 },
|
||||||
|
axisLabel: { color: "#64748b", fontSize: 12 },
|
||||||
|
splitLine: { lineStyle: { color: "#e2e8f0", type: "dashed" } },
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
@@ -677,6 +688,9 @@ const SCADADataPanel: React.FC<SCADADataPanelProps> = ({
|
|||||||
type: "value",
|
type: "value",
|
||||||
scale: true,
|
scale: true,
|
||||||
name: `压力 (${PRESSURE_DISPLAY_UNIT})`,
|
name: `压力 (${PRESSURE_DISPLAY_UNIT})`,
|
||||||
|
nameTextStyle: { color: "#64748b", fontSize: 12 },
|
||||||
|
axisLabel: { color: "#64748b", fontSize: 12 },
|
||||||
|
splitLine: { show: !hasFlowSeries, lineStyle: { color: "#e2e8f0", type: "dashed" } },
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
@@ -688,8 +702,23 @@ const SCADADataPanel: React.FC<SCADADataPanelProps> = ({
|
|||||||
end: 100,
|
end: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
type: "slider",
|
||||||
start: 0,
|
start: 0,
|
||||||
end: 100,
|
end: 100,
|
||||||
|
bottom: 12,
|
||||||
|
height: 24,
|
||||||
|
showDetail: false,
|
||||||
|
borderColor: "transparent",
|
||||||
|
backgroundColor: "#f5f7fa",
|
||||||
|
fillerColor: "rgba(25, 118, 210, 0.08)",
|
||||||
|
dataBackground: {
|
||||||
|
lineStyle: { color: "#94a3b8" },
|
||||||
|
areaStyle: { opacity: 0 },
|
||||||
|
},
|
||||||
|
selectedDataBackground: {
|
||||||
|
lineStyle: { color: "#1976d2" },
|
||||||
|
areaStyle: { opacity: 0 },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
series: getSeries().map((series, index) => ({
|
series: getSeries().map((series, index) => ({
|
||||||
@@ -698,7 +727,13 @@ const SCADADataPanel: React.FC<SCADADataPanelProps> = ({
|
|||||||
? {
|
? {
|
||||||
markArea: {
|
markArea: {
|
||||||
silent: true,
|
silent: true,
|
||||||
itemStyle: { color: "rgba(255, 152, 0, 0.10)" },
|
itemStyle: { color: "rgba(255, 152, 0, 0.06)" },
|
||||||
|
label: {
|
||||||
|
position: "insideTop",
|
||||||
|
distance: 10,
|
||||||
|
color: "#996515",
|
||||||
|
fontSize: 11,
|
||||||
|
},
|
||||||
data: [[
|
data: [[
|
||||||
{ name: "事件方案时段", xAxis: Date.parse(eventRange.start) },
|
{ name: "事件方案时段", xAxis: Date.parse(eventRange.start) },
|
||||||
{ xAxis: Date.parse(eventRange.end) },
|
{ xAxis: Date.parse(eventRange.end) },
|
||||||
|
|||||||
Reference in New Issue
Block a user