evui 3.3.40 → 3.3.41
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 +125 -102
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +125 -102
- 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/plugins/plugins.title.js +13 -8
- 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/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);
|
|
@@ -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;
|
|
@@ -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() {
|