evui 3.3.11 → 3.3.14
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 +1855 -836
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +1855 -836
- 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 +21 -2
- package/src/components/chart/chart.core.js +12 -9
- package/src/components/chart/element/element.heatmap.js +195 -51
- package/src/components/chart/element/element.line.js +20 -9
- package/src/components/chart/element/element.tip.js +69 -73
- package/src/components/chart/helpers/helpers.constant.js +13 -11
- package/src/components/chart/model/model.series.js +1 -1
- package/src/components/chart/model/model.store.js +114 -74
- package/src/components/chart/plugins/plugins.interaction.js +72 -17
- package/src/components/chart/plugins/plugins.legend.js +18 -5
- package/src/components/chart/plugins/plugins.pie.js +17 -0
- package/src/components/chart/plugins/plugins.tooltip.js +30 -14
- package/src/components/chart/scale/scale.js +5 -4
- package/src/components/chart/scale/scale.step.js +29 -2
- package/src/components/chart/scale/scale.time.category.js +27 -3
- package/src/components/chart/uses.js +22 -1
- package/src/components/grid/Grid.vue +19 -7
- package/src/components/grid/grid.summary.vue +20 -6
- package/src/components/grid/uses.js +1 -1
- package/src/components/treeGrid/TreeGrid.vue +269 -36
- package/src/components/treeGrid/TreeGridNode.vue +8 -9
- package/src/components/treeGrid/uses.js +152 -37
package/package.json
CHANGED
|
@@ -24,6 +24,10 @@ import { onMounted, onBeforeUnmount, watch, onDeactivated } from 'vue';
|
|
|
24
24
|
type: Object,
|
|
25
25
|
default: null,
|
|
26
26
|
},
|
|
27
|
+
selectedSeries: {
|
|
28
|
+
type: Object,
|
|
29
|
+
default: null,
|
|
30
|
+
},
|
|
27
31
|
options: {
|
|
28
32
|
type: Object,
|
|
29
33
|
default: () => ({}),
|
|
@@ -43,6 +47,7 @@ import { onMounted, onBeforeUnmount, watch, onDeactivated } from 'vue';
|
|
|
43
47
|
'drag-select',
|
|
44
48
|
'update:selectedItem',
|
|
45
49
|
'update:selectedLabel',
|
|
50
|
+
'update:selectedSeries',
|
|
46
51
|
],
|
|
47
52
|
setup(props) {
|
|
48
53
|
let evChart = {};
|
|
@@ -52,6 +57,7 @@ import { onMounted, onBeforeUnmount, watch, onDeactivated } from 'vue';
|
|
|
52
57
|
eventListeners,
|
|
53
58
|
selectItemInfo,
|
|
54
59
|
selectLabelInfo,
|
|
60
|
+
selectSeriesInfo,
|
|
55
61
|
getNormalizedData,
|
|
56
62
|
getNormalizedOptions,
|
|
57
63
|
} = useModel();
|
|
@@ -67,13 +73,20 @@ import { onMounted, onBeforeUnmount, watch, onDeactivated } from 'vue';
|
|
|
67
73
|
);
|
|
68
74
|
|
|
69
75
|
const createChart = () => {
|
|
76
|
+
let selected;
|
|
77
|
+
if (normalizedOptions.selectLabel.use) {
|
|
78
|
+
selected = selectLabelInfo;
|
|
79
|
+
} else if (normalizedOptions.selectSeries.use) {
|
|
80
|
+
selected = selectSeriesInfo;
|
|
81
|
+
}
|
|
82
|
+
|
|
70
83
|
evChart = new EvChart(
|
|
71
84
|
wrapper.value,
|
|
72
85
|
normalizedData,
|
|
73
86
|
normalizedOptions,
|
|
74
87
|
eventListeners,
|
|
75
88
|
selectItemInfo,
|
|
76
|
-
|
|
89
|
+
selected,
|
|
77
90
|
);
|
|
78
91
|
};
|
|
79
92
|
|
|
@@ -115,7 +128,13 @@ import { onMounted, onBeforeUnmount, watch, onDeactivated } from 'vue';
|
|
|
115
128
|
|
|
116
129
|
await watch(() => props.selectedLabel, (newValue) => {
|
|
117
130
|
if (newValue.dataIndex) {
|
|
118
|
-
evChart.
|
|
131
|
+
evChart.renderWithSelected(newValue.dataIndex);
|
|
132
|
+
}
|
|
133
|
+
}, { deep: true });
|
|
134
|
+
|
|
135
|
+
await watch(() => props.selectedSeries, (newValue) => {
|
|
136
|
+
if (newValue.seriesId) {
|
|
137
|
+
evChart.renderWithSelected(newValue.seriesId);
|
|
119
138
|
}
|
|
120
139
|
}, { deep: true });
|
|
121
140
|
});
|
|
@@ -14,7 +14,7 @@ import Pie from './plugins/plugins.pie';
|
|
|
14
14
|
import Tip from './element/element.tip';
|
|
15
15
|
|
|
16
16
|
class EvChart {
|
|
17
|
-
constructor(target, data, options, listeners, defaultSelectItemInfo,
|
|
17
|
+
constructor(target, data, options, listeners, defaultSelectItemInfo, defaultSelectInfo) {
|
|
18
18
|
Object.keys(Model).forEach(key => Object.assign(this, Model[key]));
|
|
19
19
|
Object.assign(this, Title);
|
|
20
20
|
Object.assign(this, Legend);
|
|
@@ -66,7 +66,7 @@ class EvChart {
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
this.defaultSelectItemInfo = defaultSelectItemInfo;
|
|
69
|
-
this.
|
|
69
|
+
this.defaultSelectInfo = defaultSelectInfo;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
@@ -93,7 +93,7 @@ class EvChart {
|
|
|
93
93
|
|
|
94
94
|
this.axesRange = this.getAxesRange();
|
|
95
95
|
this.labelOffset = this.getLabelOffset();
|
|
96
|
-
this.
|
|
96
|
+
this.initSelectedInfo();
|
|
97
97
|
|
|
98
98
|
this.drawChart();
|
|
99
99
|
|
|
@@ -153,7 +153,7 @@ class EvChart {
|
|
|
153
153
|
* @returns {undefined}
|
|
154
154
|
*/
|
|
155
155
|
drawSeries(hitInfo) {
|
|
156
|
-
const { maxTip, selectLabel, selectItem } = this.options;
|
|
156
|
+
const { maxTip, selectLabel, selectItem, selectSeries } = this.options;
|
|
157
157
|
|
|
158
158
|
const opt = {
|
|
159
159
|
ctx: this.bufferCtx,
|
|
@@ -161,7 +161,8 @@ class EvChart {
|
|
|
161
161
|
labelOffset: this.labelOffset,
|
|
162
162
|
axesSteps: this.axesSteps,
|
|
163
163
|
maxTipOpt: { background: maxTip.background, color: maxTip.color },
|
|
164
|
-
selectLabel: { option: selectLabel, selected: this.
|
|
164
|
+
selectLabel: { option: selectLabel, selected: this.defaultSelectInfo },
|
|
165
|
+
selectSeries: { option: selectSeries, selected: this.defaultSelectInfo },
|
|
165
166
|
};
|
|
166
167
|
|
|
167
168
|
let showIndex = 0;
|
|
@@ -282,7 +283,9 @@ class EvChart {
|
|
|
282
283
|
*/
|
|
283
284
|
createAxes(dir, axes = []) {
|
|
284
285
|
const ctx = this.bufferCtx;
|
|
285
|
-
const labels = this.
|
|
286
|
+
const labels = this.options.type === 'heatMap'
|
|
287
|
+
? this.data.labels[dir]
|
|
288
|
+
: this.data.labels;
|
|
286
289
|
const options = this.options;
|
|
287
290
|
return axes.map((axis) => {
|
|
288
291
|
switch (axis.type) {
|
|
@@ -329,7 +332,7 @@ class EvChart {
|
|
|
329
332
|
this.labelOffset,
|
|
330
333
|
this.axesSteps.x[index],
|
|
331
334
|
hitInfo,
|
|
332
|
-
this.
|
|
335
|
+
this.defaultSelectInfo);
|
|
333
336
|
});
|
|
334
337
|
|
|
335
338
|
this.axesY.forEach((axis, index) => {
|
|
@@ -338,7 +341,7 @@ class EvChart {
|
|
|
338
341
|
this.labelOffset,
|
|
339
342
|
this.axesSteps.y[index],
|
|
340
343
|
hitInfo,
|
|
341
|
-
this.
|
|
344
|
+
this.defaultSelectInfo);
|
|
342
345
|
});
|
|
343
346
|
}
|
|
344
347
|
|
|
@@ -658,7 +661,7 @@ class EvChart {
|
|
|
658
661
|
this.axesY = this.createAxes('y', options.axesY);
|
|
659
662
|
this.axesRange = this.getAxesRange();
|
|
660
663
|
this.labelOffset = this.getLabelOffset();
|
|
661
|
-
this.
|
|
664
|
+
this.initSelectedInfo();
|
|
662
665
|
|
|
663
666
|
this.render(updateInfo?.hitInfo);
|
|
664
667
|
|
|
@@ -1,36 +1,24 @@
|
|
|
1
1
|
import { merge } from 'lodash-es';
|
|
2
|
-
import Canvas from '../helpers/helpers.canvas';
|
|
3
2
|
import Util from '../helpers/helpers.util';
|
|
4
|
-
import {
|
|
3
|
+
import { HEAT_MAP_OPTION } from '../helpers/helpers.constant';
|
|
5
4
|
|
|
6
5
|
class HeatMap {
|
|
7
|
-
constructor(sId, opt,
|
|
6
|
+
constructor(sId, opt, colorOpt) {
|
|
8
7
|
const merged = merge({}, HEAT_MAP_OPTION, opt);
|
|
9
8
|
Object.keys(merged).forEach((key) => {
|
|
10
9
|
this[key] = merged[key];
|
|
11
10
|
});
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
if (this[colorProp] === undefined) {
|
|
15
|
-
this[colorProp] = COLOR[sIdx];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
this.colorAxis = this.createColorAxis(opt.colorOpt);
|
|
20
|
-
this.errorColor = opt.colorOpt.error;
|
|
21
|
-
this.borderColor = opt.colorOpt.border;
|
|
12
|
+
this.createColorAxis(colorOpt);
|
|
22
13
|
|
|
23
14
|
this.sId = sId;
|
|
24
15
|
this.data = [];
|
|
25
|
-
this.
|
|
16
|
+
this.labels = {};
|
|
17
|
+
this.valueOpt = {};
|
|
26
18
|
this.size = {
|
|
27
19
|
w: 0,
|
|
28
20
|
h: 0,
|
|
29
21
|
};
|
|
30
|
-
this.valueOpt = {
|
|
31
|
-
max: 0,
|
|
32
|
-
interval: 0,
|
|
33
|
-
};
|
|
34
22
|
this.type = 'heatMap';
|
|
35
23
|
}
|
|
36
24
|
|
|
@@ -41,7 +29,7 @@ class HeatMap {
|
|
|
41
29
|
*/
|
|
42
30
|
createColorAxis(colorOpt) {
|
|
43
31
|
const colorAxis = [];
|
|
44
|
-
const { min, max, categoryCnt } = colorOpt;
|
|
32
|
+
const { min, max, categoryCnt, error, stroke } = colorOpt;
|
|
45
33
|
|
|
46
34
|
const minColor = min.includes('#') ? Util.hexToRgb(min) : min;
|
|
47
35
|
const maxColor = max.includes('#') ? Util.hexToRgb(max) : max;
|
|
@@ -66,30 +54,66 @@ class HeatMap {
|
|
|
66
54
|
});
|
|
67
55
|
}
|
|
68
56
|
|
|
69
|
-
|
|
57
|
+
this.colorAxis = colorAxis;
|
|
58
|
+
this.errorColor = error;
|
|
59
|
+
this.stroke = stroke;
|
|
70
60
|
}
|
|
71
61
|
|
|
72
62
|
getColorIndex(value) {
|
|
73
63
|
const existError = this.valueOpt.existError;
|
|
74
|
-
const maxIndex = this.colorAxis.length;
|
|
75
|
-
if (value < 0) {
|
|
76
|
-
return maxIndex
|
|
64
|
+
const maxIndex = this.colorAxis.length - 1;
|
|
65
|
+
if (existError && value < 0) {
|
|
66
|
+
return maxIndex;
|
|
77
67
|
}
|
|
78
68
|
|
|
79
69
|
const colorIndex = Math.floor(value / this.valueOpt.interval);
|
|
80
70
|
if (colorIndex >= maxIndex) {
|
|
81
|
-
return existError ? maxIndex -
|
|
71
|
+
return existError ? maxIndex - 1 : maxIndex;
|
|
82
72
|
}
|
|
83
73
|
|
|
84
74
|
return colorIndex;
|
|
85
75
|
}
|
|
86
76
|
|
|
87
|
-
drawItem(ctx,
|
|
77
|
+
drawItem(ctx, x, y, w, h) {
|
|
88
78
|
ctx.beginPath();
|
|
89
|
-
|
|
90
|
-
|
|
79
|
+
if (this.stroke.show) {
|
|
80
|
+
ctx.fillRect(x, y, w, h);
|
|
81
|
+
ctx.strokeRect(x, y, w, h);
|
|
82
|
+
} else {
|
|
83
|
+
const aliasPixel = Util.aliasPixel(1);
|
|
84
|
+
ctx.fillRect(
|
|
85
|
+
x,
|
|
86
|
+
y - aliasPixel,
|
|
87
|
+
w + aliasPixel,
|
|
88
|
+
h + aliasPixel,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
91
|
ctx.closePath();
|
|
92
|
-
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
calculateXY(dir, value, startPoint) {
|
|
95
|
+
let point = null;
|
|
96
|
+
|
|
97
|
+
if (this.labels[dir] && this.labels[dir].length) {
|
|
98
|
+
const index = this.labels[dir].findIndex(label => label === value);
|
|
99
|
+
|
|
100
|
+
if (index > -1) {
|
|
101
|
+
point = dir === 'x'
|
|
102
|
+
? startPoint + (this.size.w * index)
|
|
103
|
+
: startPoint - (this.size.h * (index + 1));
|
|
104
|
+
} else {
|
|
105
|
+
const timeIndex = this.labels[dir].findIndex(label =>
|
|
106
|
+
new Date(label).getTime() === new Date(value).getTime(),
|
|
107
|
+
);
|
|
108
|
+
if (timeIndex > -1) {
|
|
109
|
+
point = dir === 'x'
|
|
110
|
+
? startPoint + (this.size.w * timeIndex)
|
|
111
|
+
: startPoint - (this.size.h * (timeIndex + 1));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return point;
|
|
93
117
|
}
|
|
94
118
|
|
|
95
119
|
draw(param) {
|
|
@@ -97,10 +121,7 @@ class HeatMap {
|
|
|
97
121
|
return;
|
|
98
122
|
}
|
|
99
123
|
|
|
100
|
-
const { ctx, chartRect, labelOffset
|
|
101
|
-
|
|
102
|
-
const minmaxX = axesSteps.x[this.xAxisIndex];
|
|
103
|
-
const minmaxY = axesSteps.y[this.yAxisIndex];
|
|
124
|
+
const { ctx, chartRect, labelOffset } = param;
|
|
104
125
|
|
|
105
126
|
const xArea = chartRect.chartWidth - (labelOffset.left + labelOffset.right);
|
|
106
127
|
const yArea = chartRect.chartHeight - (labelOffset.top + labelOffset.bottom);
|
|
@@ -108,29 +129,128 @@ class HeatMap {
|
|
|
108
129
|
const xsp = chartRect.x1 + labelOffset.left;
|
|
109
130
|
const ysp = chartRect.y2 - labelOffset.bottom;
|
|
110
131
|
|
|
111
|
-
this.size.w =
|
|
112
|
-
this.size.h =
|
|
132
|
+
this.size.w = xArea / this.labels.x.length;
|
|
133
|
+
this.size.h = yArea / this.labels.y.length;
|
|
113
134
|
|
|
114
135
|
this.data.forEach((item) => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
136
|
+
let xp = this.calculateXY('x', item.x, xsp);
|
|
137
|
+
let yp = this.calculateXY('y', item.y, ysp);
|
|
138
|
+
let w = this.size.w;
|
|
139
|
+
let h = this.size.h;
|
|
140
|
+
const value = item.o;
|
|
141
|
+
|
|
142
|
+
if (xp !== null && yp !== null
|
|
143
|
+
&& (value !== null && value !== undefined)) {
|
|
121
144
|
const colorIndex = this.getColorIndex(value);
|
|
122
145
|
const opacity = this.colorAxis[colorIndex].state === 'downplay' ? 0.1 : 1;
|
|
123
146
|
item.dataColor = value < 0 ? this.errorColor : this.colorAxis[colorIndex].value;
|
|
124
147
|
item.cId = this.colorAxis[colorIndex].id;
|
|
125
148
|
if (this.colorAxis[colorIndex].show) {
|
|
126
|
-
ctx.strokeStyle = Util.colorStringToRgba(this.borderColor, opacity);
|
|
127
149
|
ctx.fillStyle = Util.colorStringToRgba(item.dataColor, opacity);
|
|
128
|
-
this.
|
|
150
|
+
if (this.stroke.show) {
|
|
151
|
+
const { color, lineWidth } = this.stroke;
|
|
152
|
+
ctx.strokeStyle = Util.colorStringToRgba(color, opacity);
|
|
153
|
+
ctx.lineWidth = lineWidth;
|
|
154
|
+
xp += (lineWidth * 1.5);
|
|
155
|
+
yp += (lineWidth * 1.5);
|
|
156
|
+
w -= (lineWidth * 2);
|
|
157
|
+
h -= (lineWidth * 2);
|
|
158
|
+
}
|
|
159
|
+
this.drawItem(ctx, xp, yp, w, h);
|
|
160
|
+
|
|
161
|
+
if (this.showValue.use) {
|
|
162
|
+
this.drawValueLabels({
|
|
163
|
+
context: ctx,
|
|
164
|
+
data: item,
|
|
165
|
+
positions: {
|
|
166
|
+
x: xp,
|
|
167
|
+
y: yp,
|
|
168
|
+
w,
|
|
169
|
+
h,
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
}
|
|
129
173
|
}
|
|
174
|
+
|
|
175
|
+
item.xp = xp;
|
|
176
|
+
item.yp = yp;
|
|
177
|
+
item.w = w;
|
|
178
|
+
item.h = h;
|
|
130
179
|
}
|
|
131
180
|
});
|
|
132
181
|
}
|
|
133
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Draw value label if series 'use' of showValue option is true
|
|
185
|
+
*
|
|
186
|
+
* @param context canvas context
|
|
187
|
+
* @param data series value data (model.store.js addData return value)
|
|
188
|
+
*/
|
|
189
|
+
drawValueLabels({ context, data, positions }) {
|
|
190
|
+
const { fontSize, textColor, align, formatter, decimalPoint } = this.showValue;
|
|
191
|
+
const { x, y, w, h } = positions;
|
|
192
|
+
const ctx = context;
|
|
193
|
+
|
|
194
|
+
ctx.save();
|
|
195
|
+
ctx.beginPath();
|
|
196
|
+
|
|
197
|
+
ctx.font = `normal normal normal ${fontSize}px Roboto`;
|
|
198
|
+
ctx.fillStyle = textColor;
|
|
199
|
+
ctx.lineWidth = 1;
|
|
200
|
+
ctx.textBaseline = 'middle';
|
|
201
|
+
ctx.textAlign = align !== 'center' ? 'left' : 'center';
|
|
202
|
+
|
|
203
|
+
const value = data.o;
|
|
204
|
+
|
|
205
|
+
let formattedTxt;
|
|
206
|
+
if (formatter) {
|
|
207
|
+
formattedTxt = formatter(value);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (!formatter || typeof formattedTxt !== 'string') {
|
|
211
|
+
formattedTxt = Util.labelSignFormat(value, decimalPoint);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const vw = Math.round(ctx.measureText(formattedTxt).width);
|
|
215
|
+
const vh = fontSize;
|
|
216
|
+
const centerX = x + (w / 2);
|
|
217
|
+
const centerY = y + (h / 2);
|
|
218
|
+
|
|
219
|
+
if (vw >= w || formattedTxt < 0) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
switch (align) {
|
|
224
|
+
case 'top': {
|
|
225
|
+
const xPos = centerX - (vw / 2);
|
|
226
|
+
const yPos = centerY - (vh / 2);
|
|
227
|
+
ctx.fillText(formattedTxt, xPos, yPos);
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
case 'right': {
|
|
231
|
+
const xPos = x + w - vw;
|
|
232
|
+
ctx.fillText(formattedTxt, xPos, centerY);
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
case 'bottom': {
|
|
236
|
+
const xPos = centerX - (vw / 2);
|
|
237
|
+
const yPos = centerY + (vh / 2);
|
|
238
|
+
ctx.fillText(formattedTxt, xPos, yPos);
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
case 'left':
|
|
242
|
+
ctx.fillText(formattedTxt, x, centerY);
|
|
243
|
+
break;
|
|
244
|
+
default: {
|
|
245
|
+
const xPos = centerX - (vw / 2);
|
|
246
|
+
ctx.fillText(formattedTxt, xPos, centerY);
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
ctx.restore();
|
|
252
|
+
}
|
|
253
|
+
|
|
134
254
|
/**
|
|
135
255
|
*Returns items in range
|
|
136
256
|
* @param {object} params range values
|
|
@@ -141,9 +261,20 @@ class HeatMap {
|
|
|
141
261
|
const gdata = this.data;
|
|
142
262
|
const xep = xsp + width;
|
|
143
263
|
const yep = ysp + height;
|
|
144
|
-
return gdata.filter(
|
|
145
|
-
|
|
146
|
-
|
|
264
|
+
return gdata.filter(({ xp, yp, w, h }) => {
|
|
265
|
+
const x1 = xp;
|
|
266
|
+
const x2 = xp + w;
|
|
267
|
+
const y1 = yp;
|
|
268
|
+
const y2 = yp + h;
|
|
269
|
+
|
|
270
|
+
return ((x1 <= xsp && x2 >= xsp) && (y1 <= ysp && y2 >= ysp))
|
|
271
|
+
|| ((x1 <= xep && x2 >= xep) && (y1 <= ysp && y2 >= ysp))
|
|
272
|
+
|| ((x1 <= xsp && x2 >= xsp) && (y1 <= yep && y2 >= yep))
|
|
273
|
+
|| ((x1 <= xep && x2 >= xep) && (y1 <= yep && y2 >= yep))
|
|
274
|
+
|| ((x1 >= xsp && x1 <= xep) && (y1 >= ysp && y1 <= yep))
|
|
275
|
+
|| ((x1 >= xsp && x1 <= xep) && (y2 >= ysp && y2 <= yep))
|
|
276
|
+
|| ((x2 >= xsp && x2 <= xep) && (y1 >= ysp && y1 <= yep));
|
|
277
|
+
});
|
|
147
278
|
}
|
|
148
279
|
|
|
149
280
|
/**
|
|
@@ -159,13 +290,29 @@ class HeatMap {
|
|
|
159
290
|
|
|
160
291
|
const x = gdata.xp;
|
|
161
292
|
const y = gdata.yp;
|
|
293
|
+
const w = gdata.w;
|
|
294
|
+
const h = gdata.h;
|
|
162
295
|
|
|
163
296
|
ctx.save();
|
|
164
297
|
if (x !== null && y !== null) {
|
|
165
298
|
const color = gdata.dataColor;
|
|
166
299
|
ctx.strokeStyle = Util.colorStringToRgba(color, 1);
|
|
167
300
|
ctx.fillStyle = Util.colorStringToRgba(color, this.highlight.maxShadowOpacity);
|
|
168
|
-
|
|
301
|
+
ctx.shadowColor = color;
|
|
302
|
+
this.drawItem(ctx, x, y, w, h);
|
|
303
|
+
|
|
304
|
+
if (this.showValue.use) {
|
|
305
|
+
this.drawValueLabels({
|
|
306
|
+
context: ctx,
|
|
307
|
+
data: gdata,
|
|
308
|
+
positions: {
|
|
309
|
+
x,
|
|
310
|
+
y,
|
|
311
|
+
w,
|
|
312
|
+
h,
|
|
313
|
+
},
|
|
314
|
+
});
|
|
315
|
+
}
|
|
169
316
|
}
|
|
170
317
|
|
|
171
318
|
ctx.restore();
|
|
@@ -186,16 +333,13 @@ class HeatMap {
|
|
|
186
333
|
color: null,
|
|
187
334
|
name: null,
|
|
188
335
|
};
|
|
189
|
-
const wSize = this.size.w;
|
|
190
|
-
const hSize = this.size.h;
|
|
191
336
|
const gdata = this.data;
|
|
192
337
|
|
|
193
338
|
const foundItem = gdata.find((data) => {
|
|
194
|
-
const x = data
|
|
195
|
-
const y = data.yp;
|
|
339
|
+
const { xp: x, yp: y, w: wSize, h: hSize } = data;
|
|
196
340
|
|
|
197
|
-
return (x
|
|
198
|
-
&& (xp <= x)
|
|
341
|
+
return (x <= xp)
|
|
342
|
+
&& (xp <= x + wSize)
|
|
199
343
|
&& (y <= yp)
|
|
200
344
|
&& (yp <= y + hSize);
|
|
201
345
|
});
|
|
@@ -44,15 +44,22 @@ class Line {
|
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
const { ctx, chartRect, labelOffset, axesSteps } = param;
|
|
47
|
+
const { ctx, chartRect, labelOffset, axesSteps, selectLabel } = param;
|
|
48
48
|
const extent = this.extent[this.state];
|
|
49
|
-
|
|
50
|
-
const
|
|
49
|
+
const selectLabelOption = selectLabel.option;
|
|
50
|
+
const selectedLabel = selectLabel.selected;
|
|
51
|
+
const isExistSelectedLabel = selectLabelOption.use
|
|
52
|
+
&& selectLabelOption.useSeriesOpacity
|
|
53
|
+
&& selectedLabel.dataIndex?.length > 0;
|
|
54
|
+
const downplayOpacity = this.extent.downplay.opacity;
|
|
55
|
+
|
|
56
|
+
const fillOpacity = isExistSelectedLabel
|
|
57
|
+
? this.fillOpacity * downplayOpacity : this.fillOpacity * extent.opacity;
|
|
51
58
|
const lineWidth = this.lineWidth * extent.lineWidth;
|
|
52
59
|
|
|
53
60
|
const getOpacity = (colorStr) => {
|
|
54
61
|
const noneDownplayOpacity = colorStr.includes('rgba') ? Util.getOpacity(colorStr) : 1;
|
|
55
|
-
return this.state === 'downplay' ? 0.1 : noneDownplayOpacity;
|
|
62
|
+
return this.state === 'downplay' || isExistSelectedLabel ? 0.1 : noneDownplayOpacity;
|
|
56
63
|
};
|
|
57
64
|
|
|
58
65
|
const mainColor = this.color;
|
|
@@ -165,14 +172,18 @@ class Line {
|
|
|
165
172
|
|
|
166
173
|
ctx.fill();
|
|
167
174
|
}
|
|
168
|
-
|
|
169
|
-
if (this.point) {
|
|
175
|
+
if (this.point || isExistSelectedLabel) {
|
|
170
176
|
ctx.strokeStyle = Util.colorStringToRgba(mainColor, mainColorOpacity);
|
|
171
|
-
|
|
177
|
+
const focusStyle = Util.colorStringToRgba(pointFillColor, 1);
|
|
178
|
+
const blurStyle = Util.colorStringToRgba(pointFillColor, pointFillColorOpacity);
|
|
172
179
|
|
|
173
|
-
this.data.forEach((curr) => {
|
|
180
|
+
this.data.forEach((curr, i) => {
|
|
174
181
|
if (curr.xp !== null && curr.yp !== null) {
|
|
175
|
-
|
|
182
|
+
ctx.fillStyle = isExistSelectedLabel && selectedLabel.dataIndex.includes(i)
|
|
183
|
+
? focusStyle : blurStyle;
|
|
184
|
+
if (this.point || selectedLabel.dataIndex.includes(i)) {
|
|
185
|
+
Canvas.drawPoint(ctx, this.pointStyle, this.pointSize, curr.xp, curr.yp);
|
|
186
|
+
}
|
|
176
187
|
}
|
|
177
188
|
});
|
|
178
189
|
}
|