evui 3.3.62 → 3.3.64
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/dist/evui.common.js +2245 -3239
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +2245 -3239
- package/dist/evui.umd.js.map +1 -1
- package/dist/evui.umd.min.js +1 -1
- package/dist/evui.umd.min.js.map +1 -1
- package/package.json +2 -1
- package/src/components/chart/Chart.vue +10 -3
- package/src/components/chart/chart.core.js +14 -3
- package/src/components/chart/element/element.scatter.js +149 -46
- package/src/components/chart/model/model.series.js +1 -1
- package/src/components/chart/model/model.store.js +267 -1
- package/src/components/chart/plugins/plugins.interaction.js +77 -11
- package/src/components/chart/plugins/plugins.scrollbar.js +17 -23
- package/src/components/chart/scale/scale.js +7 -2
- package/src/components/chart/uses.js +4 -0
- package/src/components/grid/Grid.vue +9 -74
- package/src/components/grid/grid.toolbar.vue +2 -1
- package/src/components/grid/style/grid.scss +0 -39
- package/src/components/grid/uses.js +58 -219
- package/src/components/select/uses.js +13 -1
- package/src/components/treeGrid/style/treeGrid.scss +1 -40
- package/src/components/treeGrid/treeGrid.toolbar.vue +4 -3
- package/src/style/themes.scss +0 -3
- package/src/components/grid/grid.filter.window.vue +0 -493
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "evui",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.64",
|
|
4
4
|
"description": "A EXEM Library project",
|
|
5
5
|
"author": "exem <dev_client@ex-em.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"core-js": "^3.6.5",
|
|
24
24
|
"dayjs": "^1.10.4",
|
|
25
|
+
"korean-regexp": "^1.0.10",
|
|
25
26
|
"vue": "^3.0.0",
|
|
26
27
|
"vue-resize-observer": "^2.0.15",
|
|
27
28
|
"vue3-observe-visibility": "^0.1.2",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
'click',
|
|
68
68
|
'dbl-click',
|
|
69
69
|
'drag-select',
|
|
70
|
+
'mouse-move',
|
|
70
71
|
'update:selectedItem',
|
|
71
72
|
'update:selectedLabel',
|
|
72
73
|
'update:selectedSeries',
|
|
@@ -126,9 +127,13 @@
|
|
|
126
127
|
selected = selectSeriesInfo;
|
|
127
128
|
}
|
|
128
129
|
|
|
130
|
+
const chartData = props.options.realTimeScatter?.use
|
|
131
|
+
? { ...props.data, groups: [], labels: [] }
|
|
132
|
+
: normalizedData;
|
|
133
|
+
|
|
129
134
|
evChart = new EvChart(
|
|
130
135
|
wrapper.value,
|
|
131
|
-
|
|
136
|
+
chartData,
|
|
132
137
|
normalizedOptions,
|
|
133
138
|
eventListeners,
|
|
134
139
|
selectItemInfo,
|
|
@@ -165,14 +170,16 @@
|
|
|
165
170
|
}, { deep: true, flush: 'post' });
|
|
166
171
|
|
|
167
172
|
watch(() => props.data, (chartData) => {
|
|
168
|
-
const newData =
|
|
173
|
+
const newData = props.options.realTimeScatter?.use
|
|
174
|
+
? { ...chartData, groups: [], labels: [] }
|
|
175
|
+
: getNormalizedData(chartData);
|
|
169
176
|
const isUpdateSeries = !isEqual(newData.series, evChart.data.series)
|
|
170
177
|
|| !isEqual(newData.groups, evChart.data.groups)
|
|
171
178
|
|| props.options.type === 'heatMap';
|
|
172
179
|
|
|
173
180
|
const isUpdateData = !isEqual(newData, evChart.data);
|
|
174
181
|
|
|
175
|
-
evChart.data = cloneDeep(newData);
|
|
182
|
+
evChart.data = props.options.realTimeScatter?.use ? newData : cloneDeep(newData);
|
|
176
183
|
|
|
177
184
|
evChart.update({
|
|
178
185
|
updateSeries: isUpdateSeries,
|
|
@@ -104,14 +104,18 @@ class EvChart {
|
|
|
104
104
|
*/
|
|
105
105
|
init() {
|
|
106
106
|
const { series, data, labels, groups } = this.data;
|
|
107
|
-
const { type, axesX, axesY, tooltip, horizontal } = this.options;
|
|
107
|
+
const { type, axesX, axesY, tooltip, horizontal, realTimeScatter } = this.options;
|
|
108
108
|
|
|
109
109
|
this.createSeriesSet(series, type, horizontal, groups);
|
|
110
110
|
if (groups.length) {
|
|
111
111
|
this.addGroupInfo(groups);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
if (realTimeScatter?.use) {
|
|
115
|
+
this.createRealTimeScatterDataSet(data);
|
|
116
|
+
} else {
|
|
117
|
+
this.createDataSet(data, labels);
|
|
118
|
+
}
|
|
115
119
|
this.minMax = this.getStoreMinMax();
|
|
116
120
|
|
|
117
121
|
this.initRect();
|
|
@@ -232,6 +236,8 @@ class EvChart {
|
|
|
232
236
|
}
|
|
233
237
|
});
|
|
234
238
|
|
|
239
|
+
const duple = new Set();
|
|
240
|
+
|
|
235
241
|
const chartKeys = Object.keys(this.seriesInfo.charts);
|
|
236
242
|
for (let ix = 0; ix < chartKeys.length; ix++) {
|
|
237
243
|
const chartType = chartKeys[ix];
|
|
@@ -322,6 +328,7 @@ class EvChart {
|
|
|
322
328
|
series.draw({
|
|
323
329
|
legendHitInfo,
|
|
324
330
|
selectInfo,
|
|
331
|
+
duple,
|
|
325
332
|
...opt,
|
|
326
333
|
});
|
|
327
334
|
break;
|
|
@@ -752,7 +759,11 @@ class EvChart {
|
|
|
752
759
|
this.addGroupInfo(groups);
|
|
753
760
|
}
|
|
754
761
|
|
|
755
|
-
this.
|
|
762
|
+
if (this.options.realTimeScatter?.use) {
|
|
763
|
+
this.createRealTimeScatterDataSet(data);
|
|
764
|
+
} else {
|
|
765
|
+
this.createDataSet(data, labels);
|
|
766
|
+
}
|
|
756
767
|
|
|
757
768
|
// title update
|
|
758
769
|
if (options.title.show) {
|
|
@@ -4,7 +4,7 @@ import Util from '../helpers/helpers.util';
|
|
|
4
4
|
import Canvas from '../helpers/helpers.canvas';
|
|
5
5
|
|
|
6
6
|
class Scatter {
|
|
7
|
-
constructor(sId, opt, sIdx) {
|
|
7
|
+
constructor(sId, opt, sIdx, realTimeScatter = false) {
|
|
8
8
|
const merged = merge({}, LINE_OPTION, opt);
|
|
9
9
|
Object.keys(merged).forEach((key) => {
|
|
10
10
|
this[key] = merged[key];
|
|
@@ -14,7 +14,7 @@ class Scatter {
|
|
|
14
14
|
this.name = `series-${sIdx}`;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
['color', 'pointFill', 'fillColor'].forEach((colorProp) => {
|
|
17
|
+
['color', 'pointFill', 'fillColor', 'overflowColor'].forEach((colorProp) => {
|
|
18
18
|
if (this[colorProp] === undefined) {
|
|
19
19
|
this[colorProp] = COLOR[sIdx];
|
|
20
20
|
}
|
|
@@ -23,6 +23,7 @@ class Scatter {
|
|
|
23
23
|
this.sId = sId;
|
|
24
24
|
this.data = [];
|
|
25
25
|
this.type = 'scatter';
|
|
26
|
+
this.realTimeScatter = realTimeScatter;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -36,14 +37,45 @@ class Scatter {
|
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
if (this.realTimeScatter) {
|
|
41
|
+
this.realTimeScatterDraw(param);
|
|
42
|
+
} else {
|
|
43
|
+
this.defaultScatterDraw(param);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Calculate opacity for a data item in the series.
|
|
49
|
+
* @param {object} param - The parameter object passed to the draw function.
|
|
50
|
+
* @param {string} colorStr - The color string of the item.
|
|
51
|
+
* @param {number} dataIndex - The index of the item in the data array.
|
|
52
|
+
*
|
|
53
|
+
* @returns {number} - The calculated opacity level for the item.
|
|
54
|
+
*/
|
|
55
|
+
getOpacity(param, colorStr, dataIndex) {
|
|
56
|
+
const noneDownplayOpacity = colorStr.includes('rgba') ? Util.getOpacity(colorStr) : 1;
|
|
57
|
+
let isDownplay = false;
|
|
58
|
+
|
|
59
|
+
const { selectInfo, legendHitInfo } = param;
|
|
60
|
+
if (legendHitInfo) {
|
|
61
|
+
isDownplay = legendHitInfo.sId !== this.sId;
|
|
62
|
+
} else if (selectInfo) {
|
|
63
|
+
isDownplay = selectInfo?.seriesID !== this.sId || selectInfo?.dataIndex !== dataIndex;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return isDownplay ? 0.1 : noneDownplayOpacity;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Calculate x and y coordinates for a data item in the series.
|
|
71
|
+
* @param {object} item - The data item for which coordinates are to be calculated.
|
|
72
|
+
* @param {object} param - The parameter object passed to the draw function.
|
|
73
|
+
*
|
|
74
|
+
* @returns {undefined}
|
|
75
|
+
*/
|
|
76
|
+
calcItem(item, param) {
|
|
77
|
+
const { chartRect, labelOffset, axesSteps, displayOverflow } = param;
|
|
44
78
|
|
|
45
|
-
let x;
|
|
46
|
-
let y;
|
|
47
79
|
let aliasPixel;
|
|
48
80
|
const minmaxX = axesSteps.x[this.xAxisIndex];
|
|
49
81
|
const minmaxY = axesSteps.y[this.yAxisIndex];
|
|
@@ -53,53 +85,118 @@ class Scatter {
|
|
|
53
85
|
const xsp = chartRect.x1 + labelOffset.left;
|
|
54
86
|
const ysp = chartRect.y2 - labelOffset.bottom;
|
|
55
87
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
88
|
+
let x = Canvas.calculateX(item.x, minmaxX.graphMin, minmaxX.graphMax, xArea, xsp);
|
|
89
|
+
const y = Canvas.calculateY(
|
|
90
|
+
displayOverflow && item.y > minmaxY.graphMax
|
|
91
|
+
? minmaxY.graphMax
|
|
92
|
+
: item.y,
|
|
93
|
+
minmaxY.graphMin,
|
|
94
|
+
minmaxY.graphMax,
|
|
95
|
+
yArea,
|
|
96
|
+
ysp,
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
if (x !== null) {
|
|
100
|
+
aliasPixel = Util.aliasPixel(x);
|
|
101
|
+
x += aliasPixel;
|
|
61
102
|
}
|
|
62
103
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
104
|
+
item.xp = x;
|
|
105
|
+
item.yp = y;
|
|
106
|
+
}
|
|
66
107
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Draw default scatter chart
|
|
110
|
+
* @param {object} param - The parameter object passed to the draw function.
|
|
111
|
+
*
|
|
112
|
+
* @returns {undefined}
|
|
113
|
+
*/
|
|
114
|
+
defaultScatterDraw(param) {
|
|
115
|
+
const { ctx } = param;
|
|
71
116
|
|
|
72
|
-
|
|
73
|
-
item
|
|
117
|
+
this.data.forEach((item, idx) => {
|
|
118
|
+
this.calcItem(item, param);
|
|
74
119
|
|
|
75
|
-
|
|
76
|
-
|
|
120
|
+
if (item.xp !== null && item.yp !== null) {
|
|
121
|
+
const color = item.dataColor || this.color;
|
|
122
|
+
ctx.strokeStyle = Util.colorStringToRgba(color, this.getOpacity(param, color, idx));
|
|
77
123
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
124
|
+
const pointFillColor = item.dataColor || this.pointFill;
|
|
125
|
+
ctx.fillStyle = Util.colorStringToRgba(
|
|
126
|
+
pointFillColor,
|
|
127
|
+
this.getOpacity(param, pointFillColor, idx),
|
|
128
|
+
);
|
|
81
129
|
|
|
82
|
-
|
|
83
|
-
if (legendHitInfo) {
|
|
84
|
-
isDownplay = legendHitInfo.sId !== this.sId;
|
|
85
|
-
} else if (selectInfo) {
|
|
86
|
-
isDownplay = selectInfo?.seriesID !== this.sId || selectInfo?.dataIndex !== dataIndex;
|
|
130
|
+
Canvas.drawPoint(ctx, this.pointStyle, this.pointSize, item.xp, item.yp);
|
|
87
131
|
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Draw real time scatter chart
|
|
137
|
+
* @param {object} param - The parameter object passed to the draw function.
|
|
138
|
+
*
|
|
139
|
+
* @returns {undefined}
|
|
140
|
+
*/
|
|
141
|
+
realTimeScatterDraw(param) {
|
|
142
|
+
const { ctx, axesSteps, duple } = param;
|
|
143
|
+
const minmaxY = axesSteps.y[this.yAxisIndex];
|
|
144
|
+
const pointStyle = typeof this.pointStyle === 'string' ? this.pointStyle : this.pointStyle.value;
|
|
145
|
+
const pointSize = typeof this.pointSize === 'number' ? this.pointSize : this.pointSize.value;
|
|
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];
|
|
150
|
+
|
|
151
|
+
if (!duple.has(`${item.x}${item.y}`)) {
|
|
152
|
+
duple.add(`${item.x}${item.y}`);
|
|
88
153
|
|
|
89
|
-
|
|
90
|
-
};
|
|
154
|
+
this.calcItem(item, param);
|
|
91
155
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
ctx.strokeStyle = Util.colorStringToRgba(color, getOpacity(color, idx));
|
|
156
|
+
if (item.xp !== null && item.yp !== null) {
|
|
157
|
+
const overflowColor = item.y > minmaxY.graphMax && this.overflowColor;
|
|
158
|
+
const color = overflowColor || item.color || this.color;
|
|
96
159
|
|
|
97
|
-
|
|
98
|
-
ctx.fillStyle = Util.colorStringToRgba(pointFillColor, getOpacity(pointFillColor, idx));
|
|
160
|
+
ctx.strokeStyle = color;
|
|
99
161
|
|
|
100
|
-
|
|
162
|
+
const pointFillColor = overflowColor || this.pointFill || item.color || this.color;
|
|
163
|
+
ctx.fillStyle = pointFillColor;
|
|
164
|
+
|
|
165
|
+
Canvas.drawPoint(ctx, pointStyle, pointSize, item.xp, item.yp);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
101
168
|
}
|
|
102
|
-
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Filters and returns data items based on input coordinates
|
|
174
|
+
*
|
|
175
|
+
* @param {Array} data - The data to filter
|
|
176
|
+
* @param {number} xsp - Start X coordinate
|
|
177
|
+
* @param {number} ysp - Start Y coordinate
|
|
178
|
+
* @param {number} xep - End X coordinate
|
|
179
|
+
* @param {number} yep - End Y coordinate
|
|
180
|
+
* @returns {Array} Filtered data items
|
|
181
|
+
*/
|
|
182
|
+
findItemsInRange(data, xsp, ysp, xep, yep) {
|
|
183
|
+
return data.filter(seriesData =>
|
|
184
|
+
(xsp - 1 <= seriesData.xp && seriesData.xp <= xep + 1
|
|
185
|
+
&& ysp - 1 <= seriesData.yp && seriesData.yp <= yep + 1));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
defaultScatterFindItems(gdata, xsp, ysp, xep, yep) {
|
|
189
|
+
return this.findItemsInRange(gdata, xsp, ysp, xep, yep);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
realTimeScatterFindItems(gdata, xsp, ysp, xep, yep) {
|
|
193
|
+
const items = [];
|
|
194
|
+
for (let i = 0; i < gdata[this.sId].dataGroup.length; i++) {
|
|
195
|
+
const obj = gdata[this.sId].dataGroup[i];
|
|
196
|
+
items.push(...this.findItemsInRange(obj.data, xsp, ysp, xep, yep));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return items;
|
|
103
200
|
}
|
|
104
201
|
|
|
105
202
|
/**
|
|
@@ -112,9 +209,13 @@ class Scatter {
|
|
|
112
209
|
const gdata = this.data;
|
|
113
210
|
const xep = xsp + width;
|
|
114
211
|
const yep = ysp + height;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
212
|
+
let items = [];
|
|
213
|
+
|
|
214
|
+
if (this.realTimeScatter) {
|
|
215
|
+
items = this.realTimeScatterFindItems(gdata, xsp, ysp, xep, yep);
|
|
216
|
+
} else {
|
|
217
|
+
items = this.defaultScatterFindItems(gdata, xsp, ysp, xep, yep);
|
|
218
|
+
}
|
|
118
219
|
|
|
119
220
|
return items;
|
|
120
221
|
}
|
|
@@ -161,6 +262,8 @@ class Scatter {
|
|
|
161
262
|
* @returns {object} graph item
|
|
162
263
|
*/
|
|
163
264
|
findGraphData(offset) {
|
|
265
|
+
if (this.realTimeScatter) return false;
|
|
266
|
+
|
|
164
267
|
const xp = offset[0];
|
|
165
268
|
const yp = offset[1];
|
|
166
269
|
const item = { data: null, hit: false, color: this.color, index: null };
|
|
@@ -72,7 +72,7 @@ const modules = {
|
|
|
72
72
|
return new Line(id, opt, index);
|
|
73
73
|
} else if (type === 'scatter') {
|
|
74
74
|
this.seriesInfo.charts.scatter.push(id);
|
|
75
|
-
return new Scatter(id, opt, index);
|
|
75
|
+
return new Scatter(id, opt, index, this.options.realTimeScatter?.use);
|
|
76
76
|
} else if (type === 'bar') {
|
|
77
77
|
this.seriesInfo.charts.bar.push(id);
|
|
78
78
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { reverse } from 'lodash-es';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
2
3
|
import Util from '../helpers/helpers.util';
|
|
3
4
|
|
|
4
5
|
const modules = {
|
|
@@ -61,6 +62,185 @@ const modules = {
|
|
|
61
62
|
});
|
|
62
63
|
},
|
|
63
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Take chart data and create a two-dimensional array, specify max/min and delete/add over time.
|
|
67
|
+
* @param {object} datas chart series info
|
|
68
|
+
*
|
|
69
|
+
* @returns {undefined}
|
|
70
|
+
*/
|
|
71
|
+
createRealTimeScatterDataSet(datas) {
|
|
72
|
+
const keys = Object.keys(datas);
|
|
73
|
+
|
|
74
|
+
if (!this.isInit) {
|
|
75
|
+
this.dataSet = {};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const minMaxValues = {
|
|
79
|
+
maxY: 0,
|
|
80
|
+
minY: Infinity,
|
|
81
|
+
fromTime: 0,
|
|
82
|
+
toTime: 0,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
for (let x = 0; x < keys.length; x++) {
|
|
86
|
+
const key = keys[x];
|
|
87
|
+
const data = datas[key];
|
|
88
|
+
const storeLength = data.length;
|
|
89
|
+
let lastTime = 0;
|
|
90
|
+
|
|
91
|
+
if (!this.isInit) {
|
|
92
|
+
this.dataSet[key] = {
|
|
93
|
+
dataGroup: [],
|
|
94
|
+
startIndex: 0,
|
|
95
|
+
endIndex: 0,
|
|
96
|
+
length: 0,
|
|
97
|
+
fromTime: 0,
|
|
98
|
+
toTime: 0,
|
|
99
|
+
};
|
|
100
|
+
this.dataSet[key].length = this.options.realTimeScatter.range || 300;
|
|
101
|
+
this.dataSet[key].toTime = Math.floor(Date.now() / 1000) * 1000;
|
|
102
|
+
this.dataSet[key].fromTime = this.dataSet[key].toTime
|
|
103
|
+
- this.dataSet[key].length * 1000;
|
|
104
|
+
this.dataSet[key].endIndex = this.dataSet[key].length - 1;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
for (let i = 0; i < storeLength; i++) {
|
|
108
|
+
const item = data[i];
|
|
109
|
+
|
|
110
|
+
if (lastTime < item.x) {
|
|
111
|
+
lastTime = item.x;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
lastTime = Math.floor(lastTime / 1000) * 1000;
|
|
116
|
+
if (
|
|
117
|
+
(this.dataSet[key].toTime - lastTime) / 1000
|
|
118
|
+
> this.dataSet[key].length && key === ''
|
|
119
|
+
) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
let gapCount = (lastTime - this.dataSet[key].toTime) / 1000;
|
|
124
|
+
if (gapCount > 0) {
|
|
125
|
+
this.dataSet[key].toTime = lastTime;
|
|
126
|
+
this.dataSet[key].fromTime = lastTime
|
|
127
|
+
- this.dataSet[key].length * 1000;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (!this.isInit) {
|
|
131
|
+
for (let i = 0; i < this.dataSet[key].length; i++) {
|
|
132
|
+
this.dataSet[key].dataGroup[i] = {
|
|
133
|
+
data: [],
|
|
134
|
+
max: 0,
|
|
135
|
+
min: Infinity,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
} else if (gapCount > 0) {
|
|
139
|
+
if (gapCount >= this.dataSet[key].length) {
|
|
140
|
+
for (let i = 0; i < this.dataSet[key].length; i++) {
|
|
141
|
+
this.dataSet[key].dataGroup[i].data.length = 0;
|
|
142
|
+
this.dataSet[key].dataGroup[i].max = 0;
|
|
143
|
+
this.dataSet[key].dataGroup[i].min = Infinity;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
this.dataSet[key].startIndex = 0;
|
|
147
|
+
this.dataSet[key].endIndex = this.dataSet[key].length - 1;
|
|
148
|
+
} else {
|
|
149
|
+
while (gapCount > 0) {
|
|
150
|
+
if (
|
|
151
|
+
this.dataSet[key].dataGroup[this.dataSet[key].startIndex]
|
|
152
|
+
=== null
|
|
153
|
+
) {
|
|
154
|
+
this.dataSet[key].dataGroup[this.dataSet[key].startIndex] = {
|
|
155
|
+
data: [],
|
|
156
|
+
max: 0,
|
|
157
|
+
min: Infinity,
|
|
158
|
+
};
|
|
159
|
+
} else {
|
|
160
|
+
this.dataSet[key]
|
|
161
|
+
.dataGroup[this.dataSet[key].startIndex].data.length = 0;
|
|
162
|
+
this.dataSet[key]
|
|
163
|
+
.dataGroup[this.dataSet[key].startIndex].max = 0;
|
|
164
|
+
this.dataSet[key]
|
|
165
|
+
.dataGroup[this.dataSet[key].startIndex].min = Infinity;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
++this.dataSet[key].startIndex;
|
|
169
|
+
|
|
170
|
+
if (this.dataSet[key].startIndex >= this.dataSet[key].length) {
|
|
171
|
+
this.dataSet[key].startIndex = 0;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
++this.dataSet[key].endIndex;
|
|
175
|
+
if (this.dataSet[key].endIndex >= this.dataSet[key].length) {
|
|
176
|
+
this.dataSet[key].endIndex = 0;
|
|
177
|
+
}
|
|
178
|
+
--gapCount;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
for (let i = 0; i < storeLength; i++) {
|
|
184
|
+
const item = data[i];
|
|
185
|
+
const xAxisTime = Math.floor(item.x / 1000) * 1000;
|
|
186
|
+
|
|
187
|
+
if (this.dataSet[key].fromTime <= xAxisTime) {
|
|
188
|
+
let index = this.dataSet[key].endIndex
|
|
189
|
+
- (this.dataSet[key].toTime - xAxisTime) / 1000;
|
|
190
|
+
if (index < 0) {
|
|
191
|
+
index = this.dataSet[key].length + index;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
this.dataSet[key].dataGroup[index].data.push({
|
|
195
|
+
x: item.x,
|
|
196
|
+
y: item.y,
|
|
197
|
+
color: item.color,
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
this.dataSet[key].dataGroup[index].max = Math.max(
|
|
201
|
+
this.dataSet[key].dataGroup[index].max,
|
|
202
|
+
item.y,
|
|
203
|
+
);
|
|
204
|
+
this.dataSet[key].dataGroup[index].min = Math.min(
|
|
205
|
+
this.dataSet[key].dataGroup[index].min,
|
|
206
|
+
item.y,
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const tempMinMax = {
|
|
212
|
+
maxY: 0,
|
|
213
|
+
minY: Infinity,
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
for (let i = 0; i < this.dataSet[key].length; i++) {
|
|
217
|
+
if (this.dataSet[key].dataGroup[i].max > tempMinMax.maxY) {
|
|
218
|
+
tempMinMax.maxY = this.dataSet[key].dataGroup[i].max;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (this.dataSet[key].dataGroup[i].min < tempMinMax.minY) {
|
|
222
|
+
tempMinMax.minY = this.dataSet[key].dataGroup[i].min;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
minMaxValues.maxY = Math.max(minMaxValues.maxY, tempMinMax.maxY);
|
|
227
|
+
minMaxValues.minY = Math.min(minMaxValues.minY, tempMinMax.minY);
|
|
228
|
+
minMaxValues.fromTime = this.dataSet[key].fromTime;
|
|
229
|
+
minMaxValues.toTime = this.dataSet[key].toTime;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
this.seriesInfo.charts.scatter.forEach((seriesID) => {
|
|
233
|
+
const series = this.seriesList[seriesID];
|
|
234
|
+
series.data = this.dataSet;
|
|
235
|
+
series.minMax = {
|
|
236
|
+
minX: dayjs(minMaxValues.fromTime),
|
|
237
|
+
minY: minMaxValues.minY,
|
|
238
|
+
maxX: dayjs(minMaxValues.toTime),
|
|
239
|
+
maxY: minMaxValues.maxY,
|
|
240
|
+
};
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
|
|
64
244
|
/**
|
|
65
245
|
* Take chart data and to create normalized pie data
|
|
66
246
|
* @param {object} data chart series info
|
|
@@ -855,7 +1035,7 @@ const modules = {
|
|
|
855
1035
|
}
|
|
856
1036
|
} else if (scale?.labels?.length) {
|
|
857
1037
|
const labelGap = (endPoint - startPoint) / scale.labels.length;
|
|
858
|
-
const isYAxis = targetAxis === 'yAxis'
|
|
1038
|
+
const isYAxis = targetAxis === 'yAxis';
|
|
859
1039
|
const index = Math.floor(((isYAxis ? y : x) - startPoint) / labelGap);
|
|
860
1040
|
labelIndex = scale.labels.length > index ? index : -1;
|
|
861
1041
|
} else {
|
|
@@ -886,6 +1066,92 @@ const modules = {
|
|
|
886
1066
|
};
|
|
887
1067
|
},
|
|
888
1068
|
|
|
1069
|
+
/**
|
|
1070
|
+
* Get current mouse target label value in label array or calculated using mouse position
|
|
1071
|
+
* @param {string} targetAxis target Axis Location ('xAxis', 'yAxis')
|
|
1072
|
+
* @param {array} offset return value from getMousePosition()
|
|
1073
|
+
* @param {number} labelIndex
|
|
1074
|
+
*
|
|
1075
|
+
* @returns {object} current mouse target label value
|
|
1076
|
+
*/
|
|
1077
|
+
getCurMouseLabelVal(targetAxis, offset, labelIndex) {
|
|
1078
|
+
const { type: chartType, horizontal } = this.options;
|
|
1079
|
+
const isXAxis = targetAxis === 'xAxis';
|
|
1080
|
+
const targetAxisDirection = isXAxis ? 'x' : 'y';
|
|
1081
|
+
|
|
1082
|
+
let labelVal = '';
|
|
1083
|
+
let labelIdx = -1;
|
|
1084
|
+
|
|
1085
|
+
const findLabelValInLabelArr = () => {
|
|
1086
|
+
let result = '';
|
|
1087
|
+
switch (chartType) {
|
|
1088
|
+
case 'bar':
|
|
1089
|
+
case 'line': {
|
|
1090
|
+
result = (
|
|
1091
|
+
(horizontal && !isXAxis)
|
|
1092
|
+
|| (!horizontal && isXAxis)
|
|
1093
|
+
) ? this.data.labels[labelIndex] : '';
|
|
1094
|
+
break;
|
|
1095
|
+
}
|
|
1096
|
+
case 'heatMap': {
|
|
1097
|
+
result = this.data.labels[targetAxisDirection][labelIndex];
|
|
1098
|
+
break;
|
|
1099
|
+
}
|
|
1100
|
+
default:
|
|
1101
|
+
break;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
return result;
|
|
1105
|
+
};
|
|
1106
|
+
|
|
1107
|
+
const calLabelValUseMousePos = () => {
|
|
1108
|
+
let result = '';
|
|
1109
|
+
const aPos = {
|
|
1110
|
+
x1: this.chartRect.x1 + this.labelOffset.left,
|
|
1111
|
+
x2: this.chartRect.x2 - this.labelOffset.right,
|
|
1112
|
+
y1: this.chartRect.y1 + this.labelOffset.top,
|
|
1113
|
+
y2: this.chartRect.y2 - this.labelOffset.bottom,
|
|
1114
|
+
};
|
|
1115
|
+
const {
|
|
1116
|
+
steps,
|
|
1117
|
+
interval: labelValInterval,
|
|
1118
|
+
graphMin,
|
|
1119
|
+
} = this.axesSteps[targetAxisDirection][0];
|
|
1120
|
+
const {
|
|
1121
|
+
width: labelWidth,
|
|
1122
|
+
height: labelHeight,
|
|
1123
|
+
} = this.axesRange[targetAxisDirection][0].size;
|
|
1124
|
+
const axes = isXAxis ? this.axesX : this.axesY;
|
|
1125
|
+
const axisStartPoint = aPos[axes[0].units.rectStart];
|
|
1126
|
+
const axisEndPoint = aPos[axes[0].units.rectEnd];
|
|
1127
|
+
const curMousePosInAxis = Math.abs(offset[isXAxis ? 0 : 1] - axisStartPoint);
|
|
1128
|
+
const labelMidLength = (isXAxis ? labelWidth : labelHeight) / 2;
|
|
1129
|
+
const labelPosInterval = Math.abs(axisStartPoint - axisEndPoint) / steps;
|
|
1130
|
+
const labelStep = Math.floor((curMousePosInAxis + labelMidLength) / labelPosInterval);
|
|
1131
|
+
|
|
1132
|
+
if (
|
|
1133
|
+
((labelPosInterval * labelStep) + labelMidLength > curMousePosInAxis)
|
|
1134
|
+
&& ((labelPosInterval * labelStep) - labelMidLength < curMousePosInAxis)
|
|
1135
|
+
) {
|
|
1136
|
+
result = (labelStep * labelValInterval) + graphMin;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
return result;
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
if (typeof labelIndex === 'number') {
|
|
1143
|
+
labelVal = findLabelValInLabelArr();
|
|
1144
|
+
labelIdx = labelIndex;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
if (!labelVal) {
|
|
1148
|
+
labelVal = calLabelValUseMousePos();
|
|
1149
|
+
labelIdx = -1;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
return { labelVal, labelIdx };
|
|
1153
|
+
},
|
|
1154
|
+
|
|
889
1155
|
/**
|
|
890
1156
|
* Create min/max information for all of data
|
|
891
1157
|
* @property seriesList
|