evui 3.4.26 → 3.4.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evui",
3
- "version": "3.4.26",
3
+ "version": "3.4.28",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -72,6 +72,10 @@
72
72
  type: Number,
73
73
  default: 0,
74
74
  },
75
+ realTimeScatterReset: {
76
+ type: Boolean,
77
+ default: false,
78
+ },
75
79
  },
76
80
  emits: [
77
81
  'click',
@@ -83,8 +87,9 @@
83
87
  'update:selectedSeries',
84
88
  'update:zoomStartIdx',
85
89
  'update:zoomEndIdx',
90
+ 'update:realTimeScatterReset',
86
91
  ],
87
- setup(props) {
92
+ setup(props, { emit }) {
88
93
  let evChart = null;
89
94
  const isMounted = ref(false);
90
95
  const injectIsChartGroup = inject('isChartGroup', false);
@@ -246,6 +251,28 @@
246
251
  });
247
252
  }
248
253
 
254
+ watch(() => props.realTimeScatterReset, (flag) => {
255
+ if (flag) {
256
+ Object.keys(evChart.dataSet).forEach((series) => {
257
+ if (evChart.dataSet[series]) {
258
+ evChart.dataSet[series].dataGroup = [];
259
+ }
260
+ });
261
+
262
+ emit('update:realTimeScatterReset', false);
263
+ }
264
+ });
265
+
266
+ watch(() => props.options.realTimeScatter?.use, (use) => {
267
+ evChart.options.realTimeScatter.use = use ?? false;
268
+
269
+ evChart.update({
270
+ updateSeries: true,
271
+ updateSelTip: { update: false, keepDomain: false },
272
+ updateData: false,
273
+ });
274
+ });
275
+
249
276
  onMounted(async () => {
250
277
  if (injectEvChartPropsInGroup?.value) {
251
278
  injectEvChartPropsInGroup.value.push(props);
@@ -144,9 +144,9 @@ class Scatter {
144
144
  const pointStyle = typeof this.pointStyle === 'string' ? this.pointStyle : this.pointStyle.value;
145
145
  const pointSize = typeof this.pointSize === 'number' ? this.pointSize : this.pointSize.value;
146
146
 
147
- for (let i = 0; i < this.data[this.sId].dataGroup.length; i++) {
148
- for (let j = 0; j < this.data[this.sId].dataGroup[i].data.length; j++) {
149
- const item = this.data[this.sId].dataGroup[i].data[j];
147
+ for (let i = 0; i < this.data[this.sId]?.dataGroup?.length; i++) {
148
+ for (let j = 0; j < this.data[this.sId]?.dataGroup[i]?.data.length; j++) {
149
+ const item = this.data[this.sId]?.dataGroup[i]?.data[j];
150
150
 
151
151
  if (!duple.has(`${item.x}${item.y}`)) {
152
152
  duple.add(`${item.x}${item.y}`);
@@ -81,7 +81,7 @@ const modules = {
81
81
  for (let x = 0; x < keys.length; x++) {
82
82
  const key = keys[x];
83
83
  const data = datas[key];
84
- const storeLength = data.length;
84
+ const storeLength = data?.length;
85
85
  let lastTime = 0;
86
86
 
87
87
  if (!this.isInit || this.updateSeries) {
@@ -98,13 +98,13 @@ const modules = {
98
98
  ...defaultValues,
99
99
  ...this.dataSet[key],
100
100
  };
101
- this.dataSet[key].length = this.options.realTimeScatter.range || 300;
102
- this.dataSet[key].toTime = Math.floor(Date.now() / 1000) * 1000;
103
- this.dataSet[key].fromTime = this.dataSet[key].toTime
104
- - this.dataSet[key].length * 1000;
105
- this.dataSet[key].endIndex = this.dataSet[key].length - 1;
106
101
  }
107
102
 
103
+ this.dataSet[key].length = this.options.realTimeScatter.range || 300;
104
+ this.dataSet[key].toTime = Math.floor(Date.now() / 1000) * 1000;
105
+ this.dataSet[key].fromTime = this.dataSet[key].toTime - this.dataSet[key].length * 1000;
106
+ this.dataSet[key].endIndex = this.dataSet[key].length - 1;
107
+
108
108
  for (let i = 0; i < storeLength; i++) {
109
109
  const item = data[i];
110
110
 
@@ -128,20 +128,19 @@ const modules = {
128
128
  - this.dataSet[key].length * 1000;
129
129
  }
130
130
 
131
- if (!this.isInit || this.updateSeries) {
132
- for (let i = 0; i < this.dataSet[key].length; i++) {
133
- const defaultValues = {
134
- data: [],
135
- max: 0,
136
- min: Infinity,
137
- };
131
+ for (let i = 0; i < this.dataSet[key].length; i++) {
132
+ const defaultValues = {
133
+ data: [],
134
+ max: 0,
135
+ min: Infinity,
136
+ };
138
137
 
139
- this.dataSet[key].dataGroup[i] = {
140
- ...defaultValues,
141
- ...this.dataSet[key].dataGroup[i],
142
- };
143
- }
144
- } else if (gapCount > 0) {
138
+ this.dataSet[key].dataGroup[i] = {
139
+ ...defaultValues,
140
+ ...this.dataSet[key].dataGroup[i],
141
+ };
142
+ }
143
+ if (gapCount > 0) {
145
144
  if (gapCount >= this.dataSet[key].length) {
146
145
  for (let i = 0; i < this.dataSet[key].length; i++) {
147
146
  this.dataSet[key].dataGroup[i].data.length = 0;
@@ -574,6 +574,7 @@ const modules = {
574
574
  return;
575
575
  }
576
576
 
577
+ this.tooltipDOM.style.display = 'block';
577
578
  const contentsWidth = customTooltipEl.offsetWidth;
578
579
  const contentsHeight = customTooltipEl.offsetHeight;
579
580
 
@@ -595,8 +596,6 @@ const modules = {
595
596
  this.tooltipDOM.style.top = expectedPosY > maximumPosY
596
597
  ? `${reversedPosY}px`
597
598
  : `${expectedPosY}px`;
598
-
599
- this.tooltipDOM.style.display = 'block';
600
599
  },
601
600
 
602
601
  /**
@@ -131,7 +131,16 @@ export default {
131
131
  if (column.type === 'number' || column.type === 'float') {
132
132
  let columnValues = [];
133
133
  if (props.isTree) {
134
- columnValues = stores.value.store.map(node => node.data?.[column.field]);
134
+ columnValues = stores.value.store.reduce((acc, cur) => {
135
+ if (column.summaryOnlyTopParent) {
136
+ if (!cur.parent) {
137
+ acc.push(cur.data?.[column.field]);
138
+ }
139
+ } else {
140
+ acc.push(cur.data?.[column.field]);
141
+ }
142
+ return acc;
143
+ }, []);
135
144
  } else {
136
145
  columnValues = stores.value.store.map(row => row[ROW_DATA_INDEX][columnIndex]);
137
146
  }