evui 3.3.10 → 3.3.13
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 +2439 -1032
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +2439 -1032
- 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.core.js +65 -24
- package/src/components/chart/element/element.heatmap.js +195 -51
- package/src/components/chart/element/element.line.js +22 -9
- package/src/components/chart/element/element.scatter.js +26 -9
- package/src/components/chart/element/element.tip.js +103 -83
- 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 +19 -74
- package/src/components/chart/plugins/plugins.interaction.js +15 -4
- package/src/components/chart/plugins/plugins.legend.js +6 -3
- package/src/components/chart/plugins/plugins.pie.js +17 -0
- package/src/components/chart/plugins/plugins.tooltip.js +205 -32
- package/src/components/chart/scale/scale.js +10 -11
- package/src/components/chart/scale/scale.step.js +38 -3
- package/src/components/chart/scale/scale.time.category.js +35 -3
- package/src/components/chart/uses.js +12 -0
- package/src/components/grid/Grid.vue +109 -36
- package/src/components/grid/grid.summary.vue +235 -0
- package/src/components/grid/style/grid.scss +0 -14
- package/src/components/grid/uses.js +55 -46
- 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
|
@@ -153,7 +153,7 @@ class EvChart {
|
|
|
153
153
|
* @returns {undefined}
|
|
154
154
|
*/
|
|
155
155
|
drawSeries(hitInfo) {
|
|
156
|
-
const { maxTip, selectLabel } = this.options;
|
|
156
|
+
const { maxTip, selectLabel, selectItem } = this.options;
|
|
157
157
|
|
|
158
158
|
const opt = {
|
|
159
159
|
ctx: this.bufferCtx,
|
|
@@ -181,30 +181,69 @@ class EvChart {
|
|
|
181
181
|
for (let jx = 0; jx < chartTypeSet.length; jx++) {
|
|
182
182
|
const series = this.seriesList[chartTypeSet[jx]];
|
|
183
183
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (series.show) {
|
|
191
|
-
showIndex++;
|
|
184
|
+
switch (chartType) {
|
|
185
|
+
case 'line':
|
|
186
|
+
case 'heatMap': {
|
|
187
|
+
series.draw(opt);
|
|
188
|
+
break;
|
|
192
189
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
} else {
|
|
201
|
-
this.drawPie(selectInfo);
|
|
190
|
+
case 'bar': {
|
|
191
|
+
const { thickness, borderRadius } = this.options;
|
|
192
|
+
series.draw({ thickness, borderRadius, showSeriesCount, showIndex, ...opt });
|
|
193
|
+
if (series.show) {
|
|
194
|
+
showIndex++;
|
|
195
|
+
}
|
|
196
|
+
break;
|
|
202
197
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
198
|
+
case 'pie': {
|
|
199
|
+
const selectInfo = hitInfo
|
|
200
|
+
?? this.lastHitInfo
|
|
201
|
+
?? { sId: this.defaultSelectItemInfo?.seriesID };
|
|
202
|
+
|
|
203
|
+
if (this.options.sunburst) {
|
|
204
|
+
this.drawSunburst(selectInfo);
|
|
205
|
+
} else {
|
|
206
|
+
this.drawPie(selectInfo);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (this.options.doughnutHoleSize > 0) {
|
|
210
|
+
this.drawDoughnutHole();
|
|
211
|
+
}
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
case 'scatter': {
|
|
215
|
+
if (selectItem.use && selectItem.useSeriesOpacity) {
|
|
216
|
+
if (hitInfo) {
|
|
217
|
+
if (hitInfo?.maxIndex || hitInfo?.maxIndex === 0) {
|
|
218
|
+
opt.selectInfo = {
|
|
219
|
+
seriesID: hitInfo.sId,
|
|
220
|
+
dataIndex: hitInfo.maxIndex,
|
|
221
|
+
};
|
|
222
|
+
} else {
|
|
223
|
+
opt.selectInfo = null;
|
|
224
|
+
}
|
|
225
|
+
} else if (this.lastHitInfo?.maxIndex || this.lastHitInfo?.maxIndex === 0) {
|
|
226
|
+
opt.selectInfo = {
|
|
227
|
+
seriesID: this.lastHitInfo.sId,
|
|
228
|
+
dataIndex: this.lastHitInfo.maxIndex,
|
|
229
|
+
};
|
|
230
|
+
} else if (this.defaultSelectItemInfo?.dataIndex
|
|
231
|
+
|| this.defaultSelectItemInfo?.dataIndex === 0) {
|
|
232
|
+
opt.selectInfo = {
|
|
233
|
+
seriesID: this.defaultSelectItemInfo.seriesID,
|
|
234
|
+
dataIndex: this.defaultSelectItemInfo.dataIndex,
|
|
235
|
+
};
|
|
236
|
+
} else {
|
|
237
|
+
opt.selectInfo = null;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
series.draw(opt);
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
default: {
|
|
245
|
+
break;
|
|
206
246
|
}
|
|
207
|
-
break;
|
|
208
247
|
}
|
|
209
248
|
}
|
|
210
249
|
}
|
|
@@ -243,7 +282,9 @@ class EvChart {
|
|
|
243
282
|
*/
|
|
244
283
|
createAxes(dir, axes = []) {
|
|
245
284
|
const ctx = this.bufferCtx;
|
|
246
|
-
const labels = this.
|
|
285
|
+
const labels = this.options.type === 'heatMap'
|
|
286
|
+
? this.data.labels[dir]
|
|
287
|
+
: this.data.labels;
|
|
247
288
|
const options = this.options;
|
|
248
289
|
return axes.map((axis) => {
|
|
249
290
|
switch (axis.type) {
|
|
@@ -621,7 +662,7 @@ class EvChart {
|
|
|
621
662
|
this.labelOffset = this.getLabelOffset();
|
|
622
663
|
this.initSelectedLabelInfo();
|
|
623
664
|
|
|
624
|
-
this.render();
|
|
665
|
+
this.render(updateInfo?.hitInfo);
|
|
625
666
|
|
|
626
667
|
const isDragMove = this.dragInfo && this.drawSelectionArea;
|
|
627
668
|
if (isDragMove) {
|
|
@@ -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;
|
|
@@ -140,6 +147,8 @@ class Line {
|
|
|
140
147
|
if (this.stackIndex) {
|
|
141
148
|
const reversedDataList = this.data.slice().reverse();
|
|
142
149
|
reversedDataList.forEach((curr, ix) => {
|
|
150
|
+
ctx.beginPath();
|
|
151
|
+
|
|
143
152
|
x = getXPos(curr.x);
|
|
144
153
|
y = getYPos(curr.b);
|
|
145
154
|
|
|
@@ -165,14 +174,18 @@ class Line {
|
|
|
165
174
|
|
|
166
175
|
ctx.fill();
|
|
167
176
|
}
|
|
168
|
-
|
|
169
|
-
if (this.point) {
|
|
177
|
+
if (this.point || isExistSelectedLabel) {
|
|
170
178
|
ctx.strokeStyle = Util.colorStringToRgba(mainColor, mainColorOpacity);
|
|
171
|
-
|
|
179
|
+
const focusStyle = Util.colorStringToRgba(pointFillColor, 1);
|
|
180
|
+
const blurStyle = Util.colorStringToRgba(pointFillColor, pointFillColorOpacity);
|
|
172
181
|
|
|
173
|
-
this.data.forEach((curr) => {
|
|
182
|
+
this.data.forEach((curr, i) => {
|
|
174
183
|
if (curr.xp !== null && curr.yp !== null) {
|
|
175
|
-
|
|
184
|
+
ctx.fillStyle = isExistSelectedLabel && selectedLabel.dataIndex.includes(i)
|
|
185
|
+
? focusStyle : blurStyle;
|
|
186
|
+
if (this.point || selectedLabel.dataIndex.includes(i)) {
|
|
187
|
+
Canvas.drawPoint(ctx, this.pointStyle, this.pointSize, curr.xp, curr.yp);
|
|
188
|
+
}
|
|
176
189
|
}
|
|
177
190
|
});
|
|
178
191
|
}
|
|
@@ -69,18 +69,34 @@ class Scatter {
|
|
|
69
69
|
return item;
|
|
70
70
|
}, this.data[0]);
|
|
71
71
|
|
|
72
|
-
const getOpacity = (colorStr) => {
|
|
72
|
+
const getOpacity = (colorStr, dataIndex) => {
|
|
73
73
|
const noneDownplayOpacity = colorStr.includes('rgba') ? Util.getOpacity(colorStr) : 1;
|
|
74
|
-
|
|
74
|
+
let resultOpacity = noneDownplayOpacity;
|
|
75
|
+
|
|
76
|
+
const { selectInfo } = param;
|
|
77
|
+
if (selectInfo) {
|
|
78
|
+
const isSelectedData = selectInfo?.seriesID === this.sId
|
|
79
|
+
&& selectInfo?.dataIndex === dataIndex;
|
|
80
|
+
|
|
81
|
+
if (isSelectedData) {
|
|
82
|
+
resultOpacity = noneDownplayOpacity;
|
|
83
|
+
} else {
|
|
84
|
+
resultOpacity = 0.1;
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
resultOpacity = this.state === 'downplay' ? 0.1 : noneDownplayOpacity;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return resultOpacity;
|
|
75
91
|
};
|
|
76
92
|
|
|
77
|
-
this.data.forEach((curr) => {
|
|
93
|
+
this.data.forEach((curr, idx) => {
|
|
78
94
|
if (curr.xp !== null && curr.yp !== null) {
|
|
79
95
|
const color = curr.dataColor || this.color;
|
|
80
|
-
ctx.strokeStyle = Util.colorStringToRgba(color, getOpacity(color));
|
|
96
|
+
ctx.strokeStyle = Util.colorStringToRgba(color, getOpacity(color, idx));
|
|
81
97
|
|
|
82
98
|
const pointFillColor = curr.dataColor || this.pointFill;
|
|
83
|
-
ctx.fillStyle = Util.colorStringToRgba(pointFillColor, getOpacity(pointFillColor));
|
|
99
|
+
ctx.fillStyle = Util.colorStringToRgba(pointFillColor, getOpacity(pointFillColor, idx));
|
|
84
100
|
|
|
85
101
|
Canvas.drawPoint(ctx, this.pointStyle, this.pointSize, curr.xp, curr.yp);
|
|
86
102
|
}
|
|
@@ -148,11 +164,11 @@ class Scatter {
|
|
|
148
164
|
findGraphData(offset) {
|
|
149
165
|
const xp = offset[0];
|
|
150
166
|
const yp = offset[1];
|
|
151
|
-
const item = { data: null, hit: false, color: this.color };
|
|
167
|
+
const item = { data: null, hit: false, color: this.color, index: null };
|
|
152
168
|
const pointSize = this.pointSize;
|
|
153
169
|
const gdata = this.data;
|
|
154
170
|
|
|
155
|
-
const
|
|
171
|
+
const targetIndex = gdata.findIndex((data) => {
|
|
156
172
|
const x = data.xp;
|
|
157
173
|
const y = data.yp;
|
|
158
174
|
|
|
@@ -162,8 +178,9 @@ class Scatter {
|
|
|
162
178
|
&& (yp <= y + pointSize);
|
|
163
179
|
});
|
|
164
180
|
|
|
165
|
-
if (
|
|
166
|
-
item.data =
|
|
181
|
+
if (targetIndex > -1) {
|
|
182
|
+
item.data = gdata[targetIndex];
|
|
183
|
+
item.index = targetIndex;
|
|
167
184
|
item.hit = true;
|
|
168
185
|
}
|
|
169
186
|
|