This commit is contained in:
lb 2023-12-29 11:06:07 +08:00
父節點 3f44cb9e9a
當前提交 a73d61fad8
共有 4 個檔案被更改,包括 115 行新增10 行删除

查看文件

@ -85,18 +85,31 @@ function preHandleStatisticData(data, legend) {
data: [],
}));
const seriesData = [];
legend.forEach((item, index) => {
series[index].name = item;
data.forEach((d, idx) => {
// if (index == 0) {
// series[index].label = {
if (index == legend.length - 1) {
series[index].label = {
show: true,
position: "top",
distance: 10,
color: "#fffc",
formatter: (params) => data[params.dataIndex].sum,
};
}
// const sum = d.sum;
// console.log("d", d, sum);
// series[index].label = ((fff) => {
// console.log("===>", fff);
// return {
// show: true,
// position: "top",
// distance: 10,
// color: "#fffc",
// formatter: "asdf" + fff,
// };
// }
// })(sum);
series[index].data.push(obj[d.name][item] || 0);
});
});
@ -107,9 +120,10 @@ function preHandleStatisticData(data, legend) {
function getOptions(series, isra, currentStatistic) {
return {
color: ["#2760FF", "#8167F6", "#5B9BFF", "#99D66C", "#FFD160", "#FF8A40"],
grid: { top: 42, right: 12, bottom: 20, left: 48 },
grid: { top: 80, right: 12, bottom: 20, left: 48 },
legend: {
top: 10,
left: 60,
padding: 5,
itemWidth: 12,
itemHeight: 12,

查看文件

@ -21,7 +21,7 @@ export default function handler(msg: MessageEvent) {
console.log("[*] websocket: [unable to serialize] ---> ", msg);
}
// console.log("[CUTTING DATA] ---> ", serializedData);
console.log("[CUTTING DATA] ---> ", serializedData);
if (serializedData == null) return;

查看文件

@ -70,7 +70,8 @@ new XClient(
// 烟气处理相关数据
new XClient(
// "ws://10.70.27.122:8080/websocket/message?userId=CUTTING",
"ws://10.70.2.2:8080/websocket/message?userId=GAS" + newUser,
// "ws://10.70.2.2:8080/websocket/message?userId=GAS" + newUser,
"ws://192.168.1.62:48082/websocket/message?userId=GAS" + newUser,
"SMOKE_DATA",
smokeHandler
);

查看文件

@ -1,7 +1,89 @@
import { store } from "../store";
type SmokeMessageItem = {
type: string;
realtime: {
SO2_float: number;
NOX_float: number;
O2_float: number;
dust_float: number;
};
dayTrend: {
SO2_float: Array<{
time: string;
value: number;
}>;
NOX_float: Array<{
time: string;
value: number;
}>;
O2_float: Array<{
time: string;
value: number;
}>;
dust_float: Array<{
time: string;
value: number;
}>;
};
weekTrend: {
SO2_float: Array<{
time: string;
value: number;
}>;
NOX_float: Array<{
time: string;
value: number;
}>;
O2_float: Array<{
time: string;
value: number;
}>;
dust_float: Array<{
time: string;
value: number;
}>;
};
monthTrend: {
SO2_float: Array<{
time: string;
value: number;
}>;
NOX_float: Array<{
time: string;
value: number;
}>;
O2_float: Array<{
time: string;
value: number;
}>;
dust_float: Array<{
time: string;
value: number;
}>;
};
yearTrend: {
SO2_float: Array<{
time: string;
value: number;
}>;
NOX_float: Array<{
time: string;
value: number;
}>;
O2_float: Array<{
time: string;
value: number;
}>;
dust_float: Array<{
time: string;
value: number;
}>;
};
};
export default function handler(msg: MessageEvent) {
let serializedData: { type: string; data: any } | null = null;
let serializedData: SmokeMessageItem | null = null;
try {
serializedData = JSON.parse(msg.data);
} catch (error) {
@ -11,9 +93,17 @@ export default function handler(msg: MessageEvent) {
case "exhaustGas": {
store.dispatch({
type: "smoke/setInfo",
payload: serializedData.data.realtime,
payload: serializedData.realtime,
});
store.dispatch({
type: "smoke/setTrend",
payload: {
dayTrend: serializedData.dayTrend,
weekTrend: serializedData.weekTrend,
monthTrend: serializedData.monthTrend,
yearTrend: serializedData.yearTrend,
},
});
store.dispatch({ type: "smoke/setTrend", payload: serializedData.data });
break;
}