evui 3.4.129 → 3.4.131

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
@@ -11183,7 +11183,7 @@ module.exports = exports;
11183
11183
  /***/ "9224":
11184
11184
  /***/ (function(module) {
11185
11185
 
11186
- module.exports = JSON.parse("{\"a\":\"3.4.129\"}");
11186
+ module.exports = JSON.parse("{\"a\":\"3.4.131\"}");
11187
11187
 
11188
11188
  /***/ }),
11189
11189
 
@@ -38512,26 +38512,26 @@ var es_string_match = __webpack_require__("466d");
38512
38512
  return value;
38513
38513
  }
38514
38514
 
38515
- var isNegative = value < 0;
38516
- var absValue = Math.abs(value);
38517
-
38518
38515
  var assignLabelWith = function assignLabelWith(v, target, lb) {
38519
- var result = v % target === 0 ? "".concat((v / target).toFixed(decimalPoint)).concat(lb) : "".concat((v / target).toFixed(1)).concat(lb);
38520
- return isNegative ? "-".concat(result) : result;
38521
- };
38522
-
38523
- if (absValue >= quad) {
38524
- label = assignLabelWith(absValue, quad, 'P');
38525
- } else if (absValue >= trill) {
38526
- label = assignLabelWith(absValue, trill, 'T');
38527
- } else if (absValue >= billi) {
38528
- label = assignLabelWith(absValue, billi, 'G');
38529
- } else if (absValue >= milli) {
38530
- label = assignLabelWith(absValue, milli, 'M');
38531
- } else if (absValue >= killo) {
38532
- label = assignLabelWith(absValue, 1000, 'K');
38516
+ if (v % target === 0) {
38517
+ return "".concat((v / target).toFixed(decimalPoint)).concat(lb);
38518
+ }
38519
+
38520
+ return "".concat((v / target).toFixed(1)).concat(lb);
38521
+ };
38522
+
38523
+ if (value >= quad) {
38524
+ label = assignLabelWith(value, quad, 'P');
38525
+ } else if (value >= trill) {
38526
+ label = assignLabelWith(value, trill, 'T');
38527
+ } else if (value >= billi) {
38528
+ label = assignLabelWith(value, billi, 'G');
38529
+ } else if (value >= milli) {
38530
+ label = assignLabelWith(value, milli, 'M');
38531
+ } else if (value >= killo) {
38532
+ label = assignLabelWith(value, 1000, 'K');
38533
38533
  } else {
38534
- label = isNegative ? "-".concat(absValue.toFixed(decimalPoint)) : value.toFixed(decimalPoint);
38534
+ label = value.toFixed(decimalPoint);
38535
38535
  }
38536
38536
 
38537
38537
  return label;
@@ -38805,23 +38805,21 @@ var modules = {
38805
38805
  seriesIDs.forEach(function (seriesID) {
38806
38806
  var series = _this.seriesList[seriesID];
38807
38807
  var sData = data[seriesID];
38808
- var passingValue = series === null || series === void 0 ? void 0 : series.passingValue;
38809
38808
 
38810
38809
  if (series && sData) {
38811
38810
  series.data = _this.addSeriesDSforScatter(sData);
38812
- series.minMax = _this.getSeriesMinMax(series.data, passingValue);
38811
+ series.minMax = _this.getSeriesMinMax(series.data);
38813
38812
  }
38814
38813
  });
38815
38814
  } else if (typeKey === 'heatMap') {
38816
38815
  seriesIDs.forEach(function (seriesID) {
38817
38816
  var series = _this.seriesList[seriesID];
38818
- var passingValue = series === null || series === void 0 ? void 0 : series.passingValue;
38819
38817
  var sData = data[seriesID];
38820
38818
 
38821
38819
  if (series && sData) {
38822
38820
  series.labels = label;
38823
38821
  series.data = _this.addSeriesDSForHeatMap(sData);
38824
- series.minMax = _this.getSeriesMinMax(series.data, passingValue);
38822
+ series.minMax = _this.getSeriesMinMax(series.data);
38825
38823
  series.valueOpt = _this.getSeriesValueOptForHeatMap(series);
38826
38824
  }
38827
38825
  });
@@ -38853,7 +38851,7 @@ var modules = {
38853
38851
  series.data = _this.addSeriesDS(sData, label, series.isExistGrp);
38854
38852
  }
38855
38853
 
38856
- series.minMax = _this.getSeriesMinMax(series.data, series.passingValue);
38854
+ series.minMax = _this.getSeriesMinMax(series.data);
38857
38855
  }
38858
38856
  });
38859
38857
  }
