evui 3.4.149 → 3.4.151

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.umd.js CHANGED
@@ -11236,7 +11236,7 @@ var update = add("9519e5b6", content, true, {"sourceMap":false,"shadowMode":fals
11236
11236
  /***/ "9224":
11237
11237
  /***/ (function(module) {
11238
11238
 
11239
- module.exports = JSON.parse("{\"a\":\"3.4.149\"}");
11239
+ module.exports = JSON.parse("{\"a\":\"3.4.151\"}");
11240
11240
 
11241
11241
  /***/ }),
11242
11242
 
@@ -39053,18 +39053,17 @@ var modules = {
39053
39053
  };
39054
39054
 
39055
39055
  for (var x = 0; x < keys.length; x++) {
39056
- var _this$dataSet$key$dat, _this$dataSet$key$dat2, _this$dataSet$key$dat3;
39056
+ var _dataGroup$at, _dataGroup$at$data, _dataGroup$at$data$at;
39057
39057
 
39058
39058
  var key = keys[x];
39059
39059
  var data = datas[key];
39060
- var storeLength = data === null || data === void 0 ? void 0 : data.length;
39061
- var lastTime = 0;
39060
+ var storeLength = data === null || data === void 0 ? void 0 : data.length; // 1) init / updateSeries 시 dataset shape 보장
39062
39061
 
39063
- if (!this.isInit || this.updateSeries) {
39062
+ if (!this.isInit || this.updateSeries || !this.dataSet[key]) {
39064
39063
  var defaultValues = {
39065
39064
  dataGroup: [],
39066
39065
  startIndex: 0,
39067
- endIndex: 0,
39066
+ endIndex: null,
39068
39067
  length: 0,
39069
39068
  fromTime: 0,
39070
39069
  toTime: 0
@@ -39072,104 +39071,132 @@ var modules = {
39072
39071
  this.dataSet[key] = _objectSpread2(_objectSpread2({}, defaultValues), this.dataSet[key]);
39073
39072
  }
39074
39073
 
39075
- this.dataSet[key].length = this.options.realTimeScatter.range || 300;
39074
+ var dataset = this.dataSet[key];
39075
+ var dataGroup = dataset.dataGroup; // 2) range(length) 결정 + 변경 감지
39076
+
39077
+ var nextLength = this.options.realTimeScatter.range || 300;
39078
+ var lengthChanged = dataset.length !== nextLength;
39079
+ dataset.length = nextLength;
39080
+ var length = dataset.length; // 3) 이번 배치의 lastTime(초 단위) 계산
39081
+
39082
+ var lastTime = 0;
39076
39083
 
39077
39084
  for (var i = 0; i < storeLength; i++) {
39078
39085
  var item = data[i];
39079
39086
 
39080
- if (lastTime < item.x) {
39087
+ if (item && lastTime < item.x) {
39081
39088
  lastTime = item.x;
39082
39089
  }
39083
39090
  }
39084
39091
 
39085
- lastTime = Math.floor(lastTime / 1000) * 1000;
39086
- var dataGroupLastTime = ((_this$dataSet$key$dat = this.dataSet[key].dataGroup.at(-1)) === null || _this$dataSet$key$dat === void 0 ? void 0 : (_this$dataSet$key$dat2 = _this$dataSet$key$dat.data) === null || _this$dataSet$key$dat2 === void 0 ? void 0 : (_this$dataSet$key$dat3 = _this$dataSet$key$dat2.at(-1)) === null || _this$dataSet$key$dat3 === void 0 ? void 0 : _this$dataSet$key$dat3.x) || Date.now();
39087
- this.dataSet[key].toTime = lastTime || (dataGroupLastTime ? Math.floor(dataGroupLastTime / 1000) * 1000 : 0);
39088
- this.dataSet[key].fromTime = this.dataSet[key].toTime - this.dataSet[key].length * 1000;
39089
- this.dataSet[key].endIndex = this.dataSet[key].length - 1;
39092
+ lastTime = lastTime ? Math.floor(lastTime / 1000) * 1000 : 0;
39093
+ var dataGroupLastTime = ((_dataGroup$at = dataGroup.at(-1)) === null || _dataGroup$at === void 0 ? void 0 : (_dataGroup$at$data = _dataGroup$at.data) === null || _dataGroup$at$data === void 0 ? void 0 : (_dataGroup$at$data$at = _dataGroup$at$data.at(-1)) === null || _dataGroup$at$data$at === void 0 ? void 0 : _dataGroup$at$data$at.x) || Date.now();
39094
+ var fallbackTime = Math.floor(dataGroupLastTime / 1000) * 1000; // 4) prevToTime은 덮기 전 값 (없으면 fallback)
39090
39095
 
39091
- if ((this.dataSet[key].toTime - lastTime) / 1000 > this.dataSet[key].length && key === '') {
39092
- return;
39093
- }
39096
+ var prevToTime = dataset.toTime || fallbackTime; // 5) nextToTime 결정: 데이터가 있으면 lastTime, 없으면 이전 유지
39094
39097
 
39095
- var gapCount = (lastTime - this.dataSet[key].toTime) / 1000;
39098
+ var nextToTime = lastTime || prevToTime; // 6) endIndex/startIndex 초기화 (최초 1회) + length 변경 시 재구성
39096
39099
 
39097
- if (gapCount > 0) {
39098
- this.dataSet[key].toTime = lastTime;
39099
- this.dataSet[key].fromTime = lastTime - this.dataSet[key].length * 1000;
39100
- }
39100
+ if (dataset.endIndex == null || lengthChanged) {
39101
+ dataset.startIndex = 0;
39102
+ dataset.endIndex = length - 1; // dataGroup 크기 맞추고 모두 reset
39101
39103
 
39102
- for (var _i = 0; _i < this.dataSet[key].length; _i++) {
39103
- var _defaultValues = {
39104
- data: [],
39105
- max: 0,
39106
- min: Infinity
39107
- };
39108
- this.dataSet[key].dataGroup[_i] = _objectSpread2(_objectSpread2({}, _defaultValues), this.dataSet[key].dataGroup[_i]);
39104
+ dataGroup.length = length;
39105
+
39106
+ for (var _i = 0; _i < length; _i++) {
39107
+ dataGroup[_i] = dataGroup[_i] || {
39108
+ data: [],
39109
+ max: 0,
39110
+ min: Infinity
39111
+ };
39112
+ dataGroup[_i].data.length = 0;
39113
+ dataGroup[_i].max = 0;
39114
+ dataGroup[_i].min = Infinity;
39115
+ } // toTime/fromTime도 새 기준으로 맞춤
39116
+
39117
+
39118
+ dataset.toTime = nextToTime;
39119
+ dataset.fromTime = dataset.toTime - length * 1000;
39120
+ } // 7) gapCount 계산 (반드시 정수) — prevToTime 기준
39121
+
39122
+
39123
+ var rawGap = (nextToTime - prevToTime) / 1000;
39124
+ var gapCount = Number.isFinite(rawGap) ? Math.max(0, Math.floor(rawGap)) : 0; // 8) to/from 갱신
39125
+
39126
+ dataset.toTime = nextToTime;
39127
+ dataset.fromTime = dataset.toTime - length * 1000; // (원래 코드에 있던 early return 유지)
39128
+
39129
+ if (lastTime && (dataset.toTime - lastTime) / 1000 > length && key === '') {
39130
+ return;
39109
39131
  }
39110
39132
 
39111
- if (gapCount > 0) {
39112
- if (gapCount >= this.dataSet[key].length) {
39113
- for (var _i2 = 0; _i2 < this.dataSet[key].length; _i2++) {
39114
- this.dataSet[key].dataGroup[_i2].data.length = 0;
39115
- this.dataSet[key].dataGroup[_i2].max = 0;
39116
- this.dataSet[key].dataGroup[_i2].min = Infinity;
39117
- }
39133
+ var resetDataGroup = function resetDataGroup(group) {
39134
+ group.data.length = 0;
39135
+ group.max = 0;
39136
+ group.min = Infinity;
39137
+ }; // 9) dataGroup 슬롯 확보
39118
39138
 
39119
- this.dataSet[key].startIndex = 0;
39120
- this.dataSet[key].endIndex = this.dataSet[key].length - 1;
39121
- } else {
39122
- while (gapCount > 0) {
39123
- if (this.dataSet[key].dataGroup[this.dataSet[key].startIndex] === null) {
39124
- this.dataSet[key].dataGroup[this.dataSet[key].startIndex] = {
39125
- data: [],
39126
- max: 0,
39127
- min: Infinity
39128
- };
39129
- } else {
39130
- this.dataSet[key].dataGroup[this.dataSet[key].startIndex].data.length = 0;
39131
- this.dataSet[key].dataGroup[this.dataSet[key].startIndex].max = 0;
39132
- this.dataSet[key].dataGroup[this.dataSet[key].startIndex].min = Infinity;
39133
- }
39134
39139
 
39135
- ++this.dataSet[key].startIndex;
39140
+ for (var _i2 = 0; _i2 < length; _i2++) {
39141
+ if (!dataGroup[_i2]) {
39142
+ dataGroup[_i2] = {
39143
+ data: [],
39144
+ max: 0,
39145
+ min: Infinity
39146
+ };
39147
+ } else if (!dataGroup[_i2].data) {
39148
+ dataGroup[_i2].data = [];
39149
+ dataGroup[_i2].max = 0;
39150
+ dataGroup[_i2].min = Infinity;
39151
+ }
39152
+ } // 10) gap만큼 링 전진 + 지나간 버킷 clear
39136
39153
 
39137
- if (this.dataSet[key].startIndex >= this.dataSet[key].length) {
39138
- this.dataSet[key].startIndex = 0;
39139
- }
39140
39154
 
39141
- ++this.dataSet[key].endIndex;
39155
+ if (gapCount > 0) {
39156
+ if (gapCount >= length) {
39157
+ for (var _i3 = 0; _i3 < length; _i3++) {
39158
+ resetDataGroup(dataGroup[_i3]);
39159
+ }
39142
39160
 
39143
- if (this.dataSet[key].endIndex >= this.dataSet[key].length) {
39144
- this.dataSet[key].endIndex = 0;
39145
- }
39161
+ dataset.startIndex = 0;
39162
+ dataset.endIndex = length - 1;
39163
+ } else {
39164
+ var currentStart = dataset.startIndex;
39165
+ var currentEnd = dataset.endIndex;
39146
39166
 
39147
- --gapCount;
39167
+ for (var _i4 = 0; _i4 < gapCount; _i4++) {
39168
+ resetDataGroup(dataGroup[currentStart]);
39169
+ currentStart = (currentStart + 1) % length;
39170
+ currentEnd = (currentEnd + 1) % length;
39148
39171
  }
39172
+
39173
+ dataset.startIndex = currentStart;
39174
+ dataset.endIndex = currentEnd;
39149
39175
  }
39150
- }
39176
+ } // 11) 데이터 push (윈도우 안에 들어오는 것만)
39151
39177
 
39152
- for (var _i3 = 0; _i3 < storeLength; _i3++) {
39153
- var _item = data[_i3];
39154
- var xAxisTime = Math.floor(_item.x / 1000) * 1000;
39155
39178
 
39156
- if (this.dataSet[key].fromTime <= xAxisTime) {
39157
- var _item$value;
39179
+ for (var _i5 = 0; _i5 < storeLength; _i5++) {
39180
+ var _item = data[_i5];
39158
39181
 
39159
- var index = this.dataSet[key].endIndex - (this.dataSet[key].toTime - xAxisTime) / 1000;
39182
+ if (_item) {
39183
+ var xAxisTime = Math.floor(_item.x / 1000) * 1000;
39160
39184
 
39161
- if (index < 0) {
39162
- index = this.dataSet[key].length + index;
39163
- }
39185
+ if (dataset.fromTime <= xAxisTime) {
39186
+ var _item$value;
39164
39187
 
39165
- this.dataSet[key].dataGroup[index].data.push({
39166
- x: _item.x,
39167
- y: _item.y,
39168
- o: (_item$value = _item.value) !== null && _item$value !== void 0 ? _item$value : _item.y,
39169
- color: _item.color
39170
- });
39171
- this.dataSet[key].dataGroup[index].max = Math.max(this.dataSet[key].dataGroup[index].max, _item.y);
39172
- this.dataSet[key].dataGroup[index].min = Math.min(this.dataSet[key].dataGroup[index].min, _item.y);
39188
+ var index = dataset.endIndex - (dataset.toTime - xAxisTime) / 1000;
39189
+ if (index < 0) index = length + index;
39190
+ var group = dataGroup[index];
39191
+ group.data.push({
39192
+ x: _item.x,
39193
+ y: _item.y,
39194
+ o: (_item$value = _item.value) !== null && _item$value !== void 0 ? _item$value : _item.y,
39195
+ color: _item.color
39196
+ });
39197
+ group.max = Math.max(group.max, _item.y);
39198
+ group.min = Math.min(group.min, _item.y);
39199
+ }
39173
39200
  }
39174
39201
  } // 실제 차트에 그려지는 데이터(fromTime ~ toTime 범위)에서만 min/max 계산
39175
39202
 
@@ -39178,12 +39205,11 @@ var modules = {
39178
39205
  maxY: -Infinity,
39179
39206
  minY: Infinity
39180
39207
  };
39181
- var _this$dataSet$key = this.dataSet[key],
39182
- fromTime = _this$dataSet$key.fromTime,
39183
- toTime = _this$dataSet$key.toTime;
39208
+ var fromTime = dataset.fromTime,
39209
+ toTime = dataset.toTime;
39184
39210
 
39185
- for (var _i4 = 0; _i4 < this.dataSet[key].length; _i4++) {
39186
- var groupData = this.dataSet[key].dataGroup[_i4].data;
39211
+ for (var _i6 = 0; _i6 < length; _i6++) {
39212
+ var groupData = dataGroup[_i6].data;
39187
39213
 
39188
39214
  for (var j = 0; j < groupData.length; j++) {
39189
39215
  var _item2 = groupData[j]; // 현재 시간 범위 내의 데이터만 minMax 계산에 포함
@@ -39211,8 +39237,8 @@ var modules = {
39211
39237
 
39212
39238
  minMaxValues.maxY = Math.max(minMaxValues.maxY, tempMinMax.maxY);
39213
39239
  minMaxValues.minY = Math.min(minMaxValues.minY, tempMinMax.minY);
39214
- minMaxValues.fromTime = this.dataSet[key].fromTime;
39215
- minMaxValues.toTime = this.dataSet[key].toTime;
39240
+ minMaxValues.fromTime = dataset.fromTime;
39241
+ minMaxValues.toTime = dataset.toTime;
39216
39242
  }
39217
39243
 
39218
39244
  this.seriesInfo.charts.scatter.forEach(function (seriesID) {
@@ -55484,11 +55510,7 @@ var chart_core_EvChart = /*#__PURE__*/function () {
55484
55510
  }, {
55485
55511
  key: "adjustXAndYAxisWidth",
55486
55512
  value: function adjustXAndYAxisWidth() {
55487
- var _this2 = this,
55488
- _this$axesRange,
55489
- _this$axesRange$x,
55490
- _this$axesRange2,
55491
- _this$axesRange2$y;
55513
+ var _this2 = this;
55492
55514
 
55493
55515
  var getNotFormattedLabels = function getNotFormattedLabels(axesSteps, axisType, axis) {
55494
55516
  var _ref2 = axesSteps !== null && axesSteps !== void 0 ? axesSteps : {},
@@ -55532,42 +55554,51 @@ var chart_core_EvChart = /*#__PURE__*/function () {
55532
55554
  return result;
55533
55555
  };
55534
55556
 
55535
- var adjustedRange = {
55536
- x: (_this$axesRange = this.axesRange) === null || _this$axesRange === void 0 ? void 0 : (_this$axesRange$x = _this$axesRange.x) === null || _this$axesRange$x === void 0 ? void 0 : _this$axesRange$x.map(function (value, index) {
55537
- var _this2$axesSteps, _axis$labelStyle, _axis$getLabelWidthHa, _axis$getLabelWidthHa2;
55538
-
55539
- var axis = _this2.axesX[index];
55540
- var axesSteps = (_this2$axesSteps = _this2.axesSteps) === null || _this2$axesSteps === void 0 ? void 0 : _this2$axesSteps.x[index];
55541
- var notFormattedLabels = getNotFormattedLabels(axesSteps, 'x', axis);
55542
- var fixWidth = truthyNumber(axis === null || axis === void 0 ? void 0 : (_axis$labelStyle = axis.labelStyle) === null || _axis$labelStyle === void 0 ? void 0 : _axis$labelStyle.fixWidth) ? axis.labelStyle.fixWidth : 0;
55543
- var maxWidth = (_axis$getLabelWidthHa = axis === null || axis === void 0 ? void 0 : (_axis$getLabelWidthHa2 = axis.getLabelWidthHasMaxLength) === null || _axis$getLabelWidthHa2 === void 0 ? void 0 : _axis$getLabelWidthHa2.call(axis, notFormattedLabels, _this2.chartRect)) !== null && _axis$getLabelWidthHa !== void 0 ? _axis$getLabelWidthHa : 0;
55544
- return _objectSpread2(_objectSpread2({}, value), {}, {
55545
- size: {
55546
- width: fixWidth || Math.max(maxWidth, value.size.width),
55547
- height: value.size.height
55548
- }
55549
- });
55550
- }),
55551
- y: (_this$axesRange2 = this.axesRange) === null || _this$axesRange2 === void 0 ? void 0 : (_this$axesRange2$y = _this$axesRange2.y) === null || _this$axesRange2$y === void 0 ? void 0 : _this$axesRange2$y.map(function (value, index) {
55552
- var _this2$axesSteps2, _axis$labelStyle2, _axis$getLabelWidthHa3, _axis$getLabelWidthHa4;
55553
-
55554
- var axis = _this2.axesY[index];
55555
- var axesSteps = (_this2$axesSteps2 = _this2.axesSteps) === null || _this2$axesSteps2 === void 0 ? void 0 : _this2$axesSteps2.y[index];
55556
- var notFormattedLabels = getNotFormattedLabels(axesSteps, 'y', axis);
55557
- var fixWidth = truthyNumber(axis === null || axis === void 0 ? void 0 : (_axis$labelStyle2 = axis.labelStyle) === null || _axis$labelStyle2 === void 0 ? void 0 : _axis$labelStyle2.fixWidth) ? axis.labelStyle.fixWidth : 0;
55558
- var maxWidth = (_axis$getLabelWidthHa3 = axis === null || axis === void 0 ? void 0 : (_axis$getLabelWidthHa4 = axis.getLabelWidthHasMaxLength) === null || _axis$getLabelWidthHa4 === void 0 ? void 0 : _axis$getLabelWidthHa4.call(axis, notFormattedLabels, _this2.chartRect)) !== null && _axis$getLabelWidthHa3 !== void 0 ? _axis$getLabelWidthHa3 : 0;
55559
- return _objectSpread2(_objectSpread2({}, value), {}, {
55560
- size: {
55561
- width: fixWidth || Math.max(maxWidth, value.size.width),
55562
- height: value.size.height
55563
- }
55564
- });
55565
- })
55557
+ var remeasureRange = function remeasureRange(currentRange) {
55558
+ var _currentRange$x, _currentRange$y;
55559
+
55560
+ return {
55561
+ x: currentRange === null || currentRange === void 0 ? void 0 : (_currentRange$x = currentRange.x) === null || _currentRange$x === void 0 ? void 0 : _currentRange$x.map(function (value, index) {
55562
+ var _this2$axesSteps, _axis$labelStyle, _axis$getLabelWidthHa, _axis$getLabelWidthHa2;
55563
+
55564
+ var axis = _this2.axesX[index];
55565
+ var axesSteps = (_this2$axesSteps = _this2.axesSteps) === null || _this2$axesSteps === void 0 ? void 0 : _this2$axesSteps.x[index];
55566
+ var notFormattedLabels = getNotFormattedLabels(axesSteps, 'x', axis);
55567
+ var fixWidth = truthyNumber(axis === null || axis === void 0 ? void 0 : (_axis$labelStyle = axis.labelStyle) === null || _axis$labelStyle === void 0 ? void 0 : _axis$labelStyle.fixWidth) ? axis.labelStyle.fixWidth : 0;
55568
+ var maxWidth = (_axis$getLabelWidthHa = axis === null || axis === void 0 ? void 0 : (_axis$getLabelWidthHa2 = axis.getLabelWidthHasMaxLength) === null || _axis$getLabelWidthHa2 === void 0 ? void 0 : _axis$getLabelWidthHa2.call(axis, notFormattedLabels, _this2.chartRect)) !== null && _axis$getLabelWidthHa !== void 0 ? _axis$getLabelWidthHa : 0;
55569
+ return _objectSpread2(_objectSpread2({}, value), {}, {
55570
+ size: {
55571
+ width: fixWidth || Math.max(maxWidth, value.size.width),
55572
+ height: value.size.height
55573
+ }
55574
+ });
55575
+ }),
55576
+ y: currentRange === null || currentRange === void 0 ? void 0 : (_currentRange$y = currentRange.y) === null || _currentRange$y === void 0 ? void 0 : _currentRange$y.map(function (value, index) {
55577
+ var _this2$axesSteps2, _axis$labelStyle2, _axis$getLabelWidthHa3, _axis$getLabelWidthHa4;
55578
+
55579
+ var axis = _this2.axesY[index];
55580
+ var axesSteps = (_this2$axesSteps2 = _this2.axesSteps) === null || _this2$axesSteps2 === void 0 ? void 0 : _this2$axesSteps2.y[index];
55581
+ var notFormattedLabels = getNotFormattedLabels(axesSteps, 'y', axis);
55582
+ var fixWidth = truthyNumber(axis === null || axis === void 0 ? void 0 : (_axis$labelStyle2 = axis.labelStyle) === null || _axis$labelStyle2 === void 0 ? void 0 : _axis$labelStyle2.fixWidth) ? axis.labelStyle.fixWidth : 0;
55583
+ var maxWidth = (_axis$getLabelWidthHa3 = axis === null || axis === void 0 ? void 0 : (_axis$getLabelWidthHa4 = axis.getLabelWidthHasMaxLength) === null || _axis$getLabelWidthHa4 === void 0 ? void 0 : _axis$getLabelWidthHa4.call(axis, notFormattedLabels, _this2.chartRect)) !== null && _axis$getLabelWidthHa3 !== void 0 ? _axis$getLabelWidthHa3 : 0;
55584
+ return _objectSpread2(_objectSpread2({}, value), {}, {
55585
+ size: {
55586
+ width: fixWidth || Math.max(maxWidth, value.size.width),
55587
+ height: value.size.height
55588
+ }
55589
+ });
55590
+ })
55591
+ };
55566
55592
  };
55567
- this.axesRange = adjustedRange;
55568
- this.labelOffset = this.getLabelOffset(adjustedRange);
55593
+
55594
+ this.axesRange = remeasureRange(this.axesRange);
55595
+ this.labelOffset = this.getLabelOffset(this.axesRange);
55569
55596
  this.labelRange = this.getAxesLabelRange();
55570
- this.axesSteps = this.calculateSteps();
55597
+ this.axesSteps = this.calculateSteps(); // 새로운 step 기준으로 라벨 너비를 다시 측정하여 잘림 방지
55598
+ // TODO: 추후 개선 (3.4.200 이후 버전)
55599
+
55600
+ this.axesRange = remeasureRange(this.axesRange);
55601
+ this.labelOffset = this.getLabelOffset(this.axesRange);
55571
55602
  }
55572
55603
  /**
55573
55604
  * To draw canvas chart, it processes several sequential jobs