evui 3.3.54 → 3.3.56
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 +1126 -99
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +1126 -99
- 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/common/utils.js +4 -0
- package/src/components/chart/chart.core.js +47 -10
- package/src/components/chart/element/element.bar.js +51 -7
- package/src/components/chart/element/element.heatmap.js +55 -26
- package/src/components/chart/element/element.tip.js +31 -2
- package/src/components/chart/helpers/helpers.constant.js +11 -0
- package/src/components/chart/helpers/helpers.util.js +11 -0
- package/src/components/chart/model/model.store.js +20 -2
- package/src/components/chart/plugins/plugins.interaction.js +14 -7
- package/src/components/chart/plugins/plugins.scrollbar.js +592 -0
- package/src/components/chart/plugins/plugins.tooltip.js +71 -3
- package/src/components/chart/scale/scale.js +8 -6
- package/src/components/chart/scale/scale.step.js +47 -18
- package/src/components/chart/scale/scale.time.category.js +5 -4
- package/src/components/chart/style/chart.scss +81 -1
|
@@ -4,28 +4,44 @@ import Scale from './scale';
|
|
|
4
4
|
import Util from '../helpers/helpers.util';
|
|
5
5
|
|
|
6
6
|
class StepScale extends Scale {
|
|
7
|
-
constructor(type,
|
|
8
|
-
super(type,
|
|
7
|
+
constructor(type, axisOpt, ctx, labels, options) {
|
|
8
|
+
super(type, axisOpt, ctx, options);
|
|
9
9
|
this.labels = labels;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Calculate min/max value, label and size information for step scale
|
|
14
14
|
* @param {object} minMax min/max information (unused on step scale)
|
|
15
|
+
* @param {object} scrollbarOpt scroll bar option
|
|
15
16
|
* @param {object} chartRect chart size information
|
|
16
17
|
*
|
|
17
18
|
* @returns {object} min/max value and label
|
|
18
19
|
*/
|
|
19
|
-
calculateScaleRange(minMax, chartRect) {
|
|
20
|
+
calculateScaleRange(minMax, scrollbarOpt, chartRect) {
|
|
20
21
|
const stepMinMax = this.labelStyle.alignToGridLine
|
|
21
22
|
? minMax : Util.getStringMinMax(this.labels);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
let maxValue = stepMinMax.max;
|
|
24
|
+
let minValue = stepMinMax.min;
|
|
25
|
+
|
|
26
|
+
let minIndex = 0;
|
|
27
|
+
let maxIndex = this.labels.length - 1;
|
|
28
|
+
let labelCount = this.labels.length;
|
|
29
|
+
|
|
30
|
+
const range = scrollbarOpt?.use ? scrollbarOpt?.range : this.range;
|
|
31
|
+
if (range?.length) {
|
|
32
|
+
[minIndex, maxIndex] = range;
|
|
33
|
+
maxValue = this.labels[maxIndex];
|
|
34
|
+
minValue = this.labels[minIndex];
|
|
35
|
+
labelCount = maxIndex - minIndex + 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const maxWidth = chartRect.chartWidth / (labelCount + 2);
|
|
25
39
|
|
|
26
40
|
return {
|
|
27
41
|
min: minValue,
|
|
28
42
|
max: maxValue,
|
|
43
|
+
minIndex,
|
|
44
|
+
maxIndex,
|
|
29
45
|
minLabel: this.getLabelFormat(minValue, maxWidth),
|
|
30
46
|
maxLabel: this.getLabelFormat(maxValue, maxWidth),
|
|
31
47
|
size: Util.calcTextSize(
|
|
@@ -42,28 +58,40 @@ class StepScale extends Scale {
|
|
|
42
58
|
* @returns {object} steps, interval, min/max graph value
|
|
43
59
|
*/
|
|
44
60
|
calculateSteps(range) {
|
|
45
|
-
|
|
61
|
+
const {
|
|
62
|
+
minValue,
|
|
63
|
+
maxValue,
|
|
64
|
+
minIndex,
|
|
65
|
+
maxIndex,
|
|
66
|
+
maxSteps,
|
|
67
|
+
} = range;
|
|
68
|
+
|
|
69
|
+
let numberOfSteps = (maxIndex - minIndex) + 1;
|
|
46
70
|
let interval = 1;
|
|
47
71
|
|
|
72
|
+
const oriSteps = numberOfSteps;
|
|
48
73
|
const isNumbersArray = this.labels.every(label => !isNaN(label));
|
|
49
74
|
if (this.labelStyle.alignToGridLine && isNumbersArray) {
|
|
50
|
-
const { maxSteps } = range;
|
|
51
|
-
|
|
52
75
|
if (maxSteps > 2) {
|
|
53
76
|
while (numberOfSteps > maxSteps * 2) {
|
|
54
77
|
interval *= 2;
|
|
55
78
|
numberOfSteps = Math.round(numberOfSteps / interval);
|
|
56
79
|
}
|
|
57
80
|
} else {
|
|
58
|
-
interval =
|
|
81
|
+
interval = oriSteps;
|
|
59
82
|
}
|
|
83
|
+
} else if (numberOfSteps > maxSteps * 2) {
|
|
84
|
+
interval *= 2;
|
|
60
85
|
}
|
|
61
86
|
|
|
62
87
|
return {
|
|
88
|
+
oriSteps,
|
|
63
89
|
steps: numberOfSteps,
|
|
64
90
|
interval,
|
|
65
|
-
graphMin:
|
|
66
|
-
graphMax:
|
|
91
|
+
graphMin: minValue,
|
|
92
|
+
graphMax: maxValue,
|
|
93
|
+
minIndex,
|
|
94
|
+
maxIndex,
|
|
67
95
|
};
|
|
68
96
|
}
|
|
69
97
|
|
|
@@ -87,15 +115,15 @@ class StepScale extends Scale {
|
|
|
87
115
|
y2: chartRect.y2 - labelOffset.bottom,
|
|
88
116
|
};
|
|
89
117
|
|
|
90
|
-
const oriSteps = this.labels.length;
|
|
91
118
|
const steps = stepInfo.steps;
|
|
92
119
|
const count = stepInfo.interval;
|
|
120
|
+
const startIndex = stepInfo.minIndex;
|
|
93
121
|
|
|
94
122
|
const startPoint = aPos[this.units.rectStart];
|
|
95
123
|
const endPoint = aPos[this.units.rectEnd];
|
|
96
124
|
const offsetPoint = aPos[this.units.rectOffset(this.position)];
|
|
97
125
|
const offsetCounterPoint = aPos[this.units.rectOffsetCounter(this.position)];
|
|
98
|
-
const maxWidth = chartRect.chartWidth / (
|
|
126
|
+
const maxWidth = chartRect.chartWidth / (steps + 2);
|
|
99
127
|
|
|
100
128
|
this.drawAxisTitle(chartRect, labelOffset);
|
|
101
129
|
|
|
@@ -130,7 +158,7 @@ class StepScale extends Scale {
|
|
|
130
158
|
return;
|
|
131
159
|
}
|
|
132
160
|
|
|
133
|
-
const labelGap = (endPoint - startPoint) /
|
|
161
|
+
const labelGap = (endPoint - startPoint) / steps;
|
|
134
162
|
const alignToGridLine = this.labelStyle.alignToGridLine;
|
|
135
163
|
let labelCenter = null;
|
|
136
164
|
let linePosition = null;
|
|
@@ -142,8 +170,9 @@ class StepScale extends Scale {
|
|
|
142
170
|
let labelPoint;
|
|
143
171
|
let index;
|
|
144
172
|
|
|
145
|
-
for (index = 0; index <
|
|
146
|
-
const
|
|
173
|
+
for (index = 0; index < steps; index += count) {
|
|
174
|
+
const labelIndex = startIndex + index;
|
|
175
|
+
const item = this.labels[labelIndex];
|
|
147
176
|
labelCenter = Math.round(startPoint + (labelGap * index));
|
|
148
177
|
linePosition = labelCenter + aliasPixel;
|
|
149
178
|
labelText = this.getLabelFormat(item, maxWidth);
|
|
@@ -165,7 +194,7 @@ class StepScale extends Scale {
|
|
|
165
194
|
&& selectLabelOpt?.useLabelOpacity
|
|
166
195
|
&& targetAxis === this.type
|
|
167
196
|
&& selectedLabelInfo?.dataIndex?.length
|
|
168
|
-
&& !selectedLabelInfo?.dataIndex?.includes(
|
|
197
|
+
&& !selectedLabelInfo?.dataIndex?.includes(labelIndex);
|
|
169
198
|
|
|
170
199
|
const labelColor = this.labelStyle.color;
|
|
171
200
|
let defaultOpacity = 1;
|
|
@@ -4,8 +4,8 @@ import Scale from './scale';
|
|
|
4
4
|
import Util from '../helpers/helpers.util';
|
|
5
5
|
|
|
6
6
|
class TimeCategoryScale extends Scale {
|
|
7
|
-
constructor(type,
|
|
8
|
-
super(type,
|
|
7
|
+
constructor(type, axisOpt, ctx, labels, options) {
|
|
8
|
+
super(type, axisOpt, ctx);
|
|
9
9
|
this.labels = labels;
|
|
10
10
|
this.options = options;
|
|
11
11
|
}
|
|
@@ -166,7 +166,7 @@ class TimeCategoryScale extends Scale {
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
const alignToGridLine = this.labelStyle.alignToGridLine;
|
|
169
|
-
const graphGap = (endPoint - startPoint) / (
|
|
169
|
+
const graphGap = (endPoint - startPoint) / (oriSteps || 1);
|
|
170
170
|
if (this.categoryMode && !alignToGridLine) {
|
|
171
171
|
startPoint += Math.ceil(graphGap / 2) - 2;
|
|
172
172
|
}
|
|
@@ -191,7 +191,8 @@ class TimeCategoryScale extends Scale {
|
|
|
191
191
|
&& this.options?.selectLabel?.useLabelOpacity
|
|
192
192
|
&& (this.options.horizontal === (this.type === 'y'))
|
|
193
193
|
&& selectLabelInfo?.dataIndex?.length
|
|
194
|
-
&& !selectLabelInfo?.
|
|
194
|
+
&& !selectLabelInfo?.label
|
|
195
|
+
.map(t => this.getLabelFormat(Math.min(axisMax, t))).includes(labelText);
|
|
195
196
|
|
|
196
197
|
const labelColor = this.labelStyle.color;
|
|
197
198
|
let defaultOpacity = 1;
|
|
@@ -318,9 +318,89 @@
|
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
|
|
322
321
|
.ev-chart-tooltip-body {
|
|
323
322
|
overflow-x: hidden;
|
|
324
323
|
overflow-y: hidden;
|
|
325
324
|
}
|
|
325
|
+
|
|
326
|
+
.ev-chart-tooltip-custom {
|
|
327
|
+
overflow-x: hidden;
|
|
328
|
+
overflow-y: hidden;
|
|
329
|
+
|
|
330
|
+
&__header {
|
|
331
|
+
@extend .ev-chart-tooltip-header;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
&__body {
|
|
335
|
+
padding: 8px 20px 8px 16px;
|
|
336
|
+
overflow-x: hidden;
|
|
337
|
+
overflow-y: hidden;
|
|
338
|
+
|
|
339
|
+
.row {
|
|
340
|
+
display: flex;
|
|
341
|
+
flex-direction: row;
|
|
342
|
+
align-items: center;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.series-name {
|
|
346
|
+
flex: auto;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.value {
|
|
350
|
+
text-align: right;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.color-rect {
|
|
354
|
+
width: 12px;
|
|
355
|
+
height: 12px;
|
|
356
|
+
margin-right: 16px;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.color-circle {
|
|
360
|
+
border-radius: 12px;
|
|
361
|
+
|
|
362
|
+
@extend .color-rect;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.ev-chart-scrollbar {
|
|
369
|
+
position: absolute;
|
|
370
|
+
z-index: 3;
|
|
371
|
+
|
|
372
|
+
&-container {
|
|
373
|
+
position: relative;
|
|
374
|
+
top: 0;
|
|
375
|
+
left: 0;
|
|
376
|
+
width: 100%;
|
|
377
|
+
height: 100%;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
&-track {
|
|
381
|
+
position: absolute;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
&-thumb {
|
|
385
|
+
position: absolute;
|
|
386
|
+
|
|
387
|
+
&:hover {
|
|
388
|
+
opacity: 0.7;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
&-button {
|
|
393
|
+
position: absolute;
|
|
394
|
+
text-align: center;
|
|
395
|
+
|
|
396
|
+
&:hover {
|
|
397
|
+
opacity: 0.5 !important;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
&-button-icon {
|
|
402
|
+
display: none;
|
|
403
|
+
margin: 0 auto;
|
|
404
|
+
font-size: 12px;
|
|
405
|
+
}
|
|
326
406
|
}
|