@@ -39249,19 +39247,17 @@ var modules = {
39249
39247
  var isHorizontal = this.options.horizontal;
39250
39248
  var sdata = [];
39251
39249
 
39252
- var getBaseDataPosition = function getBaseDataPosition(baseIndex, dataIndex, curr) {
39250
+ var getBaseDataPosition = function getBaseDataPosition(baseIndex, dataIndex) {
39253
39251
  var nextBaseSeriesIndex = baseIndex - 1;
39254
39252
  var baseSeries = _this4.seriesList[bsIds[baseIndex]];
39255
39253
  var baseDataList = baseSeries.data;
39256
39254
  var baseData = baseDataList[dataIndex];
39257
39255
  var position = isHorizontal ? baseData === null || baseData === void 0 ? void 0 : baseData.x : baseData === null || baseData === void 0 ? void 0 : baseData.y;
39258
- var baseValue = baseData === null || baseData === void 0 ? void 0 : baseData.o;
39259
- var isPassingValue = !helpers_util.isNullOrUndefined(baseSeries === null || baseSeries === void 0 ? void 0 : baseSeries.passingValue) && (baseSeries === null || baseSeries === void 0 ? void 0 : baseSeries.passingValue) === baseValue;
39260
- var isSameSign = curr >= 0 && baseValue >= 0 || curr < 0 && baseValue < 0;
39256
+ var isPassingValue = baseSeries.passingValue === (baseData === null || baseData === void 0 ? void 0 : baseData.o);
39261
39257
 
39262
- if (isPassingValue || position == null || !isSameSign || !baseSeries.show) {
39258
+ if (isPassingValue || position == null || !baseSeries.show) {
39263
39259
  if (nextBaseSeriesIndex > -1) {
39264
- return getBaseDataPosition(nextBaseSeriesIndex, dataIndex, curr);
39260
+ return getBaseDataPosition(nextBaseSeriesIndex, dataIndex);
39265
39261
  }
39266
39262
 
39267
39263
  return 0;
@@ -39272,7 +39268,7 @@ var modules = {
39272
39268
 
39273
39269
  data.forEach(function (curr, index) {
39274
39270
  var baseIndex = bsIds.length - 1 < 0 ? 0 : bsIds.length - 1;
39275
- var bdata = getBaseDataPosition(baseIndex, index, curr); // base(previous) series data
39271
+ var bdata = getBaseDataPosition(baseIndex, index); // base(previous) series data
39276
39272
 
39277
39273
  var odata = curr; // current series original data
39278
39274
 
@@ -39455,7 +39451,7 @@ var modules = {
39455
39451
  *
39456
39452
  * @returns {object} min/max info for series
39457
39453
  */
39458
- getSeriesMinMax: function getSeriesMinMax(data, passingValue) {
39454
+ getSeriesMinMax: function getSeriesMinMax(data) {
39459
39455
  var def = {
39460
39456
  minX: null,
39461
39457
  minY: null,
@@ -39466,24 +39462,22 @@ var modules = {
39466
39462
  var isHorizontal = this.options.horizontal;
39467
39463
 
39468
39464
  if (data.length) {
39469
- var usePassingValue = !helpers_util.isNullOrUndefined(passingValue);
39470
39465
  return data.reduce(function (acc, p, index) {
39471
- var _p$x, _p$y, _p$o;
39466
+ var _p$x, _p$y;
39472
39467
 
39473
39468
  var minmax = acc;
39474
39469
  var px = ((_p$x = p.x) === null || _p$x === void 0 ? void 0 : _p$x.value) || p.x;
39475
39470
  var py = ((_p$y = p.y) === null || _p$y === void 0 ? void 0 : _p$y.value) || p.y;
39476
- var po = ((_p$o = p.o) === null || _p$o === void 0 ? void 0 : _p$o.value) || p.o;
39477
39471
 
39478
- if (usePassingValue ? po !== passingValue && px <= minmax.minX : px <= minmax.minX) {
39472
+ if (px <= minmax.minX) {
39479
39473
  minmax.minX = px === null ? 0 : px;
39480
39474
  }
39481
39475
 
39482
- if (usePassingValue ? po !== passingValue && py <= minmax.minY : py <= minmax.minY) {
39476
+ if (py <= minmax.minY) {
39483
39477
  minmax.minY = py === null ? 0 : py;
39484
39478
  }
39485
39479
 
39486
- if (usePassingValue ? po !== passingValue && px >= minmax.maxX : px >= minmax.maxX) {
39480
+ if (px >= minmax.maxX) {
39487
39481
  minmax.maxX = px === null ? 0 : px;
39488
39482
 
39489
39483
  if (isHorizontal && px !== null) {
@@ -39492,7 +39486,7 @@ var modules = {
39492
39486
  }
39493
39487
  }
39494
39488
 
39495
- if (usePassingValue ? po !== passingValue && py >= minmax.maxY : py >= minmax.maxY) {
39489
+ if (py >= minmax.maxY) {
39496
39490
  minmax.maxY = py === null ? 0 : py;
39497
39491
 
39498
39492
  if (!isHorizontal && py !== null) {
@@ -40246,25 +40240,14 @@ var modules = {
40246
40240
  }
40247
40241
  }
40248
40242
 
40249
- var isExistGrp = _this10.seriesList[key].isExistGrp;
40250
- var maxXisNegative = minmax.x[axisX].max < 0;
40251
-
40252
- if (isExistGrp && maxXisNegative) {
40253
- minmax.x[axisX].max = smm.maxX;
40254
- minmax.x[axisX].maxSID = key;
40255
- } else if (!minmax.x[axisX].max || smm.maxX >= minmax.x[axisX].max) {
40243
+ if (smm.maxX >= minmax.x[axisX].max) {
40256
40244
  minmax.x[axisX].max = smm.maxX;
40257
40245
  minmax.x[axisX].maxSID = key;
40258
40246
  }
40259
40247
 
40260
- var maxYisNegative = minmax.y[axisY].max < 0;
40261
-
40262
- if (isExistGrp && maxYisNegative) {
40248
+ if (smm.maxY >= minmax.y[axisY].max) {
40263
40249
  minmax.y[axisY].max = smm.maxY;
40264
- minmax.y[axisY].maxSID = key;
40265
- } else if (!minmax.y[axisY].max || smm.maxY >= minmax.y[axisY].max) {
40266
- minmax.y[axisY].max = smm.maxY;
40267
- minmax.y[axisY].maxSID = key;
40250
+ minmax.y[axisX].maxSID = key;
40268
40251
  }
40269
40252
  }
40270
40253
 
@@ -41725,6 +41708,8 @@ var TIME_INTERVALS = {
41725
41708
 
41726
41709
 
41727
41710
 
41711
+
41712
+
41728
41713
 
41729
41714
  var element_line_Line = /*#__PURE__*/function () {
41730
41715
  function Line(sId, opt, sIdx) {
@@ -41859,6 +41844,7 @@ var element_line_Line = /*#__PURE__*/function () {
41859
41844
  ctx.setLineDash(this.segments);
41860
41845
  }
41861
41846
 
41847
+ var endPoint = chartRect.y2 - labelOffset.bottom;
41862
41848
  var isLinearInterpolation = this.useLinearInterpolation();
41863
41849
  var barAreaByCombo = 0;
41864
41850
  var minmaxX = axesSteps.x[this.xAxisIndex];
@@ -41881,12 +41867,8 @@ var element_line_Line = /*#__PURE__*/function () {
41881
41867
 
41882
41868
  var getYPos = function getYPos(val) {
41883
41869
  return helpers_canvas.calculateY(val, minmaxY.graphMin, minmaxY.graphMax, yArea, ysp);
41884
- };
41870
+ }; // draw line
41885
41871
 
41886
- var includeNegativeValue = this.data.some(function (data) {
41887
- return data.o < 0;
41888
- });
41889
- var endPoint = includeNegativeValue ? getYPos(0) : chartRect.y2 - labelOffset.bottom; // draw line
41890
41872
 
41891
41873
  var prevValid;
41892
41874
  this.data.forEach(function (curr) {
@@ -41946,10 +41928,9 @@ var element_line_Line = /*#__PURE__*/function () {
41946
41928
  }
41947
41929
  });
41948
41930
  var gradient = ctx.createLinearGradient(0, chartRect.y2, 0, maxValueYPos);
41949
- var mainGradientColor = extent.opacity < 1 ? fillColor : mainColor;
41950
- gradient.addColorStop(0, includeNegativeValue ? mainGradientColor : fillColor);
41931
+ gradient.addColorStop(0, fillColor);
41951
41932
  gradient.addColorStop(0.5, fillColor);
41952
- gradient.addColorStop(1, mainGradientColor);
41933
+ gradient.addColorStop(1, extent.opacity < 1 ? fillColor : mainColor);
41953
41934
  ctx.fillStyle = gradient;
41954
41935
  } else {
41955
41936
  ctx.fillStyle = fillColor;
@@ -42017,7 +41998,7 @@ var element_line_Line = /*#__PURE__*/function () {
42017
41998
 
42018
41999
  var nextData = _this2.data[jx];
42019
42000
  var xp = getXPos(nextData.x);
42020
- var bp = (_getYPos2 = getYPos(nextData.b)) !== null && _getYPos2 !== void 0 ? _getYPos2 : getYPos(0);
42001
+ var bp = (_getYPos2 = getYPos(nextData.b)) !== null && _getYPos2 !== void 0 ? _getYPos2 : endPoint;
42021
42002
  ctx.lineTo(xp, bp);
42022
42003
  }
42023
42004
 
@@ -42113,78 +42094,166 @@ var element_line_Line = /*#__PURE__*/function () {
42113
42094
  var gdata = this.data.filter(function (data) {
42114
42095
  return !helpers_util.isNullOrUndefined(data.x);
42115
42096
  });
42116
- var SPARE_XP = 0.5;
42117
42097
  var isLinearInterpolation = this.useLinearInterpolation();
42118
42098
 
42119
42099
  if (gdata !== null && gdata !== void 0 && gdata.length) {
42120
42100
  if (typeof dataIndex === 'number' && this.show) {
42121
42101
  item.data = gdata[dataIndex];
42122
42102
  item.index = dataIndex;
42103
+
42104
+ if (item.data) {
42105
+ var point = gdata[dataIndex];
42106
+ var yDist = Math.abs(yp - point.yp);
42107
+ var directHitThreshold = 15; // 직접 히트 임계값
42108
+
42109
+ if (yDist <= directHitThreshold) {
42110
+ item.hit = true;
42111
+ }
42112
+ }
42123
42113
  } else if (typeof this.beforeFindItemIndex === 'number' && this.show && useSelectLabelOrItem) {
42124
42114
  item.data = gdata[this.beforeFindItemIndex];
42125
42115
  item.index = this.beforeFindItemIndex;
42126
42116
  } else {
42127
- var _gdata$;
42128
-
42129
- var s = 0;
42130
- var e = gdata.length - 1;
42131
- var gap = Math.ceil(Math.abs(((_gdata$ = gdata[1]) === null || _gdata$ === void 0 ? void 0 : _gdata$.xp) - gdata[0].xp) / 2) || 0;
42132
- var xpInterval = Math.max(gap, 6);
42133
-
42134
- while (s <= e) {
42135
- var m = Math.floor((s + e) / 2);
42136
- var x = gdata[m].xp;
42137
- var y = gdata[m].yp;
42138
-
42139
- if (x - xpInterval <= xp && xp <= x + xpInterval) {
42140
- var _gdata$m, _gdata$xp, _gdata, _gdata2, _gdata3;
42141
-
42142
- var curXpInterval = ((_gdata$m = gdata[m]) === null || _gdata$m === void 0 ? void 0 : _gdata$m.xp) - ((_gdata$xp = (_gdata = gdata[m - 1]) === null || _gdata === void 0 ? void 0 : _gdata.xp) !== null && _gdata$xp !== void 0 ? _gdata$xp : 0);
42143
-
42144
- if ((_gdata2 = gdata[m - 1]) !== null && _gdata2 !== void 0 && _gdata2.xp && (_gdata3 = gdata[m + 1]) !== null && _gdata3 !== void 0 && _gdata3.xp && curXpInterval > 0) {
42145
- var leftXp = Math.abs(xp - gdata[m - 1].xp);
42146
- var midXp = Math.abs(xp - gdata[m].xp);
42147
- var rightXp = Math.abs(gdata[m + 1].xp - xp);
42148
-
42149
- if (Math.abs(this.beforeMouseXp - xp) >= curXpInterval - SPARE_XP && (this.beforeFindItemIndex === m || midXp === rightXp || midXp === leftXp)) {
42150
- if (this.beforeMouseXp - xp > 0) {
42151
- item.data = gdata[this.beforeFindItemIndex - 1];
42152
- item.index = this.beforeFindItemIndex - 1;
42153
- } else if (this.beforeMouseXp - xp < 0) {
42154
- item.data = gdata[this.beforeFindItemIndex + 1];
42155
- item.index = this.beforeFindItemIndex + 1;
42156
- } else if (this.beforeMouseYp !== yp) {
42157
- item.data = gdata[this.beforeFindItemIndex];
42158
- item.index = this.beforeFindItemIndex;
42159
- }
42160
- } else {
42161
- var closeXp = Math.min(leftXp, midXp, rightXp);
42162
-
42163
- if (closeXp === leftXp) {
42164
- item.data = gdata[m - 1];
42165
- item.index = m - 1;
42166
- } else if (closeXp === rightXp) {
42167
- item.data = gdata[m + 1];
42168
- item.index = m + 1;
42169
- } else {
42170
- item.data = gdata[m];
42171
- item.index = m;
42172
- }
42117
+ // Axis 트리거 방식: X축 위치에서 가장 가까운 데이터 포인트 찾기
42118
+ var closestXDistance = Infinity;
42119
+ var closestIndex = -1; // null이 아닌 유효한 데이터만 필터링
42120
+
42121
+ var validData = [];
42122
+ gdata.forEach(function (point, idx) {
42123
+ if (point.xp !== null && point.yp !== null && point.o !== null) {
42124
+ validData.push(_objectSpread2(_objectSpread2({}, point), {}, {
42125
+ originalIndex: idx
42126
+ }));
42127
+ }
42128
+ });
42129
+
42130
+ if (validData.length === 0) {
42131
+ return item;
42132
+ } // 이진 탐색으로 가장 가까운 포인트 찾기
42133
+
42134
+
42135
+ var left = 0;
42136
+ var right = validData.length - 1;
42137
+
42138
+ while (left <= right) {
42139
+ var mid = Math.floor((left + right) / 2);
42140
+ var _point = validData[mid];
42141
+ var xDistance = Math.abs(xp - _point.xp);
42142
+
42143
+ if (xDistance < closestXDistance) {
42144
+ closestXDistance = xDistance;
42145
+ closestIndex = _point.originalIndex;
42146
+ }
42147
+
42148
+ if (_point.xp < xp) {
42149
+ left = mid + 1; // 다음 포인트도 확인
42150
+
42151
+ if (left < validData.length) {
42152
+ var nextDistance = Math.abs(xp - validData[left].xp);
42153
+
42154
+ if (nextDistance < closestXDistance) {
42155
+ closestXDistance = nextDistance;
42156
+ closestIndex = validData[left].originalIndex;
42173
42157
  }
42174
- } else {
42175
- item.data = gdata[m];
42176
- item.index = m;
42177
42158
  }
42159
+ } else if (_point.xp > xp) {
42160
+ right = mid - 1; // 이전 포인트도 확인
42178
42161
 
42179
- if (y - 6 <= yp && yp <= y + 6) {
42180
- item.hit = true;
42181
- }
42162
+ if (right >= 0) {
42163
+ var prevDistance = Math.abs(xp - validData[right].xp);
42182
42164
 
42165
+ if (prevDistance < closestXDistance) {
42166
+ closestXDistance = prevDistance;
42167
+ closestIndex = validData[right].originalIndex;
42168
+ }
42169
+ }
42170
+ } else {
42171
+ // 정확히 일치하는 경우
42183
42172
  break;
42184
- } else if (x + xpInterval > xp) {
42185
- e = m - 1;
42173
+ }
42174
+ } // 이진 탐색 후 주변 포인트 추가 확인 (정확도 향상)
42175
+
42176
+
42177
+ var foundIdx = validData.findIndex(function (p) {
42178
+ return p.originalIndex === closestIndex;
42179
+ });
42180
+
42181
+ if (foundIdx !== -1) {
42182
+ // 앞뒤 2개씩 추가 확인
42183
+ for (var i = Math.max(0, foundIdx - 2); i <= Math.min(validData.length - 1, foundIdx + 2); i++) {
42184
+ var _point2 = validData[i];
42185
+
42186
+ var _xDistance = Math.abs(xp - _point2.xp);
42187
+
42188
+ if (_xDistance < closestXDistance) {
42189
+ closestXDistance = _xDistance;
42190
+ closestIndex = _point2.originalIndex;
42191
+ }
42192
+ }
42193
+ } // 가장 가까운 포인트 설정
42194
+
42195
+
42196
+ if (closestIndex !== -1) {
42197
+ // 데이터 간격 계산 - 모든 데이터(null 포함)의 평균 간격 사용
42198
+ var avgInterval = 50;
42199
+
42200
+ if (gdata.length > 1) {
42201
+ var intervals = [];
42202
+
42203
+ for (var _i = 1; _i < gdata.length; _i++) {
42204
+ if (gdata[_i].xp !== null && gdata[_i - 1].xp !== null) {
42205
+ intervals.push(Math.abs(gdata[_i].xp - gdata[_i - 1].xp));
42206
+ }
42207
+ }
42208
+
42209
+ if (intervals.length > 0) {
42210
+ avgInterval = intervals.reduce(function (a, b) {
42211
+ return a + b;
42212
+ }, 0) / intervals.length;
42213
+ }
42214
+ } // 두 가지 임계값 설정
42215
+
42216
+
42217
+ var strictThreshold = avgInterval * 0.3; // 엄격한 임계값: 데이터 간격의 30%
42218
+
42219
+ var relaxedThreshold = avgInterval; // 느슨한 임계값: 데이터 간격 전체
42220
+ // 1. 먼저 엄격한 임계값으로 정확한 매치 확인
42221
+
42222
+ if (closestXDistance <= strictThreshold) {
42223
+ // 정확히 일치하거나 매우 가까운 데이터가 있음
42224
+ item.data = gdata[closestIndex];
42225
+ item.index = closestIndex;
42186
42226
  } else {
42187
- s = m + 1;
42227
+ // 2. 정확한 매치가 없을 때, 현재 X 위치 근처에 다른 유효 데이터가 있는지 확인
42228
+ var hasNearbyValidData = false;
42229
+
42230
+ for (var _i2 = 0; _i2 < validData.length; _i2++) {
42231
+ var xDist = Math.abs(xp - validData[_i2].xp);
42232
+
42233
+ if (xDist <= strictThreshold) {
42234
+ hasNearbyValidData = true;
42235
+ break;
42236
+ }
42237
+ } // 3. 근처에 다른 유효 데이터가 없을 때만 느슨한 임계값 적용
42238
+
42239
+
42240
+ if (!hasNearbyValidData && closestXDistance <= relaxedThreshold) {
42241
+ item.data = gdata[closestIndex];
42242
+ item.index = closestIndex;
42243
+ }
42244
+ } // Y축 거리를 확인하여 직접 히트 판정
42245
+
42246
+
42247
+ if (item.data) {
42248
+ var _point3 = gdata[closestIndex];
42249
+
42250
+ var _yDist = Math.abs(yp - _point3.yp);
42251
+
42252
+ var _directHitThreshold = 15; // 직접 히트 임계값
42253
+
42254
+ if (_yDist <= _directHitThreshold) {
42255
+ item.hit = true;
42256
+ }
42188
42257
  }
42189
42258
  }
42190
42259
  }
@@ -42215,6 +42284,8 @@ var element_line_Line = /*#__PURE__*/function () {
42215
42284
  }, {
42216
42285
  key: "findApproximateData",
42217
42286
  value: function findApproximateData(offset) {
42287
+ var _gdata$, _gdata$2;
42288
+
42218
42289
  var xp = offset[0];
42219
42290
  var yp = offset[1];
42220
42291
  var item = {
@@ -42225,41 +42296,87 @@ var element_line_Line = /*#__PURE__*/function () {
42225
42296
  var gdata = this.data.filter(function (data) {
42226
42297
  return !helpers_util.isNullOrUndefined(data.x);
42227
42298
  });
42299
+
42300
+ if (!gdata.length) {
42301
+ return item;
42302
+ } // 동적 감지 범위 계산
42303
+
42304
+
42305
+ var gap = gdata.length > 1 ? Math.abs(((_gdata$ = gdata[1]) === null || _gdata$ === void 0 ? void 0 : _gdata$.xp) - ((_gdata$2 = gdata[0]) === null || _gdata$2 === void 0 ? void 0 : _gdata$2.xp)) : 50;
42306
+ var xpInterval = Math.max(gap * 0.4, 10); // 데이터 간격의 40% 또는 최소 10px
42307
+
42228
42308
  var s = 0;
42229
42309
  var e = gdata.length - 1;
42310
+ var closestIndex = -1;
42311
+ var closestDistance = Infinity; // 이진 탐색으로 근처 데이터 찾기
42230
42312
 
42231
42313
  while (s <= e) {
42232
42314
  var m = Math.floor((s + e) / 2);
42233
- var x = gdata[m].xp;
42234
- var y = gdata[m].yp;
42315
+ var x = gdata[m].xp; // X 좌표가 감지 범위 내에 있는 경우
42235
42316
 
42236
- if (x - 2 <= xp && xp <= x + 2) {
42237
- item.data = gdata[m];
42238
- item.index = m;
42317
+ if (x - xpInterval <= xp && xp <= x + xpInterval) {
42318
+ // 중간점 주변 데이터들과 거리 비교
42319
+ var checkStart = Math.max(0, m - 2);
42320
+ var checkEnd = Math.min(gdata.length - 1, m + 2);
42239
42321
 
42240
- if (y - 2 <= yp && yp <= y + 2) {
42241
- item.hit = true;
42322
+ for (var i = checkStart; i <= checkEnd; i++) {
42323
+ if (gdata[i].xp !== null && gdata[i].yp !== null) {
42324
+ var distance = Math.sqrt(Math.pow(xp - gdata[i].xp, 2) + Math.pow(yp - gdata[i].yp, 2));
42325
+
42326
+ if (distance < closestDistance) {
42327
+ closestDistance = distance;
42328
+ closestIndex = i;
42329
+ }
42330
+ }
42331
+ }
42332
+
42333
+ if (closestIndex !== -1) {
42334
+ item.data = gdata[closestIndex];
42335
+ item.index = closestIndex; // 매우 가까운 경우 hit으로 표시
42336
+
42337
+ if (closestDistance < 5) {
42338
+ item.hit = true;
42339
+ }
42242
42340
  }
42243
42341
 
42244
42342
  return item;
42245
- } else if (x + 2 < xp) {
42343
+ } else if (x + xpInterval < xp) {
42344
+ // 마우스가 오른쪽에 있는 경우
42246
42345
  if (m < e && xp < gdata[m + 1].xp) {
42247
42346
  var curr = Math.abs(gdata[m].xp - xp);
42248
42347
  var next = Math.abs(gdata[m + 1].xp - xp);
42249
42348
  item.data = curr > next ? gdata[m + 1] : gdata[m];
42250
- item.index = curr > next ? m + 1 : m;
42349
+ item.index = curr > next ? m + 1 : m; // Y 거리도 확인하여 hit 판정
42350
+
42351
+ var selectedPoint = item.data;
42352
+ var yDist = Math.abs(yp - selectedPoint.yp);
42353
+
42354
+ if (yDist < 10) {
42355
+ item.hit = true;
42356
+ }
42357
+
42251
42358
  return item;
42252
42359
  }
42253
42360
 
42254
42361
  s = m + 1;
42255
42362
  } else {
42363
+ // 마우스가 왼쪽에 있는 경우
42256
42364
  if (m > 0 && xp > gdata[m - 1].xp) {
42257
42365
  var prev = Math.abs(gdata[m - 1].xp - xp);
42258
42366
 
42259
42367
  var _curr = Math.abs(gdata[m].xp - xp);
42260
42368
 
42261
42369
  item.data = prev > _curr ? gdata[m] : gdata[m - 1];
42262
- item.index = prev > _curr ? m : m - 1;
42370
+ item.index = prev > _curr ? m : m - 1; // Y 거리도 확인하여 hit 판정
42371
+
42372
+ var _selectedPoint = item.data;
42373
+
42374
+ var _yDist2 = Math.abs(yp - _selectedPoint.yp);
42375
+
42376
+ if (_yDist2 < 10) {
42377
+ item.hit = true;
42378
+ }
42379
+
42263
42380
  return item;
42264
42381
  }
42265
42382
 
@@ -42710,6 +42827,7 @@ var element_scatter_Scatter = /*#__PURE__*/function () {
42710
42827
 
42711
42828
 
42712
42829
 
42830
+
42713
42831
  var element_bar_Bar = /*#__PURE__*/function () {
42714
42832
  function Bar(sId, opt, sIdx, isHorizontal) {
42715
42833
  var _this = this;
@@ -42772,18 +42890,11 @@ var element_bar_Bar = /*#__PURE__*/function () {
42772
42890
  var minmaxX = axesSteps.x[this.xAxisIndex];
42773
42891
  var minmaxY = axesSteps.y[this.yAxisIndex];
42774
42892
  var totalCount = this.data.length;
42775
- var minIndex;
42776
- var maxIndex;
42777
42893
 
42778
- if (isHorizontal) {
42779
- var _ref = [minmaxY.minIndex, minmaxY.maxIndex];
42780
- minIndex = _ref[0];
42781
- maxIndex = _ref[1];
42782
- } else {
42783
- var _ref2 = [minmaxX.minIndex, minmaxX.maxIndex];
42784
- minIndex = _ref2[0];
42785
- maxIndex = _ref2[1];
42786
- } // minIndex, maxIndex가 유효하면 실제 그릴 데이터 개수로 보정
42894
+ var _ref = isHorizontal ? [minmaxY.minIndex, minmaxY.maxIndex] : [minmaxX.minIndex, minmaxX.maxIndex],
42895
+ _ref2 = _slicedToArray(_ref, 2),
42896
+ minIndex = _ref2[0],
42897
+ maxIndex = _ref2[1]; // minIndex, maxIndex가 유효하면 실제 그릴 데이터 개수로 보정
42787
42898
 
42788
42899
 
42789
42900
  if (truthyNumber(minIndex) && truthyNumber(maxIndex)) {
@@ -42792,12 +42903,8 @@ var element_bar_Bar = /*#__PURE__*/function () {
42792
42903
 
42793
42904
  var xArea = chartRect.chartWidth - (labelOffset.left + labelOffset.right);
42794
42905
  var yArea = chartRect.chartHeight - (labelOffset.top + labelOffset.bottom);
42795
- var xAxisPosition = chartRect.x1 + labelOffset.left;
42796
- var yAxisPosition = chartRect.y2 - labelOffset.bottom;
42797
- var xZeroPosition = helpers_canvas.calculateX(0, minmaxX.graphMin, minmaxX.graphMax, xArea);
42798
- var yZeroPosition = helpers_canvas.calculateY(0, minmaxY.graphMin, minmaxY.graphMax, yArea);
42799
- var xsp = isHorizontal ? xAxisPosition + xZeroPosition : xAxisPosition;
42800
- var ysp = isHorizontal ? yAxisPosition : yAxisPosition + yZeroPosition;
42906
+ var xsp = chartRect.x1 + labelOffset.left;
42907
+ var ysp = chartRect.y2 - labelOffset.bottom;
42801
42908
  var dArea = isHorizontal ? yArea : xArea;
42802
42909
  var cArea = dArea / (totalCount || 1);
42803
42910
  var cPad;
@@ -42814,20 +42921,7 @@ var element_bar_Bar = /*#__PURE__*/function () {
42814
42921
  var h;
42815
42922
  bArea = cArea > cPad * 2 ? cArea - cPad * 2 : cArea;
42816
42923
  bArea = this.isExistGrp ? bArea : bArea / showSeriesCount;
42817
-
42818
- var getSize = function getSize() {
42819
- if (typeof thickness === 'string' && /[0-9]+px/.test(thickness)) {
42820
- return Math.min(bArea, Number(thickness.replace('px', '')));
42821
- }
42822
-
42823
- if (typeof thickness === 'number' && thickness <= 1 && thickness >= 0) {
42824
- return Math.ceil(bArea * thickness);
42825
- }
42826
-
42827
- return bArea;
42828
- };
42829
-
42830
- var size = getSize();
42924
+ var size = this.calculateBarSize(thickness, bArea);
42831
42925
  w = isHorizontal ? null : size;
42832
42926
  h = isHorizontal ? size : null;
42833
42927
  var bPad = isHorizontal ? (bArea - h) / 2 : (bArea - w) / 2;
@@ -42855,14 +42949,7 @@ var element_bar_Bar = /*#__PURE__*/function () {
42855
42949
  var _param$selectLabel, _param$selectItem, _param$selectLabel$se, _param$selectLabel2, _param$selectLabel2$s, _param$selectItem$sel, _param$selectItem2;
42856
42950
 
42857
42951
  // 스크롤 offset(minIndex)만큼 보정해서 그리기
42858
- var categoryPoint = void 0;
42859
-
42860
- if (isHorizontal) {
42861
- categoryPoint = ysp - cArea * screenIndex - cPad;
42862
- } else {
42863
- categoryPoint = xsp + cArea * screenIndex + cPad;
42864
- } // 기본 위치 설정
42865
-
42952
+ var categoryPoint = isHorizontal ? ysp - cArea * screenIndex - cPad : xsp + cArea * screenIndex + cPad;
42866
42953
 
42867
42954
  if (isHorizontal) {
42868
42955
  x = xsp;
@@ -42870,30 +42957,22 @@ var element_bar_Bar = /*#__PURE__*/function () {
42870
42957
  } else {
42871
42958
  x = Math.round(categoryPoint + (bArea * barSeriesX - (w + bPad)));
42872
42959
  y = ysp;
42873
- } // 너비 / 높이 계산, 스택의 경우 위치 값 재계산
42874
-
42960
+ }
42875
42961
 
42876
42962
  if (isHorizontal) {
42877
- var barValue = item.b ? item.o : item.x;
42878
- w = helpers_canvas.calculateX(barValue, minmaxX.graphMin, minmaxX.graphMax, xArea, -xZeroPosition);
42879
-
42880
42963
  if (item.b) {
42881
- x = helpers_canvas.calculateX(item.b, minmaxX.graphMin, minmaxX.graphMax, xArea, xsp - xZeroPosition);
42964
+ w = helpers_canvas.calculateX(item.x - item.b, minmaxX.graphMin, minmaxX.graphMax, xArea);
42965
+ x = helpers_canvas.calculateX(item.b, minmaxX.graphMin, minmaxX.graphMax, xArea, xsp);
42966
+ } else {
42967
+ w = helpers_canvas.calculateX(item.x, minmaxX.graphMin, minmaxX.graphMax, xArea);
42882
42968
  }
42883
-
42884
- var minimumBarWidth = barValue > 0 ? -1 : 1;
42885
- w = barValue && Math.abs(w) === 0 ? minimumBarWidth : w;
42969
+ } else if (item.b) {
42970
+ // vertical stack bar chart
42971
+ h = helpers_canvas.calculateY(item.y - item.b, minmaxY.graphMin, minmaxY.graphMax, yArea);
42972
+ y = helpers_canvas.calculateY(item.b, minmaxY.graphMin, minmaxY.graphMax, yArea, ysp);
42886
42973
  } else {
42887
- var _barValue = item.b ? item.o : item.y;
42888
-
42889
- h = helpers_canvas.calculateY(_barValue, minmaxY.graphMin, minmaxY.graphMax, yArea, -yZeroPosition);
42890
-
42891
- if (item.b) {
42892
- y = helpers_canvas.calculateY(item.b, minmaxY.graphMin, minmaxY.graphMax, yArea, ysp - yZeroPosition);
42893
- }
42894
-
42895
- var minimumBarHeight = _barValue > 0 ? -1 : 1;
42896
- h = _barValue && Math.abs(h) === 0 ? minimumBarHeight : h;
42974
+ // vertical bar chart
42975
+ h = helpers_canvas.calculateY(item.y, minmaxY.graphMin, minmaxY.graphMax, yArea);
42897
42976
  }
42898
42977
 
42899
42978
  var barColor = item.dataColor || this.color;
@@ -43048,13 +43127,32 @@ var element_bar_Bar = /*#__PURE__*/function () {
43048
43127
  * Find graph item
43049
43128
  * @param {array} offset mouse position
43050
43129
  * @param {boolean} isHorizontal determines if a horizontal option's value
43130
+ * @param {number} dataIndex selected label data index
43131
+ * @param {boolean} useIndicatorOnLabel
43051
43132
  *
43052
43133
  * @returns {object} graph item
43053
43134
  */
43054
43135
 
43055
43136
  }, {
43056
43137
  key: "findGraphData",
43057
- value: function findGraphData(offset, isHorizontal) {
43138
+ value: function findGraphData(offset, isHorizontal, dataIndex, useIndicatorOnLabel) {
43139
+ if (typeof dataIndex === 'number' && this.show && useIndicatorOnLabel) {
43140
+ var gdata = this.data;
43141
+ var item = {
43142
+ data: null,
43143
+ hit: false,
43144
+ color: this.color
43145
+ };
43146
+
43147
+ if (gdata[dataIndex]) {
43148
+ item.data = gdata[dataIndex];
43149
+ item.index = dataIndex;
43150
+ item.hit = this.isPointInBar(offset, gdata[dataIndex]);
43151
+ }
43152
+
43153
+ return item;
43154
+ }
43155
+
43058
43156
  return isHorizontal ? this.findGraphRangeCount(offset) : this.findGraphRange(offset);
43059
43157
  }
43060
43158
  /**
@@ -43064,13 +43162,23 @@ var element_bar_Bar = /*#__PURE__*/function () {
43064
43162
  * @returns {object} graph item
43065
43163
  */
43066
43164
 
43165
+ /**
43166
+ * Binary search for finding graph item
43167
+ * @private
43168
+ * @param {array} offset - mouse position
43169
+ * @param {boolean} isHorizontal - search orientation
43170
+ * @returns {object} graph item
43171
+ */
43172
+
43067
43173
  }, {
43068
- key: "findGraphRange",
43069
- value: function findGraphRange(offset) {
43174
+ key: "binarySearchBar",
43175
+ value: function binarySearchBar(offset, isHorizontal) {
43070
43176
  var _this$filteredCount;
43071
43177
 
43072
- var xp = offset[0];
43073
- var yp = offset[1];
43178
+ var _offset = _slicedToArray(offset, 2),
43179
+ xp = _offset[0],
43180
+ yp = _offset[1];
43181
+
43074
43182
  var item = {
43075
43183
  data: null,
43076
43184
  hit: false,
@@ -43083,21 +43191,25 @@ var element_bar_Bar = /*#__PURE__*/function () {
43083
43191
 
43084
43192
  while (s <= e) {
43085
43193
  var m = Math.floor((s + e) / 2);
43086
- var sx = gdata[m].xp;
43087
- var sy = gdata[m].yp;
43088
- var ex = sx + gdata[m].w;
43089
- var ey = sy + gdata[m].h;
43090
-
43091
- if (sx <= xp && xp <= ex) {
43092
- item.data = gdata[m];
43093
- item.index = gdata[m].index; // 원본 데이터 인덱스 사용
43194
+ var barData = gdata[m];
43195
+ var sx = barData.xp,
43196
+ sy = barData.yp,
43197
+ w = barData.w,
43198
+ h = barData.h;
43199
+ var ex = sx + w;
43200
+ var ey = sy + h;
43201
+ var inRange = isHorizontal ? ey <= yp && yp <= sy : sx <= xp && xp <= ex;
43202
+
43203
+ if (inRange) {
43204
+ item.data = barData;
43205
+ item.index = barData.index;
43206
+ item.hit = this.isPointInBar(offset, barData);
43207
+ return item;
43208
+ }
43094
43209
 
43095
- if (ey <= yp && yp <= sy) {
43096
- item.hit = true;
43097
- }
43210
+ var shouldGoRight = isHorizontal ? !(ey < yp) : sx + 4 < xp;
43098
43211
 
43099
- return item;
43100
- } else if (sx + 4 < xp) {
43212
+ if (shouldGoRight) {
43101
43213
  s = m + 1;
43102
43214
  } else {
43103
43215
  e = m - 1;
@@ -43106,6 +43218,11 @@ var element_bar_Bar = /*#__PURE__*/function () {
43106
43218
 
43107
43219
  return item;
43108
43220
  }
43221
+ }, {
43222
+ key: "findGraphRange",
43223
+ value: function findGraphRange(offset) {
43224
+ return this.binarySearchBar(offset, false);
43225
+ }
43109
43226
  /**
43110
43227
  * Find graph item (horizontal)
43111
43228
  * @param {array} offset mouse position
@@ -43116,44 +43233,7 @@ var element_bar_Bar = /*#__PURE__*/function () {
43116
43233
  }, {
43117
43234
  key: "findGraphRangeCount",
43118
43235
  value: function findGraphRangeCount(offset) {
43119
- var _this$filteredCount2;
43120
-
43121
- var xp = offset[0];
43122
- var yp = offset[1];
43123
- var item = {
43124
- data: null,
43125
- hit: false,
43126
- color: this.color
43127
- };
43128
- var gdata = this.data;
43129
- var totalCount = (_this$filteredCount2 = this.filteredCount) !== null && _this$filteredCount2 !== void 0 ? _this$filteredCount2 : gdata.length;
43130
- var s = 0;
43131
- var e = totalCount - 1;
43132
-
43133
- while (s <= e) {
43134
- var m = Math.floor((s + e) / 2);
43135
- var sx = gdata[m].xp;
43136
- var sy = gdata[m].yp;
43137
- var ex = sx + gdata[m].w;
43138
- var ey = sy + gdata[m].h;
43139
-
43140
- if (ey <= yp && yp <= sy) {
43141
- item.data = gdata[m];
43142
- item.index = gdata[m].index; // 원본 데이터 인덱스 사용
43143
-
43144
- if (sx <= xp && xp <= ex) {
43145
- item.hit = true;
43146
- }
43147
-
43148
- return item;
43149
- } else if (ey < yp) {
43150
- e = m - 1;
43151
- } else {
43152
- s = m + 1;
43153
- }
43154
- }
43155
-
43156
- return item;
43236
+ return this.binarySearchBar(offset, true);
43157
43237
  }
43158
43238
  /**
43159
43239
  * Draw value label if series 'use' of showValue option is true
@@ -43182,10 +43262,10 @@ var element_bar_Bar = /*#__PURE__*/function () {
43182
43262
  align = _this$showValue.align,
43183
43263
  formatter = _this$showValue.formatter,
43184
43264
  decimalPoint = _this$showValue.decimalPoint;
43185
- var barX = positions.x,
43186
- barY = positions.y,
43187
- barWidth = positions.w,
43188
- barHeight = positions.h;
43265
+ var x = positions.x,
43266
+ y = positions.y,
43267
+ w = positions.w,
43268
+ h = positions.h;
43189
43269
  var ctx = context;
43190
43270
  ctx.save();
43191
43271
  ctx.beginPath();
@@ -43220,27 +43300,25 @@ var element_bar_Bar = /*#__PURE__*/function () {
43220
43300
  formattedTxt = (_Util$labelSignFormat = helpers_util.labelSignFormat(value, decimalPoint)) !== null && _Util$labelSignFormat !== void 0 ? _Util$labelSignFormat : '';
43221
43301
  }
43222
43302
 
43223
- var isNegativeValue = value < 0;
43224
43303
  var textWidth = Math.round(ctx.measureText(formattedTxt).width);
43225
- var textHeight = fontSize; // fontSize와 textHeight는 같을 수 없지만, 정확히 구할 필요 없음
43226
-
43227
- var GAP = 10;
43228
- var minXPos = isNegativeValue ? barX - GAP : barX + GAP;
43229
- var minYPos = isNegativeValue ? barY + GAP : barY - GAP;
43230
- var centerXOnBar = barX + barWidth / 2;
43231
- var centerYOnBar = isHighlight ? barY + barHeight / 2 : barY - barHeight / 2;
43232
- var drawableBarWidth = Math.abs(barWidth) - GAP;
43233
- var drawableBarHeight = Math.abs(barHeight) - GAP;
43304
+ var textHeight = fontSize + 4;
43305
+ var minXPos = x + 10;
43306
+ var minYPos = y - 10;
43307
+ var widthFreeSpaceToDraw = w - 10;
43308
+ var heightFreeSpaceToDraw = Math.abs(h + 10);
43309
+ var centerX = x + w / 2 <= minXPos ? minXPos : x + w / 2;
43310
+ var centerY = y + h / 2 >= minYPos ? minYPos : y + h / 2;
43311
+ var centerYHorizontal = isHighlight ? y + h / 2 : y - h / 2;
43234
43312
 
43235
43313
  switch (align) {
43236
43314
  case 'start':
43237
43315
  {
43238
- if (isHorizontal && textWidth < drawableBarWidth) {
43239
- var xPos = isNegativeValue ? minXPos - textWidth : minXPos;
43240
- ctx.fillText(formattedTxt, xPos, centerYOnBar);
43241
- } else if (!isHorizontal && textHeight < drawableBarHeight) {
43242
- var yPos = isNegativeValue ? barY + GAP : barY - GAP;
43243
- ctx.fillText(formattedTxt, centerXOnBar, yPos);
43316
+ if (isHorizontal) {
43317
+ if (textWidth < widthFreeSpaceToDraw) {
43318
+ ctx.fillText(formattedTxt, minXPos, centerYHorizontal);
43319
+ }
43320
+ } else if (textHeight < heightFreeSpaceToDraw) {
43321
+ ctx.fillText(formattedTxt, centerX, minYPos);
43244
43322
  }
43245
43323
 
43246
43324
  break;
@@ -43248,10 +43326,12 @@ var element_bar_Bar = /*#__PURE__*/function () {
43248
43326
 
43249
43327
  case 'center':
43250
43328
  {
43251
- if (isHorizontal && textWidth < drawableBarWidth) {
43252
- ctx.fillText(formattedTxt, centerXOnBar, centerYOnBar);
43253
- } else if (!isHorizontal && textHeight < drawableBarHeight) {
43254
- ctx.fillText(formattedTxt, centerXOnBar, barY + barHeight / 2);
43329
+ if (isHorizontal) {
43330
+ if (textWidth < widthFreeSpaceToDraw) {
43331
+ ctx.fillText(formattedTxt, centerX, centerYHorizontal);
43332
+ }
43333
+ } else if (textHeight < heightFreeSpaceToDraw) {
43334
+ ctx.fillText(formattedTxt, centerX, centerY);
43255
43335
  }
43256
43336
 
43257
43337
  break;
@@ -43265,26 +43345,9 @@ var element_bar_Bar = /*#__PURE__*/function () {
43265
43345
  }
43266
43346
 
43267
43347
  if (isHorizontal) {
43268
- var minXOnChart = this.chartRect.x1 + this.labelOffset.left;
43269
- var maxXOnChart = this.chartRect.x2 - this.labelOffset.right;
43270
-
43271
- if (isNegativeValue) {
43272
- var _xPos = barX - GAP + barWidth - textWidth;
43273
-
43274
- if (_xPos > minXOnChart) {
43275
- ctx.fillText(formattedTxt, _xPos, centerYOnBar);
43276
- }
43277
- } else {
43278
- var _xPos2 = barX + GAP + barWidth;
43279
-
43280
- if (_xPos2 + textWidth < maxXOnChart) {
43281
- ctx.fillText(formattedTxt, _xPos2, centerYOnBar);
43282
- }
43283
- }
43348
+ ctx.fillText(formattedTxt, minXPos + w, centerYHorizontal);
43284
43349
  } else {
43285
- var _yPos = isNegativeValue ? barY + barHeight + GAP : barY + barHeight - GAP;
43286
-
43287
- ctx.fillText(formattedTxt, centerXOnBar, _yPos);
43350
+ ctx.fillText(formattedTxt, centerX, y + h - textHeight / 2);
43288
43351
  }
43289
43352
 
43290
43353
  break;
@@ -43293,22 +43356,14 @@ var element_bar_Bar = /*#__PURE__*/function () {
43293
43356
  default:
43294
43357
  case 'end':
43295
43358
  {
43296
- if (isHorizontal && textWidth < drawableBarWidth) {
43297
- var _xPos3 = isNegativeValue ? barX + barWidth + GAP : barX + barWidth - textWidth - GAP;
43298
-
43299
- ctx.fillText(formattedTxt, _xPos3, centerYOnBar);
43300
- } else if (!isHorizontal) {
43301
- if (isNegativeValue) {
43302
- var _yPos2 = barY + barHeight - GAP;
43303
-
43304
- if (_yPos2 > minYPos) {
43305
- ctx.fillText(formattedTxt, centerXOnBar, _yPos2);
43306
- }
43307
- } else if (textHeight < drawableBarHeight) {
43308
- var _yPos3 = barY + barHeight + GAP;
43309
-
43310
- ctx.fillText(formattedTxt, centerXOnBar, _yPos3);
43359
+ if (isHorizontal) {
43360
+ if (textWidth < widthFreeSpaceToDraw) {
43361
+ var xPos = x + w - textWidth * 2;
43362
+ ctx.fillText(formattedTxt, xPos <= minXPos ? minXPos : xPos, centerYHorizontal);
43311
43363
  }
43364
+ } else if (textHeight < heightFreeSpaceToDraw) {
43365
+ var yPos = y + h + textHeight;
43366
+ ctx.fillText(formattedTxt, centerX, yPos >= minYPos ? minYPos : yPos);
43312
43367
  }
43313
43368
 
43314
43369
  break;
@@ -43317,14 +43372,36 @@ var element_bar_Bar = /*#__PURE__*/function () {
43317
43372
 
43318
43373
  ctx.restore();
43319
43374
  }
43375
+ /**
43376
+ * Calculate bar size based on thickness
43377
+ * @private
43378
+ * @param {string|number} thickness - thickness value
43379
+ * @param {number} bArea - available bar area
43380
+ * @returns {number} calculated size
43381
+ */
43382
+
43383
+ }, {
43384
+ key: "calculateBarSize",
43385
+ value: function calculateBarSize(thickness, bArea) {
43386
+ if (typeof thickness === 'string' && /[0-9]+px/.test(thickness)) {
43387
+ return Math.min(bArea, Number(thickness.replace('px', '')));
43388
+ }
43389
+
43390
+ if (typeof thickness === 'number' && thickness <= 1 && thickness >= 0) {
43391
+ return Math.ceil(bArea * thickness);
43392
+ }
43393
+
43394
+ return bArea;
43395
+ }
43320
43396
  }, {
43321
43397
  key: "drawBar",
43322
43398
  value: function drawBar(_ref6) {
43323
43399
  var ctx = _ref6.ctx,
43324
43400
  positions = _ref6.positions;
43325
- var isHorizontal = this.isHorizontal;
43401
+ var isHorizontal = this.isHorizontal,
43402
+ borderRadius = this.borderRadius;
43326
43403
  var isStackBar = ('stackIndex' in this);
43327
- var isBorderRadius = this.borderRadius && this.borderRadius > 0;
43404
+ var isBorderRadius = borderRadius && borderRadius > 0;
43328
43405
  var x = positions.x,
43329
43406
  y = positions.y,
43330
43407
  w = positions.w;
@@ -43348,67 +43425,68 @@ var element_bar_Bar = /*#__PURE__*/function () {
43348
43425
 
43349
43426
  ctx.restore();
43350
43427
  }
43428
+ /**
43429
+ * Check if point is within bar boundaries
43430
+ * @param {array} offset - [x, y] mouse position
43431
+ * @param {object} barData - bar data object with xp, yp, w, h properties
43432
+ * @returns {boolean} true if point is within bar
43433
+ */
43434
+
43435
+ }, {
43436
+ key: "isPointInBar",
43437
+ value: function isPointInBar(offset, barData) {
43438
+ var _offset2 = _slicedToArray(offset, 2),
43439
+ xp = _offset2[0],
43440
+ yp = _offset2[1];
43441
+
43442
+ var sx = barData.xp,
43443
+ sy = barData.yp,
43444
+ w = barData.w,
43445
+ h = barData.h;
43446
+ var ex = sx + w;
43447
+ var ey = sy + h;
43448
+ return sx <= xp && xp <= ex && ey <= yp && yp <= sy;
43449
+ }
43351
43450
  }, {
43352
43451
  key: "drawRoundedRect",
43353
43452
  value: function drawRoundedRect(ctx, positions) {
43354
- var chartRect = this.chartRect;
43355
- var labelOffset = this.labelOffset;
43356
- var isHorizontal = this.isHorizontal;
43453
+ var chartRect = this.chartRect,
43454
+ labelOffset = this.labelOffset,
43455
+ isHorizontal = this.isHorizontal,
43456
+ borderRadius = this.borderRadius;
43357
43457
  var x = positions.x,
43358
43458
  y = positions.y;
43359
43459
  var w = positions.w,
43360
43460
  h = positions.h;
43361
- var r = this.borderRadius;
43461
+ var r = borderRadius;
43362
43462
  var squarePath = new Path2D();
43363
43463
  squarePath.rect(chartRect.x1 + labelOffset.left, chartRect.y1, chartRect.chartWidth - labelOffset.right, chartRect.chartHeight - labelOffset.bottom);
43364
43464
  ctx.clip(squarePath);
43365
43465
  ctx.beginPath();
43366
43466
  ctx.moveTo(x, y);
43367
43467
 
43368
- if (Math.abs(w) < r * 2) {
43369
- r = Math.abs(w) / 2;
43370
- }
43371
-
43372
- if (Math.abs(h) < r * 2) {
43373
- r = Math.abs(h) / 2;
43374
- }
43375
-
43376
43468
  if (isHorizontal) {
43377
- var isNegativeValue = w < 0;
43378
-
43379
- if (isNegativeValue) {
43380
- w += r;
43381
- ctx.lineTo(x + w, y);
43382
- ctx.arcTo(x + w - r, y, x + w - r, y - r, r);
43383
- ctx.arcTo(x + w - r, y - h, x + w, y - h, r);
43384
- ctx.lineTo(x, y - h);
43385
- ctx.lineTo(x, y);
43386
- } else {
43387
- w -= r;
43388
- ctx.lineTo(x + w, y);
43389
- ctx.arcTo(x + w + r, y, x + w + r, y - r, r);
43390
- ctx.arcTo(x + w + r, y - h, x + w, y - h, r);
43391
- ctx.lineTo(x, y - h);
43392
- ctx.lineTo(x, y);
43469
+ if (h < r * 2) {
43470
+ r = h / 2;
43393
43471
  }
43472
+
43473
+ w -= r;
43474
+ ctx.lineTo(x + w, y);
43475
+ ctx.arcTo(x + w + r, y, x + w + r, y - r, r);
43476
+ ctx.arcTo(x + w + r, y - h, x + w, y - h, r);
43477
+ ctx.lineTo(x, y - h);
43478
+ ctx.lineTo(x, y);
43394
43479
  } else {
43395
- var _isNegativeValue = h > 0;
43396
-
43397
- if (_isNegativeValue) {
43398
- h -= r;
43399
- ctx.lineTo(x + w, y);
43400
- ctx.lineTo(x + w, y + h);
43401
- ctx.arcTo(x + w, y + h + r, x - w + r, y + h + r, r);
43402
- ctx.arcTo(x, y + h + r, x, y + h, r);
43403
- ctx.lineTo(x, y);
43404
- } else {
43405
- h += r;
43406
- ctx.lineTo(x + w, y);
43407
- ctx.lineTo(x + w, y + h);
43408
- ctx.arcTo(x + w, y + h - r, x + w - r, y + h - r, r);
43409
- ctx.arcTo(x, y + h - r, x, y + h, r);
43410
- ctx.lineTo(x, y);
43480
+ if (w < r * 2) {
43481
+ r = w / 2;
43411
43482
  }
43483
+
43484
+ h += r;
43485
+ ctx.lineTo(x + w, y);
43486
+ ctx.lineTo(x + w, y + h);
43487
+ ctx.arcTo(x + w, y + h - r, x + w - r, y + h - r, r);
43488
+ ctx.arcTo(x, y + h - r, x, y + h, r);
43489
+ ctx.lineTo(x, y);
43412
43490
  }
43413
43491
 
43414
43492
  ctx.fill();
@@ -44732,7 +44810,7 @@ var element_heatmap_HeatMap = /*#__PURE__*/function () {
44732
44810
  key: "findSelectionRange",
44733
44811
  value: function findSelectionRange(rangeInfo) {
44734
44812
  var xsp = rangeInfo.xsp,
44735
- ycp = rangeInfo.ycp,
44813
+ ysp = rangeInfo.ysp,
44736
44814
  width = rangeInfo.width,
44737
44815
  height = rangeInfo.height,
44738
44816
  range = rangeInfo.range;
@@ -44760,7 +44838,6 @@ var element_heatmap_HeatMap = /*#__PURE__*/function () {
44760
44838
  var gapX = (x2 - x1) / labelXCount;
44761
44839
  var gapY = (y2 - y1) / labelYCount;
44762
44840
  var xep = xsp + width;
44763
- var ysp = ycp;
44764
44841
  var yep = ysp + height;
44765
44842
  var xIndex = {
44766
44843
  min: Math.floor((xsp - x1) / gapX),
@@ -44768,8 +44845,8 @@ var element_heatmap_HeatMap = /*#__PURE__*/function () {
44768
44845
  };
44769
44846
  var lastIndexY = labelYCount - 1;
44770
44847
  var yIndex = {
44771
- min: lastIndexY - Math.floor((yep - y1 - gapY) / gapY),
44772
- max: lastIndexY - Math.floor((ysp - y1) / gapY)
44848
+ min: lastIndexY - Math.round((yep - y1 - gapY) / gapY),
44849
+ max: lastIndexY - Math.round((ysp - y1) / gapY)
44773
44850
  };
44774
44851
  var filteredLabelX = this.getFilteredLabel(labelX, labelXCount, xMin, xMax);
44775
44852
  var filteredLabelY = this.getFilteredLabel(labelY, labelYCount, yMin, yMax);
@@ -45163,7 +45240,6 @@ var scale_Scale = /*#__PURE__*/function () {
45163
45240
  }
45164
45241
  /**
45165
45242
  * With range information, calculate how many labels in axis
45166
- * linear type은 scale.linear.js에서 처리
45167
45243
  * @param {object} range min/max information
45168
45244
  *
45169
45245
  * @returns {object} steps, interval, min/max graph value
@@ -45372,14 +45448,6 @@ var scale_Scale = /*#__PURE__*/function () {
45372
45448
 
45373
45449
  ctx.beginPath();
45374
45450
  ticks[ix] = axisMinForLabel + ix * stepValue;
45375
- var isZeroLine = ticks[ix] === 0;
45376
-
45377
- if (isZeroLine && _this3.zeroLineColor) {
45378
- ctx.strokeStyle = _this3.zeroLineColor;
45379
- } else {
45380
- ctx.strokeStyle = _this3.gridLineColor;
45381
- }
45382
-
45383
45451
  linePosition = labelCenter + aliasPixel;
45384
45452
  labelText = _this3.getLabelFormat(Math.min(axisMax, ticks[ix]), {
45385
45453
  prev: (_ticks = ticks[ix - 1]) !== null && _ticks !== void 0 ? _ticks : ''
@@ -45485,11 +45553,9 @@ var scale_Scale = /*#__PURE__*/function () {
45485
45553
  }
45486
45554
 
45487
45555
  var mergedPlotBandOpt = lodash_es_defaultsDeep({}, plotBand, PLOT_BAND_OPTION);
45488
- var userDefinedFrom = mergedPlotBandOpt.from,
45489
- userDefinedTo = mergedPlotBandOpt.to,
45556
+ var from = mergedPlotBandOpt.from,
45557
+ to = mergedPlotBandOpt.to,
45490
45558
  labelOpt = mergedPlotBandOpt.label;
45491
- var from = userDefinedFrom ? Math.max(userDefinedFrom, axisMin) : axisMin;
45492
- var to = userDefinedTo ? Math.min(userDefinedTo, axisMax) : axisMax;
45493
45559
 
45494
45560
  _this3.setPlotBandStyle(mergedPlotBandOpt);
45495
45561
 
@@ -45497,8 +45563,8 @@ var scale_Scale = /*#__PURE__*/function () {
45497
45563
  var toPos;
45498
45564
 
45499
45565
  if (_this3.type === 'x') {
45500
- fromPos = helpers_canvas.calculateX(from, axisMin, axisMax, xArea, minX);
45501
- toPos = helpers_canvas.calculateX(to, axisMin, axisMax, xArea, minX);
45566
+ fromPos = helpers_canvas.calculateX(from !== null && from !== void 0 ? from : minX, axisMin, axisMax, xArea, minX);
45567
+ toPos = helpers_canvas.calculateX(to !== null && to !== void 0 ? to : maxX, axisMin, axisMax, xArea, minX);
45502
45568
 
45503
45569
  if (fromPos === null || toPos === null) {
45504
45570
  return;
@@ -45506,8 +45572,8 @@ var scale_Scale = /*#__PURE__*/function () {
45506
45572
 
45507
45573
  _this3.drawXPlotBand(fromPos, toPos, minX, maxX, minY, maxY);
45508
45574
  } else {
45509
- fromPos = helpers_canvas.calculateY(from, axisMin, axisMax, yArea, maxY);
45510
- toPos = helpers_canvas.calculateY(to, axisMin, axisMax, yArea, maxY);
45575
+ fromPos = helpers_canvas.calculateY(from !== null && from !== void 0 ? from : axisMin, axisMin, axisMax, yArea, maxY);
45576
+ toPos = helpers_canvas.calculateY(to !== null && to !== void 0 ? to : axisMax, axisMin, axisMax, yArea, maxY);
45511
45577
 
45512
45578
  if (fromPos === null || toPos === null) {
45513
45579
  return;
@@ -46078,7 +46144,6 @@ var scale_time_TimeScale = /*#__PURE__*/function (_Scale) {
46078
46144
 
46079
46145
 
46080
46146
 
46081
-
46082
46147
  var scale_linear_LinearScale = /*#__PURE__*/function (_Scale) {
46083
46148
  _inherits(LinearScale, _Scale);
46084
46149
 
@@ -46117,192 +46182,16 @@ var scale_linear_LinearScale = /*#__PURE__*/function (_Scale) {
46117
46182
  * Calculate interval
46118
46183
  * @param {object} range range information
46119
46184
  *
46120
- * @returns {number} interval (한 칸에 표시할 값의 간격)
46185
+ * @returns {number} interval
46121
46186
  */
46122
46187
 
46123
46188
  }, {
46124
46189
  key: "getInterval",
46125
46190
  value: function getInterval(range) {
46126
- if (this.interval) return this.interval;
46127
46191
  var max = range.maxValue;
46128
46192
  var min = range.minValue;
46129
- var steps = range.maxSteps; // step이 0이면 interval 계산 불가
46130
-
46131
- if (!steps || steps <= 0) return 0; // startToZero이고, 최소값이 음수일 경우 0을 반드시 포함
46132
-
46133
- if (this.startToZero && min < 0) {
46134
- var totalRange = Math.abs(min) + Math.abs(max); // 비율로 나눔
46135
-
46136
- var negativeRatio = Math.abs(min) / totalRange;
46137
- var positiveRatio = Math.abs(max) / totalRange; // 각 방향에 최소 1칸 이상 배정되도록 보장
46138
-
46139
- var negativeSteps = Math.max(1, Math.round(negativeRatio * steps));
46140
- var positiveSteps = Math.max(1, steps - negativeSteps); // 다시 합이 steps보다 커질 수도 있으니, 조정
46141
-
46142
- if (negativeSteps + positiveSteps > steps) {
46143
- // 가장 큰 쪽에서 하나 줄임
46144
- if (negativeRatio > positiveRatio) {
46145
- negativeSteps -= 1;
46146
- } else {
46147
- positiveSteps -= 1;
46148
- }
46149
- }
46150
-
46151
- return Math.ceil(Math.max(Math.abs(min) / (negativeSteps || 1), Math.abs(max) / (positiveSteps || 1)));
46152
- }
46153
-
46154
- return Math.ceil((max - min) / steps);
46155
- }
46156
- /**
46157
- * With range information, calculate how many labels in axis
46158
- * @param {object} range min/max information
46159
- *
46160
- * @returns {object} steps, interval, min/max graph value
46161
- */
46162
-
46163
- }, {
46164
- key: "calculateSteps",
46165
- value: function calculateSteps(range) {
46166
- var maxValue = range.maxValue,
46167
- minValue = range.minValue;
46168
- var _range$maxSteps = range.maxSteps,
46169
- maxSteps = _range$maxSteps === void 0 ? 1 : _range$maxSteps;
46170
- var interval = this.getInterval(range);
46171
- var graphMin = 0;
46172
- var graphMax = 0; // 그래프 최대/최소 값 계산
46173
-
46174
- if (minValue >= 0) {
46175
- // 전부 양수
46176
- graphMin = +minValue;
46177
- graphMax = Math.ceil(maxValue / interval) * interval;
46178
- } else if (maxValue >= 0) {
46179
- // 양수/음수 혼합
46180
- graphMin = Math.floor(minValue / interval) * interval;
46181
- graphMax = Math.ceil(maxValue / interval) * interval;
46182
- } else {
46183
- // 전부 음수
46184
- graphMax = +maxValue;
46185
- graphMin = Math.floor(minValue / interval) * interval;
46186
- }
46187
-
46188
- var graphRange = graphMax - graphMin;
46189
- var numberOfSteps = Math.round(graphRange / interval); // 특수 케이스: 양수 최소값, 최대값이 1일 경우
46190
-
46191
- if (minValue > 0 && maxValue === 1) {
46192
- if (!this.decimalPoint) {
46193
- interval = 1;
46194
- numberOfSteps = 1;
46195
- maxSteps = 1;
46196
- } else if (maxSteps > 2) {
46197
- interval = 0.2;
46198
- numberOfSteps = 5;
46199
- maxSteps = 5;
46200
- } else {
46201
- interval = 0.5;
46202
- numberOfSteps = 2;
46203
- maxSteps = 2;
46204
- }
46205
- } // 최대 스텝 수 조정
46206
-
46207
-
46208
- while (numberOfSteps > maxSteps) {
46209
- interval *= 2;
46210
- numberOfSteps = Math.round(graphRange / interval);
46211
- interval = Math.ceil(graphRange / numberOfSteps);
46212
- }
46213
-
46214
- if (graphRange > numberOfSteps * interval) {
46215
- interval = Math.ceil(graphRange / numberOfSteps);
46216
- }
46217
-
46218
- return {
46219
- steps: numberOfSteps,
46220
- interval: interval,
46221
- graphMin: graphMin,
46222
- graphMax: graphMax
46223
- };
46224
- }
46225
- /**
46226
- * Calculate min/max value, label and size information for axis
46227
- * @param {object} minMax min/max information
46228
- * @param {object} scrollbarOpt scrollbar option
46229
- *
46230
- * @returns {object} min/max value and label
46231
- */
46232
-
46233
- }, {
46234
- key: "calculateScaleRange",
46235
- value: function calculateScaleRange(minMax, scrollbarOpt) {
46236
- var _this$labelStyle;
46237
-
46238
- var maxValue;
46239
- var minValue;
46240
- var isDefaultMaxSameAsMin = false;
46241
- var range = scrollbarOpt !== null && scrollbarOpt !== void 0 && scrollbarOpt.use ? scrollbarOpt === null || scrollbarOpt === void 0 ? void 0 : scrollbarOpt.range : this.range;
46242
-
46243
- if (Array.isArray(range) && (range === null || range === void 0 ? void 0 : range.length) === 2) {
46244
- if (this.options.type === 'heatMap') {
46245
- maxValue = range[1] > +minMax.max ? +minMax.max : range[1];
46246
- minValue = range[0] < +minMax.min ? +minMax.min : range[0];
46247
- } else {
46248
- maxValue = range[1];
46249
- minValue = range[0];
46250
- }
46251
- } else if (typeof range === 'function') {
46252
- var _range = range(minMax.min, minMax.max);
46253
-
46254
- var _range2 = _slicedToArray(_range, 2);
46255
-
46256
- minValue = _range2[0];
46257
- maxValue = _range2[1];
46258
- } else {
46259
- maxValue = minMax.max;
46260
- minValue = minMax.min;
46261
- } // autoScaleRatio 적용 케이스
46262
-
46263
-
46264
- if (this.autoScaleRatio) {
46265
- var temp = maxValue; // 양수 방향에만 autoScaleRatio 적용
46266
-
46267
- maxValue = Math.ceil(maxValue * (this.autoScaleRatio + 1));
46268
-
46269
- if (maxValue > 0 && minValue < 0) {
46270
- // 양수/음수 혼합 케이스 -- 음수 방향에도 maxValue 증가분만큼 더하기
46271
- var diff = temp - maxValue;
46272
- minValue += diff;
46273
- } else if (maxValue < 0 && minValue < 0) {
46274
- // 전부 음수 케이스 -- 음수 방향에도 autoScaleRatio 적용
46275
- minValue = Math.ceil(minValue * (this.autoScaleRatio + 1));
46276
- }
46277
- } // 0 기준 축 설정 케이스
46278
-
46279
-
46280
- if (this.startToZero) {
46281
- if (minValue > 0) {
46282
- minValue = 0;
46283
- }
46284
-
46285
- if (maxValue < 0) {
46286
- maxValue = 0;
46287
- }
46288
- }
46289
-
46290
- if (maxValue === minValue) {
46291
- maxValue += 1;
46292
- isDefaultMaxSameAsMin = true;
46293
- }
46294
-
46295
- var minLabel = this.getLabelFormat(minValue);
46296
- var maxLabel = this.getLabelFormat(maxValue, {
46297
- isMaxValueSameAsMin: isDefaultMaxSameAsMin
46298
- });
46299
- return {
46300
- min: minValue,
46301
- max: maxValue,
46302
- minLabel: minLabel,
46303
- maxLabel: maxLabel,
46304
- size: helpers_util.calcTextSize(maxLabel, helpers_util.getLabelStyle(this.labelStyle), (_this$labelStyle = this.labelStyle) === null || _this$labelStyle === void 0 ? void 0 : _this$labelStyle.padding)
46305
- };
46193
+ var step = range.maxSteps;
46194
+ return this.interval ? this.interval : Math.ceil((max - min) / step);
46306
46195
  }
46307
46196
  }]);
46308
46197
 
@@ -47532,7 +47421,7 @@ var plugins_legend_modules = {
47532
47421
  var useLegendSeries = [];
47533
47422
 
47534
47423
  if (groups) {
47535
- useLegendSeries = groups.filter(function (sId) {
47424
+ useLegendSeries = groups.slice().reverse().filter(function (sId) {
47536
47425
  return _this3.seriesList[sId].showLegend;
47537
47426
  }).map(function (sId) {
47538
47427
  return [sId, _this3.seriesList[sId]];
@@ -47583,8 +47472,9 @@ var plugins_legend_modules = {
47583
47472
  },
47584
47473
 
47585
47474
  /**
47586
- * Adds legends for each group in `groups` array, iterating through each series within the group.
47587
- * Only adds series with `showLegend` set to `true`.
47475
+ * Adds legends for each group in `groups` array, iterating through each series
47476
+ * within the group in reverse order. This ensures the legends align with the series
47477
+ * order as displayed in the chart. Only adds series with `showLegend` set to `true`.
47588
47478
  *
47589
47479
  * @param {Array} groups - Array of groups containing series identifiers.
47590
47480
  * @param {Object} seriesList - Object containing all series, keyed by series ID.
@@ -47595,7 +47485,7 @@ var plugins_legend_modules = {
47595
47485
  var _this5 = this;
47596
47486
 
47597
47487
  groups.forEach(function (group) {
47598
- group.forEach(function (sId) {
47488
+ group.slice().reverse().forEach(function (sId) {
47599
47489
  var series = seriesList[sId];
47600
47490
 
47601
47491
  if (series && series.showLegend) {
@@ -50710,7 +50600,7 @@ function toFinite(value) {
50710
50600
  * _.inRange(-3, -2, -6);
50711
50601
  * // => true
50712
50602
  */
50713
- function inRange(number, start, end) {
50603
+ function inRange_inRange(number, start, end) {
50714
50604
  start = lodash_es_toFinite(start);
50715
50605
  if (end === undefined) {
50716
50606
  end = start;
@@ -50722,7 +50612,7 @@ function inRange(number, start, end) {
50722
50612
  return _baseInRange(number, start, end);
50723
50613
  }
50724
50614
 
50725
- /* harmony default export */ var lodash_es_inRange = (inRange);
50615
+ /* harmony default export */ var lodash_es_inRange = (inRange_inRange);
50726
50616
 
50727
50617
  // CONCATENATED MODULE: ./src/components/chart/plugins/plugins.interaction.js
50728
50618
 
@@ -50741,13 +50631,6 @@ function inRange(number, start, end) {
50741
50631
 
50742
50632
 
50743
50633
 
50744
-
50745
-
50746
-
50747
-
50748
-
50749
-
50750
-
50751
50634
 
50752
50635
 
50753
50636
 
@@ -50838,6 +50721,29 @@ var plugins_interaction_modules = {
50838
50721
  _this.drawTooltip(hitInfo, _this.tooltipCtx);
50839
50722
  }
50840
50723
  }
50724
+ } // tooltip이 표시될 때 indicator를 해당 라벨 위치로 이동 (line 차트이거나 line series가 포함된 경우)
50725
+
50726
+
50727
+ var hasLineSeries = Object.values(_this.seriesList || {}).some(function (series) {
50728
+ return series.type === 'line';
50729
+ });
50730
+
50731
+ if (tooltip.use && (type === 'line' || hasLineSeries)) {
50732
+ // indicator를 그리고 실제 위치한 라벨 정보를 받음
50733
+ var indicatorInfo = _this.drawIndicatorForTooltip(hitInfo, indicator.color); // 실제 indicator가 위치한 라벨 값을 동기화에 사용
50734
+
50735
+
50736
+ var actualLabelValue = indicatorInfo === null || indicatorInfo === void 0 ? void 0 : indicatorInfo.labelValue;
50737
+
50738
+ var label = _this.getTimeLabel(offset);
50739
+
50740
+ args.hoveredLabel = {
50741
+ horizontal: _this.options.horizontal,
50742
+ label: label,
50743
+ mousePosition: [e.clientX, e.clientY],
50744
+ dataLabel: actualLabelValue,
50745
+ isTooltipBased: true
50746
+ };
50841
50747
  }
50842
50748
  } else if (tooltip.use && _this.isInitTooltip) {
50843
50749
  if (typeof (tooltip === null || tooltip === void 0 ? void 0 : tooltip.returnValue) === 'function') {
@@ -50849,35 +50755,28 @@ var plugins_interaction_modules = {
50849
50755
 
50850
50756
  if (_this.dragInfoBackup) {
50851
50757
  _this.drawSelectionArea(_this.dragInfoBackup);
50852
- }
50853
-
50854
- if (indicator.use && type !== 'pie' && type !== 'scatter' && type !== 'heatMap') {
50855
- // Use data point position instead of mouse position for indicator when tooltip is enabled
50856
- var indicatorOffset = offset;
50857
-
50858
- var label = _this.getTimeLabel(offset);
50758
+ } // tooltip 기반 indicator가 아직 설정되지 않은 경우에만 일반 indicator 처리
50859
50759
 
50860
- var useAxisTrigger = tooltip.use && tooltip.trigger === 'axis' && type === 'line';
50861
50760
 
50862
- if (useAxisTrigger && Object.keys(hitInfo.items).length) {
50863
- var hitId = hitInfo.hitId || Object.keys(hitInfo.items)[0];
50864
- var hitItem = hitInfo.items[hitId];
50761
+ if (!args.hoveredLabel && type !== 'pie' && type !== 'scatter' && type !== 'heatMap') {
50762
+ // line 차트가 아니고 line series가 없거나, tooltip이 없을 때는 일반 indicator 표시
50763
+ var _hasLineSeries = Object.values(_this.seriesList || {}).some(function (series) {
50764
+ return series.type === 'line';
50765
+ });
50865
50766
 
50866
- if (hitItem && hitItem.data && hitItem.data.xp !== undefined && hitItem.data.yp !== undefined) {
50867
- indicatorOffset = [hitItem.data.xp, hitItem.data.yp];
50868
- label = _this.data.labels[hitItem.index];
50869
- }
50767
+ if (type !== 'line' && !_hasLineSeries || !tooltip.use || !Object.keys(hitInfo.items).length) {
50768
+ _this.drawIndicator(offset, indicator.color);
50870
50769
  }
50871
50770
 
50872
- _this.drawIndicator(indicatorOffset, indicator.color);
50771
+ var _label = _this.getTimeLabel(offset);
50873
50772
 
50874
50773
  args.hoveredLabel = {
50875
50774
  horizontal: _this.options.horizontal,
50876
- label: label,
50775
+ label: _label,
50877
50776
  mousePosition: [e.clientX, e.clientY],
50878
- useAxisTrigger: useAxisTrigger
50777
+ isTooltipBased: false
50879
50778
  };
50880
- } else {
50779
+ } else if (!args.hoveredLabel) {
50881
50780
  args.hoveredLabel = {
50882
50781
  label: ''
50883
50782
  };
@@ -51735,19 +51634,11 @@ var plugins_interaction_modules = {
51735
51634
  }
51736
51635
  },
51737
51636
 
51738
- /**
51739
- * @typedef {object} HitInfo
51740
- * @property {object} items
51741
- * @property {string} hitId
51742
- * @property {object} maxTip
51743
- * @property {object} maxHighlight
51744
- */
51745
-
51746
51637
  /**
51747
51638
  * Find graph item on mouse position
51748
51639
  * @param {array} offset return value from getMousePosition()
51749
51640
  *
51750
- * @returns {HitInfo} hit item information
51641
+ * @returns {object} hit item information
51751
51642
  */
51752
51643
  findHitItem: function findHitItem(offset) {
51753
51644
  var _this4 = this;
@@ -51755,122 +51646,160 @@ var plugins_interaction_modules = {
51755
51646
  var sIds = Object.keys(this.seriesList);
51756
51647
  var items = {};
51757
51648
  var isHorizontal = !!this.options.horizontal;
51758
- var ctx = this.tooltipCtx; // Cache for measureText to avoid repeated calculations
51759
-
51760
- if (!this._measureTextCache) {
51761
- this._measureTextCache = new Map();
51762
- } // Use sliding window cache based on text length to maintain frequently used entries
51649
+ var ctx = this.tooltipCtx;
51650
+ var hitId = null;
51651
+ var maxs = '';
51652
+ var maxsw = 0;
51653
+ var maxv = '';
51654
+ var maxg = null;
51655
+ var maxSID = null; // 파이 차트는 특별한 처리가 필요
51763
51656
 
51657
+ if (this.options.type === 'pie') {
51658
+ for (var ix = 0; ix < sIds.length; ix++) {
51659
+ var sId = sIds[ix];
51660
+ var series = this.seriesList[sId];
51764
51661
 
51765
- if (this._measureTextCache.size > 1000) {
51766
- var entries = Array.from(this._measureTextCache.entries()); // Sort by text length (shorter texts are likely more frequently used)
51662
+ if (series.findGraphData && series.show) {
51663
+ var item = series.findGraphData(offset);
51767
51664
 
51768
- entries.sort(function (_ref2, _ref3) {
51769
- var _ref4 = _slicedToArray(_ref2, 1),
51770
- keyA = _ref4[0];
51665
+ if (item !== null && item !== void 0 && item.data && item.hit) {
51666
+ var gdata = item.data.o;
51771
51667
 
51772
- var _ref5 = _slicedToArray(_ref3, 1),
51773
- keyB = _ref5[0];
51668
+ if (gdata !== null && gdata !== undefined) {
51669
+ var formattedSeriesName = this.getFormattedTooltipLabel({
51670
+ dataId: series.id,
51671
+ seriesId: sId,
51672
+ seriesName: series.name,
51673
+ itemData: item.data
51674
+ });
51675
+ var sw = ctx ? ctx.measureText(formattedSeriesName).width : 1;
51676
+ item.id = series.id;
51677
+ item.name = formattedSeriesName;
51678
+ item.axis = {
51679
+ x: 0,
51680
+ y: 0
51681
+ };
51682
+ items[sId] = item;
51683
+ var formattedTxt = this.getFormattedTooltipValue({
51684
+ dataId: series.id,
51685
+ seriesId: sId,
51686
+ seriesName: formattedSeriesName,
51687
+ value: gdata,
51688
+ itemData: item.data
51689
+ });
51690
+ item.data.formatted = formattedTxt;
51774
51691
 
51775
- var textA = keyA.split('-')[0];
51776
- var textB = keyB.split('-')[0];
51777
- return textA.length - textB.length;
51778
- }); // Keep the first 500 entries (shorter texts)
51692
+ if (maxsw < sw) {
51693
+ maxs = formattedSeriesName;
51694
+ maxsw = sw;
51695
+ }
51779
51696
 
51780
- this._measureTextCache.clear();
51697
+ if (maxv.length <= "".concat(formattedTxt).length) {
51698
+ maxv = "".concat(formattedTxt);
51699
+ }
51781
51700
 
51782
- entries.slice(0, 500).forEach(function (_ref6) {
51783
- var _ref7 = _slicedToArray(_ref6, 2),
51784
- key = _ref7[0],
51785
- value = _ref7[1];
51701
+ if (maxg === null || maxg <= gdata) {
51702
+ maxg = gdata;
51703
+ maxSID = sId;
51704
+ }
51786
51705
 
51787
- _this4._measureTextCache.set(key, value);
51788
- });
51789
- }
51706
+ hitId = sId;
51707
+ }
51708
+ }
51709
+ }
51710
+ }
51790
51711
 
51791
- var hitId = null;
51792
- var maxs = '';
51793
- var maxsw = 0;
51794
- var maxv = '';
51795
- var maxg = null;
51796
- var maxSID = null;
51712
+ var _maxHighlight2 = maxg !== null ? [maxSID, maxg] : null;
51797
51713
 
51798
- for (var ix = 0; ix < sIds.length; ix++) {
51799
- var sId = sIds[ix];
51800
- var series = this.seriesList[sId]; // Skip hidden series for performance
51714
+ return {
51715
+ items: items,
51716
+ hitId: hitId,
51717
+ maxTip: [maxs, maxv],
51718
+ maxHighlight: _maxHighlight2
51719
+ };
51720
+ } // 1. 먼저 공통으로 사용할 데이터 인덱스 결정
51801
51721
 
51802
- if (!series.show || !series.findGraphData) {
51803
- // eslint-disable-next-line no-continue
51804
- continue;
51805
- }
51806
51722
 
51807
- var item = series.findGraphData(offset, isHorizontal);
51723
+ var targetDataIndex = this.findClosestDataIndex(offset, sIds);
51808
51724
 
51809
- if (item !== null && item !== void 0 && item.data) {
51810
- var gdata = void 0;
51725
+ if (targetDataIndex === -1) {
51726
+ return {
51727
+ items: items,
51728
+ hitId: hitId,
51729
+ maxTip: [maxs, maxv],
51730
+ maxHighlight: null
51731
+ };
51732
+ } // 2. 모든 시리즈가 동일한 데이터 인덱스 사용
51811
51733
 
51812
- if (item.data.o === null && series.interpolation !== 'zero') {
51813
- if (!series.isExistGrp) {
51814
- gdata = isHorizontal ? item.data.x : item.data.y;
51815
- }
51816
- } else if (!isNaN(item.data.o)) {
51817
- gdata = item.data.o;
51818
- }
51819
51734
 
51820
- if (gdata !== null && gdata !== undefined) {
51821
- var formattedSeriesName = this.getFormattedTooltipLabel({
51822
- dataId: series.id,
51823
- seriesId: sId,
51824
- seriesName: series.name,
51825
- itemData: item.data
51826
- }); // Use cached measureText for better performance
51735
+ var allSeriesIsBar = sIds.every(function (sId) {
51736
+ return _this4.seriesList[sId].type === 'bar';
51737
+ });
51827
51738
 
51828
- var sw = 1;
51739
+ for (var _ix = 0; _ix < sIds.length; _ix++) {
51740
+ var _sId = sIds[_ix];
51741
+ var _series = this.seriesList[_sId];
51829
51742
 
51830
- if (ctx) {
51831
- var cacheKey = "".concat(formattedSeriesName, "-").concat(ctx.font);
51743
+ if (_series.findGraphData && _series.show) {
51744
+ // 특정 데이터 인덱스로 데이터 요청
51745
+ var _item = _series.findGraphData(offset, isHorizontal, targetDataIndex, !allSeriesIsBar);
51832
51746
 
51833
- if (this._measureTextCache.has(cacheKey)) {
51834
- sw = this._measureTextCache.get(cacheKey);
51835
- } else {
51836
- sw = ctx.measureText(formattedSeriesName).width;
51747
+ if (_item !== null && _item !== void 0 && _item.data) {
51748
+ var _gdata = void 0;
51837
51749
 
51838
- this._measureTextCache.set(cacheKey, sw);
51750
+ if (_item.data.o === null && _series.interpolation !== 'zero') {
51751
+ if (!_series.isExistGrp) {
51752
+ _gdata = isHorizontal ? _item.data.x : _item.data.y;
51839
51753
  }
51754
+ } else if (!isNaN(_item.data.o)) {
51755
+ _gdata = _item.data.o;
51840
51756
  }
51841
51757
 
51842
- item.id = series.id;
51843
- item.name = formattedSeriesName;
51844
- item.axis = {
51845
- x: series.xAxisIndex,
51846
- y: series.yAxisIndex
51847
- };
51848
- items[sId] = item;
51849
- var formattedTxt = this.getFormattedTooltipValue({
51850
- dataId: series.id,
51851
- seriesId: sId,
51852
- seriesName: formattedSeriesName,
51853
- value: gdata,
51854
- itemData: item.data
51855
- });
51856
- item.data.formatted = formattedTxt;
51758
+ if (_gdata !== null && _gdata !== undefined) {
51759
+ var _formattedSeriesName = this.getFormattedTooltipLabel({
51760
+ dataId: _series.id,
51761
+ seriesId: _sId,
51762
+ seriesName: _series.name,
51763
+ itemData: _item.data
51764
+ });
51857
51765
 
51858
- if (maxsw < sw) {
51859
- maxs = formattedSeriesName;
51860
- maxsw = sw;
51861
- }
51766
+ var _sw = ctx ? ctx.measureText(_formattedSeriesName).width : 1;
51862
51767
 
51863
- if (maxv.length <= "".concat(formattedTxt).length) {
51864
- maxv = "".concat(formattedTxt);
51865
- }
51768
+ _item.id = _series.id;
51769
+ _item.name = _formattedSeriesName;
51770
+ _item.axis = {
51771
+ x: _series.xAxisIndex,
51772
+ y: _series.yAxisIndex
51773
+ };
51774
+ items[_sId] = _item;
51775
+
51776
+ var _formattedTxt = this.getFormattedTooltipValue({
51777
+ dataId: _series.id,
51778
+ seriesId: _sId,
51779
+ seriesName: _formattedSeriesName,
51780
+ value: _gdata,
51781
+ itemData: _item.data
51782
+ });
51866
51783
 
51867
- if (maxg === null || maxg <= gdata) {
51868
- maxg = gdata;
51869
- maxSID = sId;
51870
- }
51784
+ _item.data.formatted = _formattedTxt;
51871
51785
 
51872
- if (item.hit) {
51873
- hitId = sId;
51786
+ if (maxsw < _sw) {
51787
+ maxs = _formattedSeriesName;
51788
+ maxsw = _sw;
51789
+ }
51790
+
51791
+ if (maxv.length <= "".concat(_formattedTxt).length) {
51792
+ maxv = "".concat(_formattedTxt);
51793
+ }
51794
+
51795
+ if (maxg === null || maxg <= _gdata) {
51796
+ maxg = _gdata;
51797
+ maxSID = _sId;
51798
+ }
51799
+
51800
+ if (_item.hit) {
51801
+ hitId = _sId;
51802
+ }
51874
51803
  }
51875
51804
  }
51876
51805
  }
@@ -51886,6 +51815,78 @@ var plugins_interaction_modules = {
51886
51815
  };
51887
51816
  },
51888
51817
 
51818
+ /**
51819
+ * Find the closest data index (label) based on mouse position
51820
+ * @param {array} offset mouse position
51821
+ * @param {array} sIds series IDs
51822
+ * @returns {number} closest data index
51823
+ */
51824
+ findClosestDataIndex: function findClosestDataIndex(offset, sIds) {
51825
+ var _this5 = this,
51826
+ _this$seriesList$refe;
51827
+
51828
+ var _offset = _slicedToArray(offset, 2),
51829
+ xp = _offset[0],
51830
+ yp = _offset[1];
51831
+
51832
+ var isHorizontal = !!this.options.horizontal;
51833
+ var mousePos = isHorizontal ? yp : xp;
51834
+ var closestDistance = Infinity;
51835
+ var closestIndex = -1; // 첫 번째 표시 중인 시리즈를 기준으로 라벨 위치 확인
51836
+
51837
+ var referenceSeries = sIds.find(function (sId) {
51838
+ var _this5$seriesList$sId;
51839
+
51840
+ return (_this5$seriesList$sId = _this5.seriesList[sId]) === null || _this5$seriesList$sId === void 0 ? void 0 : _this5$seriesList$sId.show;
51841
+ });
51842
+
51843
+ if (!referenceSeries || !((_this$seriesList$refe = this.seriesList[referenceSeries]) !== null && _this$seriesList$refe !== void 0 && _this$seriesList$refe.data)) {
51844
+ return -1;
51845
+ }
51846
+
51847
+ var referenceData = this.seriesList[referenceSeries].data; // 각 라벨에서 가장 가까운 것 찾기
51848
+
51849
+ var _loop = function _loop(i) {
51850
+ // 이 라벨에 유효한 데이터가 있는 시리즈가 하나 이상 있는지 확인
51851
+ var hasValidData = sIds.some(function (sId) {
51852
+ var _series$data, _series$data$i, _series$data2, _series$data2$i;
51853
+
51854
+ var series = _this5.seriesList[sId];
51855
+ return (series === null || series === void 0 ? void 0 : series.show) && ((_series$data = series.data) === null || _series$data === void 0 ? void 0 : (_series$data$i = _series$data[i]) === null || _series$data$i === void 0 ? void 0 : _series$data$i.o) !== null && ((_series$data2 = series.data) === null || _series$data2 === void 0 ? void 0 : (_series$data2$i = _series$data2[i]) === null || _series$data2$i === void 0 ? void 0 : _series$data2$i.o) !== undefined;
51856
+ });
51857
+
51858
+ if (hasValidData) {
51859
+ var point = referenceData[i];
51860
+
51861
+ if (point) {
51862
+ // 라벨 위치 계산
51863
+ var labelPos;
51864
+
51865
+ if (isHorizontal) {
51866
+ labelPos = point.h ? point.yp + point.h / 2 : point.yp;
51867
+ } else {
51868
+ labelPos = point.w ? point.xp + point.w / 2 : point.xp;
51869
+ }
51870
+
51871
+ if (labelPos !== null) {
51872
+ var distance = Math.abs(mousePos - labelPos);
51873
+
51874
+ if (distance < closestDistance) {
51875
+ closestDistance = distance;
51876
+ closestIndex = i;
51877
+ }
51878
+ }
51879
+ }
51880
+ }
51881
+ };
51882
+
51883
+ for (var i = 0; i < referenceData.length; i++) {
51884
+ _loop(i);
51885
+ }
51886
+
51887
+ return closestIndex;
51888
+ },
51889
+
51889
51890
  /**
51890
51891
  * get formatted label for tooltip
51891
51892
  * @param dataId
@@ -51894,13 +51895,13 @@ var plugins_interaction_modules = {
51894
51895
  * @param itemData
51895
51896
  * @returns {string}
51896
51897
  */
51897
- getFormattedTooltipLabel: function getFormattedTooltipLabel(_ref8) {
51898
+ getFormattedTooltipLabel: function getFormattedTooltipLabel(_ref2) {
51898
51899
  var _tooltipOpt$formatter;
51899
51900
 
51900
- var dataId = _ref8.dataId,
51901
- seriesId = _ref8.seriesId,
51902
- seriesName = _ref8.seriesName,
51903
- itemData = _ref8.itemData;
51901
+ var dataId = _ref2.dataId,
51902
+ seriesId = _ref2.seriesId,
51903
+ seriesName = _ref2.seriesName,
51904
+ itemData = _ref2.itemData;
51904
51905
  var opt = this.options;
51905
51906
  var tooltipOpt = opt.tooltip;
51906
51907
  var tooltipLabelFormatter = tooltipOpt === null || tooltipOpt === void 0 ? void 0 : (_tooltipOpt$formatter = tooltipOpt.formatter) === null || _tooltipOpt$formatter === void 0 ? void 0 : _tooltipOpt$formatter.label;
@@ -51927,14 +51928,14 @@ var plugins_interaction_modules = {
51927
51928
  * @param itemData
51928
51929
  * @returns {string}
51929
51930
  */
51930
- getFormattedTooltipValue: function getFormattedTooltipValue(_ref9) {
51931
+ getFormattedTooltipValue: function getFormattedTooltipValue(_ref3) {
51931
51932
  var _tooltipOpt$formatter2;
51932
51933
 
51933
- var dataId = _ref9.dataId,
51934
- seriesId = _ref9.seriesId,
51935
- seriesName = _ref9.seriesName,
51936
- value = _ref9.value,
51937
- itemData = _ref9.itemData;
51934
+ var dataId = _ref3.dataId,
51935
+ seriesId = _ref3.seriesId,
51936
+ seriesName = _ref3.seriesName,
51937
+ value = _ref3.value,
51938
+ itemData = _ref3.itemData;
51938
51939
  var opt = this.options;
51939
51940
  var isHorizontal = !!opt.horizontal;
51940
51941
  var tooltipOpt = opt.tooltip;
@@ -52015,9 +52016,9 @@ var plugins_interaction_modules = {
52015
52016
  seriesName: formattedSeriesName,
52016
52017
  value: hasData === null || hasData === void 0 ? void 0 : hasData.o,
52017
52018
  itemData: hasData
52018
- });
52019
+ }); // Only add data if there's a valid value for this exact label
52019
52020
 
52020
- if (hasData && !hitInfo.items[sId]) {
52021
+ if (hasData && hasData.o !== null && hasData.o !== undefined && !hitInfo.items[sId]) {
52021
52022
  var item = {};
52022
52023
  item.color = series.color;
52023
52024
  item.hit = false;
@@ -52107,7 +52108,7 @@ var plugins_interaction_modules = {
52107
52108
  * @returns {object[]}
52108
52109
  */
52109
52110
  getSelectedLabelInfoWithLabelData: function getSelectedLabelInfoWithLabelData(labelIndexList, targetAxis) {
52110
- var _this5 = this;
52111
+ var _this6 = this;
52111
52112
 
52112
52113
  var _this$options9 = this.options,
52113
52114
  selectLabelOpt = _this$options9.selectLabel,
@@ -52123,14 +52124,14 @@ var plugins_interaction_modules = {
52123
52124
  {
52124
52125
  result.dataIndex.splice(selectLabelOpt.limit);
52125
52126
  result.label = result.dataIndex.map(function (i) {
52126
- return _this5.data.labels[i];
52127
+ return _this6.data.labels[i];
52127
52128
  });
52128
52129
  var dataEntries = Object.entries(this.data.data);
52129
52130
  result.data = result.dataIndex.map(function (labelIdx) {
52130
- return Object.fromEntries(dataEntries.map(function (_ref10) {
52131
- var _ref11 = _slicedToArray(_ref10, 2),
52132
- sId = _ref11[0],
52133
- data = _ref11[1];
52131
+ return Object.fromEntries(dataEntries.map(function (_ref4) {
52132
+ var _ref5 = _slicedToArray(_ref4, 2),
52133
+ sId = _ref5[0],
52134
+ data = _ref5[1];
52134
52135
 
52135
52136
  return [sId, data[labelIdx]];
52136
52137
  }));
@@ -52153,12 +52154,12 @@ var plugins_interaction_modules = {
52153
52154
  }
52154
52155
 
52155
52156
  result.label = result.dataIndex.map(function (i) {
52156
- return _this5.data.labels[targetAxisDirection][i];
52157
+ return _this6.data.labels[targetAxisDirection][i];
52157
52158
  });
52158
52159
  var dataValues = Object.values(this.data.data)[0];
52159
- result.data = dataValues.filter(function (_ref12) {
52160
- var x = _ref12.x,
52161
- y = _ref12.y;
52160
+ result.data = dataValues.filter(function (_ref6) {
52161
+ var x = _ref6.x,
52162
+ y = _ref6.y;
52162
52163
  return result.label.includes(targetAxisDirection === 'y' ? y : x);
52163
52164
  });
52164
52165
  break;
@@ -52244,6 +52245,76 @@ var plugins_interaction_modules = {
52244
52245
  return after;
52245
52246
  },
52246
52247
 
52248
+ /**
52249
+ * Draw indicator at the label position when tooltip is displayed
52250
+ * @param {object} hitInfo hit item information from findHitItem
52251
+ * @param {string} color indicator color
52252
+ * @returns {object|null} indicator position info with actual label value
52253
+ */
52254
+ drawIndicatorForTooltip: function drawIndicatorForTooltip(hitInfo, color) {
52255
+ var _this$options$indicat;
52256
+
52257
+ if (!(hitInfo !== null && hitInfo !== void 0 && hitInfo.items) || !Object.keys(hitInfo.items).length) {
52258
+ return null;
52259
+ }
52260
+
52261
+ var ctx = this.overlayCtx;
52262
+ var horizontal = this.options.horizontal;
52263
+ var graphPos = {
52264
+ x1: this.chartRect.x1 + this.labelOffset.left,
52265
+ x2: this.chartRect.x2 - this.labelOffset.right,
52266
+ y1: this.chartRect.y1 + this.labelOffset.top,
52267
+ y2: this.chartRect.y2 - this.labelOffset.bottom
52268
+ }; // 첫 번째 시리즈의 데이터를 기준으로 라벨 위치 계산
52269
+
52270
+ var firstSeriesId = Object.keys(hitInfo.items)[0];
52271
+ var firstItem = hitInfo.items[firstSeriesId];
52272
+
52273
+ if (!(firstItem !== null && firstItem !== void 0 && firstItem.data)) {
52274
+ return null;
52275
+ } // 실제 indicator가 위치하는 라벨 값 추출
52276
+
52277
+
52278
+ var actualLabelValue = horizontal ? firstItem.data.y : firstItem.data.x;
52279
+ var indicatorPosition;
52280
+
52281
+ if (horizontal) {
52282
+ // 수평 차트에서는 Y축 라벨 위치에 수평선
52283
+ var yPosition = firstItem.data.yp + (firstItem.data.h ? firstItem.data.h / 2 : 0);
52284
+ indicatorPosition = [graphPos.x1, yPosition];
52285
+ } else {
52286
+ // 수직 차트에서는 X축 라벨 위치에 수직선
52287
+ var xPosition = firstItem.data.xp + (firstItem.data.w ? firstItem.data.w / 2 : 0);
52288
+ indicatorPosition = [xPosition, graphPos.y1];
52289
+ }
52290
+
52291
+ ctx.beginPath();
52292
+ ctx.save();
52293
+ ctx.strokeStyle = color;
52294
+ ctx.lineWidth = 1;
52295
+
52296
+ if ((_this$options$indicat = this.options.indicator) !== null && _this$options$indicat !== void 0 && _this$options$indicat.segments) {
52297
+ ctx.setLineDash(this.options.indicator.segments);
52298
+ }
52299
+
52300
+ if (horizontal) {
52301
+ ctx.moveTo(graphPos.x1, indicatorPosition[1] + 0.5);
52302
+ ctx.lineTo(graphPos.x2, indicatorPosition[1] + 0.5);
52303
+ } else {
52304
+ ctx.moveTo(indicatorPosition[0] + 0.5, graphPos.y1);
52305
+ ctx.lineTo(indicatorPosition[0] + 0.5, graphPos.y2);
52306
+ }
52307
+
52308
+ ctx.stroke();
52309
+ ctx.restore();
52310
+ ctx.closePath(); // 실제 indicator가 위치한 라벨 정보 반환
52311
+
52312
+ return {
52313
+ labelValue: actualLabelValue,
52314
+ position: indicatorPosition
52315
+ };
52316
+ },
52317
+
52247
52318
  /**
52248
52319
  * Find items by series within a range
52249
52320
  * @param {object} range object for find series items
@@ -52281,14 +52352,14 @@ var plugins_interaction_modules = {
52281
52352
  * object.range: coordinate-based range in graph
52282
52353
  * @returns {object}
52283
52354
  */
52284
- getSelectionRange: function getSelectionRange(_ref13) {
52355
+ getSelectionRange: function getSelectionRange(_ref7) {
52285
52356
  var _this$boxOverflow, _this$boxOverflow2, _this$boxOverflow3, _this$boxOverflow4;
52286
52357
 
52287
- var xsp = _ref13.xsp,
52288
- ysp = _ref13.ysp,
52289
- width = _ref13.width,
52290
- height = _ref13.height,
52291
- range = _ref13.range;
52358
+ var xsp = _ref7.xsp,
52359
+ ysp = _ref7.ysp,
52360
+ width = _ref7.width,
52361
+ height = _ref7.height,
52362
+ range = _ref7.range;
52292
52363
  var dataRangeX = this.axesSteps.x.length ? this.axesSteps.x[0] : null;
52293
52364
  var dataRangeY = this.axesSteps.y.length ? this.axesSteps.y[0] : null;
52294
52365
 
@@ -52345,11 +52416,11 @@ var plugins_interaction_modules = {
52345
52416
 
52346
52417
  var sId = Object.keys(this.seriesList)[0];
52347
52418
 
52348
- var _ref14 = (_this$seriesList$sId$ = this.seriesList[sId].findSelectionRange(range)) !== null && _this$seriesList$sId$ !== void 0 ? _this$seriesList$sId$ : {},
52349
- xMin = _ref14.xMin,
52350
- xMax = _ref14.xMax,
52351
- yMin = _ref14.yMin,
52352
- yMax = _ref14.yMax;
52419
+ var _ref8 = (_this$seriesList$sId$ = this.seriesList[sId].findSelectionRange(range)) !== null && _this$seriesList$sId$ !== void 0 ? _this$seriesList$sId$ : {},
52420
+ xMin = _ref8.xMin,
52421
+ xMax = _ref8.xMax,
52422
+ yMin = _ref8.yMin,
52423
+ yMax = _ref8.yMax;
52353
52424
 
52354
52425
  return {
52355
52426
  xMin: xMin !== null && xMin !== void 0 ? xMin : dataRangeX.graphMin,
@@ -52376,9 +52447,9 @@ var plugins_interaction_modules = {
52376
52447
  * @returns {string}
52377
52448
  */
52378
52449
  getCurMouseLocation: function getCurMouseLocation(offset) {
52379
- var _offset = _slicedToArray(offset, 2),
52380
- offsetX = _offset[0],
52381
- offsetY = _offset[1];
52450
+ var _offset2 = _slicedToArray(offset, 2),
52451
+ offsetX = _offset2[0],
52452
+ offsetY = _offset2[1];
52382
52453
 
52383
52454
  var aPos = {
52384
52455
  x1: this.chartRect.x1 + this.labelOffset.left,
@@ -52439,6 +52510,7 @@ var plugins_interaction_modules = {
52439
52510
 
52440
52511
 
52441
52512
 
52513
+
52442
52514
 
52443
52515
  var LINE_SPACING = 8;
52444
52516
  var VALUE_MARGIN = 50;
@@ -53230,9 +53302,10 @@ var plugins_tooltip_modules = {
53230
53302
  y1: this.chartRect.y1 + this.labelOffset.top,
53231
53303
  y2: this.chartRect.y2 - this.labelOffset.bottom
53232
53304
  };
53233
- var mouseXIp = 5; // mouseInterpolation - increased for better edge detection
53305
+ var mouseXIp = 15; // mouseInterpolation - 넓은 범위에서 감지
53306
+
53307
+ var mouseYIp = 15; // Y축도 동일하게 증가
53234
53308
 
53235
- var mouseYIp = 10;
53236
53309
  var options = this.options;
53237
53310
 
53238
53311
  if (offsetX >= graphPos.x1 - mouseXIp && offsetX <= graphPos.x2 + mouseXIp && offsetY >= graphPos.y1 - mouseYIp && offsetY <= graphPos.y2 + mouseYIp) {
@@ -53327,11 +53400,22 @@ var plugins_tooltip_modules = {
53327
53400
  var horizontal = _ref5.horizontal,
53328
53401
  label = _ref5.label,
53329
53402
  mousePosition = _ref5.mousePosition,
53330
- useAxisTrigger = _ref5.useAxisTrigger;
53403
+ dataLabel = _ref5.dataLabel,
53404
+ isTooltipBased = _ref5.isTooltipBased;
53331
53405
 
53332
53406
  if (!mousePosition || !!horizontal !== !!this.options.horizontal) {
53333
53407
  return;
53334
- }
53408
+ } // tooltip 기반 동기화인 경우
53409
+
53410
+
53411
+ if (isTooltipBased) {
53412
+ this.drawSyncedIndicatorForTooltip({
53413
+ dataLabel: dataLabel,
53414
+ mousePosition: mousePosition
53415
+ });
53416
+ return;
53417
+ } // 기존 시간 기반 동기화
53418
+
53335
53419
 
53336
53420
  if (this.options.syncHover === false || !horizontal && !this.options.axesX.every(function (_ref6) {
53337
53421
  var type = _ref6.type;
@@ -53374,25 +53458,7 @@ var plugins_tooltip_modules = {
53374
53458
  y2: this.chartRect.y2 - this.labelOffset.bottom
53375
53459
  };
53376
53460
 
53377
- if (useAxisTrigger && label) {
53378
- var _this$data$labels5;
53379
-
53380
- var matchIndex = (_this$data$labels5 = this.data.labels) === null || _this$data$labels5 === void 0 ? void 0 : _this$data$labels5.findIndex(function (l) {
53381
- return (l === null || l === void 0 ? void 0 : l.valueOf()) === (label === null || label === void 0 ? void 0 : label.valueOf());
53382
- });
53383
-
53384
- if (matchIndex >= 0) {
53385
- var _Object$keys, _this$seriesList, _this$seriesList$seri, _this$seriesList$seri2;
53386
-
53387
- var seriesId = (_Object$keys = Object.keys(this.seriesList)) === null || _Object$keys === void 0 ? void 0 : _Object$keys[0];
53388
- var dataPoint = (_this$seriesList = this.seriesList) === null || _this$seriesList === void 0 ? void 0 : (_this$seriesList$seri = _this$seriesList[seriesId]) === null || _this$seriesList$seri === void 0 ? void 0 : (_this$seriesList$seri2 = _this$seriesList$seri.data) === null || _this$seriesList$seri2 === void 0 ? void 0 : _this$seriesList$seri2[matchIndex];
53389
-
53390
- if ((dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.xp) !== undefined && (dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.xp) !== null) {
53391
- var yPosition = !lodash_es_isNil(dataPoint.yp) ? dataPoint.yp : (graphPos.y1 + graphPos.y2) / 2;
53392
- this.drawIndicator([dataPoint.xp, yPosition], this.options.indicator.color);
53393
- }
53394
- }
53395
- } else if (horizontal) {
53461
+ if (horizontal) {
53396
53462
  var chartHeight = graphPos.y2 - graphPos.y1;
53397
53463
  var offsetY = chartHeight * (label - fromTime) / (toTime - fromTime) + graphPos.y1;
53398
53464
  this.drawIndicator([graphPos.x2, offsetY], this.options.indicator.color);
@@ -53403,6 +53469,82 @@ var plugins_tooltip_modules = {
53403
53469
  }
53404
53470
  },
53405
53471
 
53472
+ /**
53473
+ * 제공된 dataLabel과 일치하는 Label이 있다면 indicator를 그림
53474
+ * @param {object} dataLabel data label
53475
+ * @param {object} mousePosition mouse position
53476
+ *
53477
+ * @returns {undefined}
53478
+ */
53479
+ drawSyncedIndicatorForTooltip: function drawSyncedIndicatorForTooltip(_ref8) {
53480
+ var _this$data;
53481
+
53482
+ var dataLabel = _ref8.dataLabel,
53483
+ mousePosition = _ref8.mousePosition;
53484
+
53485
+ if (!((_this$data = this.data) !== null && _this$data !== void 0 && _this$data.labels) || !dataLabel) {
53486
+ return;
53487
+ }
53488
+
53489
+ var matchingLabelIndex = this.data.labels.findIndex(function (label) {
53490
+ return (label === null || label === void 0 ? void 0 : label.valueOf()) === (dataLabel === null || dataLabel === void 0 ? void 0 : dataLabel.valueOf());
53491
+ });
53492
+
53493
+ if (matchingLabelIndex === -1) {
53494
+ this.overlayClear();
53495
+ return;
53496
+ }
53497
+
53498
+ var horizontal = this.options.horizontal;
53499
+
53500
+ var _this$chartDOM$getBou2 = this.chartDOM.getBoundingClientRect(),
53501
+ top = _this$chartDOM$getBou2.top,
53502
+ bottom = _this$chartDOM$getBou2.bottom,
53503
+ left = _this$chartDOM$getBou2.left,
53504
+ right = _this$chartDOM$getBou2.right;
53505
+
53506
+ var isHoveredChart = lodash_es_inRange(mousePosition[0], left, right) && lodash_es_inRange(mousePosition[1], bottom, top);
53507
+
53508
+ if (isHoveredChart) {
53509
+ return;
53510
+ }
53511
+
53512
+ this.overlayClear();
53513
+ var graphPos = {
53514
+ x1: this.chartRect.x1 + this.labelOffset.left,
53515
+ x2: this.chartRect.x2 - this.labelOffset.right,
53516
+ y1: this.chartRect.y1 + this.labelOffset.top,
53517
+ y2: this.chartRect.y2 - this.labelOffset.bottom
53518
+ };
53519
+ var labelsCount = this.data.labels.length;
53520
+ var indicatorPosition;
53521
+
53522
+ if (horizontal) {
53523
+ var _this$options$axesY;
53524
+
53525
+ var chartHeight = graphPos.y2 - graphPos.y1; // CategoryMode인 경우 라벨들이 균등 간격으로 배치됨
53526
+
53527
+ var isCategoryMode = (_this$options$axesY = this.options.axesY) === null || _this$options$axesY === void 0 ? void 0 : _this$options$axesY.some(function (axis) {
53528
+ return axis.categoryMode;
53529
+ });
53530
+ var positionY = isCategoryMode ? graphPos.y1 + chartHeight * (matchingLabelIndex + 0.5) / labelsCount : graphPos.y1 + chartHeight * matchingLabelIndex / (labelsCount - 1);
53531
+ indicatorPosition = [graphPos.x2, positionY];
53532
+ } else {
53533
+ var _this$options$axesX;
53534
+
53535
+ var chartWidth = graphPos.x2 - graphPos.x1; // CategoryMode인 경우 라벨들이 균등 간격으로 배치됨
53536
+
53537
+ var _isCategoryMode = (_this$options$axesX = this.options.axesX) === null || _this$options$axesX === void 0 ? void 0 : _this$options$axesX.some(function (axis) {
53538
+ return axis.categoryMode;
53539
+ });
53540
+
53541
+ var positionX = _isCategoryMode ? graphPos.x1 + chartWidth * (matchingLabelIndex + 0.5) / labelsCount : graphPos.x1 + chartWidth * matchingLabelIndex / (labelsCount - 1);
53542
+ indicatorPosition = [positionX, graphPos.y2];
53543
+ }
53544
+
53545
+ this.drawIndicator(indicatorPosition, this.options.indicator.color);
53546
+ },
53547
+
53406
53548
  /**
53407
53549
  * Clear tooltip canvas
53408
53550
  *
@@ -53743,6 +53885,7 @@ var plugins_pie_modules = {
53743
53885
 
53744
53886
 
53745
53887
 
53888
+
53746
53889
  var element_tip_modules = {
53747
53890
  /**
53748
53891
  * Draw TextTip with tip's locationInfo
@@ -53776,7 +53919,8 @@ var element_tip_modules = {
53776
53919
  }
53777
53920
 
53778
53921
  if (labelTipOpt.use && labelTipOpt.showTip) {
53779
- isExistSelectedLabel = opt.type === 'heatMap' ? this.drawLabelTipForHeatMap() : this.drawTipForSelectedLabel();
53922
+ var isHeatMap = opt.type === 'heatMap';
53923
+ isExistSelectedLabel = isHeatMap ? this.drawLabelTipForHeatMap() : this.drawLabelTip();
53780
53924
  }
53781
53925
 
53782
53926
  var executeDrawIndicator = function executeDrawIndicator(tipOpt) {
@@ -54062,10 +54206,9 @@ var element_tip_modules = {
54062
54206
 
54063
54207
  /**
54064
54208
  * Draw Selected Label Tip
54065
- * none Text
54066
54209
  * @returns {boolean} Whether drew at least one tip
54067
54210
  */
54068
- drawTipForSelectedLabel: function drawTipForSelectedLabel() {
54211
+ drawLabelTip: function drawLabelTip() {
54069
54212
  var _this2 = this;
54070
54213
 
54071
54214
  var opt = this.options;
@@ -54091,7 +54234,7 @@ var element_tip_modules = {
54091
54234
  };
54092
54235
  var labelAxes = isHorizontal ? this.axesY[0] : this.axesX[0];
54093
54236
  var valueAxes = isHorizontal ? this.axesX[0] : this.axesY[0];
54094
- var valueAxesSteps = isHorizontal ? this.axesSteps.x[0] : this.axesSteps.y[0];
54237
+ var valueAxesRange = isHorizontal ? this.axesRange.x[0] : this.axesRange.y[0];
54095
54238
  var valuePositionCalcFunction = isHorizontal ? helpers_canvas.calculateX : helpers_canvas.calculateY;
54096
54239
  var labelPositionCalcFunction = isHorizontal ? helpers_canvas.calculateY : helpers_canvas.calculateX;
54097
54240
  var scrollbarOpt = isHorizontal ? this.scrollbar.y : this.scrollbar.x;
@@ -54109,8 +54252,8 @@ var element_tip_modules = {
54109
54252
  return _this2.seriesList[sId].isExistGrp && !_this2.seriesList[sId].isOverlapping;
54110
54253
  });
54111
54254
  var groups = (_this$data$groups$ = (_this$data$groups = this.data.groups) === null || _this$data$groups === void 0 ? void 0 : _this$data$groups[0]) !== null && _this$data$groups$ !== void 0 ? _this$data$groups$ : [];
54112
- var labelPos;
54113
- var dataPos;
54255
+ var gp;
54256
+ var dp;
54114
54257
  var value;
54115
54258
  var labelStartPoint;
54116
54259
  var labelEndPoint;
@@ -54158,39 +54301,31 @@ var element_tip_modules = {
54158
54301
  }
54159
54302
 
54160
54303
  data.forEach(function (selectedData, i) {
54161
- value = valueAxesSteps.graphMax;
54162
-
54163
- if (!labelTipOpt.fixedPosTop) {
54164
- if (isExistGrp) {
54165
- var _visibleSeries$filter, _visibleSeries$filter2;
54166
-
54167
- var positiveSum = visibleSeries === null || visibleSeries === void 0 ? void 0 : visibleSeries.reduce(function (ac, sId) {
54168
- var _selectedData$sId$val, _selectedData$sId, _selectedData$sId$val2, _selectedData$sId2;
54169
-
54170
- return groups.includes(sId) && ((_selectedData$sId$val = (_selectedData$sId = selectedData[sId]) === null || _selectedData$sId === void 0 ? void 0 : _selectedData$sId.value) !== null && _selectedData$sId$val !== void 0 ? _selectedData$sId$val : selectedData[sId]) > 0 ? ac + ((_selectedData$sId$val2 = (_selectedData$sId2 = selectedData[sId]) === null || _selectedData$sId2 === void 0 ? void 0 : _selectedData$sId2.value) !== null && _selectedData$sId$val2 !== void 0 ? _selectedData$sId$val2 : selectedData[sId]) : ac;
54171
- }, 0);
54172
- var nonGroupValues = (_visibleSeries$filter = visibleSeries === null || visibleSeries === void 0 ? void 0 : (_visibleSeries$filter2 = visibleSeries.filter(function (sId) {
54173
- return !groups.includes(sId);
54174
- })) === null || _visibleSeries$filter2 === void 0 ? void 0 : _visibleSeries$filter2.map(function (sId) {
54175
- var _selectedData$sId$val3, _selectedData$sId3;
54176
-
54177
- return (_selectedData$sId$val3 = (_selectedData$sId3 = selectedData[sId]) === null || _selectedData$sId3 === void 0 ? void 0 : _selectedData$sId3.value) !== null && _selectedData$sId$val3 !== void 0 ? _selectedData$sId$val3 : selectedData[sId];
54178
- })) !== null && _visibleSeries$filter !== void 0 ? _visibleSeries$filter : [];
54179
- var maxNonGroupValue = (nonGroupValues === null || nonGroupValues === void 0 ? void 0 : nonGroupValues.length) > 0 ? nonGroupValues.reduce(function (max, val) {
54180
- return Math.max(max, val !== null && val !== void 0 ? val : -Infinity);
54181
- }, -Infinity) : -Infinity;
54182
- value = positiveSum > 0 ? Math.max(maxNonGroupValue, positiveSum) : Math.max(maxNonGroupValue, 0);
54183
- } else if (visibleSeries.length) {
54184
- var visibleValue = visibleSeries.map(function (sId) {
54185
- var _selectedData$sId$val4, _selectedData$sId4;
54186
-
54187
- return (_selectedData$sId$val4 = (_selectedData$sId4 = selectedData[sId]) === null || _selectedData$sId4 === void 0 ? void 0 : _selectedData$sId4.value) !== null && _selectedData$sId$val4 !== void 0 ? _selectedData$sId$val4 : selectedData[sId];
54188
- });
54189
- var maxValue = visibleValue.length > 0 ? visibleValue.reduce(function (max, val) {
54190
- return Math.max(max, val !== null && val !== void 0 ? val : -Infinity);
54191
- }, -Infinity) : -Infinity;
54192
- value = maxValue > 0 || _this2.options.type !== 'bar' ? maxValue : 0;
54193
- }
54304
+ if (labelTipOpt.fixedPosTop) {
54305
+ value = valueAxesRange.max;
54306
+ } else if (isExistGrp) {
54307
+ var sumValue = visibleSeries.reduce(function (ac, sId) {
54308
+ var _selectedData$sId$val, _selectedData$sId;
54309
+
54310
+ return groups.includes(sId) ? ac + ((_selectedData$sId$val = (_selectedData$sId = selectedData[sId]) === null || _selectedData$sId === void 0 ? void 0 : _selectedData$sId.value) !== null && _selectedData$sId$val !== void 0 ? _selectedData$sId$val : selectedData[sId]) : ac;
54311
+ }, 0);
54312
+ var nonGroupValues = visibleSeries.filter(function (sId) {
54313
+ return !groups.includes(sId);
54314
+ }).map(function (sId) {
54315
+ var _selectedData$sId$val2, _selectedData$sId2;
54316
+
54317
+ return (_selectedData$sId$val2 = (_selectedData$sId2 = selectedData[sId]) === null || _selectedData$sId2 === void 0 ? void 0 : _selectedData$sId2.value) !== null && _selectedData$sId$val2 !== void 0 ? _selectedData$sId$val2 : selectedData[sId];
54318
+ });
54319
+ value = Math.max.apply(Math, _toConsumableArray(nonGroupValues).concat([sumValue]));
54320
+ } else if (visibleSeries.length) {
54321
+ var visibleValue = visibleSeries.map(function (sId) {
54322
+ var _selectedData$sId$val3, _selectedData$sId3;
54323
+
54324
+ return (_selectedData$sId$val3 = (_selectedData$sId3 = selectedData[sId]) === null || _selectedData$sId3 === void 0 ? void 0 : _selectedData$sId3.value) !== null && _selectedData$sId$val3 !== void 0 ? _selectedData$sId$val3 : selectedData[sId];
54325
+ });
54326
+ value = Math.max.apply(Math, _toConsumableArray(visibleValue));
54327
+ } else {
54328
+ value = valueAxesRange.max;
54194
54329
  }
54195
54330
 
54196
54331
  if (labelAxes.labels) {
@@ -54200,17 +54335,18 @@ var element_tip_modules = {
54200
54335
 
54201
54336
  var labelIndex = dataIndex[i] - startIndex;
54202
54337
  var labelCenter = Math.round(labelStartPoint + labelGap * labelIndex);
54203
- labelPos = labelCenter + labelGap / 2;
54338
+ dp = labelCenter + labelGap / 2;
54204
54339
  } else {
54205
- labelPos = labelPositionCalcFunction(label[i], graphX.graphMin, graphX.graphMax, chartWidth - sizeObj.comboOffset, aPos.x1 + sizeObj.comboOffset / 2);
54340
+ dp = labelPositionCalcFunction(label[i], graphX.graphMin, graphX.graphMax, chartWidth - sizeObj.comboOffset, aPos.x1 + sizeObj.comboOffset / 2);
54206
54341
  }
54207
54342
 
54208
- dataPos = valuePositionCalcFunction(value, valueAxesSteps.graphMin, valueAxesSteps.graphMax, valueSpace, valueStartPoint) + offset;
54343
+ gp = valuePositionCalcFunction(value, valueAxesRange.min, valueAxesRange.max, valueSpace, valueStartPoint);
54344
+ gp += offset;
54209
54345
 
54210
54346
  _this2.showTip({
54211
54347
  context: _this2.bufferCtx,
54212
- x: isHorizontal ? dataPos : labelPos,
54213
- y: isHorizontal ? labelPos : dataPos,
54348
+ x: isHorizontal ? gp : dp,
54349
+ y: isHorizontal ? dp : gp,
54214
54350
  opt: labelTipOpt,
54215
54351
  isSamePos: false
54216
54352
  });
@@ -54322,11 +54458,10 @@ var element_tip_modules = {
54322
54458
  }
54323
54459
  } else if (isHorizontal) {
54324
54460
  gp = helpers_canvas.calculateX(value, graphX.graphMin, graphX.graphMax, xArea, xsp);
54325
- gp = value < 0 ? gp - offset : gp + offset;
54461
+ gp += offset;
54326
54462
  } else {
54327
- var adjustedValue = type === 'bar' && value < 0 ? 0 : value;
54328
- gp = helpers_canvas.calculateY(adjustedValue, graphY.graphMin, graphY.graphMax, yArea, ysp);
54329
- gp = adjustedValue < 0 ? gp + offset : gp - offset;
54463
+ gp = helpers_canvas.calculateY(value, graphY.graphMin, graphY.graphMax, yArea, ysp);
54464
+ gp -= offset;
54330
54465
  }
54331
54466
 
54332
54467
  var maxTipType = 'center';
@@ -54358,8 +54493,7 @@ var element_tip_modules = {
54358
54493
  arrowSize: arrowSize,
54359
54494
  borderRadius: borderRadius,
54360
54495
  text: text,
54361
- textStyle: textStyle,
54362
- isNegative: value < 0
54496
+ textStyle: textStyle
54363
54497
  });
54364
54498
  }
54365
54499
 
@@ -54393,21 +54527,12 @@ var element_tip_modules = {
54393
54527
  borderRadius = param.borderRadius,
54394
54528
  text = param.text,
54395
54529
  opt = param.opt,
54396
- textStyle = param.textStyle,
54397
- isNegative = param.isNegative;
54530
+ textStyle = param.textStyle;
54398
54531
  var ctx = param.context;
54399
54532
  var sx = x - width / 2;
54400
54533
  var ex = x + width / 2;
54401
54534
  var sy = y - height;
54402
54535
  var ey = y;
54403
-
54404
- if (isNegative) {
54405
- if (isHorizontal) {
54406
- sx = x - width / 2 - width;
54407
- ex = x - width / 2;
54408
- }
54409
- }
54410
-
54411
54536
  ctx.save();
54412
54537
  ctx.font = textStyle;
54413
54538
  ctx.fillStyle = (_opt$tipBackground = opt.tipBackground) !== null && _opt$tipBackground !== void 0 ? _opt$tipBackground : opt.tipStyle.background;
@@ -54415,73 +54540,44 @@ var element_tip_modules = {
54415
54540
  ctx.beginPath();
54416
54541
  ctx.moveTo(sx + borderRadius, sy);
54417
54542
  ctx.quadraticCurveTo(sx, sy, sx, sy + borderRadius);
54543
+
54544
+ if (isHorizontal) {
54545
+ ctx.lineTo(sx, sy + borderRadius + arrowSize / 2);
54546
+ ctx.lineTo(sx - arrowSize, ey - height / 2);
54547
+ ctx.lineTo(sx, ey - borderRadius - arrowSize / 2);
54548
+ }
54549
+
54418
54550
  ctx.lineTo(sx, ey - borderRadius);
54419
54551
  ctx.quadraticCurveTo(sx, ey, sx + borderRadius, ey);
54552
+
54553
+ if (!isHorizontal) {
54554
+ if (type === 'left') {
54555
+ ctx.lineTo(sx + borderRadius + arrowSize, ey + arrowSize);
54556
+ ctx.lineTo(sx + borderRadius + arrowSize * 2, ey);
54557
+ } else if (type === 'right') {
54558
+ ctx.lineTo(ex - arrowSize * 2 - borderRadius, ey);
54559
+ ctx.lineTo(ex - arrowSize - borderRadius, ey + arrowSize);
54560
+ } else {
54561
+ ctx.lineTo(x - arrowSize, ey);
54562
+ ctx.lineTo(x, ey + arrowSize);
54563
+ ctx.lineTo(x + arrowSize, ey);
54564
+ }
54565
+ }
54566
+
54420
54567
  ctx.lineTo(ex - borderRadius, ey);
54421
54568
  ctx.quadraticCurveTo(ex, ey, ex, ey - borderRadius);
54422
54569
  ctx.lineTo(ex, sy + borderRadius);
54423
54570
  ctx.quadraticCurveTo(ex, sy, ex - borderRadius, sy);
54424
54571
  ctx.lineTo(sx + borderRadius, sy);
54425
54572
  ctx.closePath();
54426
- ctx.fill(); // draw arrow
54427
-
54428
- ctx.beginPath();
54429
-
54430
- if (isHorizontal) {
54431
- if (isNegative) {
54432
- ctx.moveTo(ex, ey);
54433
- ctx.lineTo(ex, sy + borderRadius + arrowSize / 2);
54434
- ctx.lineTo(ex + arrowSize, ey - height / 2);
54435
- ctx.lineTo(ex, ey - borderRadius - arrowSize / 2);
54436
- } else {
54437
- ctx.moveTo(sx, sy);
54438
- ctx.lineTo(sx, sy + borderRadius + arrowSize / 2);
54439
- ctx.lineTo(sx - arrowSize, ey - height / 2);
54440
- ctx.lineTo(sx, ey - borderRadius - arrowSize / 2);
54441
- }
54442
-
54443
- ctx.closePath();
54444
- ctx.fill();
54445
- } else {
54446
- if (isNegative) {
54447
- if (type === 'left') {
54448
- ctx.lineTo(sx + borderRadius + arrowSize, ey + arrowSize);
54449
- ctx.lineTo(sx + borderRadius + arrowSize * 2, ey);
54450
- } else if (type === 'right') {
54451
- ctx.lineTo(ex - arrowSize * 2 - borderRadius, ey);
54452
- ctx.lineTo(ex - arrowSize - borderRadius, ey + arrowSize);
54453
- } else {
54454
- ctx.lineTo(x - arrowSize, ey);
54455
- ctx.lineTo(x, ey + arrowSize);
54456
- ctx.lineTo(x + arrowSize, ey);
54457
- }
54458
- } else if (!isNegative) {
54459
- if (type === 'left') {
54460
- ctx.moveTo(sx, sy);
54461
- ctx.lineTo(sx + borderRadius + arrowSize, ey + arrowSize);
54462
- ctx.lineTo(sx + borderRadius + arrowSize * 2, ey);
54463
- } else if (type === 'right') {
54464
- ctx.moveTo(ex, sy);
54465
- ctx.lineTo(ex - arrowSize * 2 - borderRadius, ey);
54466
- ctx.lineTo(ex - arrowSize - borderRadius, ey + arrowSize);
54467
- } else {
54468
- ctx.lineTo(x - arrowSize, ey);
54469
- ctx.lineTo(x, ey + arrowSize);
54470
- ctx.lineTo(x + arrowSize, ey);
54471
- }
54472
- }
54473
-
54474
- ctx.closePath();
54475
- ctx.fill();
54476
- }
54477
-
54573
+ ctx.fill();
54478
54574
  ctx.restore();
54479
54575
  ctx.save();
54480
54576
  ctx.font = textStyle;
54481
54577
  ctx.fillStyle = (_opt$tipTextColor = opt.tipTextColor) !== null && _opt$tipTextColor !== void 0 ? _opt$tipTextColor : opt.tipStyle.textColor;
54482
54578
  ctx.textBaseline = 'middle';
54483
54579
  ctx.textAlign = 'center';
54484
- ctx.fillText("".concat(text), sx + width / 2, sy + height / 2);
54580
+ ctx.fillText("".concat(text), x, sy + height / 2);
54485
54581
  ctx.restore();
54486
54582
  },
54487
54583
 
@@ -54733,13 +54829,11 @@ var chart_core_EvChart = /*#__PURE__*/function () {
54733
54829
  value: function drawSyncedIndicator(_ref) {
54734
54830
  var horizontal = _ref.horizontal,
54735
54831
  label = _ref.label,
54736
- mousePosition = _ref.mousePosition,
54737
- useAxisTrigger = _ref.useAxisTrigger;
54832
+ mousePosition = _ref.mousePosition;
54738
54833
  this.drawSyncedIndicator({
54739
54834
  horizontal: horizontal,
54740
54835
  label: label,
54741
- mousePosition: mousePosition,
54742
- useAxisTrigger: useAxisTrigger
54836
+ mousePosition: mousePosition
54743
54837
  });
54744
54838
  }
54745
54839
  }, {
@@ -56567,7 +56661,6 @@ var DEFAULT_OPTIONS = {
56567
56661
  combo: false,
56568
56662
  tooltip: {
56569
56663
  use: true,
56570
- trigger: 'axis',
56571
56664
  sortByValue: true,
56572
56665
  backgroundColor: '#4C4C4C',
56573
56666
  fontColor: '#FFFFFF',