d2aura 26.0.11 → 26.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/eda/edaManagerApi.d.ts +19 -2
- package/api/eda/edaManagerApi.js +36 -3
- package/api/eda/edaManagerApi.js.map +1 -1
- package/api/eda/generated/events.d.ts +86 -28
- package/api/eda/generated/events.js +154 -42
- package/api/eda/generated/events.js.map +1 -1
- package/api/eda/generated/structures.d.ts +21 -0
- package/api/eda/generated/structures.js.map +1 -1
- package/api/impl/utils/reportError.js +16 -0
- package/api/impl/utils/reportError.js.map +1 -1
- package/api/webPush/webPushApi.js.map +1 -1
- package/api/webPush/webPushUtils.js.map +1 -1
- package/core/i18n/d2aura.sk.json +8 -0
- package/core/i18n/jsapi.sk.json +4 -0
- package/core/i18n/jsapi.ua.json +4 -0
- package/coreui/components/edaManagerComponent/components/edaDataBasePanel.d.ts +13 -37
- package/coreui/components/edaManagerComponent/components/edaDataBasePanel.js +114 -211
- package/coreui/components/edaManagerComponent/components/edaDataBasePanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaDetailPanel.d.ts +2 -0
- package/coreui/components/edaManagerComponent/components/edaDetailPanel.js +2 -2
- package/coreui/components/edaManagerComponent/components/edaDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaGraphPanel.d.ts +14 -5
- package/coreui/components/edaManagerComponent/components/edaGraphPanel.js +338 -326
- package/coreui/components/edaManagerComponent/components/edaGraphPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaTablePanel.d.ts +15 -4
- package/coreui/components/edaManagerComponent/components/edaTablePanel.js +139 -64
- package/coreui/components/edaManagerComponent/components/edaTablePanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaTimeWindowPickerPanel.d.ts +3 -8
- package/coreui/components/edaManagerComponent/components/edaTimeWindowPickerPanel.js +12 -38
- package/coreui/components/edaManagerComponent/components/edaTimeWindowPickerPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaTreeView.d.ts +1 -1
- package/coreui/components/edaManagerComponent/components/edaTreeView.js +5 -5
- package/coreui/components/edaManagerComponent/components/edaTreeView.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaVectorDetailPanel.d.ts +8 -2
- package/coreui/components/edaManagerComponent/components/edaVectorDetailPanel.js +39 -11
- package/coreui/components/edaManagerComponent/components/edaVectorDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/context/edaVectorDataContext.d.ts +33 -0
- package/coreui/components/edaManagerComponent/context/edaVectorDataContext.js +3 -0
- package/coreui/components/edaManagerComponent/context/edaVectorDataContext.js.map +1 -0
- package/coreui/components/edaManagerComponent/context/edaVectorDataProvider.d.ts +9 -0
- package/coreui/components/edaManagerComponent/context/edaVectorDataProvider.js +267 -0
- package/coreui/components/edaManagerComponent/context/edaVectorDataProvider.js.map +1 -0
- package/coreui/components/edaManagerComponent/context/loadingContext.d.ts +7 -0
- package/coreui/components/edaManagerComponent/context/loadingContext.js +3 -0
- package/coreui/components/edaManagerComponent/context/loadingContext.js.map +1 -0
- package/coreui/components/edaManagerComponent/context/sharedSampleRange.d.ts +1 -2
- package/coreui/components/edaManagerComponent/context/sharedSampleRange.js +10 -0
- package/coreui/components/edaManagerComponent/context/sharedSampleRange.js.map +1 -1
- package/coreui/components/edaManagerComponent/edaDetail.d.ts +4 -12
- package/coreui/components/edaManagerComponent/edaDetail.js +53 -88
- package/coreui/components/edaManagerComponent/edaDetail.js.map +1 -1
- package/coreui/components/edaManagerComponent/edaNavigator.d.ts +2 -1
- package/coreui/components/edaManagerComponent/edaNavigator.js.map +1 -1
- package/coreui/components/edaManagerComponent/edaSelect.d.ts +13 -7
- package/coreui/components/edaManagerComponent/edaSelect.js +211 -7
- package/coreui/components/edaManagerComponent/edaSelect.js.map +1 -1
- package/coreui/components/edaManagerComponent/utils/utils.d.ts +17 -0
- package/coreui/components/edaManagerComponent/utils/utils.js +57 -0
- package/coreui/components/edaManagerComponent/utils/utils.js.map +1 -1
- package/coreui/components/webPush/webPushSwitch.js.map +1 -1
- package/coreui/images/logo.svg +9 -9
- package/coreui/images/logo_full.svg +11 -11
- package/d2configuration/edaManager/E.EM_NAVIGATOR_IMPL.xml +64 -2
- package/d2configuration/edaManager/E.EM_NAVIGATOR_SQL.xml +51 -13
- package/d2configuration/edaManager/E.EM_NAVIGATOR_UNIT.xml +304 -4
- package/d2configuration/edaManager/E.EM_VECTOR_IMPL.xml +9 -3
- package/d2configuration/edaManager/E.EM_VECTOR_UNIT.xml +89 -3
- package/d2configuration/edaManager/EDA_StatVectorRec.xml +56 -0
- package/d2configuration/edaManager/SD.EM_EDA_StatVectorRec_V1.xml +125 -0
- package/d2configuration/edaManager/SD.EM_Filter_Condition.xml +156 -0
- package/d2configuration/edaManager/SD.EM_Tree_Item.xml +34 -1
- package/package.json +3 -3
- package/coreui/components/edaManagerComponent/context/sharedSampleRangeWrapper.d.ts +0 -6
- package/coreui/components/edaManagerComponent/context/sharedSampleRangeWrapper.js +0 -14
- package/coreui/components/edaManagerComponent/context/sharedSampleRangeWrapper.js.map +0 -1
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { Button, Checkbox, ConfigProvider, Space } from "antd";
|
|
6
|
-
import ExtendedDataGrid from "d2coreui/components/grid/extendedDataGrid";
|
|
7
|
-
import i18n from "d2core/i18n/i18n";
|
|
8
|
-
import dayjs from "d2core/dayjs";
|
|
1
|
+
import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { SharedSampleRangeContext } from "../context/sharedSampleRange";
|
|
3
|
+
import { EdaVectorDataContext } from "../context/edaVectorDataContext";
|
|
4
|
+
import { Button, Checkbox, ConfigProvider, Space, theme } from "antd";
|
|
9
5
|
import { LocaleHolder } from "d2core/i18n/localeHolder";
|
|
10
|
-
import { DownloadOutlined, RetweetOutlined, StockOutlined, ZoomInOutlined } from "@ant-design/icons";
|
|
11
6
|
import { createStyles } from "antd-style";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
7
|
+
import { DownloadOutlined, RetweetOutlined, StockOutlined, ZoomInOutlined } from "@ant-design/icons";
|
|
8
|
+
import i18n from "d2core/i18n/i18n";
|
|
9
|
+
import ReactEcharts from "echarts-for-react";
|
|
10
|
+
import dayjs from "d2core/dayjs";
|
|
11
|
+
import ExtendedDataGrid from "d2coreui/components/grid/extendedDataGrid";
|
|
12
|
+
import { EdaDataBasePanel } from "./edaDataBasePanel";
|
|
13
|
+
import { formatValue } from "../utils/utils";
|
|
14
14
|
const useStyles = createStyles(({ css, token }) => {
|
|
15
15
|
return {
|
|
16
16
|
baseLayout: css `
|
|
17
17
|
display: flex;
|
|
18
18
|
flex-direction: column;
|
|
19
19
|
gap: ${token.paddingXXS}px;
|
|
20
|
+
height: 100%;
|
|
20
21
|
|
|
21
22
|
> .chart {
|
|
22
23
|
display: flex;
|
|
@@ -48,211 +49,146 @@ const rowSelection = {
|
|
|
48
49
|
checkboxes: false,
|
|
49
50
|
};
|
|
50
51
|
const colors = ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'];
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
export const EdaGraphPanel = ({ api, pageSize, type, data, isActive, showTimeWindow, showChartLegend, size }) => {
|
|
53
|
+
const mask = LocaleHolder.getDateTimeFormat(true, false, false, true);
|
|
54
|
+
const css = useStyles();
|
|
55
|
+
const range = useContext(SharedSampleRangeContext);
|
|
56
|
+
const dataContext = useContext(EdaVectorDataContext);
|
|
57
|
+
const chartInstance = useRef(null);
|
|
58
|
+
const chartContainerRef = useRef(null);
|
|
59
|
+
const gridApi = useRef(null);
|
|
60
|
+
const { token } = theme.useToken();
|
|
61
|
+
const [labelData, setLabelData] = useState(undefined);
|
|
62
|
+
const [showLegend, setShowLegend] = useState(!!showChartLegend);
|
|
63
|
+
const [dataZoom, setDataZoom] = useState(false);
|
|
64
|
+
const chartOptions = useMemo(() => ({
|
|
65
|
+
grid: {
|
|
66
|
+
bottom: 60 + 2 * token.paddingXXS + (!showLegend ? 30 : 0),
|
|
67
|
+
top: token.padding
|
|
55
68
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.mask = LocaleHolder.getDateTimeFormat(true, false, false, true);
|
|
65
|
-
this.chartInstance = null;
|
|
66
|
-
this.tooltipFormatter = this.tooltipFormatter.bind(this);
|
|
67
|
-
this.legendSelectChanged = this.legendSelectChanged.bind(this);
|
|
68
|
-
this.checkboxCellRenderer = this.checkboxCellRenderer.bind(this);
|
|
69
|
-
this.onHeaderCheckboxToggle = this.onHeaderCheckboxToggle.bind(this);
|
|
70
|
-
this.getOptions = memoizeOne(this.getOptions);
|
|
71
|
-
}
|
|
72
|
-
async componentDidUpdate(prevProps, prevState) {
|
|
73
|
-
await super.componentDidUpdate(prevProps, prevState);
|
|
74
|
-
if (prevState.labelData !== this.state.labelData) {
|
|
75
|
-
this.setState({ columnDefs: this.getColumnDefs() });
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
getDefaultDataBaseState(props) {
|
|
79
|
-
return {
|
|
80
|
-
columnDefs: this.getColumnDefs(),
|
|
81
|
-
showLegend: props.showChartLegend,
|
|
82
|
-
dataZoom: false,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
onDataLoaded(data, vectors) {
|
|
86
|
-
const { labelData } = this.state;
|
|
87
|
-
if (labelData === undefined) {
|
|
88
|
-
const chartSeries = vectors.map((v) => {
|
|
89
|
-
const values = data[v.ID] || [];
|
|
90
|
-
return {
|
|
91
|
-
name: v.DisplayName ?? String(v.ID),
|
|
92
|
-
id: v.ID,
|
|
93
|
-
type: 'line',
|
|
94
|
-
symbol: 'none',
|
|
95
|
-
sampling: "minmax",
|
|
96
|
-
step: "end",
|
|
97
|
-
lineStyle: {
|
|
98
|
-
width: 1,
|
|
99
|
-
},
|
|
100
|
-
data: values.map(v => [v.Value.valueTime, v.Value.value]),
|
|
101
|
-
animationDuration: 300,
|
|
102
|
-
animationEasing: 'exponentialOut',
|
|
103
|
-
};
|
|
104
|
-
});
|
|
105
|
-
const selectedMap = {};
|
|
106
|
-
const labels = vectors.map((v, index) => ({ ...v, id: index, visible: true, invalid: false }));
|
|
107
|
-
labels?.forEach(item => {
|
|
108
|
-
selectedMap[item.DisplayName] = item.visible;
|
|
109
|
-
});
|
|
110
|
-
this.chartInstance?.setOption({ series: chartSeries, legend: { selected: selectedMap } }, { replaceMerge: ['series'] });
|
|
111
|
-
this.setState({ labelData: labels });
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
const newLabelData = [...labelData];
|
|
115
|
-
newLabelData.forEach((row) => {
|
|
116
|
-
const values = data[row.ID];
|
|
117
|
-
this.chartInstance?.setOption({ series: [{ name: row.DisplayName, id: row.ID, data: values?.map(v => [v.Value.valueTime, v.Value.value]) }] });
|
|
118
|
-
row.invalid = !values;
|
|
119
|
-
});
|
|
120
|
-
this.setState({ labelData: newLabelData });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
onDataSourceChanged() {
|
|
124
|
-
this.setState({ labelData: undefined });
|
|
125
|
-
}
|
|
126
|
-
onLoadVectors(vectors) {
|
|
127
|
-
const { labelData } = this.state;
|
|
128
|
-
if (labelData) {
|
|
129
|
-
return vectors.filter((v) => labelData.find((l) => l.ID === v.ID && l.visible));
|
|
130
|
-
}
|
|
131
|
-
return vectors;
|
|
132
|
-
}
|
|
133
|
-
renderContent(token) {
|
|
134
|
-
const { showLegend } = this.state;
|
|
135
|
-
return (React.createElement(WithCss, { useStyles: useStyles }, (css) => React.createElement("div", { className: css.styles.baseLayout },
|
|
136
|
-
this.renderChart(token),
|
|
137
|
-
showLegend && this.renderLegend(token))));
|
|
138
|
-
}
|
|
139
|
-
renderChart(token) {
|
|
140
|
-
const { size } = this.props;
|
|
141
|
-
const { showLegend, dataZoom } = this.state;
|
|
142
|
-
return (React.createElement("div", { className: "chart" },
|
|
143
|
-
React.createElement(Space, null,
|
|
144
|
-
React.createElement(Button, { size: size, icon: React.createElement(StockOutlined, null), title: i18n("Show Legend"), type: showLegend ? "primary" : "default", onClick: () => this.setState({ showLegend: !showLegend }) }),
|
|
145
|
-
React.createElement(Space.Compact, null,
|
|
146
|
-
React.createElement(Button, { size: size, icon: React.createElement(ZoomInOutlined, null), title: i18n("Zoom"), type: dataZoom ? "primary" : "default", onClick: () => {
|
|
147
|
-
this.setState({ dataZoom: !dataZoom }, () => {
|
|
148
|
-
this.chartInstance?.dispatchAction({ type: 'takeGlobalCursor', key: 'dataZoomSelect', dataZoomSelectActive: this.state.dataZoom });
|
|
149
|
-
});
|
|
150
|
-
} }),
|
|
151
|
-
React.createElement(Button, { size: size, icon: React.createElement(RetweetOutlined, null), title: i18n("Restore"), onClick: () => {
|
|
152
|
-
this.setState({ dataZoom: false }, () => {
|
|
153
|
-
this.chartInstance?.dispatchAction({ type: 'dataZoom', start: 0, end: 100 });
|
|
154
|
-
this.chartInstance?.dispatchAction({ type: 'takeGlobalCursor', key: 'dataZoomSelect', dataZoomSelectActive: false });
|
|
155
|
-
});
|
|
156
|
-
} })),
|
|
157
|
-
React.createElement(Button, { size: size, icon: React.createElement(DownloadOutlined, null), title: i18n("Export as PNG"), onClick: () => {
|
|
158
|
-
if (this.chartInstance) {
|
|
159
|
-
const img = this.chartInstance.getDataURL({ type: 'png', pixelRatio: 2, backgroundColor: '#fff', excludeComponents: ['dataZoom', 'toolbox'] });
|
|
160
|
-
const link = document.createElement("a");
|
|
161
|
-
link.href = img;
|
|
162
|
-
link.download = "chart.png";
|
|
163
|
-
document.body.appendChild(link);
|
|
164
|
-
link.click();
|
|
165
|
-
document.body.removeChild(link);
|
|
166
|
-
}
|
|
167
|
-
} })),
|
|
168
|
-
React.createElement(ReactEcharts, { option: this.getOptions(token, !!showLegend), onChartReady: (instance) => {
|
|
169
|
-
this.chartInstance = instance;
|
|
170
|
-
instance.on("legendselectchanged", this.legendSelectChanged);
|
|
171
|
-
} })));
|
|
172
|
-
}
|
|
173
|
-
getOptions(token, showLegend) {
|
|
174
|
-
return {
|
|
175
|
-
grid: {
|
|
176
|
-
bottom: 60 + 2 * token.paddingXXS + (!showLegend ? 30 : 0),
|
|
177
|
-
top: token.padding
|
|
69
|
+
tooltip: {
|
|
70
|
+
backgroundColor: token.colorBgElevated,
|
|
71
|
+
borderColor: token.colorBorder,
|
|
72
|
+
textStyle: { color: token.colorText },
|
|
73
|
+
extraCssText: `box-shadow: ${token.boxShadowSecondary}; border-radius: ${token.borderRadius}px;`,
|
|
74
|
+
trigger: 'axis',
|
|
75
|
+
axisPointer: {
|
|
76
|
+
type: 'cross',
|
|
178
77
|
},
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
fontSize: token.fontSize,
|
|
194
|
-
color: token.colorText
|
|
78
|
+
appendTo: 'body',
|
|
79
|
+
formatter: (p) => tooltipFormatter(p, mask, dataContext),
|
|
80
|
+
},
|
|
81
|
+
textStyle: {
|
|
82
|
+
fontFamily: token.fontFamily,
|
|
83
|
+
fontSize: token.fontSize,
|
|
84
|
+
color: token.colorText
|
|
85
|
+
},
|
|
86
|
+
xAxis: {
|
|
87
|
+
axisLine: { lineStyle: { color: token.colorTextSecondary } },
|
|
88
|
+
axisTick: { lineStyle: { color: token.colorTextTertiary } },
|
|
89
|
+
axisLabel: {
|
|
90
|
+
color: token.colorTextSecondary,
|
|
91
|
+
hideOverlap: true,
|
|
195
92
|
},
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
formatter: (value) => dayjs(value).format(this.mask),
|
|
203
|
-
},
|
|
204
|
-
splitLine: { lineStyle: { color: token.colorBorder } },
|
|
205
|
-
type: 'time',
|
|
206
|
-
boundaryGap: [0, 0],
|
|
207
|
-
axisPointer: {
|
|
208
|
-
label: {
|
|
209
|
-
formatter: (value) => dayjs(value.value).format(this.mask),
|
|
210
|
-
}
|
|
93
|
+
splitLine: { lineStyle: { color: token.colorBorder } },
|
|
94
|
+
type: 'time',
|
|
95
|
+
boundaryGap: [0, 0],
|
|
96
|
+
axisPointer: {
|
|
97
|
+
label: {
|
|
98
|
+
formatter: (value) => dayjs(value.value).format(mask),
|
|
211
99
|
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
realtime: true,
|
|
228
|
-
labelFormatter: (value) => dayjs(value).format(this.mask),
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
type: 'inside',
|
|
232
|
-
realtime: true,
|
|
233
|
-
}
|
|
234
|
-
],
|
|
235
|
-
legend: {
|
|
236
|
-
show: !showLegend,
|
|
237
|
-
type: "scroll",
|
|
238
|
-
bottom: 0,
|
|
239
|
-
},
|
|
240
|
-
toolbox: {
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
yAxis: {
|
|
103
|
+
axisLine: { lineStyle: { color: token.colorTextSecondary } },
|
|
104
|
+
axisTick: { lineStyle: { color: token.colorTextTertiary } },
|
|
105
|
+
axisLabel: { color: token.colorTextSecondary },
|
|
106
|
+
splitLine: { lineStyle: { color: token.colorBorder } },
|
|
107
|
+
type: 'value'
|
|
108
|
+
},
|
|
109
|
+
dataZoom: [
|
|
110
|
+
{
|
|
111
|
+
bottom: showLegend ? token.paddingXXS + 8 : 40,
|
|
112
|
+
left: 130,
|
|
113
|
+
right: 130,
|
|
114
|
+
type: 'slider',
|
|
241
115
|
show: true,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
feature: {
|
|
245
|
-
dataZoom: {
|
|
246
|
-
yAxisIndex: 'none',
|
|
247
|
-
},
|
|
248
|
-
restore: {}
|
|
249
|
-
}
|
|
116
|
+
realtime: true,
|
|
117
|
+
labelFormatter: (value) => dayjs(value).format(mask),
|
|
250
118
|
},
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
119
|
+
{
|
|
120
|
+
type: 'inside',
|
|
121
|
+
realtime: true,
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
legend: {
|
|
125
|
+
show: !showLegend,
|
|
126
|
+
type: "scroll",
|
|
127
|
+
bottom: 0,
|
|
128
|
+
},
|
|
129
|
+
toolbox: {
|
|
130
|
+
show: true,
|
|
131
|
+
itemSize: 0,
|
|
132
|
+
right: 9999,
|
|
133
|
+
feature: {
|
|
134
|
+
dataZoom: {
|
|
135
|
+
yAxisIndex: 'none',
|
|
136
|
+
},
|
|
137
|
+
restore: {}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
color: colors,
|
|
141
|
+
}), [token, showLegend, mask, dataContext?.vectors]);
|
|
142
|
+
const legendSelectChanged = (params) => {
|
|
143
|
+
if (chartInstance.current !== null) {
|
|
144
|
+
const name = params.name;
|
|
145
|
+
const row = dataContext?.vectors.find((r) => r.DisplayName === name);
|
|
146
|
+
if (row) {
|
|
147
|
+
dataContext?.toggleVectorVisibility(row.ID, params.selected[name]);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const legendSelectRef = useRef(legendSelectChanged);
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
legendSelectRef.current = legendSelectChanged;
|
|
154
|
+
}, [legendSelectChanged]);
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
if (!chartContainerRef.current || !chartInstance.current) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
160
|
+
chartInstance.current?.resize();
|
|
161
|
+
});
|
|
162
|
+
resizeObserver.observe(chartContainerRef.current);
|
|
163
|
+
return () => resizeObserver.disconnect();
|
|
164
|
+
}, []);
|
|
165
|
+
const renderChart = () => (React.createElement(Space, { direction: "vertical", className: "chart" },
|
|
166
|
+
React.createElement(Space, null,
|
|
167
|
+
React.createElement(Button, { size: size, icon: React.createElement(StockOutlined, null), title: i18n("Show Legend"), type: showLegend ? "primary" : "default", onClick: () => setShowLegend(!showLegend) }),
|
|
168
|
+
React.createElement(Space.Compact, null,
|
|
169
|
+
React.createElement(Button, { size: size, icon: React.createElement(ZoomInOutlined, null), title: i18n("Zoom"), type: dataZoom ? "primary" : "default", onClick: () => setDataZoom(!dataZoom) }),
|
|
170
|
+
React.createElement(Button, { size: size, icon: React.createElement(RetweetOutlined, null), title: i18n("Restore"), onClick: () => {
|
|
171
|
+
setDataZoom(false);
|
|
172
|
+
chartInstance.current?.dispatchAction({ type: 'dataZoom', start: 0, end: 100 });
|
|
173
|
+
chartInstance.current?.dispatchAction({ type: 'takeGlobalCursor', key: 'dataZoomSelect', dataZoomSelectActive: false });
|
|
174
|
+
} })),
|
|
175
|
+
React.createElement(Button, { size: size, icon: React.createElement(DownloadOutlined, null), title: i18n("Export as PNG"), onClick: () => {
|
|
176
|
+
if (chartInstance.current) {
|
|
177
|
+
const img = chartInstance.current.getDataURL({ type: 'png', pixelRatio: 2, backgroundColor: '#fff', excludeComponents: ['dataZoom', 'toolbox'] });
|
|
178
|
+
const link = document.createElement("a");
|
|
179
|
+
link.href = img;
|
|
180
|
+
link.download = "chart.png";
|
|
181
|
+
document.body.appendChild(link);
|
|
182
|
+
link.click();
|
|
183
|
+
document.body.removeChild(link);
|
|
184
|
+
}
|
|
185
|
+
} })),
|
|
186
|
+
React.createElement("div", { style: { width: "100%", height: "100%" }, ref: chartContainerRef },
|
|
187
|
+
React.createElement(ReactEcharts, { style: { width: "100%", height: "100%" }, option: chartOptions, lazyUpdate: true, onChartReady: (instance) => {
|
|
188
|
+
chartInstance.current = instance;
|
|
189
|
+
instance.on("legendselectchanged", (params) => legendSelectRef.current(params));
|
|
190
|
+
} }))));
|
|
191
|
+
const renderLegend = () => {
|
|
256
192
|
const height = 35 + 28 * (labelData ?? []).length + 15;
|
|
257
193
|
return (React.createElement("div", { className: "legend", style: { flex: `0 0 ${height}px` } },
|
|
258
194
|
React.createElement(ExtendedDataGrid, { columnDefs: columnDefs, onLoadData: callback => {
|
|
@@ -260,134 +196,210 @@ class EdaGraphPanel extends EdaBaseDataPanel {
|
|
|
260
196
|
}, defaultGridConfiguration: {
|
|
261
197
|
pageSize: -1,
|
|
262
198
|
}, onGridReady: (params) => {
|
|
263
|
-
|
|
264
|
-
}, rowData: labelData, tablePanelStyle: { marginTop: `0 ${
|
|
199
|
+
gridApi.current = params.api;
|
|
200
|
+
}, rowData: labelData, tablePanelStyle: { marginTop: `0 ${token.paddingXXS}` }, panelStyle: { padding: `0 ${token.paddingXXS}px` }, toolbar: {
|
|
265
201
|
hideRecordCount: true,
|
|
266
202
|
renderToolbar: () => React.createElement(React.Fragment, null)
|
|
267
203
|
}, search: {
|
|
268
204
|
hidden: true,
|
|
269
205
|
searchButtonHidden: true,
|
|
270
206
|
}, noRecordsOverlayRenderer: () => React.createElement(React.Fragment, null), rowSelection: rowSelection })));
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
if (row.visible && row.invalid) {
|
|
281
|
-
this.loadVectorData([row]);
|
|
282
|
-
return;
|
|
207
|
+
};
|
|
208
|
+
const onHeaderCheckboxToggle = async (checked) => {
|
|
209
|
+
dataContext?.setAllVectorVisibility(checked);
|
|
210
|
+
};
|
|
211
|
+
const checkboxCellRenderer = (params) => {
|
|
212
|
+
return (React.createElement(ColoredCheckbox, { index: params.data.id, checked: dataContext?.visible.has(params.data.ID), onChange: async (event) => {
|
|
213
|
+
const row = dataContext?.vectors.find((l) => l.ID === params.data.ID);
|
|
214
|
+
if (row) {
|
|
215
|
+
dataContext?.toggleVectorVisibility(params.data.ID, event.target.checked);
|
|
283
216
|
}
|
|
217
|
+
} }));
|
|
218
|
+
};
|
|
219
|
+
const CustomHeader = (props) => {
|
|
220
|
+
return (React.createElement("div", { className: "custom-header-wrapper" },
|
|
221
|
+
React.createElement(Checkbox, { checked: dataContext?.allVectorsVisible() && !dataContext?.noVectorsVisible(), indeterminate: !dataContext?.allVectorsVisible() && !dataContext?.noVectorsVisible(), onChange: (e) => {
|
|
222
|
+
props.onToggle(e.target.checked);
|
|
223
|
+
} })));
|
|
224
|
+
};
|
|
225
|
+
const getColumnDefs = () => ([
|
|
226
|
+
{
|
|
227
|
+
field: "checkbox",
|
|
228
|
+
headerName: i18n("Checkbox"),
|
|
229
|
+
headerComponent: CustomHeader,
|
|
230
|
+
headerComponentParams: {
|
|
231
|
+
onToggle: onHeaderCheckboxToggle
|
|
232
|
+
},
|
|
233
|
+
maxWidth: 32,
|
|
234
|
+
width: 32,
|
|
235
|
+
minWidth: 32,
|
|
236
|
+
cellRenderer: checkboxCellRenderer,
|
|
237
|
+
group: i18n("Basic Columns")
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
field: "DisplayName",
|
|
241
|
+
headerName: i18n("Name"),
|
|
242
|
+
group: i18n("Basic Columns")
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
field: "Min",
|
|
246
|
+
headerName: i18n("Min"),
|
|
247
|
+
valueGetter: (props) => dataContext?.visible.has(props.data.ID) ? props.data.Min : undefined,
|
|
248
|
+
valueFormatter: (props) => formatValue(props.value, props.data.RoundingType, props.data.RoundingPlaces),
|
|
249
|
+
type: ["alignRight"],
|
|
250
|
+
group: i18n("Basic Columns")
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
field: "Max",
|
|
254
|
+
headerName: i18n("Max"),
|
|
255
|
+
valueGetter: (props) => dataContext?.visible.has(props.data.ID) ? props.data.Max : undefined,
|
|
256
|
+
valueFormatter: (props) => formatValue(props.value, props.data.RoundingType, props.data.RoundingPlaces),
|
|
257
|
+
type: ["alignRight"],
|
|
258
|
+
group: i18n("Basic Columns")
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
field: "Sum",
|
|
262
|
+
headerName: i18n("Sum"),
|
|
263
|
+
valueGetter: (props) => dataContext?.visible.has(props.data.ID) ? props.data.Sum : undefined,
|
|
264
|
+
valueFormatter: (props) => formatValue(props.value, props.data.RoundingType, props.data.RoundingPlaces),
|
|
265
|
+
type: ["alignRight"],
|
|
266
|
+
group: i18n("Basic Columns")
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
field: "Avg",
|
|
270
|
+
headerName: i18n("Average"),
|
|
271
|
+
valueGetter: (props) => dataContext?.visible.has(props.data.ID) ? props.data.Avg : undefined,
|
|
272
|
+
valueFormatter: (props) => formatValue(props.value, props.data.RoundingType, props.data.RoundingPlaces),
|
|
273
|
+
type: ["alignRight"],
|
|
274
|
+
group: i18n("Basic Columns")
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
field: "Units",
|
|
278
|
+
headerName: i18n("Units"),
|
|
279
|
+
valueGetter: (props) => dataContext?.visible.has(props.data.ID) ? props.data.Units : undefined,
|
|
280
|
+
group: i18n("Basic Columns")
|
|
281
|
+
},
|
|
282
|
+
]);
|
|
283
|
+
const columnDefs = useMemo(() => getColumnDefs(), [dataContext?.data, dataContext?.visible]);
|
|
284
|
+
useEffect(() => {
|
|
285
|
+
const selectedMap = {};
|
|
286
|
+
dataContext?.vectors.forEach((vector) => {
|
|
287
|
+
selectedMap[vector.DisplayName] = dataContext?.visible.has(vector.ID);
|
|
288
|
+
});
|
|
289
|
+
chartInstance.current?.setOption({ legend: { selected: selectedMap } });
|
|
290
|
+
}, [dataContext?.visible]);
|
|
291
|
+
useEffect(() => {
|
|
292
|
+
if (type === undefined || data === undefined || !range || !dataContext) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const dataSourceChanged = dataContext.loadedType !== type || dataContext.loadedData !== data;
|
|
296
|
+
if (isActive) {
|
|
297
|
+
if (dataSourceChanged) {
|
|
298
|
+
if (range.vectorPage !== 1) {
|
|
299
|
+
range.updateValues(range.btTotal, range.etTotal, range.sampling, 1);
|
|
300
|
+
}
|
|
301
|
+
setLabelData(undefined);
|
|
302
|
+
dataContext.loadAllData(type, data);
|
|
303
|
+
return;
|
|
284
304
|
}
|
|
285
|
-
|
|
305
|
+
dataContext.loadSpecificVectors(dataContext.vectors.filter((v) => dataContext.visible.has(v.ID)));
|
|
286
306
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
307
|
+
else if (dataSourceChanged) {
|
|
308
|
+
setLabelData(undefined);
|
|
309
|
+
}
|
|
310
|
+
}, [isActive, type, data, showTimeWindow, range]);
|
|
311
|
+
useEffect(() => {
|
|
312
|
+
if (dataContext?.data && dataContext.initialized) {
|
|
313
|
+
if (labelData === undefined) {
|
|
314
|
+
const chartSeries = dataContext.vectors.map((v) => {
|
|
315
|
+
const values = dataContext.data[v.ID] || [];
|
|
316
|
+
return {
|
|
317
|
+
name: v.DisplayName ?? String(v.ID),
|
|
318
|
+
id: v.ID,
|
|
319
|
+
type: 'line',
|
|
320
|
+
symbol: 'none',
|
|
321
|
+
sampling: "minmax",
|
|
322
|
+
step: "end",
|
|
323
|
+
lineStyle: {
|
|
324
|
+
width: 1,
|
|
325
|
+
},
|
|
326
|
+
data: values.data?.data?.map((v) => [v.Value.valueTime, v.Value.value]) ?? [],
|
|
327
|
+
animationDuration: 300,
|
|
328
|
+
animationEasing: 'exponentialOut',
|
|
329
|
+
};
|
|
330
|
+
});
|
|
331
|
+
const selectedMap = {};
|
|
332
|
+
const labels = dataContext.vectors.map((v, index) => {
|
|
333
|
+
const stats = dataContext.data[v.ID]?.data?.stats;
|
|
334
|
+
return {
|
|
335
|
+
...v,
|
|
336
|
+
id: index,
|
|
337
|
+
Min: stats?.Min.value,
|
|
338
|
+
Max: stats?.Max.value,
|
|
339
|
+
Sum: stats?.Sum.value,
|
|
340
|
+
Avg: stats?.Avg.value,
|
|
341
|
+
};
|
|
342
|
+
});
|
|
343
|
+
labels?.forEach((item) => {
|
|
344
|
+
selectedMap[item.DisplayName] = dataContext.isVectorVisible(item.ID);
|
|
345
|
+
});
|
|
346
|
+
chartInstance.current?.setOption({ series: chartSeries, legend: { selected: selectedMap } }, { replaceMerge: ['series'] });
|
|
347
|
+
setLabelData(labels);
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
const newLabelData = [...labelData];
|
|
351
|
+
newLabelData.forEach((row) => {
|
|
352
|
+
const values = dataContext.data[row.ID]?.data;
|
|
353
|
+
if (values?.data) {
|
|
354
|
+
chartInstance.current?.setOption({ series: [{ name: row.DisplayName, id: row.ID, data: values.data.map(v => [v.Value.valueTime, v.Value.value]) }] });
|
|
355
|
+
row.Min = values.stats?.Min.value;
|
|
356
|
+
row.Max = values.stats?.Max.value;
|
|
357
|
+
row.Sum = values.stats?.Sum.value;
|
|
358
|
+
row.Avg = values.stats?.Avg.value;
|
|
315
359
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
onHeaderCheckboxToggle(checked) {
|
|
321
|
-
const { labelData } = this.state;
|
|
322
|
-
if (!labelData) {
|
|
323
|
-
return;
|
|
360
|
+
});
|
|
361
|
+
setLabelData(newLabelData);
|
|
362
|
+
}
|
|
324
363
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
|
|
364
|
+
}, [dataContext?.data, dataContext?.vectors, dataContext?.initialized]);
|
|
365
|
+
useEffect(() => {
|
|
366
|
+
chartInstance.current?.dispatchAction({ type: 'takeGlobalCursor', key: 'dataZoomSelect', dataZoomSelectActive: dataZoom });
|
|
367
|
+
}, [dataZoom]);
|
|
368
|
+
if (range && dataContext) {
|
|
369
|
+
return (React.createElement(EdaDataBasePanel, { api: api, type: type, data: data, size: size, range: range, dataContext: dataContext, showTimeWindow: showTimeWindow, pageSize: pageSize },
|
|
370
|
+
React.createElement("div", { className: css.styles.baseLayout },
|
|
371
|
+
renderChart(),
|
|
372
|
+
showLegend && renderLegend())));
|
|
333
373
|
}
|
|
334
|
-
|
|
335
|
-
return
|
|
336
|
-
{
|
|
337
|
-
field: "checkbox",
|
|
338
|
-
headerName: i18n("Checkbox"),
|
|
339
|
-
headerComponent: CustomHeader,
|
|
340
|
-
headerComponentParams: {
|
|
341
|
-
labelData: this.state?.labelData,
|
|
342
|
-
onToggle: this.onHeaderCheckboxToggle
|
|
343
|
-
},
|
|
344
|
-
maxWidth: 32,
|
|
345
|
-
width: 32,
|
|
346
|
-
minWidth: 32,
|
|
347
|
-
cellRenderer: this.checkboxCellRenderer,
|
|
348
|
-
group: i18n("Basic Columns")
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
field: "DisplayName",
|
|
352
|
-
headerName: i18n("Name"),
|
|
353
|
-
group: i18n("Basic Columns")
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
field: "Min",
|
|
357
|
-
headerName: i18n("Min"),
|
|
358
|
-
group: i18n("Basic Columns")
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
field: "Max",
|
|
362
|
-
headerName: i18n("Max"),
|
|
363
|
-
group: i18n("Basic Columns")
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
field: "Sum",
|
|
367
|
-
headerName: i18n("Sum"),
|
|
368
|
-
group: i18n("Basic Columns")
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
field: "Average",
|
|
372
|
-
headerName: i18n("Average"),
|
|
373
|
-
group: i18n("Basic Columns")
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
field: "Units",
|
|
377
|
-
headerName: i18n("Units"),
|
|
378
|
-
group: i18n("Basic Columns")
|
|
379
|
-
},
|
|
380
|
-
];
|
|
374
|
+
else {
|
|
375
|
+
return React.createElement("h1", null, "no data");
|
|
381
376
|
}
|
|
382
|
-
}
|
|
383
|
-
const CustomHeader = (props) => {
|
|
384
|
-
const { labelData, onToggle } = props;
|
|
385
|
-
const visibleCount = labelData?.filter((i) => i.visible).length ?? 0;
|
|
386
|
-
const totalCount = labelData?.length || 0;
|
|
387
|
-
return (React.createElement("div", { className: "custom-header-wrapper" },
|
|
388
|
-
React.createElement(Checkbox, { checked: totalCount > 0 && visibleCount === totalCount, indeterminate: visibleCount > 0 && visibleCount < totalCount, onChange: (e) => {
|
|
389
|
-
onToggle(e.target.checked);
|
|
390
|
-
} })));
|
|
391
377
|
};
|
|
392
|
-
|
|
378
|
+
const ColoredCheckbox = ({ index, children, ...props }) => {
|
|
379
|
+
const theme = React.useMemo(() => ({
|
|
380
|
+
token: {
|
|
381
|
+
colorPrimary: colors[index % colors.length],
|
|
382
|
+
},
|
|
383
|
+
hashed: true,
|
|
384
|
+
}), [index]);
|
|
385
|
+
return (React.createElement(ConfigProvider, { theme: theme },
|
|
386
|
+
React.createElement(Checkbox, { ...props }, children)));
|
|
387
|
+
};
|
|
388
|
+
const tooltipFormatter = (p, mask, dataContext) => {
|
|
389
|
+
const params = p;
|
|
390
|
+
const values = params[0].value;
|
|
391
|
+
const date = dayjs(values[0]).format(mask);
|
|
392
|
+
let list = `<div style="margin-bottom: 4px;">${date}</div>`;
|
|
393
|
+
params.forEach((item) => {
|
|
394
|
+
const values = item.value;
|
|
395
|
+
const vectorInfo = dataContext?.vectors.find((v) => v.DisplayName === item.seriesName);
|
|
396
|
+
if (vectorInfo) {
|
|
397
|
+
const value = values[1] !== null ? (formatValue(values[1], vectorInfo.RoundingType, vectorInfo.RoundingPlaces) + " " + (vectorInfo.Units ?? "")) : "Invalid";
|
|
398
|
+
list += `<div style="display: flex; justify-content: space-between; align-items: center; min-width: 150px; gap: 20px;">`;
|
|
399
|
+
list += `<span style="display: flex; align-items: center;">${item.marker}<span style="margin-left: 5px;">${item.seriesName}</span></span>`;
|
|
400
|
+
list += `<span style="font-weight: bold;">${value}</span></div>`;
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
return list;
|
|
404
|
+
};
|
|
393
405
|
//# sourceMappingURL=edaGraphPanel.js.map
|