evui 3.4.118 → 3.4.200

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.
@@ -11171,7 +11171,7 @@ module.exports = exports;
11171
11171
  /***/ "9224":
11172
11172
  /***/ (function(module) {
11173
11173
 
11174
- module.exports = JSON.parse("{\"a\":\"3.4.118\"}");
11174
+ module.exports = JSON.parse("{\"a\":\"3.4.200\"}");
11175
11175
 
11176
11176
  /***/ }),
11177
11177
 
@@ -38503,26 +38503,26 @@ var es_string_match = __webpack_require__("466d");
38503
38503
  return value;
38504
38504
  }
38505
38505
 
38506
- var assignLabelWith = function assignLabelWith(v, target, lb) {
38507
- if (v % target === 0) {
38508
- return "".concat((v / target).toFixed(decimalPoint)).concat(lb);
38509
- }
38506
+ var isNegative = value < 0;
38507
+ var absValue = Math.abs(value);
38510
38508
 
38511
- return "".concat((v / target).toFixed(1)).concat(lb);
38512
- };
38513
-
38514
- if (value >= quad) {
38515
- label = assignLabelWith(value, quad, 'P');
38516
- } else if (value >= trill) {
38517
- label = assignLabelWith(value, trill, 'T');
38518
- } else if (value >= billi) {
38519
- label = assignLabelWith(value, billi, 'G');
38520
- } else if (value >= milli) {
38521
- label = assignLabelWith(value, milli, 'M');
38522
- } else if (value >= killo) {
38523
- label = assignLabelWith(value, 1000, 'K');
38509
+ var assignLabelWith = function assignLabelWith(v, target, lb) {
38510
+ var result = v % target === 0 ? "".concat((v / target).toFixed(decimalPoint)).concat(lb) : "".concat((v / target).toFixed(1)).concat(lb);
38511
+ return isNegative ? "-".concat(result) : result;
38512
+ };
38513
+
38514
+ if (absValue >= quad) {
38515
+ label = assignLabelWith(absValue, quad, 'P');
38516
+ } else if (absValue >= trill) {
38517
+ label = assignLabelWith(absValue, trill, 'T');
38518
+ } else if (absValue >= billi) {
38519
+ label = assignLabelWith(absValue, billi, 'G');
38520
+ } else if (absValue >= milli) {
38521
+ label = assignLabelWith(absValue, milli, 'M');
38522
+ } else if (absValue >= killo) {
38523
+ label = assignLabelWith(absValue, 1000, 'K');
38524
38524
  } else {
38525
- label = value.toFixed(decimalPoint);
38525
+ label = isNegative ? "-".concat(absValue.toFixed(decimalPoint)) : value.toFixed(decimalPoint);
38526
38526
  }
38527
38527
 
38528
38528
  return label;
@@ -38796,32 +38796,36 @@ var modules = {
38796
38796
  seriesIDs.forEach(function (seriesID) {
38797
38797
  var series = _this.seriesList[seriesID];
38798
38798
  var sData = data[seriesID];
38799
+ var passingValue = series === null || series === void 0 ? void 0 : series.passingValue;
38799
38800
 
38800
38801
  if (series && sData) {
38801
38802
  series.data = _this.addSeriesDSforScatter(sData);
38802
- series.minMax = _this.getSeriesMinMax(series.data);
38803
+ series.minMax = _this.getSeriesMinMax(series.data, passingValue);
38803
38804
  }
38804
38805
  });
38805
38806
  } else if (typeKey === 'heatMap') {
38806
38807
  seriesIDs.forEach(function (seriesID) {
38807
38808
  var series = _this.seriesList[seriesID];
38809
+ var passingValue = series === null || series === void 0 ? void 0 : series.passingValue;
38808
38810
  var sData = data[seriesID];
38809
38811
 
38810
38812
  if (series && sData) {
38811
38813
  series.labels = label;
38812
38814
  series.data = _this.addSeriesDSForHeatMap(sData);
38813
- series.minMax = _this.getSeriesMinMax(series.data);
38815
+ series.minMax = _this.getSeriesMinMax(series.data, passingValue);
38814
38816
  series.valueOpt = _this.getSeriesValueOptForHeatMap(series);
38815
38817
  }
38816
38818
  });
38817
38819
  } else {
38818
38820
  seriesIDs.forEach(function (seriesID) {
38821
+ var _data$seriesID, _data$seriesID2;
38822
+
38819
38823
  var series = _this.seriesList[seriesID];
38820
- var hasPassingValueInData = data[seriesID].some(function (item) {
38824
+ var hasPassingValueInData = data === null || data === void 0 ? void 0 : (_data$seriesID = data[seriesID]) === null || _data$seriesID === void 0 ? void 0 : _data$seriesID.some(function (item) {
38821
38825
  return item === series.passingValue;
38822
38826
  });
38823
38827
  series.hasPassingValueInData = hasPassingValueInData;
38824
- var sData = data[seriesID].map(function (item) {
38828
+ var sData = data === null || data === void 0 ? void 0 : (_data$seriesID2 = data[seriesID]) === null || _data$seriesID2 === void 0 ? void 0 : _data$seriesID2.map(function (item) {
38825
38829
  if (series.interpolation === 'zero' && !item) {
38826
38830
  return 0;
38827
38831
  }
@@ -38840,7 +38844,7 @@ var modules = {
38840
38844
  series.data = _this.addSeriesDS(sData, label, series.isExistGrp);
38841
38845
  }
38842
38846
 
38843
- series.minMax = _this.getSeriesMinMax(series.data);
38847
+ series.minMax = _this.getSeriesMinMax(series.data, series.passingValue);
38844
38848
  }
38845
38849
  });
38846
38850
  }
@@ -39236,17 +39240,19 @@ var modules = {
39236
39240
  var isHorizontal = this.options.horizontal;
39237
39241
  var sdata = [];
39238
39242
 
39239
- var getBaseDataPosition = function getBaseDataPosition(baseIndex, dataIndex) {
39243
+ var getBaseDataPosition = function getBaseDataPosition(baseIndex, dataIndex, curr) {
39240
39244
  var nextBaseSeriesIndex = baseIndex - 1;
39241
39245
  var baseSeries = _this4.seriesList[bsIds[baseIndex]];
39242
39246
  var baseDataList = baseSeries.data;
39243
39247
  var baseData = baseDataList[dataIndex];
39244
39248
  var position = isHorizontal ? baseData === null || baseData === void 0 ? void 0 : baseData.x : baseData === null || baseData === void 0 ? void 0 : baseData.y;
39245
- var isPassingValue = baseSeries.passingValue === (baseData === null || baseData === void 0 ? void 0 : baseData.o);
39249
+ var baseValue = baseData === null || baseData === void 0 ? void 0 : baseData.o;
39250
+ var isPassingValue = baseSeries.passingValue === baseValue;
39251
+ var isSameSign = curr >= 0 && baseValue >= 0 || curr < 0 && baseValue < 0;
39246
39252
 
39247
- if (isPassingValue || position == null || !baseSeries.show) {
39253
+ if (isPassingValue || position == null || !isSameSign || !baseSeries.show) {
39248
39254
  if (nextBaseSeriesIndex > -1) {
39249
- return getBaseDataPosition(nextBaseSeriesIndex, dataIndex);
39255
+ return getBaseDataPosition(nextBaseSeriesIndex, dataIndex, curr);
39250
39256
  }
39251
39257
 
39252
39258
  return 0;
@@ -39257,7 +39263,7 @@ var modules = {
39257
39263
 
39258
39264
  data.forEach(function (curr, index) {
39259
39265
  var baseIndex = bsIds.length - 1 < 0 ? 0 : bsIds.length - 1;
39260
- var bdata = getBaseDataPosition(baseIndex, index); // base(previous) series data
39266
+ var bdata = getBaseDataPosition(baseIndex, index, curr); // base(previous) series data
39261
39267
 
39262
39268
  var odata = curr; // current series original data
39263
39269
 
@@ -39440,7 +39446,7 @@ var modules = {
39440
39446
  *
39441
39447
  * @returns {object} min/max info for series
39442
39448
  */
39443
- getSeriesMinMax: function getSeriesMinMax(data) {
39449
+ getSeriesMinMax: function getSeriesMinMax(data, passingValue) {
39444
39450
  var def = {
39445
39451
  minX: null,
39446
39452
  minY: null,
@@ -39452,21 +39458,22 @@ var modules = {
39452
39458
 
39453
39459
  if (data.length) {
39454
39460
  return data.reduce(function (acc, p, index) {
39455
- var _p$x, _p$y;
39461
+ var _p$x, _p$y, _p$o;
39456
39462
 
39457
39463
  var minmax = acc;
39458
39464
  var px = ((_p$x = p.x) === null || _p$x === void 0 ? void 0 : _p$x.value) || p.x;
39459
39465
  var py = ((_p$y = p.y) === null || _p$y === void 0 ? void 0 : _p$y.value) || p.y;
39466
+ var po = ((_p$o = p.o) === null || _p$o === void 0 ? void 0 : _p$o.value) || p.o;
39460
39467
 
39461
- if (px <= minmax.minX) {
39468
+ if (po !== passingValue && px <= minmax.minX) {
39462
39469
  minmax.minX = px === null ? 0 : px;
39463
39470
  }
39464
39471
 
39465
- if (py <= minmax.minY) {
39472
+ if (po !== passingValue && py <= minmax.minY) {
39466
39473
  minmax.minY = py === null ? 0 : py;
39467
39474
  }
39468
39475
 
39469
- if (px >= minmax.maxX) {
39476
+ if (po !== passingValue && px >= minmax.maxX) {
39470
39477
  minmax.maxX = px === null ? 0 : px;
39471
39478
 
39472
39479
  if (isHorizontal && px !== null) {
@@ -39475,7 +39482,7 @@ var modules = {
39475
39482
  }
39476
39483
  }
39477
39484
 
39478
- if (py >= minmax.maxY) {
39485
+ if (po !== passingValue && py >= minmax.maxY) {
39479
39486
  minmax.maxY = py === null ? 0 : py;
39480
39487
 
39481
39488
  if (!isHorizontal && py !== null) {
@@ -40229,14 +40236,25 @@ var modules = {
40229
40236
  }
40230
40237
  }
40231
40238
 
40232
- if (smm.maxX >= minmax.x[axisX].max) {
40239
+ var isExistGrp = _this10.seriesList[key].isExistGrp;
40240
+ var maxXisNegative = minmax.x[axisX].max < 0;
40241
+
40242
+ if (isExistGrp && maxXisNegative) {
40243
+ minmax.x[axisX].max = smm.maxX;
40244
+ minmax.x[axisX].maxSID = key;
40245
+ } else if (!minmax.x[axisX].max || smm.maxX >= minmax.x[axisX].max) {
40233
40246
  minmax.x[axisX].max = smm.maxX;
40234
40247
  minmax.x[axisX].maxSID = key;
40235
40248
  }
40236
40249
 
40237
- if (smm.maxY >= minmax.y[axisY].max) {
40250
+ var maxYisNegative = minmax.y[axisY].max < 0;
40251
+
40252
+ if (isExistGrp && maxYisNegative) {
40253
+ minmax.y[axisY].max = smm.maxY;
40254
+ minmax.y[axisY].maxSID = key;
40255
+ } else if (!minmax.y[axisY].max || smm.maxY >= minmax.y[axisY].max) {
40238
40256
  minmax.y[axisY].max = smm.maxY;
40239
- minmax.y[axisX].maxSID = key;
40257
+ minmax.y[axisY].maxSID = key;
40240
40258
  }
40241
40259
  }
40242
40260
 
@@ -41697,6 +41715,7 @@ var TIME_INTERVALS = {
41697
41715
 
41698
41716
 
41699
41717
 
41718
+
41700
41719
  var element_line_Line = /*#__PURE__*/function () {
41701
41720
  function Line(sId, opt, sIdx) {
41702
41721
  var _this = this;
@@ -41830,7 +41849,6 @@ var element_line_Line = /*#__PURE__*/function () {
41830
41849
  ctx.setLineDash(this.segments);
41831
41850
  }
41832
41851
 
41833
- var endPoint = chartRect.y2 - labelOffset.bottom;
41834
41852
  var isLinearInterpolation = this.useLinearInterpolation();
41835
41853
  var barAreaByCombo = 0;
41836
41854
  var minmaxX = axesSteps.x[this.xAxisIndex];
@@ -41853,8 +41871,12 @@ var element_line_Line = /*#__PURE__*/function () {
41853
41871
 
41854
41872
  var getYPos = function getYPos(val) {
41855
41873
  return helpers_canvas.calculateY(val, minmaxY.graphMin, minmaxY.graphMax, yArea, ysp);
41856
- }; // draw line
41874
+ };
41857
41875
 
41876
+ var includeNegativeValue = this.data.some(function (data) {
41877
+ return data.o < 0;
41878
+ });
41879
+ var endPoint = includeNegativeValue ? getYPos(0) : chartRect.y2 - labelOffset.bottom; // draw line
41858
41880
 
41859
41881
  var prevValid;
41860
41882
  this.data.forEach(function (curr) {
@@ -41914,9 +41936,10 @@ var element_line_Line = /*#__PURE__*/function () {
41914
41936
  }
41915
41937
  });
41916
41938
  var gradient = ctx.createLinearGradient(0, chartRect.y2, 0, maxValueYPos);
41917
- gradient.addColorStop(0, fillColor);
41939
+ var mainGradientColor = extent.opacity < 1 ? fillColor : mainColor;
41940
+ gradient.addColorStop(0, includeNegativeValue ? mainGradientColor : fillColor);
41918
41941
  gradient.addColorStop(0.5, fillColor);
41919
- gradient.addColorStop(1, extent.opacity < 1 ? fillColor : mainColor);
41942
+ gradient.addColorStop(1, mainGradientColor);
41920
41943
  ctx.fillStyle = gradient;
41921
41944
  } else {
41922
41945
  ctx.fillStyle = fillColor;
@@ -41984,7 +42007,7 @@ var element_line_Line = /*#__PURE__*/function () {
41984
42007
 
41985
42008
  var nextData = _this2.data[jx];
41986
42009
  var xp = getXPos(nextData.x);
41987
- var bp = (_getYPos2 = getYPos(nextData.b)) !== null && _getYPos2 !== void 0 ? _getYPos2 : endPoint;
42010
+ var bp = (_getYPos2 = getYPos(nextData.b)) !== null && _getYPos2 !== void 0 ? _getYPos2 : getYPos(0);
41988
42011
  ctx.lineTo(xp, bp);
41989
42012
  }
41990
42013
 
@@ -42745,8 +42768,12 @@ var element_bar_Bar = /*#__PURE__*/function () {
42745
42768
 
42746
42769
  var xArea = chartRect.chartWidth - (labelOffset.left + labelOffset.right);
42747
42770
  var yArea = chartRect.chartHeight - (labelOffset.top + labelOffset.bottom);
42748
- var xsp = chartRect.x1 + labelOffset.left;
42749
- var ysp = chartRect.y2 - labelOffset.bottom;
42771
+ var xAxisPosition = chartRect.x1 + labelOffset.left;
42772
+ var yAxisPosition = chartRect.y2 - labelOffset.bottom;
42773
+ var xZeroPosition = helpers_canvas.calculateX(0, minmaxX.graphMin, minmaxX.graphMax, xArea);
42774
+ var yZeroPosition = helpers_canvas.calculateY(0, minmaxY.graphMin, minmaxY.graphMax, yArea);
42775
+ var xsp = isHorizontal ? xAxisPosition + xZeroPosition : xAxisPosition;
42776
+ var ysp = isHorizontal ? yAxisPosition : yAxisPosition + yZeroPosition;
42750
42777
  var dArea = isHorizontal ? yArea : xArea;
42751
42778
  var cArea = dArea / (totalCount || 1);
42752
42779
  var cPad;
@@ -42810,7 +42837,8 @@ var element_bar_Bar = /*#__PURE__*/function () {
42810
42837
  categoryPoint = ysp - cArea * screenIndex - cPad;
42811
42838
  } else {
42812
42839
  categoryPoint = xsp + cArea * screenIndex + cPad;
42813
- }
42840
+ } // 기본 위치 설정
42841
+
42814
42842
 
42815
42843
  if (isHorizontal) {
42816
42844
  x = xsp;
@@ -42818,22 +42846,30 @@ var element_bar_Bar = /*#__PURE__*/function () {
42818
42846
  } else {
42819
42847
  x = Math.round(categoryPoint + (bArea * barSeriesX - (w + bPad)));
42820
42848
  y = ysp;
42821
- }
42849
+ } // 너비 / 높이 계산, 스택의 경우 위치 값 재계산
42850
+
42822
42851
 
42823
42852
  if (isHorizontal) {
42853
+ var barValue = item.b ? item.o : item.x;
42854
+ w = helpers_canvas.calculateX(barValue, minmaxX.graphMin, minmaxX.graphMax, xArea, -xZeroPosition);
42855
+
42824
42856
  if (item.b) {
42825
- w = helpers_canvas.calculateX(item.x - item.b, minmaxX.graphMin, minmaxX.graphMax, xArea);
42826
- x = helpers_canvas.calculateX(item.b, minmaxX.graphMin, minmaxX.graphMax, xArea, xsp);
42827
- } else {
42828
- w = helpers_canvas.calculateX(item.x, minmaxX.graphMin, minmaxX.graphMax, xArea);
42857
+ x = helpers_canvas.calculateX(item.b, minmaxX.graphMin, minmaxX.graphMax, xArea, xsp - xZeroPosition);
42829
42858
  }
42830
- } else if (item.b) {
42831
- // vertical stack bar chart
42832
- h = helpers_canvas.calculateY(item.y - item.b, minmaxY.graphMin, minmaxY.graphMax, yArea);
42833
- y = helpers_canvas.calculateY(item.b, minmaxY.graphMin, minmaxY.graphMax, yArea, ysp);
42859
+
42860
+ var minimumBarWidth = barValue > 0 ? -1 : 1;
42861
+ w = barValue && Math.abs(w) === 0 ? minimumBarWidth : w;
42834
42862
  } else {
42835
- // vertical bar chart
42836
- h = helpers_canvas.calculateY(item.y, minmaxY.graphMin, minmaxY.graphMax, yArea);
42863
+ var _barValue = item.b ? item.o : item.y;
42864
+
42865
+ h = helpers_canvas.calculateY(_barValue, minmaxY.graphMin, minmaxY.graphMax, yArea, -yZeroPosition);
42866
+
42867
+ if (item.b) {
42868
+ y = helpers_canvas.calculateY(item.b, minmaxY.graphMin, minmaxY.graphMax, yArea, ysp - yZeroPosition);
42869
+ }
42870
+
42871
+ var minimumBarHeight = _barValue > 0 ? -1 : 1;
42872
+ h = _barValue && Math.abs(h) === 0 ? minimumBarHeight : h;
42837
42873
  }
42838
42874
 
42839
42875
  var barColor = item.dataColor || this.color;
@@ -43122,10 +43158,10 @@ var element_bar_Bar = /*#__PURE__*/function () {
43122
43158
  align = _this$showValue.align,
43123
43159
  formatter = _this$showValue.formatter,
43124
43160
  decimalPoint = _this$showValue.decimalPoint;
43125
- var x = positions.x,
43126
- y = positions.y,
43127
- w = positions.w,
43128
- h = positions.h;
43161
+ var barX = positions.x,
43162
+ barY = positions.y,
43163
+ barWidth = positions.w,
43164
+ barHeight = positions.h;
43129
43165
  var ctx = context;
43130
43166
  ctx.save();
43131
43167
  ctx.beginPath();
@@ -43160,25 +43196,27 @@ var element_bar_Bar = /*#__PURE__*/function () {
43160
43196
  formattedTxt = (_Util$labelSignFormat = helpers_util.labelSignFormat(value, decimalPoint)) !== null && _Util$labelSignFormat !== void 0 ? _Util$labelSignFormat : '';
43161
43197
  }
43162
43198
 
43199
+ var isNegativeValue = value < 0;
43163
43200
  var textWidth = Math.round(ctx.measureText(formattedTxt).width);
43164
- var textHeight = fontSize + 4;
43165
- var minXPos = x + 10;
43166
- var minYPos = y - 10;
43167
- var widthFreeSpaceToDraw = w - 10;
43168
- var heightFreeSpaceToDraw = Math.abs(h + 10);
43169
- var centerX = x + w / 2 <= minXPos ? minXPos : x + w / 2;
43170
- var centerY = y + h / 2 >= minYPos ? minYPos : y + h / 2;
43171
- var centerYHorizontal = isHighlight ? y + h / 2 : y - h / 2;
43201
+ var textHeight = fontSize; // fontSize와 textHeight는 같을 수 없지만, 정확히 구할 필요 없음
43202
+
43203
+ var GAP = 10;
43204
+ var minXPos = isNegativeValue ? barX - GAP : barX + GAP;
43205
+ var minYPos = isNegativeValue ? barY + GAP : barY - GAP;
43206
+ var centerXOnBar = barX + barWidth / 2;
43207
+ var centerYOnBar = isHighlight ? barY + barHeight / 2 : barY - barHeight / 2;
43208
+ var drawableBarWidth = Math.abs(barWidth) - GAP;
43209
+ var drawableBarHeight = Math.abs(barHeight) - GAP;
43172
43210
 
43173
43211
  switch (align) {
43174
43212
  case 'start':
43175
43213
  {
43176
- if (isHorizontal) {
43177
- if (textWidth < widthFreeSpaceToDraw) {
43178
- ctx.fillText(formattedTxt, minXPos, centerYHorizontal);
43179
- }
43180
- } else if (textHeight < heightFreeSpaceToDraw) {
43181
- ctx.fillText(formattedTxt, centerX, minYPos);
43214
+ if (isHorizontal && textWidth < drawableBarWidth) {
43215
+ var xPos = isNegativeValue ? minXPos - textWidth : minXPos;
43216
+ ctx.fillText(formattedTxt, xPos, centerYOnBar);
43217
+ } else if (!isHorizontal && textHeight < drawableBarHeight) {
43218
+ var yPos = isNegativeValue ? barY + GAP : barY - GAP;
43219
+ ctx.fillText(formattedTxt, centerXOnBar, yPos);
43182
43220
  }
43183
43221
 
43184
43222
  break;
@@ -43186,12 +43224,10 @@ var element_bar_Bar = /*#__PURE__*/function () {
43186
43224
 
43187
43225
  case 'center':
43188
43226
  {
43189
- if (isHorizontal) {
43190
- if (textWidth < widthFreeSpaceToDraw) {
43191
- ctx.fillText(formattedTxt, centerX, centerYHorizontal);
43192
- }
43193
- } else if (textHeight < heightFreeSpaceToDraw) {
43194
- ctx.fillText(formattedTxt, centerX, centerY);
43227
+ if (isHorizontal && textWidth < drawableBarWidth) {
43228
+ ctx.fillText(formattedTxt, centerXOnBar, centerYOnBar);
43229
+ } else if (!isHorizontal && textHeight < drawableBarHeight) {
43230
+ ctx.fillText(formattedTxt, centerXOnBar, barY + barHeight / 2);
43195
43231
  }
43196
43232
 
43197
43233
  break;
@@ -43205,9 +43241,26 @@ var element_bar_Bar = /*#__PURE__*/function () {
43205
43241
  }
43206
43242
 
43207
43243
  if (isHorizontal) {
43208
- ctx.fillText(formattedTxt, minXPos + w, centerYHorizontal);
43244
+ var minXOnChart = this.chartRect.x1 + this.labelOffset.left;
43245
+ var maxXOnChart = this.chartRect.x2 - this.labelOffset.right;
43246
+
43247
+ if (isNegativeValue) {
43248
+ var _xPos = barX - GAP + barWidth - textWidth;
43249
+
43250
+ if (_xPos > minXOnChart) {
43251
+ ctx.fillText(formattedTxt, _xPos, centerYOnBar);
43252
+ }
43253
+ } else {
43254
+ var _xPos2 = barX + GAP + barWidth;
43255
+
43256
+ if (_xPos2 + textWidth < maxXOnChart) {
43257
+ ctx.fillText(formattedTxt, _xPos2, centerYOnBar);
43258
+ }
43259
+ }
43209
43260
  } else {
43210
- ctx.fillText(formattedTxt, centerX, y + h - textHeight / 2);
43261
+ var _yPos = isNegativeValue ? barY + barHeight + GAP : barY + barHeight - GAP;
43262
+
43263
+ ctx.fillText(formattedTxt, centerXOnBar, _yPos);
43211
43264
  }
43212
43265
 
43213
43266
  break;
@@ -43216,14 +43269,22 @@ var element_bar_Bar = /*#__PURE__*/function () {
43216
43269
  default:
43217
43270
  case 'end':
43218
43271
  {
43219
- if (isHorizontal) {
43220
- if (textWidth < widthFreeSpaceToDraw) {
43221
- var xPos = x + w - textWidth * 2;
43222
- ctx.fillText(formattedTxt, xPos <= minXPos ? minXPos : xPos, centerYHorizontal);
43272
+ if (isHorizontal && textWidth < drawableBarWidth) {
43273
+ var _xPos3 = isNegativeValue ? barX + barWidth + GAP : barX + barWidth - textWidth - GAP;
43274
+
43275
+ ctx.fillText(formattedTxt, _xPos3, centerYOnBar);
43276
+ } else if (!isHorizontal) {
43277
+ if (isNegativeValue) {
43278
+ var _yPos2 = barY + barHeight - GAP;
43279
+
43280
+ if (_yPos2 > minYPos) {
43281
+ ctx.fillText(formattedTxt, centerXOnBar, _yPos2);
43282
+ }
43283
+ } else if (textHeight < drawableBarHeight) {
43284
+ var _yPos3 = barY + barHeight + GAP;
43285
+
43286
+ ctx.fillText(formattedTxt, centerXOnBar, _yPos3);
43223
43287
  }
43224
- } else if (textHeight < heightFreeSpaceToDraw) {
43225
- var yPos = y + h + textHeight;
43226
- ctx.fillText(formattedTxt, centerX, yPos >= minYPos ? minYPos : yPos);
43227
43288
  }
43228
43289
 
43229
43290
  break;
@@ -43280,28 +43341,50 @@ var element_bar_Bar = /*#__PURE__*/function () {
43280
43341
  ctx.beginPath();
43281
43342
  ctx.moveTo(x, y);
43282
43343
 
43344
+ if (Math.abs(w) < r * 2) {
43345
+ r = Math.abs(w) / 2;
43346
+ }
43347
+
43348
+ if (Math.abs(h) < r * 2) {
43349
+ r = Math.abs(h) / 2;
43350
+ }
43351
+
43283
43352
  if (isHorizontal) {
43284
- if (h < r * 2) {
43285
- r = h / 2;
43353
+ var isNegativeValue = w < 0;
43354
+
43355
+ if (isNegativeValue) {
43356
+ w += r;
43357
+ ctx.lineTo(x + w, y);
43358
+ ctx.arcTo(x + w - r, y, x + w - r, y - r, r);
43359
+ ctx.arcTo(x + w - r, y - h, x + w, y - h, r);
43360
+ ctx.lineTo(x, y - h);
43361
+ ctx.lineTo(x, y);
43362
+ } else {
43363
+ w -= r;
43364
+ ctx.lineTo(x + w, y);
43365
+ ctx.arcTo(x + w + r, y, x + w + r, y - r, r);
43366
+ ctx.arcTo(x + w + r, y - h, x + w, y - h, r);
43367
+ ctx.lineTo(x, y - h);
43368
+ ctx.lineTo(x, y);
43286
43369
  }
43287
-
43288
- w -= r;
43289
- ctx.lineTo(x + w, y);
43290
- ctx.arcTo(x + w + r, y, x + w + r, y - r, r);
43291
- ctx.arcTo(x + w + r, y - h, x + w, y - h, r);
43292
- ctx.lineTo(x, y - h);
43293
- ctx.lineTo(x, y);
43294
43370
  } else {
43295
- if (w < r * 2) {
43296
- r = w / 2;
43371
+ var _isNegativeValue = h > 0;
43372
+
43373
+ if (_isNegativeValue) {
43374
+ h -= r;
43375
+ ctx.lineTo(x + w, y);
43376
+ ctx.lineTo(x + w, y + h);
43377
+ ctx.arcTo(x + w, y + h + r, x - w + r, y + h + r, r);
43378
+ ctx.arcTo(x, y + h + r, x, y + h, r);
43379
+ ctx.lineTo(x, y);
43380
+ } else {
43381
+ h += r;
43382
+ ctx.lineTo(x + w, y);
43383
+ ctx.lineTo(x + w, y + h);
43384
+ ctx.arcTo(x + w, y + h - r, x + w - r, y + h - r, r);
43385
+ ctx.arcTo(x, y + h - r, x, y + h, r);
43386
+ ctx.lineTo(x, y);
43297
43387
  }
43298
-
43299
- h += r;
43300
- ctx.lineTo(x + w, y);
43301
- ctx.lineTo(x + w, y + h);
43302
- ctx.arcTo(x + w, y + h - r, x + w - r, y + h - r, r);
43303
- ctx.arcTo(x, y + h - r, x, y + h, r);
43304
- ctx.lineTo(x, y);
43305
43388
  }
43306
43389
 
43307
43390
  ctx.fill();
@@ -45056,6 +45139,7 @@ var scale_Scale = /*#__PURE__*/function () {
45056
45139
  }
45057
45140
  /**
45058
45141
  * With range information, calculate how many labels in axis
45142
+ * linear type은 scale.linear.js에서 처리
45059
45143
  * @param {object} range min/max information
45060
45144
  *
45061
45145
  * @returns {object} steps, interval, min/max graph value
@@ -45232,116 +45316,130 @@ var scale_Scale = /*#__PURE__*/function () {
45232
45316
  }
45233
45317
 
45234
45318
  if ((_this$labelStyle2 = this.labelStyle) !== null && _this$labelStyle2 !== void 0 && _this$labelStyle2.show) {
45235
- var distance = endPoint - startPoint;
45236
- var labelGap = distance / steps;
45237
- var ticks = [];
45238
- var size = stepInfo.interval;
45239
- var labelCenter = null;
45240
- var linePosition = null;
45241
- var offsetStartPoint = startPoint;
45242
- var axisMinForLabel = axisMin;
45243
-
45244
- if (this.type === 'x' && options !== null && options !== void 0 && options.axesX[0].flow && dataLabels.length !== steps + 1) {
45245
- var axisMinByMinutes = Math.floor(axisMin / size) * size;
45246
-
45247
- if (axisMinByMinutes !== +axisMin) {
45248
- axisMinForLabel = axisMinByMinutes + size;
45249
- offsetStartPoint += distance / (axisMax - axisMin) * (axisMinForLabel - axisMin);
45319
+ (function () {
45320
+ var distance = endPoint - startPoint;
45321
+ var labelGap = distance / steps;
45322
+ var ticks = [];
45323
+ var size = stepInfo.interval;
45324
+ var labelCenter = null;
45325
+ var linePosition = null;
45326
+ var offsetStartPoint = startPoint;
45327
+ var axisMinForLabel = axisMin;
45328
+
45329
+ if (_this3.type === 'x' && options !== null && options !== void 0 && options.axesX[0].flow && dataLabels.length !== steps + 1) {
45330
+ var axisMinByMinutes = Math.floor(axisMin / size) * size;
45331
+
45332
+ if (axisMinByMinutes !== +axisMin) {
45333
+ axisMinForLabel = axisMinByMinutes + size;
45334
+ offsetStartPoint += distance / (axisMax - axisMin) * (axisMinForLabel - axisMin);
45335
+ }
45250
45336
  }
45251
- }
45252
45337
 
45253
- ctx.strokeStyle = this.gridLineColor;
45254
- ctx.lineWidth = 1;
45255
- aliasPixel = helpers_util.aliasPixel(ctx.lineWidth);
45256
- var labelText;
45338
+ ctx.strokeStyle = _this3.gridLineColor;
45339
+ ctx.lineWidth = 1;
45340
+ aliasPixel = helpers_util.aliasPixel(ctx.lineWidth);
45341
+ var labelText;
45257
45342
 
45258
- for (var ix = 0; ix <= steps; ix++) {
45259
- labelCenter = Math.round(offsetStartPoint + labelGap * ix);
45343
+ var _loop = function _loop(ix) {
45344
+ labelCenter = Math.round(offsetStartPoint + labelGap * ix);
45260
45345
 
45261
- if (labelCenter <= endPoint || this.type !== 'x' || !(options !== null && options !== void 0 && options.axesX[0].flow) || dataLabels.length === steps + 1) {
45262
- var _ticks, _this$options, _this$options$selectL, _this$options2, _this$options2$select, _selectLabelInfo$data;
45346
+ if (labelCenter <= endPoint || _this3.type !== 'x' || !(options !== null && options !== void 0 && options.axesX[0].flow) || dataLabels.length === steps + 1) {
45347
+ var _ticks, _this3$options, _this3$options$select, _this3$options2, _this3$options2$selec, _selectLabelInfo$data;
45263
45348
 
45264
- ctx.beginPath();
45265
- ticks[ix] = axisMinForLabel + ix * stepValue;
45266
- linePosition = labelCenter + aliasPixel;
45267
- labelText = this.getLabelFormat(Math.min(axisMax, ticks[ix]), {
45268
- prev: (_ticks = ticks[ix - 1]) !== null && _ticks !== void 0 ? _ticks : ''
45269
- });
45270
- var isBlurredLabel = ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : (_this$options$selectL = _this$options.selectLabel) === null || _this$options$selectL === void 0 ? void 0 : _this$options$selectL.use) && ((_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : (_this$options2$select = _this$options2.selectLabel) === null || _this$options2$select === void 0 ? void 0 : _this$options2$select.useLabelOpacity) && this.options.horizontal === (this.type === 'y') && (selectLabelInfo === null || selectLabelInfo === void 0 ? void 0 : (_selectLabelInfo$data = selectLabelInfo.dataIndex) === null || _selectLabelInfo$data === void 0 ? void 0 : _selectLabelInfo$data.length) && !(selectLabelInfo !== null && selectLabelInfo !== void 0 && selectLabelInfo.label.map(function (t, index) {
45271
- var _selectLabelInfo$labe;
45349
+ ctx.beginPath();
45350
+ ticks[ix] = axisMinForLabel + ix * stepValue;
45351
+ var isZeroLine = ticks[ix] === 0;
45272
45352
 
45273
- return _this3.getLabelFormat(Math.min(axisMax, t), {
45274
- prev: (_selectLabelInfo$labe = selectLabelInfo === null || selectLabelInfo === void 0 ? void 0 : selectLabelInfo.label[index - 1]) !== null && _selectLabelInfo$labe !== void 0 ? _selectLabelInfo$labe : ''
45353
+ if (isZeroLine && _this3.zeroLineColor) {
45354
+ ctx.strokeStyle = _this3.zeroLineColor;
45355
+ } else {
45356
+ ctx.strokeStyle = _this3.gridLineColor;
45357
+ }
45358
+
45359
+ linePosition = labelCenter + aliasPixel;
45360
+ labelText = _this3.getLabelFormat(Math.min(axisMax, ticks[ix]), {
45361
+ prev: (_ticks = ticks[ix - 1]) !== null && _ticks !== void 0 ? _ticks : ''
45275
45362
  });
45276
- }).includes(labelText));
45277
- var labelColor = this.labelStyle.color;
45278
- var defaultOpacity = 1;
45363
+ var isBlurredLabel = ((_this3$options = _this3.options) === null || _this3$options === void 0 ? void 0 : (_this3$options$select = _this3$options.selectLabel) === null || _this3$options$select === void 0 ? void 0 : _this3$options$select.use) && ((_this3$options2 = _this3.options) === null || _this3$options2 === void 0 ? void 0 : (_this3$options2$selec = _this3$options2.selectLabel) === null || _this3$options2$selec === void 0 ? void 0 : _this3$options2$selec.useLabelOpacity) && _this3.options.horizontal === (_this3.type === 'y') && (selectLabelInfo === null || selectLabelInfo === void 0 ? void 0 : (_selectLabelInfo$data = selectLabelInfo.dataIndex) === null || _selectLabelInfo$data === void 0 ? void 0 : _selectLabelInfo$data.length) && !(selectLabelInfo !== null && selectLabelInfo !== void 0 && selectLabelInfo.label.map(function (t) {
45364
+ var _ticks2;
45279
45365
 
45280
- if (helpers_util.getColorStringType(labelColor) === 'RGBA') {
45281
- defaultOpacity = helpers_util.getOpacity(labelColor);
45282
- }
45366
+ return _this3.getLabelFormat(Math.min(axisMax, t), {
45367
+ prev: (_ticks2 = ticks[ix - 1]) !== null && _ticks2 !== void 0 ? _ticks2 : ''
45368
+ });
45369
+ }).includes(labelText));
45370
+ var labelColor = _this3.labelStyle.color;
45371
+ var defaultOpacity = 1;
45283
45372
 
45284
- ctx.fillStyle = helpers_util.colorStringToRgba(labelColor, isBlurredLabel ? 0.1 : defaultOpacity);
45285
- var labelPoint = void 0;
45373
+ if (helpers_util.getColorStringType(labelColor) === 'RGBA') {
45374
+ defaultOpacity = helpers_util.getOpacity(labelColor);
45375
+ }
45286
45376
 
45287
- if (this.type === 'x') {
45288
- var _options$brush, _options$selectItem, _this$options3;
45377
+ ctx.fillStyle = helpers_util.colorStringToRgba(labelColor, isBlurredLabel ? 0.1 : defaultOpacity);
45378
+ var labelPoint;
45289
45379
 
45290
- labelPoint = this.position === 'top' ? offsetPoint - 10 : offsetPoint + 10;
45380
+ if (_this3.type === 'x') {
45381
+ var _options$brush, _options$selectItem, _this3$options3;
45291
45382
 
45292
- if (options !== null && options !== void 0 && (_options$brush = options.brush) !== null && _options$brush !== void 0 && _options$brush.showLabel || !(options !== null && options !== void 0 && options.brush)) {
45293
- ctx.fillText(labelText, labelCenter, labelPoint);
45294
- }
45383
+ labelPoint = _this3.position === 'top' ? offsetPoint - 10 : offsetPoint + 10;
45295
45384
 
45296
- if (!isBlurredLabel && options !== null && options !== void 0 && (_options$selectItem = options.selectItem) !== null && _options$selectItem !== void 0 && _options$selectItem.showLabelTip && hitInfo !== null && hitInfo !== void 0 && hitInfo.label && !((_this$options3 = this.options) !== null && _this$options3 !== void 0 && _this$options3.horizontal)) {
45297
- var selectedLabel = this.getLabelFormat(Math.min(axisMax, hitInfo.label + 0 * stepValue));
45298
-
45299
- if (selectedLabel === labelText) {
45300
- var _this$labelStyle3, _options$selectItem2, _options$selectItem2$, _options$selectItem3, _options$selectItem3$;
45301
-
45302
- var height = Math.round(ctx.measureText((_this$labelStyle3 = this.labelStyle) === null || _this$labelStyle3 === void 0 ? void 0 : _this$labelStyle3.fontSize).width);
45303
- helpers_util.showLabelTip({
45304
- ctx: this.ctx,
45305
- width: Math.round(ctx.measureText(selectedLabel).width) + 10,
45306
- height: height,
45307
- x: labelCenter,
45308
- y: labelPoint + (height - 2),
45309
- borderRadius: 2,
45310
- arrowSize: 3,
45311
- text: labelText,
45312
- backgroundColor: options === null || options === void 0 ? void 0 : (_options$selectItem2 = options.selectItem) === null || _options$selectItem2 === void 0 ? void 0 : (_options$selectItem2$ = _options$selectItem2.labelTipStyle) === null || _options$selectItem2$ === void 0 ? void 0 : _options$selectItem2$.backgroundColor,
45313
- textColor: options === null || options === void 0 ? void 0 : (_options$selectItem3 = options.selectItem) === null || _options$selectItem3 === void 0 ? void 0 : (_options$selectItem3$ = _options$selectItem3.labelTipStyle) === null || _options$selectItem3$ === void 0 ? void 0 : _options$selectItem3$.textColor
45314
- });
45385
+ if (options !== null && options !== void 0 && (_options$brush = options.brush) !== null && _options$brush !== void 0 && _options$brush.showLabel || !(options !== null && options !== void 0 && options.brush)) {
45386
+ ctx.fillText(labelText, labelCenter, labelPoint);
45315
45387
  }
45316
- }
45317
45388
 
45318
- if ((ix !== 0 || options !== null && options !== void 0 && options.axesX[0].flow) && this.showGrid) {
45319
- ctx.moveTo(linePosition, offsetPoint);
45320
- ctx.lineTo(linePosition, offsetCounterPoint);
45321
- }
45322
- } else {
45323
- var _options$brush2;
45389
+ if (!isBlurredLabel && options !== null && options !== void 0 && (_options$selectItem = options.selectItem) !== null && _options$selectItem !== void 0 && _options$selectItem.showLabelTip && hitInfo !== null && hitInfo !== void 0 && hitInfo.label && !((_this3$options3 = _this3.options) !== null && _this3$options3 !== void 0 && _this3$options3.horizontal)) {
45390
+ var selectedLabel = _this3.getLabelFormat(Math.min(axisMax, hitInfo.label + 0 * stepValue));
45391
+
45392
+ if (selectedLabel === labelText) {
45393
+ var _this3$labelStyle, _options$selectItem2, _options$selectItem2$, _options$selectItem3, _options$selectItem3$;
45394
+
45395
+ var height = Math.round(ctx.measureText((_this3$labelStyle = _this3.labelStyle) === null || _this3$labelStyle === void 0 ? void 0 : _this3$labelStyle.fontSize).width);
45396
+ helpers_util.showLabelTip({
45397
+ ctx: _this3.ctx,
45398
+ width: Math.round(ctx.measureText(selectedLabel).width) + 10,
45399
+ height: height,
45400
+ x: labelCenter,
45401
+ y: labelPoint + (height - 2),
45402
+ borderRadius: 2,
45403
+ arrowSize: 3,
45404
+ text: labelText,
45405
+ backgroundColor: options === null || options === void 0 ? void 0 : (_options$selectItem2 = options.selectItem) === null || _options$selectItem2 === void 0 ? void 0 : (_options$selectItem2$ = _options$selectItem2.labelTipStyle) === null || _options$selectItem2$ === void 0 ? void 0 : _options$selectItem2$.backgroundColor,
45406
+ textColor: options === null || options === void 0 ? void 0 : (_options$selectItem3 = options.selectItem) === null || _options$selectItem3 === void 0 ? void 0 : (_options$selectItem3$ = _options$selectItem3.labelTipStyle) === null || _options$selectItem3$ === void 0 ? void 0 : _options$selectItem3$.textColor
45407
+ });
45408
+ }
45409
+ }
45410
+
45411
+ if ((ix !== 0 || options !== null && options !== void 0 && options.axesX[0].flow) && _this3.showGrid) {
45412
+ ctx.moveTo(linePosition, offsetPoint);
45413
+ ctx.lineTo(linePosition, offsetCounterPoint);
45414
+ }
45415
+ } else {
45416
+ var _options$brush2;
45324
45417
 
45325
- labelPoint = this.position === 'left' ? offsetPoint - 10 : offsetPoint + 10;
45418
+ labelPoint = _this3.position === 'left' ? offsetPoint - 10 : offsetPoint + 10;
45326
45419
 
45327
- if (options !== null && options !== void 0 && (_options$brush2 = options.brush) !== null && _options$brush2 !== void 0 && _options$brush2.showLabel || !(options !== null && options !== void 0 && options.brush)) {
45328
- ctx.fillText(labelText, labelPoint, labelCenter);
45329
- }
45420
+ if (options !== null && options !== void 0 && (_options$brush2 = options.brush) !== null && _options$brush2 !== void 0 && _options$brush2.showLabel || !(options !== null && options !== void 0 && options.brush)) {
45421
+ ctx.fillText(labelText, labelPoint, labelCenter);
45422
+ }
45330
45423
 
45331
- if (ix === steps) {
45332
- linePosition -= 1;
45333
- }
45424
+ if (ix === steps) {
45425
+ linePosition -= 1;
45426
+ }
45334
45427
 
45335
- if (ix !== 0 && this.showGrid) {
45336
- ctx.moveTo(offsetPoint, linePosition);
45337
- ctx.lineTo(offsetCounterPoint, linePosition);
45428
+ if (ix !== 0 && _this3.showGrid) {
45429
+ ctx.moveTo(offsetPoint, linePosition);
45430
+ ctx.lineTo(offsetCounterPoint, linePosition);
45431
+ }
45338
45432
  }
45433
+
45434
+ ctx.stroke();
45435
+ ctx.closePath();
45339
45436
  }
45437
+ };
45340
45438
 
45341
- ctx.stroke();
45342
- ctx.closePath();
45439
+ for (var ix = 0; ix <= steps; ix++) {
45440
+ _loop(ix);
45343
45441
  }
45344
- }
45442
+ })();
45345
45443
  } // Draw plot lines and plot bands
45346
45444
 
45347
45445
 
@@ -45363,9 +45461,11 @@ var scale_Scale = /*#__PURE__*/function () {
45363
45461
  }
45364
45462
 
45365
45463
  var mergedPlotBandOpt = lodash_es_defaultsDeep({}, plotBand, PLOT_BAND_OPTION);
45366
- var from = mergedPlotBandOpt.from,
45367
- to = mergedPlotBandOpt.to,
45464
+ var userDefinedFrom = mergedPlotBandOpt.from,
45465
+ userDefinedTo = mergedPlotBandOpt.to,
45368
45466
  labelOpt = mergedPlotBandOpt.label;
45467
+ var from = userDefinedFrom ? Math.max(userDefinedFrom, axisMin) : axisMin;
45468
+ var to = userDefinedTo ? Math.min(userDefinedTo, axisMax) : axisMax;
45369
45469
 
45370
45470
  _this3.setPlotBandStyle(mergedPlotBandOpt);
45371
45471
 
@@ -45373,8 +45473,8 @@ var scale_Scale = /*#__PURE__*/function () {
45373
45473
  var toPos;
45374
45474
 
45375
45475
  if (_this3.type === 'x') {
45376
- fromPos = helpers_canvas.calculateX(from !== null && from !== void 0 ? from : minX, axisMin, axisMax, xArea, minX);
45377
- toPos = helpers_canvas.calculateX(to !== null && to !== void 0 ? to : maxX, axisMin, axisMax, xArea, minX);
45476
+ fromPos = helpers_canvas.calculateX(from, axisMin, axisMax, xArea, minX);
45477
+ toPos = helpers_canvas.calculateX(to, axisMin, axisMax, xArea, minX);
45378
45478
 
45379
45479
  if (fromPos === null || toPos === null) {
45380
45480
  return;
@@ -45382,8 +45482,8 @@ var scale_Scale = /*#__PURE__*/function () {
45382
45482
 
45383
45483
  _this3.drawXPlotBand(fromPos, toPos, minX, maxX, minY, maxY);
45384
45484
  } else {
45385
- fromPos = helpers_canvas.calculateY(from !== null && from !== void 0 ? from : axisMin, axisMin, axisMax, yArea, maxY);
45386
- toPos = helpers_canvas.calculateY(to !== null && to !== void 0 ? to : axisMax, axisMin, axisMax, yArea, maxY);
45485
+ fromPos = helpers_canvas.calculateY(from, axisMin, axisMax, yArea, maxY);
45486
+ toPos = helpers_canvas.calculateY(to, axisMin, axisMax, yArea, maxY);
45387
45487
 
45388
45488
  if (fromPos === null || toPos === null) {
45389
45489
  return;
@@ -45953,6 +46053,7 @@ var scale_time_TimeScale = /*#__PURE__*/function (_Scale) {
45953
46053
 
45954
46054
 
45955
46055
 
46056
+
45956
46057
  var scale_linear_LinearScale = /*#__PURE__*/function (_Scale) {
45957
46058
  _inherits(LinearScale, _Scale);
45958
46059
 
@@ -45991,16 +46092,192 @@ var scale_linear_LinearScale = /*#__PURE__*/function (_Scale) {
45991
46092
  * Calculate interval
45992
46093
  * @param {object} range range information
45993
46094
  *
45994
- * @returns {number} interval
46095
+ * @returns {number} interval (한 칸에 표시할 값의 간격)
45995
46096
  */
45996
46097
 
45997
46098
  }, {
45998
46099
  key: "getInterval",
45999
46100
  value: function getInterval(range) {
46101
+ if (this.interval) return this.interval;
46000
46102
  var max = range.maxValue;
46001
46103
  var min = range.minValue;
46002
- var step = range.maxSteps;
46003
- return this.interval ? this.interval : Math.ceil((max - min) / step);
46104
+ var steps = range.maxSteps; // step이 0이면 interval 계산 불가
46105
+
46106
+ if (!steps || steps <= 0) return 0; // startToZero이고, 최소값이 음수일 경우 0을 반드시 포함
46107
+
46108
+ if (this.startToZero && min < 0) {
46109
+ var totalRange = Math.abs(min) + Math.abs(max); // 비율로 나눔
46110
+
46111
+ var negativeRatio = Math.abs(min) / totalRange;
46112
+ var positiveRatio = Math.abs(max) / totalRange; // 각 방향에 최소 1칸 이상 배정되도록 보장
46113
+
46114
+ var negativeSteps = Math.max(1, Math.round(negativeRatio * steps));
46115
+ var positiveSteps = Math.max(1, steps - negativeSteps); // 다시 합이 steps보다 커질 수도 있으니, 조정
46116
+
46117
+ if (negativeSteps + positiveSteps > steps) {
46118
+ // 가장 큰 쪽에서 하나 줄임
46119
+ if (negativeRatio > positiveRatio) {
46120
+ negativeSteps -= 1;
46121
+ } else {
46122
+ positiveSteps -= 1;
46123
+ }
46124
+ }
46125
+
46126
+ return Math.ceil(Math.max(Math.abs(min) / (negativeSteps || 1), Math.abs(max) / (positiveSteps || 1)));
46127
+ }
46128
+
46129
+ return Math.ceil((max - min) / steps);
46130
+ }
46131
+ /**
46132
+ * With range information, calculate how many labels in axis
46133
+ * @param {object} range min/max information
46134
+ *
46135
+ * @returns {object} steps, interval, min/max graph value
46136
+ */
46137
+
46138
+ }, {
46139
+ key: "calculateSteps",
46140
+ value: function calculateSteps(range) {
46141
+ var maxValue = range.maxValue,
46142
+ minValue = range.minValue;
46143
+ var _range$maxSteps = range.maxSteps,
46144
+ maxSteps = _range$maxSteps === void 0 ? 1 : _range$maxSteps;
46145
+ var interval = this.getInterval(range);
46146
+ var graphMin = 0;
46147
+ var graphMax = 0; // 그래프 최대/최소 값 계산
46148
+
46149
+ if (minValue >= 0) {
46150
+ // 전부 양수
46151
+ graphMin = +minValue;
46152
+ graphMax = Math.ceil(maxValue / interval) * interval;
46153
+ } else if (maxValue >= 0) {
46154
+ // 양수/음수 혼합
46155
+ graphMin = Math.floor(minValue / interval) * interval;
46156
+ graphMax = Math.ceil(maxValue / interval) * interval;
46157
+ } else {
46158
+ // 전부 음수
46159
+ graphMax = +maxValue;
46160
+ graphMin = Math.floor(minValue / interval) * interval;
46161
+ }
46162
+
46163
+ var graphRange = graphMax - graphMin;
46164
+ var numberOfSteps = Math.round(graphRange / interval); // 특수 케이스: 양수 최소값, 최대값이 1일 경우
46165
+
46166
+ if (minValue > 0 && maxValue === 1) {
46167
+ if (!this.decimalPoint) {
46168
+ interval = 1;
46169
+ numberOfSteps = 1;
46170
+ maxSteps = 1;
46171
+ } else if (maxSteps > 2) {
46172
+ interval = 0.2;
46173
+ numberOfSteps = 5;
46174
+ maxSteps = 5;
46175
+ } else {
46176
+ interval = 0.5;
46177
+ numberOfSteps = 2;
46178
+ maxSteps = 2;
46179
+ }
46180
+ } // 최대 스텝 수 조정
46181
+
46182
+
46183
+ while (numberOfSteps > maxSteps) {
46184
+ interval *= 2;
46185
+ numberOfSteps = Math.round(graphRange / interval);
46186
+ interval = Math.ceil(graphRange / numberOfSteps);
46187
+ }
46188
+
46189
+ if (graphRange > numberOfSteps * interval) {
46190
+ interval = Math.ceil(graphRange / numberOfSteps);
46191
+ }
46192
+
46193
+ return {
46194
+ steps: numberOfSteps,
46195
+ interval: interval,
46196
+ graphMin: graphMin,
46197
+ graphMax: graphMax
46198
+ };
46199
+ }
46200
+ /**
46201
+ * Calculate min/max value, label and size information for axis
46202
+ * @param {object} minMax min/max information
46203
+ * @param {object} scrollbarOpt scrollbar option
46204
+ *
46205
+ * @returns {object} min/max value and label
46206
+ */
46207
+
46208
+ }, {
46209
+ key: "calculateScaleRange",
46210
+ value: function calculateScaleRange(minMax, scrollbarOpt) {
46211
+ var _this$labelStyle;
46212
+
46213
+ var maxValue;
46214
+ var minValue;
46215
+ var isDefaultMaxSameAsMin = false;
46216
+ var range = scrollbarOpt !== null && scrollbarOpt !== void 0 && scrollbarOpt.use ? scrollbarOpt === null || scrollbarOpt === void 0 ? void 0 : scrollbarOpt.range : this.range;
46217
+
46218
+ if (Array.isArray(range) && (range === null || range === void 0 ? void 0 : range.length) === 2) {
46219
+ if (this.options.type === 'heatMap') {
46220
+ maxValue = range[1] > +minMax.max ? +minMax.max : range[1];
46221
+ minValue = range[0] < +minMax.min ? +minMax.min : range[0];
46222
+ } else {
46223
+ maxValue = range[1];
46224
+ minValue = range[0];
46225
+ }
46226
+ } else if (typeof range === 'function') {
46227
+ var _range = range(minMax.min, minMax.max);
46228
+
46229
+ var _range2 = _slicedToArray(_range, 2);
46230
+
46231
+ minValue = _range2[0];
46232
+ maxValue = _range2[1];
46233
+ } else {
46234
+ maxValue = minMax.max;
46235
+ minValue = minMax.min;
46236
+ } // autoScaleRatio 적용 케이스
46237
+
46238
+
46239
+ if (this.autoScaleRatio) {
46240
+ var temp = maxValue; // 양수 방향에만 autoScaleRatio 적용
46241
+
46242
+ maxValue = Math.ceil(maxValue * (this.autoScaleRatio + 1));
46243
+
46244
+ if (maxValue > 0 && minValue < 0) {
46245
+ // 양수/음수 혼합 케이스 -- 음수 방향에도 maxValue 증가분만큼 더하기
46246
+ var diff = temp - maxValue;
46247
+ minValue += diff;
46248
+ } else if (maxValue < 0 && minValue < 0) {
46249
+ // 전부 음수 케이스 -- 음수 방향에도 autoScaleRatio 적용
46250
+ minValue = Math.ceil(minValue * (this.autoScaleRatio + 1));
46251
+ }
46252
+ } // 0 기준 축 설정 케이스
46253
+
46254
+
46255
+ if (this.startToZero) {
46256
+ if (minValue > 0) {
46257
+ minValue = 0;
46258
+ }
46259
+
46260
+ if (maxValue < 0) {
46261
+ maxValue = 0;
46262
+ }
46263
+ }
46264
+
46265
+ if (maxValue === minValue) {
46266
+ maxValue += 1;
46267
+ isDefaultMaxSameAsMin = true;
46268
+ }
46269
+
46270
+ var minLabel = this.getLabelFormat(minValue);
46271
+ var maxLabel = this.getLabelFormat(maxValue, {
46272
+ isMaxValueSameAsMin: isDefaultMaxSameAsMin
46273
+ });
46274
+ return {
46275
+ min: minValue,
46276
+ max: maxValue,
46277
+ minLabel: minLabel,
46278
+ maxLabel: maxLabel,
46279
+ size: helpers_util.calcTextSize(maxLabel, helpers_util.getLabelStyle(this.labelStyle), (_this$labelStyle = this.labelStyle) === null || _this$labelStyle === void 0 ? void 0 : _this$labelStyle.padding)
46280
+ };
46004
46281
  }
46005
46282
  }]);
46006
46283
 
@@ -46839,8 +47116,8 @@ var scale_time_category_TimeCategoryScale = /*#__PURE__*/function (_Scale) {
46839
47116
  var ix;
46840
47117
  var maxIndex = oriSteps === count ? oriSteps : oriSteps - 1;
46841
47118
 
46842
- for (ix = 0; ix <= maxIndex; ix += count) {
46843
- var _this$options, _this$options$selectL, _this$options2, _this$options2$select, _selectLabelInfo$data;
47119
+ var _loop = function _loop() {
47120
+ var _this2$options, _this2$options$select, _this2$options2, _this2$options2$selec, _selectLabelInfo$data;
46844
47121
 
46845
47122
  ticks[ix] = dayjs_min_default()(axisMin).valueOf() + ix * stepValue;
46846
47123
  labelCenter = Math.round(startPoint + graphGap * ix);
@@ -46853,17 +47130,15 @@ var scale_time_category_TimeCategoryScale = /*#__PURE__*/function (_Scale) {
46853
47130
  }
46854
47131
  }
46855
47132
 
46856
- labelText = this.getLabelFormat(Math.min(axisMax, ticks[ix]), {
47133
+ labelText = _this2.getLabelFormat(Math.min(axisMax, ticks[ix]), {
46857
47134
  prev: prev
46858
47135
  });
46859
- var isBlurredLabel = ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : (_this$options$selectL = _this$options.selectLabel) === null || _this$options$selectL === void 0 ? void 0 : _this$options$selectL.use) && ((_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : (_this$options2$select = _this$options2.selectLabel) === null || _this$options2$select === void 0 ? void 0 : _this$options2$select.useLabelOpacity) && this.options.horizontal === (this.type === 'y') && (selectLabelInfo === null || selectLabelInfo === void 0 ? void 0 : (_selectLabelInfo$data = selectLabelInfo.dataIndex) === null || _selectLabelInfo$data === void 0 ? void 0 : _selectLabelInfo$data.length) && !(selectLabelInfo !== null && selectLabelInfo !== void 0 && selectLabelInfo.label.map(function (t, index) {
46860
- var _selectLabelInfo$labe;
46861
-
47136
+ var isBlurredLabel = ((_this2$options = _this2.options) === null || _this2$options === void 0 ? void 0 : (_this2$options$select = _this2$options.selectLabel) === null || _this2$options$select === void 0 ? void 0 : _this2$options$select.use) && ((_this2$options2 = _this2.options) === null || _this2$options2 === void 0 ? void 0 : (_this2$options2$selec = _this2$options2.selectLabel) === null || _this2$options2$selec === void 0 ? void 0 : _this2$options2$selec.useLabelOpacity) && _this2.options.horizontal === (_this2.type === 'y') && (selectLabelInfo === null || selectLabelInfo === void 0 ? void 0 : (_selectLabelInfo$data = selectLabelInfo.dataIndex) === null || _selectLabelInfo$data === void 0 ? void 0 : _selectLabelInfo$data.length) && !(selectLabelInfo !== null && selectLabelInfo !== void 0 && selectLabelInfo.label.map(function (t) {
46862
47137
  return _this2.getLabelFormat(Math.min(axisMax, t), {
46863
- prev: (_selectLabelInfo$labe = selectLabelInfo === null || selectLabelInfo === void 0 ? void 0 : selectLabelInfo.label[index - 1]) !== null && _selectLabelInfo$labe !== void 0 ? _selectLabelInfo$labe : ''
47138
+ prev: prev
46864
47139
  });
46865
47140
  }).includes(labelText));
46866
- var labelColor = this.labelStyle.color;
47141
+ var labelColor = _this2.labelStyle.color;
46867
47142
  var defaultOpacity = 1;
46868
47143
 
46869
47144
  if (helpers_util.getColorStringType(labelColor) === 'RGBA') {
@@ -46872,21 +47147,21 @@ var scale_time_category_TimeCategoryScale = /*#__PURE__*/function (_Scale) {
46872
47147
 
46873
47148
  ctx.fillStyle = helpers_util.colorStringToRgba(labelColor, isBlurredLabel ? 0.1 : defaultOpacity);
46874
47149
 
46875
- if (this.type === 'x') {
46876
- var _this$options3, _this$options3$select, _this$options4;
47150
+ if (_this2.type === 'x') {
47151
+ var _this2$options3, _this2$options3$selec, _this2$options4;
46877
47152
 
46878
- labelPoint = this.position === 'top' ? offsetPoint - 10 : offsetPoint + 10;
47153
+ labelPoint = _this2.position === 'top' ? offsetPoint - 10 : offsetPoint + 10;
46879
47154
  ctx.fillText(labelText, labelCenter, labelPoint);
46880
47155
 
46881
- if (!isBlurredLabel && (_this$options3 = this.options) !== null && _this$options3 !== void 0 && (_this$options3$select = _this$options3.selectItem) !== null && _this$options3$select !== void 0 && _this$options3$select.showLabelTip && hitInfo !== null && hitInfo !== void 0 && hitInfo.label && !((_this$options4 = this.options) !== null && _this$options4 !== void 0 && _this$options4.horizontal)) {
46882
- var selectedLabel = this.getLabelFormat(Math.min(axisMax, hitInfo.label + 0 * stepValue));
47156
+ if (!isBlurredLabel && (_this2$options3 = _this2.options) !== null && _this2$options3 !== void 0 && (_this2$options3$selec = _this2$options3.selectItem) !== null && _this2$options3$selec !== void 0 && _this2$options3$selec.showLabelTip && hitInfo !== null && hitInfo !== void 0 && hitInfo.label && !((_this2$options4 = _this2.options) !== null && _this2$options4 !== void 0 && _this2$options4.horizontal)) {
47157
+ var selectedLabel = _this2.getLabelFormat(Math.min(axisMax, hitInfo.label + 0 * stepValue));
46883
47158
 
46884
47159
  if (selectedLabel === labelText) {
46885
- var _this$labelStyle, _this$options5, _this$options5$select, _this$options5$select2, _this$options6, _this$options6$select, _this$options6$select2;
47160
+ var _this2$labelStyle, _this2$options5, _this2$options5$selec, _this2$options5$selec2, _this2$options6, _this2$options6$selec, _this2$options6$selec2;
46886
47161
 
46887
- var height = Math.round(ctx.measureText((_this$labelStyle = this.labelStyle) === null || _this$labelStyle === void 0 ? void 0 : _this$labelStyle.fontSize).width);
47162
+ var height = Math.round(ctx.measureText((_this2$labelStyle = _this2.labelStyle) === null || _this2$labelStyle === void 0 ? void 0 : _this2$labelStyle.fontSize).width);
46888
47163
  helpers_util.showLabelTip({
46889
- ctx: this.ctx,
47164
+ ctx: _this2.ctx,
46890
47165
  width: Math.round(ctx.measureText(selectedLabel).width) + 10,
46891
47166
  height: height,
46892
47167
  x: labelCenter,
@@ -46894,27 +47169,31 @@ var scale_time_category_TimeCategoryScale = /*#__PURE__*/function (_Scale) {
46894
47169
  borderRadius: 2,
46895
47170
  arrowSize: 3,
46896
47171
  text: labelText,
46897
- backgroundColor: (_this$options5 = this.options) === null || _this$options5 === void 0 ? void 0 : (_this$options5$select = _this$options5.selectItem) === null || _this$options5$select === void 0 ? void 0 : (_this$options5$select2 = _this$options5$select.labelTipStyle) === null || _this$options5$select2 === void 0 ? void 0 : _this$options5$select2.backgroundColor,
46898
- textColor: (_this$options6 = this.options) === null || _this$options6 === void 0 ? void 0 : (_this$options6$select = _this$options6.selectItem) === null || _this$options6$select === void 0 ? void 0 : (_this$options6$select2 = _this$options6$select.labelTipStyle) === null || _this$options6$select2 === void 0 ? void 0 : _this$options6$select2.textColor
47172
+ backgroundColor: (_this2$options5 = _this2.options) === null || _this2$options5 === void 0 ? void 0 : (_this2$options5$selec = _this2$options5.selectItem) === null || _this2$options5$selec === void 0 ? void 0 : (_this2$options5$selec2 = _this2$options5$selec.labelTipStyle) === null || _this2$options5$selec2 === void 0 ? void 0 : _this2$options5$selec2.backgroundColor,
47173
+ textColor: (_this2$options6 = _this2.options) === null || _this2$options6 === void 0 ? void 0 : (_this2$options6$selec = _this2$options6.selectItem) === null || _this2$options6$selec === void 0 ? void 0 : (_this2$options6$selec2 = _this2$options6$selec.labelTipStyle) === null || _this2$options6$selec2 === void 0 ? void 0 : _this2$options6$selec2.textColor
46899
47174
  });
46900
47175
  }
46901
47176
  }
46902
47177
 
46903
- if (ix !== 0 && ix < oriSteps && this.showGrid) {
47178
+ if (ix !== 0 && ix < oriSteps && _this2.showGrid) {
46904
47179
  ctx.moveTo(linePosition, offsetPoint);
46905
47180
  ctx.lineTo(linePosition, offsetCounterPoint);
46906
47181
  }
46907
47182
  } else {
46908
- labelPoint = this.position === 'left' ? offsetPoint - 10 : offsetPoint + 10;
47183
+ labelPoint = _this2.position === 'left' ? offsetPoint - 10 : offsetPoint + 10;
46909
47184
  ctx.fillText(labelText, labelPoint, labelCenter);
46910
47185
 
46911
- if (ix !== 0 && ix < oriSteps && this.showGrid) {
47186
+ if (ix !== 0 && ix < oriSteps && _this2.showGrid) {
46912
47187
  ctx.moveTo(offsetPoint, linePosition);
46913
47188
  ctx.lineTo(offsetCounterPoint, linePosition);
46914
47189
  }
46915
47190
  }
46916
47191
 
46917
47192
  ctx.stroke();
47193
+ };
47194
+
47195
+ for (ix = 0; ix <= maxIndex; ix += count) {
47196
+ _loop();
46918
47197
  }
46919
47198
 
46920
47199
  if (this.categoryMode && alignToGridLine && ix * count === oriSteps) {
@@ -47220,7 +47499,7 @@ var plugins_legend_modules = {
47220
47499
  var useLegendSeries = [];
47221
47500
 
47222
47501
  if (groups) {
47223
- useLegendSeries = groups.slice().reverse().filter(function (sId) {
47502
+ useLegendSeries = groups.filter(function (sId) {
47224
47503
  return _this3.seriesList[sId].showLegend;
47225
47504
  }).map(function (sId) {
47226
47505
  return [sId, _this3.seriesList[sId]];
@@ -47271,9 +47550,8 @@ var plugins_legend_modules = {
47271
47550
  },
47272
47551
 
47273
47552
  /**
47274
- * Adds legends for each group in `groups` array, iterating through each series
47275
- * within the group in reverse order. This ensures the legends align with the series
47276
- * order as displayed in the chart. Only adds series with `showLegend` set to `true`.
47553
+ * Adds legends for each group in `groups` array, iterating through each series within the group.
47554
+ * Only adds series with `showLegend` set to `true`.
47277
47555
  *
47278
47556
  * @param {Array} groups - Array of groups containing series identifiers.
47279
47557
  * @param {Object} seriesList - Object containing all series, keyed by series ID.
@@ -47284,7 +47562,7 @@ var plugins_legend_modules = {
47284
47562
  var _this5 = this;
47285
47563
 
47286
47564
  groups.forEach(function (group) {
47287
- group.slice().reverse().forEach(function (sId) {
47565
+ group.forEach(function (sId) {
47288
47566
  var series = seriesList[sId];
47289
47567
 
47290
47568
  if (series && series.showLegend) {
@@ -53302,7 +53580,6 @@ var plugins_pie_modules = {
53302
53580
 
53303
53581
 
53304
53582
 
53305
-
53306
53583
  var element_tip_modules = {
53307
53584
  /**
53308
53585
  * Draw TextTip with tip's locationInfo
@@ -53336,8 +53613,7 @@ var element_tip_modules = {
53336
53613
  }
53337
53614
 
53338
53615
  if (labelTipOpt.use && labelTipOpt.showTip) {
53339
- var isHeatMap = opt.type === 'heatMap';
53340
- isExistSelectedLabel = isHeatMap ? this.drawLabelTipForHeatMap() : this.drawLabelTip();
53616
+ isExistSelectedLabel = opt.type === 'heatMap' ? this.drawLabelTipForHeatMap() : this.drawTipForSelectedLabel();
53341
53617
  }
53342
53618
 
53343
53619
  var executeDrawIndicator = function executeDrawIndicator(tipOpt) {
@@ -53623,9 +53899,10 @@ var element_tip_modules = {
53623
53899
 
53624
53900
  /**
53625
53901
  * Draw Selected Label Tip
53902
+ * none Text
53626
53903
  * @returns {boolean} Whether drew at least one tip
53627
53904
  */
53628
- drawLabelTip: function drawLabelTip() {
53905
+ drawTipForSelectedLabel: function drawTipForSelectedLabel() {
53629
53906
  var _this2 = this;
53630
53907
 
53631
53908
  var opt = this.options;
@@ -53651,7 +53928,7 @@ var element_tip_modules = {
53651
53928
  };
53652
53929
  var labelAxes = isHorizontal ? this.axesY[0] : this.axesX[0];
53653
53930
  var valueAxes = isHorizontal ? this.axesX[0] : this.axesY[0];
53654
- var valueAxesRange = isHorizontal ? this.axesRange.x[0] : this.axesRange.y[0];
53931
+ var valueAxesSteps = isHorizontal ? this.axesSteps.x[0] : this.axesSteps.y[0];
53655
53932
  var valuePositionCalcFunction = isHorizontal ? helpers_canvas.calculateX : helpers_canvas.calculateY;
53656
53933
  var labelPositionCalcFunction = isHorizontal ? helpers_canvas.calculateY : helpers_canvas.calculateX;
53657
53934
  var scrollbarOpt = isHorizontal ? this.scrollbar.y : this.scrollbar.x;
@@ -53669,8 +53946,8 @@ var element_tip_modules = {
53669
53946
  return _this2.seriesList[sId].isExistGrp && !_this2.seriesList[sId].isOverlapping;
53670
53947
  });
53671
53948
  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$ : [];
53672
- var gp;
53673
- var dp;
53949
+ var labelPos;
53950
+ var dataPos;
53674
53951
  var value;
53675
53952
  var labelStartPoint;
53676
53953
  var labelEndPoint;
@@ -53718,31 +53995,39 @@ var element_tip_modules = {
53718
53995
  }
53719
53996
 
53720
53997
  data.forEach(function (selectedData, i) {
53721
- if (labelTipOpt.fixedPosTop) {
53722
- value = valueAxesRange.max;
53723
- } else if (isExistGrp) {
53724
- var sumValue = visibleSeries.reduce(function (ac, sId) {
53725
- var _selectedData$sId$val, _selectedData$sId;
53726
-
53727
- 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;
53728
- }, 0);
53729
- var nonGroupValues = visibleSeries.filter(function (sId) {
53730
- return !groups.includes(sId);
53731
- }).map(function (sId) {
53732
- var _selectedData$sId$val2, _selectedData$sId2;
53733
-
53734
- 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];
53735
- });
53736
- value = Math.max.apply(Math, _toConsumableArray(nonGroupValues).concat([sumValue]));
53737
- } else if (visibleSeries.length) {
53738
- var visibleValue = visibleSeries.map(function (sId) {
53739
- var _selectedData$sId$val3, _selectedData$sId3;
53740
-
53741
- 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];
53742
- });
53743
- value = Math.max.apply(Math, _toConsumableArray(visibleValue));
53744
- } else {
53745
- value = valueAxesRange.max;
53998
+ value = valueAxesSteps.graphMax;
53999
+
54000
+ if (!labelTipOpt.fixedPosTop) {
54001
+ if (isExistGrp) {
54002
+ var _visibleSeries$filter, _visibleSeries$filter2;
54003
+
54004
+ var positiveSum = visibleSeries === null || visibleSeries === void 0 ? void 0 : visibleSeries.reduce(function (ac, sId) {
54005
+ var _selectedData$sId$val, _selectedData$sId, _selectedData$sId$val2, _selectedData$sId2;
54006
+
54007
+ 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;
54008
+ }, 0);
54009
+ var nonGroupValues = (_visibleSeries$filter = visibleSeries === null || visibleSeries === void 0 ? void 0 : (_visibleSeries$filter2 = visibleSeries.filter(function (sId) {
54010
+ return !groups.includes(sId);
54011
+ })) === null || _visibleSeries$filter2 === void 0 ? void 0 : _visibleSeries$filter2.map(function (sId) {
54012
+ var _selectedData$sId$val3, _selectedData$sId3;
54013
+
54014
+ 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];
54015
+ })) !== null && _visibleSeries$filter !== void 0 ? _visibleSeries$filter : [];
54016
+ var maxNonGroupValue = (nonGroupValues === null || nonGroupValues === void 0 ? void 0 : nonGroupValues.length) > 0 ? nonGroupValues.reduce(function (max, val) {
54017
+ return Math.max(max, val !== null && val !== void 0 ? val : -Infinity);
54018
+ }, -Infinity) : -Infinity;
54019
+ value = positiveSum > 0 ? Math.max(maxNonGroupValue, positiveSum) : Math.max(maxNonGroupValue, 0);
54020
+ } else if (visibleSeries.length) {
54021
+ var visibleValue = visibleSeries.map(function (sId) {
54022
+ var _selectedData$sId$val4, _selectedData$sId4;
54023
+
54024
+ 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];
54025
+ });
54026
+ var maxValue = visibleValue.length > 0 ? visibleValue.reduce(function (max, val) {
54027
+ return Math.max(max, val !== null && val !== void 0 ? val : -Infinity);
54028
+ }, -Infinity) : -Infinity;
54029
+ value = maxValue > 0 || _this2.options.type !== 'bar' ? maxValue : 0;
54030
+ }
53746
54031
  }
53747
54032
 
53748
54033
  if (labelAxes.labels) {
@@ -53752,18 +54037,17 @@ var element_tip_modules = {
53752
54037
 
53753
54038
  var labelIndex = dataIndex[i] - startIndex;
53754
54039
  var labelCenter = Math.round(labelStartPoint + labelGap * labelIndex);
53755
- dp = labelCenter + labelGap / 2;
54040
+ labelPos = labelCenter + labelGap / 2;
53756
54041
  } else {
53757
- dp = labelPositionCalcFunction(label[i], graphX.graphMin, graphX.graphMax, chartWidth - sizeObj.comboOffset, aPos.x1 + sizeObj.comboOffset / 2);
54042
+ labelPos = labelPositionCalcFunction(label[i], graphX.graphMin, graphX.graphMax, chartWidth - sizeObj.comboOffset, aPos.x1 + sizeObj.comboOffset / 2);
53758
54043
  }
53759
54044
 
53760
- gp = valuePositionCalcFunction(value, valueAxesRange.min, valueAxesRange.max, valueSpace, valueStartPoint);
53761
- gp += offset;
54045
+ dataPos = valuePositionCalcFunction(value, valueAxesSteps.graphMin, valueAxesSteps.graphMax, valueSpace, valueStartPoint) + offset;
53762
54046
 
53763
54047
  _this2.showTip({
53764
54048
  context: _this2.bufferCtx,
53765
- x: isHorizontal ? gp : dp,
53766
- y: isHorizontal ? dp : gp,
54049
+ x: isHorizontal ? dataPos : labelPos,
54050
+ y: isHorizontal ? labelPos : dataPos,
53767
54051
  opt: labelTipOpt,
53768
54052
  isSamePos: false
53769
54053
  });
@@ -53875,10 +54159,11 @@ var element_tip_modules = {
53875
54159
  }
53876
54160
  } else if (isHorizontal) {
53877
54161
  gp = helpers_canvas.calculateX(value, graphX.graphMin, graphX.graphMax, xArea, xsp);
53878
- gp += offset;
54162
+ gp = value < 0 ? gp - offset : gp + offset;
53879
54163
  } else {
53880
- gp = helpers_canvas.calculateY(value, graphY.graphMin, graphY.graphMax, yArea, ysp);
53881
- gp -= offset;
54164
+ var adjustedValue = type === 'bar' && value < 0 ? 0 : value;
54165
+ gp = helpers_canvas.calculateY(adjustedValue, graphY.graphMin, graphY.graphMax, yArea, ysp);
54166
+ gp = adjustedValue < 0 ? gp + offset : gp - offset;
53882
54167
  }
53883
54168
 
53884
54169
  var maxTipType = 'center';
@@ -53910,7 +54195,8 @@ var element_tip_modules = {
53910
54195
  arrowSize: arrowSize,
53911
54196
  borderRadius: borderRadius,
53912
54197
  text: text,
53913
- textStyle: textStyle
54198
+ textStyle: textStyle,
54199
+ isNegative: value < 0
53914
54200
  });
53915
54201
  }
53916
54202
 
@@ -53944,12 +54230,21 @@ var element_tip_modules = {
53944
54230
  borderRadius = param.borderRadius,
53945
54231
  text = param.text,
53946
54232
  opt = param.opt,
53947
- textStyle = param.textStyle;
54233
+ textStyle = param.textStyle,
54234
+ isNegative = param.isNegative;
53948
54235
  var ctx = param.context;
53949
54236
  var sx = x - width / 2;
53950
54237
  var ex = x + width / 2;
53951
54238
  var sy = y - height;
53952
54239
  var ey = y;
54240
+
54241
+ if (isNegative) {
54242
+ if (isHorizontal) {
54243
+ sx = x - width / 2 - width;
54244
+ ex = x - width / 2;
54245
+ }
54246
+ }
54247
+
53953
54248
  ctx.save();
53954
54249
  ctx.font = textStyle;
53955
54250
  ctx.fillStyle = (_opt$tipBackground = opt.tipBackground) !== null && _opt$tipBackground !== void 0 ? _opt$tipBackground : opt.tipStyle.background;
@@ -53957,44 +54252,73 @@ var element_tip_modules = {
53957
54252
  ctx.beginPath();
53958
54253
  ctx.moveTo(sx + borderRadius, sy);
53959
54254
  ctx.quadraticCurveTo(sx, sy, sx, sy + borderRadius);
53960
-
53961
- if (isHorizontal) {
53962
- ctx.lineTo(sx, sy + borderRadius + arrowSize / 2);
53963
- ctx.lineTo(sx - arrowSize, ey - height / 2);
53964
- ctx.lineTo(sx, ey - borderRadius - arrowSize / 2);
53965
- }
53966
-
53967
54255
  ctx.lineTo(sx, ey - borderRadius);
53968
54256
  ctx.quadraticCurveTo(sx, ey, sx + borderRadius, ey);
53969
-
53970
- if (!isHorizontal) {
53971
- if (type === 'left') {
53972
- ctx.lineTo(sx + borderRadius + arrowSize, ey + arrowSize);
53973
- ctx.lineTo(sx + borderRadius + arrowSize * 2, ey);
53974
- } else if (type === 'right') {
53975
- ctx.lineTo(ex - arrowSize * 2 - borderRadius, ey);
53976
- ctx.lineTo(ex - arrowSize - borderRadius, ey + arrowSize);
53977
- } else {
53978
- ctx.lineTo(x - arrowSize, ey);
53979
- ctx.lineTo(x, ey + arrowSize);
53980
- ctx.lineTo(x + arrowSize, ey);
53981
- }
53982
- }
53983
-
53984
54257
  ctx.lineTo(ex - borderRadius, ey);
53985
54258
  ctx.quadraticCurveTo(ex, ey, ex, ey - borderRadius);
53986
54259
  ctx.lineTo(ex, sy + borderRadius);
53987
54260
  ctx.quadraticCurveTo(ex, sy, ex - borderRadius, sy);
53988
54261
  ctx.lineTo(sx + borderRadius, sy);
53989
54262
  ctx.closePath();
53990
- ctx.fill();
54263
+ ctx.fill(); // draw arrow
54264
+
54265
+ ctx.beginPath();
54266
+
54267
+ if (isHorizontal) {
54268
+ if (isNegative) {
54269
+ ctx.moveTo(ex, ey);
54270
+ ctx.lineTo(ex, sy + borderRadius + arrowSize / 2);
54271
+ ctx.lineTo(ex + arrowSize, ey - height / 2);
54272
+ ctx.lineTo(ex, ey - borderRadius - arrowSize / 2);
54273
+ } else {
54274
+ ctx.moveTo(sx, sy);
54275
+ ctx.lineTo(sx, sy + borderRadius + arrowSize / 2);
54276
+ ctx.lineTo(sx - arrowSize, ey - height / 2);
54277
+ ctx.lineTo(sx, ey - borderRadius - arrowSize / 2);
54278
+ }
54279
+
54280
+ ctx.closePath();
54281
+ ctx.fill();
54282
+ } else {
54283
+ if (isNegative) {
54284
+ if (type === 'left') {
54285
+ ctx.lineTo(sx + borderRadius + arrowSize, ey + arrowSize);
54286
+ ctx.lineTo(sx + borderRadius + arrowSize * 2, ey);
54287
+ } else if (type === 'right') {
54288
+ ctx.lineTo(ex - arrowSize * 2 - borderRadius, ey);
54289
+ ctx.lineTo(ex - arrowSize - borderRadius, ey + arrowSize);
54290
+ } else {
54291
+ ctx.lineTo(x - arrowSize, ey);
54292
+ ctx.lineTo(x, ey + arrowSize);
54293
+ ctx.lineTo(x + arrowSize, ey);
54294
+ }
54295
+ } else if (!isNegative) {
54296
+ if (type === 'left') {
54297
+ ctx.moveTo(sx, sy);
54298
+ ctx.lineTo(sx + borderRadius + arrowSize, ey + arrowSize);
54299
+ ctx.lineTo(sx + borderRadius + arrowSize * 2, ey);
54300
+ } else if (type === 'right') {
54301
+ ctx.moveTo(ex, sy);
54302
+ ctx.lineTo(ex - arrowSize * 2 - borderRadius, ey);
54303
+ ctx.lineTo(ex - arrowSize - borderRadius, ey + arrowSize);
54304
+ } else {
54305
+ ctx.lineTo(x - arrowSize, ey);
54306
+ ctx.lineTo(x, ey + arrowSize);
54307
+ ctx.lineTo(x + arrowSize, ey);
54308
+ }
54309
+ }
54310
+
54311
+ ctx.closePath();
54312
+ ctx.fill();
54313
+ }
54314
+
53991
54315
  ctx.restore();
53992
54316
  ctx.save();
53993
54317
  ctx.font = textStyle;
53994
54318
  ctx.fillStyle = (_opt$tipTextColor = opt.tipTextColor) !== null && _opt$tipTextColor !== void 0 ? _opt$tipTextColor : opt.tipStyle.textColor;
53995
54319
  ctx.textBaseline = 'middle';
53996
54320
  ctx.textAlign = 'center';
53997
- ctx.fillText("".concat(text), x, sy + height / 2);
54321
+ ctx.fillText("".concat(text), sx + width / 2, sy + height / 2);
53998
54322
  ctx.restore();
53999
54323
  },
54000
54324