evui 3.4.201 → 3.4.202

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evui",
3
- "version": "3.4.201",
3
+ "version": "3.4.202",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -272,21 +272,24 @@ class EvChart {
272
272
  isReverseOrder ? jx-- : jx++
273
273
  ) {
274
274
  const series = this.seriesList[chartTypeSet[jx]];
275
- if (this.options.realTimeScatter?.use) {
276
- const seriesDatas = series.data[series.sId]?.dataGroup;
277
- for (let i = 0; i < seriesDatas.length; i++) {
278
- const dataItems = seriesDatas[i]?.data || [];
279
- for (let j = 0; j < dataItems.length; j++) {
280
- const item = dataItems[j];
275
+ const shouldInclude = !!series?.show;
276
+ if (shouldInclude) {
277
+ if (this.options.realTimeScatter?.use) {
278
+ const seriesDatas = series.data[series.sId]?.dataGroup;
279
+ for (let i = 0; i < seriesDatas.length; i++) {
280
+ const dataItems = seriesDatas[i]?.data || [];
281
+ for (let j = 0; j < dataItems.length; j++) {
282
+ const item = dataItems[j];
283
+ duple.set(`${item.x}${item.y}`, series.sId);
284
+ }
285
+ }
286
+ } else {
287
+ const seriesDatas = this.data.data[chartTypeSet[jx]] ?? [];
288
+ for (let i = 0; i < seriesDatas.length; i++) {
289
+ const item = seriesDatas[i];
281
290
  duple.set(`${item.x}${item.y}`, series.sId);
282
291
  }
283
292
  }
284
- } else {
285
- const seriesDatas = this.data.data[chartTypeSet[jx]] ?? [];
286
- for (let i = 0; i < seriesDatas.length; i++) {
287
- const item = seriesDatas[i];
288
- duple.set(`${item.x}${item.y}`, series.sId);
289
- }
290
293
  }
291
294
  }
292
295
  }
@@ -341,7 +344,7 @@ class EvChart {
341
344
  const chartType = chartKeys[ix];
342
345
  const chartTypeSet = this.seriesInfo.charts[chartType];
343
346
 
344
- if (chartType === 'scatter') {
347
+ if (chartType === 'scatter' && this.options.coordinateDedupe) {
345
348
  this.collectDuplicatePoints(duple, chartTypeSet);
346
349
  }
347
350
 
@@ -435,6 +438,7 @@ class EvChart {
435
438
  legendHitInfo,
436
439
  selectInfo,
437
440
  duple,
441
+ coordinateDedupe: this.options.coordinateDedupe,
438
442
  ...opt,
439
443
  });
440
444
  break;
@@ -483,10 +483,7 @@ class HeatMap {
483
483
  const y1 = yp;
484
484
  const y2 = yp + h;
485
485
 
486
- return ((x1 >= xsp && x1 <= xep) && (y1 >= ysp && y1 <= yep))
487
- || ((x1 >= xsp && x1 <= xep) && (y2 >= ysp && y2 <= yep))
488
- || ((x2 >= xsp && x2 <= xep) && (y1 >= ysp && y1 <= yep))
489
- || ((x2 >= xsp && x2 <= xep) && (y2 >= ysp && y2 <= yep));
486
+ return ((x1 >= xsp && x2 <= xep) && (y1 >= ysp && y2 <= yep));
490
487
  });
491
488
  }
492
489
 
@@ -695,8 +692,8 @@ class HeatMap {
695
692
  y: { steps: yCurrentCount, min: yMin, max: yMax },
696
693
  } = this.currentLabelInfo;
697
694
 
698
- const labelXCount = xCurrentCount || labelX.x.length;
699
- const labelYCount = yCurrentCount || labelY.y.length;
695
+ const labelXCount = xCurrentCount || labelX.length;
696
+ const labelYCount = yCurrentCount || labelY.length;
700
697
  const gapX = (x2 - x1) / labelXCount;
701
698
  const gapY = (y2 - y1) / labelYCount;
702
699
 
@@ -112,14 +112,22 @@ class Scatter {
112
112
  * @returns {undefined}
113
113
  */
114
114
  defaultScatterDraw(param) {
115
- const { ctx, axesSteps, duple, legendHitInfo } = param;
115
+ const { ctx, axesSteps, duple, legendHitInfo, coordinateDedupe } = param;
116
116
  const minmaxY = axesSteps.y[this.yAxisIndex];
117
117
 
118
118
  // Adjusted because Real Time Scatter is drawn from the back.
119
119
  for (let i = 0; i < this.data.length; i++) {
120
120
  const item = this.data[i];
121
121
  const idx = i;
122
- const shouldDraw = legendHitInfo ? (legendHitInfo.sId === this.sId) : duple.get(`${item.x}${item.y}`) === this.sId;
122
+ const isDedupeOn = coordinateDedupe !== false;
123
+ let shouldDraw;
124
+ if (legendHitInfo) {
125
+ shouldDraw = (legendHitInfo.sId === this.sId);
126
+ } else if (isDedupeOn) {
127
+ shouldDraw = duple.get(`${item.x}${item.y}`) === this.sId;
128
+ } else {
129
+ shouldDraw = true;
130
+ }
123
131
 
124
132
  if (shouldDraw) {
125
133
  this.calcItem(item, param);
@@ -148,7 +156,7 @@ class Scatter {
148
156
  * @returns {undefined}
149
157
  */
150
158
  realTimeScatterDraw(param) {
151
- const { ctx, axesSteps, duple, legendHitInfo } = param;
159
+ const { ctx, axesSteps, duple, legendHitInfo, coordinateDedupe } = param;
152
160
  const minmaxY = axesSteps.y[this.yAxisIndex];
153
161
  const pointStyle = typeof this.pointStyle === 'string' ? this.pointStyle : this.pointStyle.value;
154
162
  const pointSize = typeof this.pointSize === 'number' ? this.pointSize : this.pointSize.value;
@@ -157,7 +165,15 @@ class Scatter {
157
165
  for (let j = 0; j < this.data[this.sId]?.dataGroup[i]?.data.length; j++) {
158
166
  const item = this.data[this.sId]?.dataGroup[i]?.data[j];
159
167
 
160
- const shouldDraw = legendHitInfo ? (legendHitInfo.sId === this.sId) : duple.get(`${item.x}${item.y}`) === this.sId;
168
+ const isDedupeOnRT = coordinateDedupe !== false;
169
+ let shouldDraw;
170
+ if (legendHitInfo) {
171
+ shouldDraw = (legendHitInfo.sId === this.sId);
172
+ } else if (isDedupeOnRT) {
173
+ shouldDraw = duple.get(`${item.x}${item.y}`) === this.sId;
174
+ } else {
175
+ shouldDraw = true;
176
+ }
161
177
 
162
178
  if (shouldDraw) {
163
179
  this.calcItem(item, param);
@@ -37,7 +37,22 @@ const modules = {
37
37
  if (tooltip.use && this.isInitTooltip) {
38
38
  this.drawItemsHighlight(hitInfo, ctx);
39
39
 
40
- if (tooltip?.formatter?.html) {
40
+ if (typeof tooltip?.returnValue === 'function') {
41
+ const seriesList = [];
42
+ Object.keys(hitInfo.items).forEach((sId) => {
43
+ seriesList.push({
44
+ sId,
45
+ data: hitInfo.items[sId].data,
46
+ color: hitInfo.items[sId].color,
47
+ name: hitInfo.items[sId].name,
48
+ dataId: hitInfo.items[sId].id,
49
+ index: hitInfo.items[sId].index,
50
+ });
51
+ });
52
+
53
+ this.hideTooltipDOM();
54
+ tooltip.returnValue(seriesList, e);
55
+ } else if (tooltip?.formatter?.html) {
41
56
  this.drawCustomTooltip(hitInfo?.items);
42
57
  this.setCustomTooltipLayoutPosition(hitInfo, e);
43
58
  } else {
@@ -52,6 +67,10 @@ const modules = {
52
67
  }
53
68
  }
54
69
  } else if (tooltip.use && this.isInitTooltip) {
70
+ if (typeof tooltip?.returnValue === 'function') {
71
+ tooltip.returnValue([], e);
72
+ }
73
+
55
74
  this.hideTooltipDOM();
56
75
  }
57
76
 
@@ -88,7 +107,7 @@ const modules = {
88
107
  * @returns {undefined}
89
108
  */
90
109
 
91
- this.onMouseLeave = () => {
110
+ this.onMouseLeave = (e) => {
92
111
  const { tooltip, dragSelection } = this.options;
93
112
 
94
113
  if (tooltip.throttledMove) {
@@ -100,6 +119,10 @@ const modules = {
100
119
  }
101
120
 
102
121
  if (tooltip.use && this.isInitTooltip) {
122
+ if (typeof tooltip?.returnValue === 'function') {
123
+ tooltip.returnValue([], e);
124
+ }
125
+
103
126
  this.tooltipClear();
104
127
  }
105
128
  this.listeners['mouse-leave']();
@@ -444,8 +444,12 @@ class Scale {
444
444
 
445
445
  const mergedPlotBandOpt = defaultsDeep({}, plotBand, PLOT_BAND_OPTION);
446
446
  const { from: userDefinedFrom, to: userDefinedTo, label: labelOpt } = mergedPlotBandOpt;
447
- const from = userDefinedFrom ? Math.max(userDefinedFrom, axisMin) : axisMin;
448
- const to = userDefinedTo ? Math.min(userDefinedTo, axisMax) : axisMax;
447
+ const from = !Util.isNullOrUndefined(userDefinedFrom)
448
+ ? Math.max(userDefinedFrom, axisMin)
449
+ : axisMin;
450
+ const to = !Util.isNullOrUndefined(userDefinedTo)
451
+ ? Math.min(userDefinedTo, axisMax)
452
+ : axisMax;
449
453
 
450
454
  this.setPlotBandStyle(mergedPlotBandOpt);
451
455
 
@@ -127,9 +127,6 @@ class TimeCategoryScale extends Scale {
127
127
  const stepValue = stepInfo.rawInterval;
128
128
  const oriSteps = stepInfo.oriSteps;
129
129
 
130
- // 2개 이하일 경우, 첫번째와 마지막 라벨만 표시
131
- const count = steps <= 2 ? oriSteps : Math.round(oriSteps / steps);
132
-
133
130
  let startPoint = aPos[this.units.rectStart];
134
131
  const endPoint = aPos[this.units.rectEnd];
135
132
  const offsetPoint = aPos[this.units.rectOffset(this.position)];
@@ -184,7 +181,19 @@ class TimeCategoryScale extends Scale {
184
181
  let labelText;
185
182
  let labelPoint;
186
183
  let ix;
187
- const maxIndex = oriSteps === count ? oriSteps : oriSteps - 1;
184
+
185
+ // 2개 이하일 경우, 첫번째와 마지막 라벨만 표시
186
+ let count = steps <= 2 ? oriSteps : Math.round(oriSteps / steps);
187
+
188
+ // 첫번째 라벨이 축 시작점보다 오른쪽에 있을 경우, count를 1로 설정
189
+ // 추후 개선 필요: 근본적 문제는 라벨이 2개인 경우 oriSteps가 1로 와야하는데 2로 옴. horizontal일 때 예외처리 필요.
190
+ const isStartPointRightOfRectStart = startPoint > Math.ceil(aPos[this.units.rectStart]);
191
+ if (this.type === 'x' && isStartPointRightOfRectStart && count === oriSteps) {
192
+ count = 1;
193
+ }
194
+
195
+ const maxIndex = count === oriSteps ? oriSteps : oriSteps - 1;
196
+
188
197
  for (ix = 0; ix <= maxIndex; ix += count) {
189
198
  ticks[ix] = dayjs(axisMin).valueOf() + (ix * stepValue);
190
199
 
@@ -244,7 +253,11 @@ class TimeCategoryScale extends Scale {
244
253
  });
245
254
  }
246
255
  }
247
- if ((ix !== 0 && ix < oriSteps && this.showGrid)) {
256
+ if (
257
+ ix < oriSteps && this.showGrid && (
258
+ isStartPointRightOfRectStart || (!isStartPointRightOfRectStart && ix !== 0)
259
+ )
260
+ ) {
248
261
  ctx.moveTo(linePosition, offsetPoint);
249
262
  ctx.lineTo(linePosition, offsetCounterPoint);
250
263
  }
@@ -252,7 +265,10 @@ class TimeCategoryScale extends Scale {
252
265
  labelPoint = this.position === 'left' ? offsetPoint - 10 : offsetPoint + 10;
253
266
  ctx.fillText(labelText, labelPoint, labelCenter);
254
267
 
255
- if ((ix !== 0 && ix < oriSteps && this.showGrid)) {
268
+ if (
269
+ ix < oriSteps && this.showGrid && (
270
+ isStartPointRightOfRectStart || (!isStartPointRightOfRectStart && ix !== 0)
271
+ )) {
256
272
  ctx.moveTo(offsetPoint, linePosition);
257
273
  ctx.lineTo(offsetCounterPoint, linePosition);
258
274
  }
@@ -246,6 +246,7 @@ const DEFAULT_OPTIONS = {
246
246
  decimalPoint: 0,
247
247
  },
248
248
  seriesReverse: false,
249
+ coordinateDedupe: true,
249
250
  };
250
251
 
251
252
  const DEFAULT_DATA = {
@@ -895,8 +895,8 @@ export default {
895
895
  );
896
896
  watch(
897
897
  () => [props.width, props.height, props.option.columnWidth],
898
- (value) => {
899
- resizeInfo.columnWidth = value[3];
898
+ () => {
899
+ if (props.option.columnWidth != null) resizeInfo.columnWidth = props.option.columnWidth;
900
900
  stores.orderedColumns.map((column) => {
901
901
  const item = column;
902
902