evui 3.3.40 → 3.3.42
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 +199 -168
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +199 -168
- 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 +1 -1
- package/src/components/chart/Chart.vue +1 -1
- package/src/components/chart/chart.core.js +2 -0
- package/src/components/chart/chartZoom.core.js +1 -1
- package/src/components/chart/element/element.line.js +6 -4
- package/src/components/chart/plugins/plugins.title.js +13 -8
- package/src/components/chart/scale/scale.js +2 -2
- package/src/components/chart/uses.js +14 -5
- package/src/components/chartBrush/ChartBrush.vue +1 -1
- package/src/components/chartBrush/chartBrush.core.js +49 -44
- package/src/components/chartGroup/ChartGroup.vue +6 -3
package/package.json
CHANGED
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
const injectIsChartGroup = inject('isChartGroup', false);
|
|
79
79
|
const injectBrushSeries = inject('brushSeries', { list: [], chartIdx: null });
|
|
80
80
|
const injectGroupSelectedLabel = inject('groupSelectedLabel', null);
|
|
81
|
-
const injectBrushIdx = inject('brushIdx', { start: 0, end:
|
|
81
|
+
const injectBrushIdx = inject('brushIdx', { start: 0, end: -1 });
|
|
82
82
|
|
|
83
83
|
const {
|
|
84
84
|
eventListeners,
|
|
@@ -438,7 +438,7 @@ export default class EvChartZoom {
|
|
|
438
438
|
}
|
|
439
439
|
};
|
|
440
440
|
|
|
441
|
-
if (isUseZoomMode) {
|
|
441
|
+
if (isUseZoomMode && this.dragZoomIcon.classList.contains('active')) {
|
|
442
442
|
const { previous, latest } = this.zoomAreaMemory;
|
|
443
443
|
|
|
444
444
|
toggleIconStyle(this.previousIcon, previous.length);
|
|
@@ -246,12 +246,14 @@ class Line {
|
|
|
246
246
|
let s = 0;
|
|
247
247
|
let e = gdata.length - 1;
|
|
248
248
|
|
|
249
|
+
const xpInterval = gdata[1].xp - gdata[0].xp < 6 ? 1.5 : 6;
|
|
250
|
+
|
|
249
251
|
while (s <= e) {
|
|
250
252
|
const m = Math.floor((s + e) / 2);
|
|
251
253
|
const x = gdata[m].xp;
|
|
252
254
|
const y = gdata[m].yp;
|
|
253
255
|
|
|
254
|
-
if ((x -
|
|
256
|
+
if ((x - xpInterval < xp) && (xp < x + xpInterval)) {
|
|
255
257
|
item.data = gdata[m];
|
|
256
258
|
item.index = m;
|
|
257
259
|
|
|
@@ -259,10 +261,10 @@ class Line {
|
|
|
259
261
|
item.hit = true;
|
|
260
262
|
}
|
|
261
263
|
return item;
|
|
262
|
-
} else if (x +
|
|
263
|
-
s = m + 1;
|
|
264
|
-
} else {
|
|
264
|
+
} else if (x + xpInterval > xp) {
|
|
265
265
|
e = m - 1;
|
|
266
|
+
} else {
|
|
267
|
+
s = m + 1;
|
|
266
268
|
}
|
|
267
269
|
}
|
|
268
270
|
|
|
@@ -20,14 +20,7 @@ const modules = {
|
|
|
20
20
|
this.createTitle();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
Object.keys(opt.style).forEach((key) => {
|
|
25
|
-
this.titleDOM.style[key] = opt.style[key];
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
this.titleDOM.textContent = opt.text;
|
|
29
|
-
this.titleDOM.style.height = `${opt.height}px`;
|
|
30
|
-
this.titleDOM.style.lineHeight = `${opt.height}px`;
|
|
23
|
+
this.updateTitle();
|
|
31
24
|
|
|
32
25
|
this.isInitTitle = true;
|
|
33
26
|
},
|
|
@@ -51,6 +44,18 @@ const modules = {
|
|
|
51
44
|
this.titleDOM.style.display = 'none';
|
|
52
45
|
this.wrapperDOM.style.paddingTop = '0px';
|
|
53
46
|
},
|
|
47
|
+
|
|
48
|
+
updateTitle() {
|
|
49
|
+
const opt = this.options.title;
|
|
50
|
+
|
|
51
|
+
Object.keys(opt.style).forEach((key) => {
|
|
52
|
+
this.titleDOM.style[key] = opt.style[key];
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
this.titleDOM.textContent = opt.text;
|
|
56
|
+
this.titleDOM.style.height = `${opt.height}px`;
|
|
57
|
+
this.titleDOM.style.lineHeight = `${opt.height}px`;
|
|
58
|
+
},
|
|
54
59
|
};
|
|
55
60
|
|
|
56
61
|
export default modules;
|
|
@@ -311,7 +311,7 @@ class Scale {
|
|
|
311
311
|
|
|
312
312
|
if (this.type === 'x') {
|
|
313
313
|
labelPoint = this.position === 'top' ? offsetPoint - 10 : offsetPoint + 10;
|
|
314
|
-
if (options?.brush?.showLabel || !options
|
|
314
|
+
if (options?.brush?.showLabel || !options?.brush) {
|
|
315
315
|
ctx.fillText(labelText, labelCenter, labelPoint);
|
|
316
316
|
}
|
|
317
317
|
|
|
@@ -344,7 +344,7 @@ class Scale {
|
|
|
344
344
|
}
|
|
345
345
|
} else {
|
|
346
346
|
labelPoint = this.position === 'left' ? offsetPoint - 10 : offsetPoint + 10;
|
|
347
|
-
if (options?.brush?.showLabel || !options
|
|
347
|
+
if (options?.brush?.showLabel || !options?.brush) {
|
|
348
348
|
ctx.fillText(labelText, labelPoint, labelCenter);
|
|
349
349
|
}
|
|
350
350
|
|
|
@@ -232,7 +232,7 @@ export const useModel = (selectedLabel) => {
|
|
|
232
232
|
left: 2,
|
|
233
233
|
bottom: 4,
|
|
234
234
|
};
|
|
235
|
-
}
|
|
235
|
+
}
|
|
236
236
|
|
|
237
237
|
return normalizedOptions;
|
|
238
238
|
};
|
|
@@ -308,7 +308,6 @@ export const useWrapper = (options) => {
|
|
|
308
308
|
};
|
|
309
309
|
};
|
|
310
310
|
|
|
311
|
-
|
|
312
311
|
export const useZoomModel = (
|
|
313
312
|
evChartNormalizedOptions,
|
|
314
313
|
{ wrapper: evChartWrapper, evChartGroupRef },
|
|
@@ -323,7 +322,7 @@ export const useZoomModel = (
|
|
|
323
322
|
const evChartZoomOptions = reactive({ zoom: evChartNormalizedOptions.zoom });
|
|
324
323
|
const brushIdx = reactive({
|
|
325
324
|
start: 0,
|
|
326
|
-
end:
|
|
325
|
+
end: -1,
|
|
327
326
|
isUseButton: false,
|
|
328
327
|
isUseScroll: false,
|
|
329
328
|
});
|
|
@@ -337,6 +336,7 @@ export const useZoomModel = (
|
|
|
337
336
|
},
|
|
338
337
|
});
|
|
339
338
|
const evChartClone = reactive({ data: null, options: null });
|
|
339
|
+
const brushChartIdx = ref([]);
|
|
340
340
|
|
|
341
341
|
const getRangeInfo = (zoomInfo) => {
|
|
342
342
|
if (zoomInfo.data.length && zoomInfo.range && isUseZoomMode.value) {
|
|
@@ -387,6 +387,8 @@ export const useZoomModel = (
|
|
|
387
387
|
|
|
388
388
|
evChartInfo.props.data.push(data);
|
|
389
389
|
evChartInfo.props.options.push(options);
|
|
390
|
+
} else if (type?.name === 'EvChartBrush') {
|
|
391
|
+
brushChartIdx.value.push(evChartProps?.options?.chartIdx ?? 0);
|
|
390
392
|
}
|
|
391
393
|
});
|
|
392
394
|
}
|
|
@@ -490,8 +492,15 @@ export const useZoomModel = (
|
|
|
490
492
|
|
|
491
493
|
setEvChartOptions();
|
|
492
494
|
|
|
493
|
-
brushIdx.
|
|
494
|
-
|
|
495
|
+
brushIdx.end = -1;
|
|
496
|
+
for (let i = 0; i < brushChartIdx.value.length; i++) {
|
|
497
|
+
const data = evChartClone.data[brushChartIdx.value[i]];
|
|
498
|
+
|
|
499
|
+
if (data.labels.length) {
|
|
500
|
+
brushIdx.start = 0;
|
|
501
|
+
brushIdx.end = data.labels.length - 1;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
495
504
|
|
|
496
505
|
if (evChartZoom) {
|
|
497
506
|
evChartZoom.updateEvChartCloneData(evChartClone, isUseZoomMode.value);
|
|
@@ -15,6 +15,8 @@ export default class EvChartBrush {
|
|
|
15
15
|
|
|
16
16
|
init(isResize) {
|
|
17
17
|
if (this.brushIdx.start > this.brushIdx.end) {
|
|
18
|
+
this.initEventState();
|
|
19
|
+
this.removeBrushCanvas();
|
|
18
20
|
return;
|
|
19
21
|
}
|
|
20
22
|
|
|
@@ -72,52 +74,55 @@ export default class EvChartBrush {
|
|
|
72
74
|
const brushIdx = this.debounceBrushIdx ?? this.brushIdx;
|
|
73
75
|
|
|
74
76
|
const labelEndIdx = this.evChartData.value.labels.length - 1;
|
|
75
|
-
this.labelEndIdx = labelEndIdx;
|
|
76
|
-
const axesXInterval = (evChartRange.x2 - evChartRange.x1) / labelEndIdx;
|
|
77
|
-
const brushRectX = brushIdx.start * axesXInterval * pixelRatio;
|
|
78
|
-
const brushRectWidth = (
|
|
79
|
-
brushCanvasWidth - (
|
|
80
|
-
labelEndIdx - (brushIdx.end - brushIdx.start)
|
|
81
|
-
) * axesXInterval
|
|
82
|
-
) * pixelRatio;
|
|
83
|
-
const brushRectHeight = this.evChartBrushOptions.value.height - evChartRange.y1;
|
|
84
|
-
const brushButtonLeftXPos = brushRectX;
|
|
85
|
-
const brushButtonRightXPos = brushRectX + brushRectWidth;
|
|
86
|
-
|
|
87
|
-
if (!brushCanvas.style.position) {
|
|
88
|
-
brushCanvas.style.position = 'absolute';
|
|
89
|
-
brushCanvas.style.top = `${evChartRange.y1}px`;
|
|
90
|
-
brushCanvas.style.left = `${evChartRange.x1 - (brushButtonWidth / 2)}px`;
|
|
91
|
-
}
|
|
92
77
|
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
78
|
+
if (labelEndIdx >= 0) {
|
|
79
|
+
this.labelEndIdx = labelEndIdx;
|
|
80
|
+
const axesXInterval = (evChartRange.x2 - evChartRange.x1) / labelEndIdx;
|
|
81
|
+
const brushRectX = brushIdx.start * axesXInterval * pixelRatio;
|
|
82
|
+
const brushRectWidth = (
|
|
83
|
+
brushCanvasWidth - (
|
|
84
|
+
labelEndIdx - (brushIdx.end - brushIdx.start)
|
|
85
|
+
) * axesXInterval
|
|
86
|
+
) * pixelRatio;
|
|
87
|
+
const brushRectHeight = this.evChartBrushOptions.value.height - evChartRange.y1;
|
|
88
|
+
const brushButtonLeftXPos = brushRectX;
|
|
89
|
+
const brushButtonRightXPos = brushRectX + brushRectWidth;
|
|
90
|
+
|
|
91
|
+
if (!brushCanvas.style.position) {
|
|
92
|
+
brushCanvas.style.position = 'absolute';
|
|
93
|
+
brushCanvas.style.top = `${evChartRange.y1}px`;
|
|
94
|
+
brushCanvas.style.left = `${evChartRange.x1 - (brushButtonWidth / 2)}px`;
|
|
95
|
+
}
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
97
|
+
if (!isEqualWidth) {
|
|
98
|
+
brushCanvas.width = (brushCanvasWidth * pixelRatio);
|
|
99
|
+
brushCanvas.style.width = `${brushCanvasWidth}px`;
|
|
100
|
+
brushCanvas.height = brushCanvasHeight * pixelRatio;
|
|
101
|
+
brushCanvas.style.height = `${brushCanvasHeight}px`;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const ctx = brushCanvas.getContext('2d');
|
|
105
|
+
|
|
106
|
+
ctx.clearRect(
|
|
107
|
+
0,
|
|
108
|
+
0,
|
|
109
|
+
brushCanvasWidth * pixelRatio,
|
|
110
|
+
brushCanvasHeight * pixelRatio,
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
ctx.fillStyle = this.evChartBrushOptions.value.selection.fillColor;
|
|
114
|
+
ctx.globalAlpha = this.evChartBrushOptions.value.selection.opacity;
|
|
115
|
+
ctx.fillRect(brushRectX, 0, brushRectWidth, brushRectHeight);
|
|
116
|
+
ctx.fillRect(brushButtonLeftXPos, 0, brushButtonWidth, brushRectHeight);
|
|
117
|
+
ctx.fillRect(brushButtonRightXPos - brushButtonWidth, 0, brushButtonWidth, brushRectHeight);
|
|
118
|
+
|
|
119
|
+
this.evChartBrushPos = {
|
|
120
|
+
leftX: brushButtonLeftXPos / pixelRatio,
|
|
121
|
+
rightX: brushButtonRightXPos / pixelRatio,
|
|
122
|
+
buttonWidth: brushButtonWidth,
|
|
123
|
+
axesXInterval,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
addEvent() {
|
|
@@ -47,10 +47,11 @@ export default {
|
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
emits: [
|
|
50
|
+
'update:groupSelectedLabel',
|
|
50
51
|
'update:zoomStartIdx',
|
|
51
52
|
'update:zoomEndIdx',
|
|
52
53
|
],
|
|
53
|
-
setup(props) {
|
|
54
|
+
setup(props, { emit }) {
|
|
54
55
|
const {
|
|
55
56
|
getNormalizedOptions,
|
|
56
57
|
isExecuteZoom,
|
|
@@ -62,8 +63,10 @@ export default {
|
|
|
62
63
|
provide('isExecuteZoom', isExecuteZoom);
|
|
63
64
|
provide('isChartGroup', true);
|
|
64
65
|
provide('brushSeries', brushSeries);
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
const groupSelectedLabel = computed({
|
|
67
|
+
get: () => props.groupSelectedLabel,
|
|
68
|
+
set: val => emit('update:groupSelectedLabel', val),
|
|
69
|
+
});
|
|
67
70
|
provide('groupSelectedLabel', groupSelectedLabel);
|
|
68
71
|
|
|
69
72
|
const {
|