evui 3.4.123 → 3.4.201

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
@@ -11180,7 +11180,7 @@ module.exports = exports;
11180
11180
  /***/ "9224":
11181
11181
  /***/ (function(module) {
11182
11182
 
11183
- module.exports = JSON.parse("{\"a\":\"3.4.123\"}");
11183
+ module.exports = JSON.parse("{\"a\":\"3.4.201\"}");
11184
11184
 
11185
11185
  /***/ }),
11186
11186
 
@@ -38512,26 +38512,26 @@ var es_string_match = __webpack_require__("466d");
38512
38512
  return value;
38513
38513
  }
38514
38514
 
38515
- var assignLabelWith = function assignLabelWith(v, target, lb) {
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
- };
38515
+ var isNegative = value < 0;
38516
+ var absValue = Math.abs(value);
38522
38517
 
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');
38518
+ 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');
38533
38533
  } else {
38534
- label = value.toFixed(decimalPoint);
38534
+ label = isNegative ? "-".concat(absValue.toFixed(decimalPoint)) : value.toFixed(decimalPoint);
38535
38535
  }
38536
38536
 
38537
38537
  return label;
@@ -38805,21 +38805,23 @@ 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;
38808
38809
 
38809
38810
  if (series && sData) {
38810
38811
  series.data = _this.addSeriesDSforScatter(sData);
38811
- series.minMax = _this.getSeriesMinMax(series.data);
38812
+ series.minMax = _this.getSeriesMinMax(series.data, passingValue);
38812
38813
  }
38813
38814
  });
38814
38815
  } else if (typeKey === 'heatMap') {
38815
38816
  seriesIDs.forEach(function (seriesID) {
38816
38817
  var series = _this.seriesList[seriesID];
38818
+ var passingValue = series === null || series === void 0 ? void 0 : series.passingValue;
38817
38819
  var sData = data[seriesID];
38818
38820
 
38819
38821
  if (series && sData) {
38820
38822
  series.labels = label;
38821
38823
  series.data = _this.addSeriesDSForHeatMap(sData);
38822
- series.minMax = _this.getSeriesMinMax(series.data);
38824
+ series.minMax = _this.getSeriesMinMax(series.data, passingValue);
38823
38825
  series.valueOpt = _this.getSeriesValueOptForHeatMap(series);
38824
38826
  }
38825
38827
  });
@@ -38851,7 +38853,7 @@ var modules = {
38851
38853
  series.data = _this.addSeriesDS(sData, label, series.isExistGrp);
38852
38854
  }
38853
38855
 
38854
- series.minMax = _this.getSeriesMinMax(series.data);
38856
+ series.minMax = _this.getSeriesMinMax(series.data, series.passingValue);
38855
38857
  }
38856
38858
  });
38857
38859
  }
@@ -39247,17 +39249,19 @@ var modules = {
39247
39249
  var isHorizontal = this.options.horizontal;
39248
39250
  var sdata = [];
39249
39251
 
39250
- var getBaseDataPosition = function getBaseDataPosition(baseIndex, dataIndex) {
39252
+ var getBaseDataPosition = function getBaseDataPosition(baseIndex, dataIndex, curr) {
39251
39253
  var nextBaseSeriesIndex = baseIndex - 1;
39252
39254
  var baseSeries = _this4.seriesList[bsIds[baseIndex]];
39253
39255
  var baseDataList = baseSeries.data;
39254
39256
  var baseData = baseDataList[dataIndex];
39255
39257
  var position = isHorizontal ? baseData === null || baseData === void 0 ? void 0 : baseData.x : baseData === null || baseData === void 0 ? void 0 : baseData.y;
39256
- var isPassingValue = baseSeries.passingValue === (baseData === null || baseData === void 0 ? void 0 : baseData.o);
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;
39257
39261
 
39258
- if (isPassingValue || position == null || !baseSeries.show) {
39262
+ if (isPassingValue || position == null || !isSameSign || !baseSeries.show) {
39259
39263
  if (nextBaseSeriesIndex > -1) {
39260
- return getBaseDataPosition(nextBaseSeriesIndex, dataIndex);
39264
+ return getBaseDataPosition(nextBaseSeriesIndex, dataIndex, curr);
39261
39265
  }
39262
39266
 
39263
39267
  return 0;
@@ -39268,7 +39272,7 @@ var modules = {
39268
39272
 
39269
39273
  data.forEach(function (curr, index) {
39270
39274
  var baseIndex = bsIds.length - 1 < 0 ? 0 : bsIds.length - 1;
39271
- var bdata = getBaseDataPosition(baseIndex, index); // base(previous) series data
39275
+ var bdata = getBaseDataPosition(baseIndex, index, curr); // base(previous) series data
39272
39276
 
39273
39277
  var odata = curr; // current series original data
39274
39278
 
@@ -39451,7 +39455,7 @@ var modules = {
39451
39455
  *
39452
39456
  * @returns {object} min/max info for series
39453
39457
  */
39454
- getSeriesMinMax: function getSeriesMinMax(data) {
39458
+ getSeriesMinMax: function getSeriesMinMax(data, passingValue) {
39455
39459
  var def = {
39456
39460
  minX: null,
39457
39461
  minY: null,
@@ -39462,22 +39466,24 @@ var modules = {
39462
39466
  var isHorizontal = this.options.horizontal;
39463
39467
 
39464
39468
  if (data.length) {
39469
+ var usePassingValue = !helpers_util.isNullOrUndefined(passingValue);
39465
39470
  return data.reduce(function (acc, p, index) {
39466
- var _p$x, _p$y;
39471
+ var _p$x, _p$y, _p$o;
39467
39472
 
39468
39473
  var minmax = acc;
39469
39474
  var px = ((_p$x = p.x) === null || _p$x === void 0 ? void 0 : _p$x.value) || p.x;
39470
39475
  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;
39471
39477
 
39472
- if (px <= minmax.minX) {
39478
+ if (usePassingValue ? po !== passingValue && px <= minmax.minX : px <= minmax.minX) {
39473
39479
  minmax.minX = px === null ? 0 : px;
39474
39480
  }
39475
39481
 
39476
- if (py <= minmax.minY) {
39482
+ if (usePassingValue ? po !== passingValue && py <= minmax.minY : py <= minmax.minY) {
39477
39483
  minmax.minY = py === null ? 0 : py;
39478
39484
  }
39479
39485
 
39480
- if (px >= minmax.maxX) {
39486
+ if (usePassingValue ? po !== passingValue && px >= minmax.maxX : px >= minmax.maxX) {
39481
39487
  minmax.maxX = px === null ? 0 : px;
39482
39488
 
39483
39489
  if (isHorizontal && px !== null) {
@@ -39486,7 +39492,7 @@ var modules = {
39486
39492
  }
39487
39493
  }
39488
39494
 
39489
- if (py >= minmax.maxY) {
39495
+ if (usePassingValue ? po !== passingValue && py >= minmax.maxY : py >= minmax.maxY) {
39490
39496
  minmax.maxY = py === null ? 0 : py;
39491
39497
 
39492
39498
  if (!isHorizontal && py !== null) {
@@ -40240,14 +40246,25 @@ var modules = {
40240
40246
  }
40241
40247
  }
40242
40248
 
40243
- if (smm.maxX >= minmax.x[axisX].max) {
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) {
40244
40256
  minmax.x[axisX].max = smm.maxX;
40245
40257
  minmax.x[axisX].maxSID = key;
40246
40258
  }
40247
40259
 
40248
- if (smm.maxY >= minmax.y[axisY].max) {
40260
+ var maxYisNegative = minmax.y[axisY].max < 0;
40261
+
40262
+ if (isExistGrp && maxYisNegative) {
40263
+ 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) {
40249
40266
  minmax.y[axisY].max = smm.maxY;
40250
- minmax.y[axisX].maxSID = key;
40267
+ minmax.y[axisY].maxSID = key;
40251
40268
  }
40252
40269
  }
40253
40270
 
@@ -41708,6 +41725,7 @@ var TIME_INTERVALS = {
41708
41725
 
41709
41726
 
41710
41727
 
41728
+
41711
41729
  var element_line_Line = /*#__PURE__*/function () {
41712
41730
  function Line(sId, opt, sIdx) {
41713
41731
  var _this = this;
@@ -41841,7 +41859,6 @@ var element_line_Line = /*#__PURE__*/function () {
41841
41859
  ctx.setLineDash(this.segments);
41842
41860
  }
41843
41861
 
41844
- var endPoint = chartRect.y2 - labelOffset.bottom;
41845
41862
  var isLinearInterpolation = this.useLinearInterpolation();
41846
41863
  var barAreaByCombo = 0;
41847
41864
  var minmaxX = axesSteps.x[this.xAxisIndex];
@@ -41864,8 +41881,12 @@ var element_line_Line = /*#__PURE__*/function () {
41864
41881
 
41865
41882
  var getYPos = function getYPos(val) {
41866
41883
  return helpers_canvas.calculateY(val, minmaxY.graphMin, minmaxY.graphMax, yArea, ysp);
41867
- }; // draw line
41884
+ };
41868
41885
 
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
41869
41890
 
41870
41891
  var prevValid;
41871
41892
  this.data.forEach(function (curr) {
@@ -41925,9 +41946,10 @@ var element_line_Line = /*#__PURE__*/function () {
41925
41946
  }
41926
41947
  });
41927
41948
  var gradient = ctx.createLinearGradient(0, chartRect.y2, 0, maxValueYPos);
41928
- gradient.addColorStop(0, fillColor);
41949
+ var mainGradientColor = extent.opacity < 1 ? fillColor : mainColor;
41950
+ gradient.addColorStop(0, includeNegativeValue ? mainGradientColor : fillColor);
41929
41951
  gradient.addColorStop(0.5, fillColor);
41930
- gradient.addColorStop(1, extent.opacity < 1 ? fillColor : mainColor);
41952
+ gradient.addColorStop(1, mainGradientColor);
41931
41953
  ctx.fillStyle = gradient;
41932
41954
  } else {
41933
41955
  ctx.fillStyle = fillColor;
@@ -41995,7 +42017,7 @@ var element_line_Line = /*#__PURE__*/function () {
41995
42017
 
41996
42018
  var nextData = _this2.data[jx];
41997
42019
  var xp = getXPos(nextData.x);
41998
- var bp = (_getYPos2 = getYPos(nextData.b)) !== null && _getYPos2 !== void 0 ? _getYPos2 : endPoint;
42020
+ var bp = (_getYPos2 = getYPos(nextData.b)) !== null && _getYPos2 !== void 0 ? _getYPos2 : getYPos(0);
41999
42021
  ctx.lineTo(xp, bp);
42000
42022
  }
42001
42023
 
@@ -42749,8 +42771,12 @@ var element_bar_Bar = /*#__PURE__*/function () {
42749
42771
 
42750
42772
  var xArea = chartRect.chartWidth - (labelOffset.left + labelOffset.right);
42751
42773
  var yArea = chartRect.chartHeight - (labelOffset.top + labelOffset.bottom);
42752
- var xsp = chartRect.x1 + labelOffset.left;
42753
- var ysp = chartRect.y2 - labelOffset.bottom;
42774
+ var xAxisPosition = chartRect.x1 + labelOffset.left;
42775
+ var yAxisPosition = chartRect.y2 - labelOffset.bottom;
42776
+ var xZeroPosition = helpers_canvas.calculateX(0, minmaxX.graphMin, minmaxX.graphMax, xArea);
42777
+ var yZeroPosition = helpers_canvas.calculateY(0, minmaxY.graphMin, minmaxY.graphMax, yArea);
42778
+ var xsp = isHorizontal ? xAxisPosition + xZeroPosition : xAxisPosition;
42779
+ var ysp = isHorizontal ? yAxisPosition : yAxisPosition + yZeroPosition;
42754
42780
  var dArea = isHorizontal ? yArea : xArea;
42755
42781
  var cArea = dArea / (totalCount || 1);
42756
42782
  var cPad;
@@ -42814,7 +42840,8 @@ var element_bar_Bar = /*#__PURE__*/function () {
42814
42840
  categoryPoint = ysp - cArea * screenIndex - cPad;
42815
42841
  } else {
42816
42842
  categoryPoint = xsp + cArea * screenIndex + cPad;
42817
- }
42843
+ } // 기본 위치 설정
42844
+
42818
42845
 
42819
42846
  if (isHorizontal) {
42820
42847
  x = xsp;
@@ -42822,22 +42849,30 @@ var element_bar_Bar = /*#__PURE__*/function () {
42822
42849
  } else {
42823
42850
  x = Math.round(categoryPoint + (bArea * barSeriesX - (w + bPad)));
42824
42851
  y = ysp;
42825
- }
42852
+ } // 너비 / 높이 계산, 스택의 경우 위치 값 재계산
42853
+
42826
42854
 
42827
42855
  if (isHorizontal) {
42856
+ var barValue = item.b ? item.o : item.x;
42857
+ w = helpers_canvas.calculateX(barValue, minmaxX.graphMin, minmaxX.graphMax, xArea, -xZeroPosition);
42858
+
42828
42859
  if (item.b) {
42829
- w = helpers_canvas.calculateX(item.x - item.b, minmaxX.graphMin, minmaxX.graphMax, xArea);
42830
- x = helpers_canvas.calculateX(item.b, minmaxX.graphMin, minmaxX.graphMax, xArea, xsp);
42831
- } else {
42832
- w = helpers_canvas.calculateX(item.x, minmaxX.graphMin, minmaxX.graphMax, xArea);
42860
+ x = helpers_canvas.calculateX(item.b, minmaxX.graphMin, minmaxX.graphMax, xArea, xsp - xZeroPosition);
42833
42861
  }
42834
- } else if (item.b) {
42835
- // vertical stack bar chart
42836
- h = helpers_canvas.calculateY(item.y - item.b, minmaxY.graphMin, minmaxY.graphMax, yArea);
42837
- y = helpers_canvas.calculateY(item.b, minmaxY.graphMin, minmaxY.graphMax, yArea, ysp);
42862
+
42863
+ var minimumBarWidth = barValue > 0 ? -1 : 1;
42864
+ w = barValue && Math.abs(w) === 0 ? minimumBarWidth : w;
42838
42865
  } else {
42839
- // vertical bar chart
42840
- h = helpers_canvas.calculateY(item.y, minmaxY.graphMin, minmaxY.graphMax, yArea);
42866
+ var _barValue = item.b ? item.o : item.y;
42867
+
42868
+ h = helpers_canvas.calculateY(_barValue, minmaxY.graphMin, minmaxY.graphMax, yArea, -yZeroPosition);
42869
+
42870
+ if (item.b) {
42871
+ y = helpers_canvas.calculateY(item.b, minmaxY.graphMin, minmaxY.graphMax, yArea, ysp - yZeroPosition);
42872
+ }
42873
+
42874
+ var minimumBarHeight = _barValue > 0 ? -1 : 1;
42875
+ h = _barValue && Math.abs(h) === 0 ? minimumBarHeight : h;
42841
42876
  }
42842
42877
 
42843
42878
  var barColor = item.dataColor || this.color;
@@ -43126,10 +43161,10 @@ var element_bar_Bar = /*#__PURE__*/function () {
43126
43161
  align = _this$showValue.align,
43127
43162
  formatter = _this$showValue.formatter,
43128
43163
  decimalPoint = _this$showValue.decimalPoint;
43129
- var x = positions.x,
43130
- y = positions.y,
43131
- w = positions.w,
43132
- h = positions.h;
43164
+ var barX = positions.x,
43165
+ barY = positions.y,
43166
+ barWidth = positions.w,
43167
+ barHeight = positions.h;
43133
43168
  var ctx = context;
43134
43169
  ctx.save();
43135
43170
  ctx.beginPath();
@@ -43164,25 +43199,27 @@ var element_bar_Bar = /*#__PURE__*/function () {
43164
43199
  formattedTxt = (_Util$labelSignFormat = helpers_util.labelSignFormat(value, decimalPoint)) !== null && _Util$labelSignFormat !== void 0 ? _Util$labelSignFormat : '';
43165
43200
  }
43166
43201
 
43202
+ var isNegativeValue = value < 0;
43167
43203
  var textWidth = Math.round(ctx.measureText(formattedTxt).width);
43168
- var textHeight = fontSize + 4;
43169
- var minXPos = x + 10;
43170
- var minYPos = y - 10;
43171
- var widthFreeSpaceToDraw = w - 10;
43172
- var heightFreeSpaceToDraw = Math.abs(h + 10);
43173
- var centerX = x + w / 2 <= minXPos ? minXPos : x + w / 2;
43174
- var centerY = y + h / 2 >= minYPos ? minYPos : y + h / 2;
43175
- var centerYHorizontal = isHighlight ? y + h / 2 : y - h / 2;
43204
+ var textHeight = fontSize; // fontSize와 textHeight는 같을 수 없지만, 정확히 구할 필요 없음
43205
+
43206
+ var GAP = 10;
43207
+ var minXPos = isNegativeValue ? barX - GAP : barX + GAP;
43208
+ var minYPos = isNegativeValue ? barY + GAP : barY - GAP;
43209
+ var centerXOnBar = barX + barWidth / 2;
43210
+ var centerYOnBar = isHighlight ? barY + barHeight / 2 : barY - barHeight / 2;
43211
+ var drawableBarWidth = Math.abs(barWidth) - GAP;
43212
+ var drawableBarHeight = Math.abs(barHeight) - GAP;
43176
43213
 
43177
43214
  switch (align) {
43178
43215
  case 'start':
43179
43216
  {
43180
- if (isHorizontal) {
43181
- if (textWidth < widthFreeSpaceToDraw) {
43182
- ctx.fillText(formattedTxt, minXPos, centerYHorizontal);
43183
- }
43184
- } else if (textHeight < heightFreeSpaceToDraw) {
43185
- ctx.fillText(formattedTxt, centerX, minYPos);
43217
+ if (isHorizontal && textWidth < drawableBarWidth) {
43218
+ var xPos = isNegativeValue ? minXPos - textWidth : minXPos;
43219
+ ctx.fillText(formattedTxt, xPos, centerYOnBar);
43220
+ } else if (!isHorizontal && textHeight < drawableBarHeight) {
43221
+ var yPos = isNegativeValue ? barY + GAP : barY - GAP;
43222
+ ctx.fillText(formattedTxt, centerXOnBar, yPos);
43186
43223
  }
43187
43224
 
43188
43225
  break;
@@ -43190,12 +43227,10 @@ var element_bar_Bar = /*#__PURE__*/function () {
43190
43227
 
43191
43228
  case 'center':
43192
43229
  {
43193
- if (isHorizontal) {
43194
- if (textWidth < widthFreeSpaceToDraw) {
43195
- ctx.fillText(formattedTxt, centerX, centerYHorizontal);
43196
- }
43197
- } else if (textHeight < heightFreeSpaceToDraw) {
43198
- ctx.fillText(formattedTxt, centerX, centerY);
43230
+ if (isHorizontal && textWidth < drawableBarWidth) {
43231
+ ctx.fillText(formattedTxt, centerXOnBar, centerYOnBar);
43232
+ } else if (!isHorizontal && textHeight < drawableBarHeight) {
43233
+ ctx.fillText(formattedTxt, centerXOnBar, barY + barHeight / 2);
43199
43234
  }
43200
43235
 
43201
43236
  break;
@@ -43209,9 +43244,26 @@ var element_bar_Bar = /*#__PURE__*/function () {
43209
43244
  }
43210
43245
 
43211
43246
  if (isHorizontal) {
43212
- ctx.fillText(formattedTxt, minXPos + w, centerYHorizontal);
43247
+ var minXOnChart = this.chartRect.x1 + this.labelOffset.left;
43248
+ var maxXOnChart = this.chartRect.x2 - this.labelOffset.right;
43249
+
43250
+ if (isNegativeValue) {
43251
+ var _xPos = barX - GAP + barWidth - textWidth;
43252
+
43253
+ if (_xPos > minXOnChart) {
43254
+ ctx.fillText(formattedTxt, _xPos, centerYOnBar);
43255
+ }
43256
+ } else {
43257
+ var _xPos2 = barX + GAP + barWidth;
43258
+
43259
+ if (_xPos2 + textWidth < maxXOnChart) {
43260
+ ctx.fillText(formattedTxt, _xPos2, centerYOnBar);
43261
+ }
43262
+ }
43213
43263
  } else {
43214
- ctx.fillText(formattedTxt, centerX, y + h - textHeight / 2);
43264
+ var _yPos = isNegativeValue ? barY + barHeight + GAP : barY + barHeight - GAP;
43265
+
43266
+ ctx.fillText(formattedTxt, centerXOnBar, _yPos);
43215
43267
  }
43216
43268
 
43217
43269
  break;
@@ -43220,14 +43272,22 @@ var element_bar_Bar = /*#__PURE__*/function () {
43220
43272
  default:
43221
43273
  case 'end':
43222
43274
  {
43223
- if (isHorizontal) {
43224
- if (textWidth < widthFreeSpaceToDraw) {
43225
- var xPos = x + w - textWidth * 2;
43226
- ctx.fillText(formattedTxt, xPos <= minXPos ? minXPos : xPos, centerYHorizontal);
43275
+ if (isHorizontal && textWidth < drawableBarWidth) {
43276
+ var _xPos3 = isNegativeValue ? barX + barWidth + GAP : barX + barWidth - textWidth - GAP;
43277
+
43278
+ ctx.fillText(formattedTxt, _xPos3, centerYOnBar);
43279
+ } else if (!isHorizontal) {
43280
+ if (isNegativeValue) {
43281
+ var _yPos2 = barY + barHeight - GAP;
43282
+
43283
+ if (_yPos2 > minYPos) {
43284
+ ctx.fillText(formattedTxt, centerXOnBar, _yPos2);
43285
+ }
43286
+ } else if (textHeight < drawableBarHeight) {
43287
+ var _yPos3 = barY + barHeight + GAP;
43288
+
43289
+ ctx.fillText(formattedTxt, centerXOnBar, _yPos3);
43227
43290
  }
43228
- } else if (textHeight < heightFreeSpaceToDraw) {
43229
- var yPos = y + h + textHeight;
43230
- ctx.fillText(formattedTxt, centerX, yPos >= minYPos ? minYPos : yPos);
43231
43291
  }
43232
43292
 
43233
43293
  break;
@@ -43284,28 +43344,50 @@ var element_bar_Bar = /*#__PURE__*/function () {
43284
43344
  ctx.beginPath();
43285
43345
  ctx.moveTo(x, y);
43286
43346
 
43347
+ if (Math.abs(w) < r * 2) {
43348
+ r = Math.abs(w) / 2;
43349
+ }
43350
+
43351
+ if (Math.abs(h) < r * 2) {
43352
+ r = Math.abs(h) / 2;
43353
+ }
43354
+
43287
43355
  if (isHorizontal) {
43288
- if (h < r * 2) {
43289
- r = h / 2;
43356
+ var isNegativeValue = w < 0;
43357
+
43358
+ if (isNegativeValue) {
43359
+ w += r;
43360
+ ctx.lineTo(x + w, y);
43361
+ ctx.arcTo(x + w - r, y, x + w - r, y - r, r);
43362
+ ctx.arcTo(x + w - r, y - h, x + w, y - h, r);
43363
+ ctx.lineTo(x, y - h);
43364
+ ctx.lineTo(x, y);
43365
+ } else {
43366
+ w -= r;
43367
+ ctx.lineTo(x + w, y);
43368
+ ctx.arcTo(x + w + r, y, x + w + r, y - r, r);
43369
+ ctx.arcTo(x + w + r, y - h, x + w, y - h, r);
43370
+ ctx.lineTo(x, y - h);
43371
+ ctx.lineTo(x, y);
43290
43372
  }
43291
-
43292
- w -= r;
43293
- ctx.lineTo(x + w, y);
43294
- ctx.arcTo(x + w + r, y, x + w + r, y - r, r);
43295
- ctx.arcTo(x + w + r, y - h, x + w, y - h, r);
43296
- ctx.lineTo(x, y - h);
43297
- ctx.lineTo(x, y);
43298
43373
  } else {
43299
- if (w < r * 2) {
43300
- r = w / 2;
43374
+ var _isNegativeValue = h > 0;
43375
+
43376
+ if (_isNegativeValue) {
43377
+ h -= r;
43378
+ ctx.lineTo(x + w, y);
43379
+ ctx.lineTo(x + w, y + h);
43380
+ ctx.arcTo(x + w, y + h + r, x - w + r, y + h + r, r);
43381
+ ctx.arcTo(x, y + h + r, x, y + h, r);
43382
+ ctx.lineTo(x, y);
43383
+ } else {
43384
+ h += r;
43385
+ ctx.lineTo(x + w, y);
43386
+ ctx.lineTo(x + w, y + h);
43387
+ ctx.arcTo(x + w, y + h - r, x + w - r, y + h - r, r);
43388
+ ctx.arcTo(x, y + h - r, x, y + h, r);
43389
+ ctx.lineTo(x, y);
43301
43390
  }
43302
-
43303
- h += r;
43304
- ctx.lineTo(x + w, y);
43305
- ctx.lineTo(x + w, y + h);
43306
- ctx.arcTo(x + w, y + h - r, x + w - r, y + h - r, r);
43307
- ctx.arcTo(x, y + h - r, x, y + h, r);
43308
- ctx.lineTo(x, y);
43309
43391
  }
43310
43392
 
43311
43393
  ctx.fill();
@@ -45060,6 +45142,7 @@ var scale_Scale = /*#__PURE__*/function () {
45060
45142
  }
45061
45143
  /**
45062
45144
  * With range information, calculate how many labels in axis
45145
+ * linear type은 scale.linear.js에서 처리
45063
45146
  * @param {object} range min/max information
45064
45147
  *
45065
45148
  * @returns {object} steps, interval, min/max graph value
@@ -45268,6 +45351,14 @@ var scale_Scale = /*#__PURE__*/function () {
45268
45351
 
45269
45352
  ctx.beginPath();
45270
45353
  ticks[ix] = axisMinForLabel + ix * stepValue;
45354
+ var isZeroLine = ticks[ix] === 0;
45355
+
45356
+ if (isZeroLine && _this3.zeroLineColor) {
45357
+ ctx.strokeStyle = _this3.zeroLineColor;
45358
+ } else {
45359
+ ctx.strokeStyle = _this3.gridLineColor;
45360
+ }
45361
+
45271
45362
  linePosition = labelCenter + aliasPixel;
45272
45363
  labelText = _this3.getLabelFormat(Math.min(axisMax, ticks[ix]), {
45273
45364
  prev: (_ticks = ticks[ix - 1]) !== null && _ticks !== void 0 ? _ticks : ''
@@ -45373,9 +45464,11 @@ var scale_Scale = /*#__PURE__*/function () {
45373
45464
  }
45374
45465
 
45375
45466
  var mergedPlotBandOpt = lodash_es_defaultsDeep({}, plotBand, PLOT_BAND_OPTION);
45376
- var from = mergedPlotBandOpt.from,
45377
- to = mergedPlotBandOpt.to,
45467
+ var userDefinedFrom = mergedPlotBandOpt.from,
45468
+ userDefinedTo = mergedPlotBandOpt.to,
45378
45469
  labelOpt = mergedPlotBandOpt.label;
45470
+ var from = userDefinedFrom ? Math.max(userDefinedFrom, axisMin) : axisMin;
45471
+ var to = userDefinedTo ? Math.min(userDefinedTo, axisMax) : axisMax;
45379
45472
 
45380
45473
  _this3.setPlotBandStyle(mergedPlotBandOpt);
45381
45474
 
@@ -45383,8 +45476,8 @@ var scale_Scale = /*#__PURE__*/function () {
45383
45476
  var toPos;
45384
45477
 
45385
45478
  if (_this3.type === 'x') {
45386
- fromPos = helpers_canvas.calculateX(from !== null && from !== void 0 ? from : minX, axisMin, axisMax, xArea, minX);
45387
- toPos = helpers_canvas.calculateX(to !== null && to !== void 0 ? to : maxX, axisMin, axisMax, xArea, minX);
45479
+ fromPos = helpers_canvas.calculateX(from, axisMin, axisMax, xArea, minX);
45480
+ toPos = helpers_canvas.calculateX(to, axisMin, axisMax, xArea, minX);
45388
45481
 
45389
45482
  if (fromPos === null || toPos === null) {
45390
45483
  return;
@@ -45392,8 +45485,8 @@ var scale_Scale = /*#__PURE__*/function () {
45392
45485
 
45393
45486
  _this3.drawXPlotBand(fromPos, toPos, minX, maxX, minY, maxY);
45394
45487
  } else {
45395
- fromPos = helpers_canvas.calculateY(from !== null && from !== void 0 ? from : axisMin, axisMin, axisMax, yArea, maxY);
45396
- toPos = helpers_canvas.calculateY(to !== null && to !== void 0 ? to : axisMax, axisMin, axisMax, yArea, maxY);
45488
+ fromPos = helpers_canvas.calculateY(from, axisMin, axisMax, yArea, maxY);
45489
+ toPos = helpers_canvas.calculateY(to, axisMin, axisMax, yArea, maxY);
45397
45490
 
45398
45491
  if (fromPos === null || toPos === null) {
45399
45492
  return;
@@ -45420,9 +45513,6 @@ var scale_Scale = /*#__PURE__*/function () {
45420
45513
  var mergedPlotLineOpt = lodash_es_defaultsDeep({}, plotLine, PLOT_LINE_OPTION);
45421
45514
  var value = mergedPlotLineOpt.value,
45422
45515
  labelOpt = mergedPlotLineOpt.label;
45423
-
45424
- _this3.setPlotLineStyle(mergedPlotLineOpt);
45425
-
45426
45516
  var dataPos;
45427
45517
 
45428
45518
  if (_this3.type === 'x') {
@@ -45432,6 +45522,8 @@ var scale_Scale = /*#__PURE__*/function () {
45432
45522
  return;
45433
45523
  }
45434
45524
 
45525
+ _this3.setPlotLineStyle(mergedPlotLineOpt);
45526
+
45435
45527
  _this3.drawXPlotLine(dataPos, minX, maxX, minY, maxY);
45436
45528
  } else {
45437
45529
  dataPos = helpers_canvas.calculateY(value, axisMin, axisMax, yArea, maxY);
@@ -45440,6 +45532,8 @@ var scale_Scale = /*#__PURE__*/function () {
45440
45532
  return;
45441
45533
  }
45442
45534
 
45535
+ _this3.setPlotLineStyle(mergedPlotLineOpt);
45536
+
45443
45537
  _this3.drawYPlotLine(dataPos, minX, maxX, minY, maxY);
45444
45538
  }
45445
45539
 
@@ -45963,6 +46057,7 @@ var scale_time_TimeScale = /*#__PURE__*/function (_Scale) {
45963
46057
 
45964
46058
 
45965
46059
 
46060
+
45966
46061
  var scale_linear_LinearScale = /*#__PURE__*/function (_Scale) {
45967
46062
  _inherits(LinearScale, _Scale);
45968
46063
 
@@ -46001,16 +46096,192 @@ var scale_linear_LinearScale = /*#__PURE__*/function (_Scale) {
46001
46096
  * Calculate interval
46002
46097
  * @param {object} range range information
46003
46098
  *
46004
- * @returns {number} interval
46099
+ * @returns {number} interval (한 칸에 표시할 값의 간격)
46005
46100
  */
46006
46101
 
46007
46102
  }, {
46008
46103
  key: "getInterval",
46009
46104
  value: function getInterval(range) {
46105
+ if (this.interval) return this.interval;
46010
46106
  var max = range.maxValue;
46011
46107
  var min = range.minValue;
46012
- var step = range.maxSteps;
46013
- return this.interval ? this.interval : Math.ceil((max - min) / step);
46108
+ var steps = range.maxSteps; // step이 0이면 interval 계산 불가
46109
+
46110
+ if (!steps || steps <= 0) return 0; // startToZero이고, 최소값이 음수일 경우 0을 반드시 포함
46111
+
46112
+ if (this.startToZero && min < 0) {
46113
+ var totalRange = Math.abs(min) + Math.abs(max); // 비율로 나눔
46114
+
46115
+ var negativeRatio = Math.abs(min) / totalRange;
46116
+ var positiveRatio = Math.abs(max) / totalRange; // 각 방향에 최소 1칸 이상 배정되도록 보장
46117
+
46118
+ var negativeSteps = Math.max(1, Math.round(negativeRatio * steps));
46119
+ var positiveSteps = Math.max(1, steps - negativeSteps); // 다시 합이 steps보다 커질 수도 있으니, 조정
46120
+
46121
+ if (negativeSteps + positiveSteps > steps) {
46122
+ // 가장 큰 쪽에서 하나 줄임
46123
+ if (negativeRatio > positiveRatio) {
46124
+ negativeSteps -= 1;
46125
+ } else {
46126
+ positiveSteps -= 1;
46127
+ }
46128
+ }
46129
+
46130
+ return Math.ceil(Math.max(Math.abs(min) / (negativeSteps || 1), Math.abs(max) / (positiveSteps || 1)));
46131
+ }
46132
+
46133
+ return Math.ceil((max - min) / steps);
46134
+ }
46135
+ /**
46136
+ * With range information, calculate how many labels in axis
46137
+ * @param {object} range min/max information
46138
+ *
46139
+ * @returns {object} steps, interval, min/max graph value
46140
+ */
46141
+
46142
+ }, {
46143
+ key: "calculateSteps",
46144
+ value: function calculateSteps(range) {
46145
+ var maxValue = range.maxValue,
46146
+ minValue = range.minValue;
46147
+ var _range$maxSteps = range.maxSteps,
46148
+ maxSteps = _range$maxSteps === void 0 ? 1 : _range$maxSteps;
46149
+ var interval = this.getInterval(range);
46150
+ var graphMin = 0;
46151
+ var graphMax = 0; // 그래프 최대/최소 값 계산
46152
+
46153
+ if (minValue >= 0) {
46154
+ // 전부 양수
46155
+ graphMin = +minValue;
46156
+ graphMax = Math.ceil(maxValue / interval) * interval;
46157
+ } else if (maxValue >= 0) {
46158
+ // 양수/음수 혼합
46159
+ graphMin = Math.floor(minValue / interval) * interval;
46160
+ graphMax = Math.ceil(maxValue / interval) * interval;
46161
+ } else {
46162
+ // 전부 음수
46163
+ graphMax = +maxValue;
46164
+ graphMin = Math.floor(minValue / interval) * interval;
46165
+ }
46166
+
46167
+ var graphRange = graphMax - graphMin;
46168
+ var numberOfSteps = Math.round(graphRange / interval); // 특수 케이스: 양수 최소값, 최대값이 1일 경우
46169
+
46170
+ if (minValue > 0 && maxValue === 1) {
46171
+ if (!this.decimalPoint) {
46172
+ interval = 1;
46173
+ numberOfSteps = 1;
46174
+ maxSteps = 1;
46175
+ } else if (maxSteps > 2) {
46176
+ interval = 0.2;
46177
+ numberOfSteps = 5;
46178
+ maxSteps = 5;
46179
+ } else {
46180
+ interval = 0.5;
46181
+ numberOfSteps = 2;
46182
+ maxSteps = 2;
46183
+ }
46184
+ } // 최대 스텝 수 조정
46185
+
46186
+
46187
+ while (numberOfSteps > maxSteps) {
46188
+ interval *= 2;
46189
+ numberOfSteps = Math.round(graphRange / interval);
46190
+ interval = Math.ceil(graphRange / numberOfSteps);
46191
+ }
46192
+
46193
+ if (graphRange > numberOfSteps * interval) {
46194
+ interval = Math.ceil(graphRange / numberOfSteps);
46195
+ }
46196
+
46197
+ return {
46198
+ steps: numberOfSteps,
46199
+ interval: interval,
46200
+ graphMin: graphMin,
46201
+ graphMax: graphMax
46202
+ };
46203
+ }
46204
+ /**
46205
+ * Calculate min/max value, label and size information for axis
46206
+ * @param {object} minMax min/max information
46207
+ * @param {object} scrollbarOpt scrollbar option
46208
+ *
46209
+ * @returns {object} min/max value and label
46210
+ */
46211
+
46212
+ }, {
46213
+ key: "calculateScaleRange",
46214
+ value: function calculateScaleRange(minMax, scrollbarOpt) {
46215
+ var _this$labelStyle;
46216
+
46217
+ var maxValue;
46218
+ var minValue;
46219
+ var isDefaultMaxSameAsMin = false;
46220
+ var range = scrollbarOpt !== null && scrollbarOpt !== void 0 && scrollbarOpt.use ? scrollbarOpt === null || scrollbarOpt === void 0 ? void 0 : scrollbarOpt.range : this.range;
46221
+
46222
+ if (Array.isArray(range) && (range === null || range === void 0 ? void 0 : range.length) === 2) {
46223
+ if (this.options.type === 'heatMap') {
46224
+ maxValue = range[1] > +minMax.max ? +minMax.max : range[1];
46225
+ minValue = range[0] < +minMax.min ? +minMax.min : range[0];
46226
+ } else {
46227
+ maxValue = range[1];
46228
+ minValue = range[0];
46229
+ }
46230
+ } else if (typeof range === 'function') {
46231
+ var _range = range(minMax.min, minMax.max);
46232
+
46233
+ var _range2 = _slicedToArray(_range, 2);
46234
+
46235
+ minValue = _range2[0];
46236
+ maxValue = _range2[1];
46237
+ } else {
46238
+ maxValue = minMax.max;
46239
+ minValue = minMax.min;
46240
+ } // autoScaleRatio 적용 케이스
46241
+
46242
+
46243
+ if (this.autoScaleRatio) {
46244
+ var temp = maxValue; // 양수 방향에만 autoScaleRatio 적용
46245
+
46246
+ maxValue = Math.ceil(maxValue * (this.autoScaleRatio + 1));
46247
+
46248
+ if (maxValue > 0 && minValue < 0) {
46249
+ // 양수/음수 혼합 케이스 -- 음수 방향에도 maxValue 증가분만큼 더하기
46250
+ var diff = temp - maxValue;
46251
+ minValue += diff;
46252
+ } else if (maxValue < 0 && minValue < 0) {
46253
+ // 전부 음수 케이스 -- 음수 방향에도 autoScaleRatio 적용
46254
+ minValue = Math.ceil(minValue * (this.autoScaleRatio + 1));
46255
+ }
46256
+ } // 0 기준 축 설정 케이스
46257
+
46258
+
46259
+ if (this.startToZero) {
46260
+ if (minValue > 0) {
46261
+ minValue = 0;
46262
+ }
46263
+
46264
+ if (maxValue < 0) {
46265
+ maxValue = 0;
46266
+ }
46267
+ }
46268
+
46269
+ if (maxValue === minValue) {
46270
+ maxValue += 1;
46271
+ isDefaultMaxSameAsMin = true;
46272
+ }
46273
+
46274
+ var minLabel = this.getLabelFormat(minValue);
46275
+ var maxLabel = this.getLabelFormat(maxValue, {
46276
+ isMaxValueSameAsMin: isDefaultMaxSameAsMin
46277
+ });
46278
+ return {
46279
+ min: minValue,
46280
+ max: maxValue,
46281
+ minLabel: minLabel,
46282
+ maxLabel: maxLabel,
46283
+ size: helpers_util.calcTextSize(maxLabel, helpers_util.getLabelStyle(this.labelStyle), (_this$labelStyle = this.labelStyle) === null || _this$labelStyle === void 0 ? void 0 : _this$labelStyle.padding)
46284
+ };
46014
46285
  }
46015
46286
  }]);
46016
46287
 
@@ -47232,7 +47503,7 @@ var plugins_legend_modules = {
47232
47503
  var useLegendSeries = [];
47233
47504
 
47234
47505
  if (groups) {
47235
- useLegendSeries = groups.slice().reverse().filter(function (sId) {
47506
+ useLegendSeries = groups.filter(function (sId) {
47236
47507
  return _this3.seriesList[sId].showLegend;
47237
47508
  }).map(function (sId) {
47238
47509
  return [sId, _this3.seriesList[sId]];
@@ -47283,9 +47554,8 @@ var plugins_legend_modules = {
47283
47554
  },
47284
47555
 
47285
47556
  /**
47286
- * Adds legends for each group in `groups` array, iterating through each series
47287
- * within the group in reverse order. This ensures the legends align with the series
47288
- * order as displayed in the chart. Only adds series with `showLegend` set to `true`.
47557
+ * Adds legends for each group in `groups` array, iterating through each series within the group.
47558
+ * Only adds series with `showLegend` set to `true`.
47289
47559
  *
47290
47560
  * @param {Array} groups - Array of groups containing series identifiers.
47291
47561
  * @param {Object} seriesList - Object containing all series, keyed by series ID.
@@ -47296,7 +47566,7 @@ var plugins_legend_modules = {
47296
47566
  var _this5 = this;
47297
47567
 
47298
47568
  groups.forEach(function (group) {
47299
- group.slice().reverse().forEach(function (sId) {
47569
+ group.forEach(function (sId) {
47300
47570
  var series = seriesList[sId];
47301
47571
 
47302
47572
  if (series && series.showLegend) {
@@ -53314,7 +53584,6 @@ var plugins_pie_modules = {
53314
53584
 
53315
53585
 
53316
53586
 
53317
-
53318
53587
  var element_tip_modules = {
53319
53588
  /**
53320
53589
  * Draw TextTip with tip's locationInfo
@@ -53348,8 +53617,7 @@ var element_tip_modules = {
53348
53617
  }
53349
53618
 
53350
53619
  if (labelTipOpt.use && labelTipOpt.showTip) {
53351
- var isHeatMap = opt.type === 'heatMap';
53352
- isExistSelectedLabel = isHeatMap ? this.drawLabelTipForHeatMap() : this.drawLabelTip();
53620
+ isExistSelectedLabel = opt.type === 'heatMap' ? this.drawLabelTipForHeatMap() : this.drawTipForSelectedLabel();
53353
53621
  }
53354
53622
 
53355
53623
  var executeDrawIndicator = function executeDrawIndicator(tipOpt) {
@@ -53635,9 +53903,10 @@ var element_tip_modules = {
53635
53903
 
53636
53904
  /**
53637
53905
  * Draw Selected Label Tip
53906
+ * none Text
53638
53907
  * @returns {boolean} Whether drew at least one tip
53639
53908
  */
53640
- drawLabelTip: function drawLabelTip() {
53909
+ drawTipForSelectedLabel: function drawTipForSelectedLabel() {
53641
53910
  var _this2 = this;
53642
53911
 
53643
53912
  var opt = this.options;
@@ -53663,7 +53932,7 @@ var element_tip_modules = {
53663
53932
  };
53664
53933
  var labelAxes = isHorizontal ? this.axesY[0] : this.axesX[0];
53665
53934
  var valueAxes = isHorizontal ? this.axesX[0] : this.axesY[0];
53666
- var valueAxesRange = isHorizontal ? this.axesRange.x[0] : this.axesRange.y[0];
53935
+ var valueAxesSteps = isHorizontal ? this.axesSteps.x[0] : this.axesSteps.y[0];
53667
53936
  var valuePositionCalcFunction = isHorizontal ? helpers_canvas.calculateX : helpers_canvas.calculateY;
53668
53937
  var labelPositionCalcFunction = isHorizontal ? helpers_canvas.calculateY : helpers_canvas.calculateX;
53669
53938
  var scrollbarOpt = isHorizontal ? this.scrollbar.y : this.scrollbar.x;
@@ -53681,8 +53950,8 @@ var element_tip_modules = {
53681
53950
  return _this2.seriesList[sId].isExistGrp && !_this2.seriesList[sId].isOverlapping;
53682
53951
  });
53683
53952
  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$ : [];
53684
- var gp;
53685
- var dp;
53953
+ var labelPos;
53954
+ var dataPos;
53686
53955
  var value;
53687
53956
  var labelStartPoint;
53688
53957
  var labelEndPoint;
@@ -53730,31 +53999,39 @@ var element_tip_modules = {
53730
53999
  }
53731
54000
 
53732
54001
  data.forEach(function (selectedData, i) {
53733
- if (labelTipOpt.fixedPosTop) {
53734
- value = valueAxesRange.max;
53735
- } else if (isExistGrp) {
53736
- var sumValue = visibleSeries.reduce(function (ac, sId) {
53737
- var _selectedData$sId$val, _selectedData$sId;
53738
-
53739
- 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;
53740
- }, 0);
53741
- var nonGroupValues = visibleSeries.filter(function (sId) {
53742
- return !groups.includes(sId);
53743
- }).map(function (sId) {
53744
- var _selectedData$sId$val2, _selectedData$sId2;
53745
-
53746
- 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];
53747
- });
53748
- value = Math.max.apply(Math, _toConsumableArray(nonGroupValues).concat([sumValue]));
53749
- } else if (visibleSeries.length) {
53750
- var visibleValue = visibleSeries.map(function (sId) {
53751
- var _selectedData$sId$val3, _selectedData$sId3;
53752
-
53753
- 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];
53754
- });
53755
- value = Math.max.apply(Math, _toConsumableArray(visibleValue));
53756
- } else {
53757
- value = valueAxesRange.max;
54002
+ value = valueAxesSteps.graphMax;
54003
+
54004
+ if (!labelTipOpt.fixedPosTop) {
54005
+ if (isExistGrp) {
54006
+ var _visibleSeries$filter, _visibleSeries$filter2;
54007
+
54008
+ var positiveSum = visibleSeries === null || visibleSeries === void 0 ? void 0 : visibleSeries.reduce(function (ac, sId) {
54009
+ var _selectedData$sId$val, _selectedData$sId, _selectedData$sId$val2, _selectedData$sId2;
54010
+
54011
+ 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;
54012
+ }, 0);
54013
+ var nonGroupValues = (_visibleSeries$filter = visibleSeries === null || visibleSeries === void 0 ? void 0 : (_visibleSeries$filter2 = visibleSeries.filter(function (sId) {
54014
+ return !groups.includes(sId);
54015
+ })) === null || _visibleSeries$filter2 === void 0 ? void 0 : _visibleSeries$filter2.map(function (sId) {
54016
+ var _selectedData$sId$val3, _selectedData$sId3;
54017
+
54018
+ 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];
54019
+ })) !== null && _visibleSeries$filter !== void 0 ? _visibleSeries$filter : [];
54020
+ var maxNonGroupValue = (nonGroupValues === null || nonGroupValues === void 0 ? void 0 : nonGroupValues.length) > 0 ? nonGroupValues.reduce(function (max, val) {
54021
+ return Math.max(max, val !== null && val !== void 0 ? val : -Infinity);
54022
+ }, -Infinity) : -Infinity;
54023
+ value = positiveSum > 0 ? Math.max(maxNonGroupValue, positiveSum) : Math.max(maxNonGroupValue, 0);
54024
+ } else if (visibleSeries.length) {
54025
+ var visibleValue = visibleSeries.map(function (sId) {
54026
+ var _selectedData$sId$val4, _selectedData$sId4;
54027
+
54028
+ 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];
54029
+ });
54030
+ var maxValue = visibleValue.length > 0 ? visibleValue.reduce(function (max, val) {
54031
+ return Math.max(max, val !== null && val !== void 0 ? val : -Infinity);
54032
+ }, -Infinity) : -Infinity;
54033
+ value = maxValue > 0 || _this2.options.type !== 'bar' ? maxValue : 0;
54034
+ }
53758
54035
  }
53759
54036
 
53760
54037
  if (labelAxes.labels) {
@@ -53764,18 +54041,17 @@ var element_tip_modules = {
53764
54041
 
53765
54042
  var labelIndex = dataIndex[i] - startIndex;
53766
54043
  var labelCenter = Math.round(labelStartPoint + labelGap * labelIndex);
53767
- dp = labelCenter + labelGap / 2;
54044
+ labelPos = labelCenter + labelGap / 2;
53768
54045
  } else {
53769
- dp = labelPositionCalcFunction(label[i], graphX.graphMin, graphX.graphMax, chartWidth - sizeObj.comboOffset, aPos.x1 + sizeObj.comboOffset / 2);
54046
+ labelPos = labelPositionCalcFunction(label[i], graphX.graphMin, graphX.graphMax, chartWidth - sizeObj.comboOffset, aPos.x1 + sizeObj.comboOffset / 2);
53770
54047
  }
53771
54048
 
53772
- gp = valuePositionCalcFunction(value, valueAxesRange.min, valueAxesRange.max, valueSpace, valueStartPoint);
53773
- gp += offset;
54049
+ dataPos = valuePositionCalcFunction(value, valueAxesSteps.graphMin, valueAxesSteps.graphMax, valueSpace, valueStartPoint) + offset;
53774
54050
 
53775
54051
  _this2.showTip({
53776
54052
  context: _this2.bufferCtx,
53777
- x: isHorizontal ? gp : dp,
53778
- y: isHorizontal ? dp : gp,
54053
+ x: isHorizontal ? dataPos : labelPos,
54054
+ y: isHorizontal ? labelPos : dataPos,
53779
54055
  opt: labelTipOpt,
53780
54056
  isSamePos: false
53781
54057
  });
@@ -53887,10 +54163,11 @@ var element_tip_modules = {
53887
54163
  }
53888
54164
  } else if (isHorizontal) {
53889
54165
  gp = helpers_canvas.calculateX(value, graphX.graphMin, graphX.graphMax, xArea, xsp);
53890
- gp += offset;
54166
+ gp = value < 0 ? gp - offset : gp + offset;
53891
54167
  } else {
53892
- gp = helpers_canvas.calculateY(value, graphY.graphMin, graphY.graphMax, yArea, ysp);
53893
- gp -= offset;
54168
+ var adjustedValue = type === 'bar' && value < 0 ? 0 : value;
54169
+ gp = helpers_canvas.calculateY(adjustedValue, graphY.graphMin, graphY.graphMax, yArea, ysp);
54170
+ gp = adjustedValue < 0 ? gp + offset : gp - offset;
53894
54171
  }
53895
54172
 
53896
54173
  var maxTipType = 'center';
@@ -53922,7 +54199,8 @@ var element_tip_modules = {
53922
54199
  arrowSize: arrowSize,
53923
54200
  borderRadius: borderRadius,
53924
54201
  text: text,
53925
- textStyle: textStyle
54202
+ textStyle: textStyle,
54203
+ isNegative: value < 0
53926
54204
  });
53927
54205
  }
53928
54206
 
@@ -53956,12 +54234,21 @@ var element_tip_modules = {
53956
54234
  borderRadius = param.borderRadius,
53957
54235
  text = param.text,
53958
54236
  opt = param.opt,
53959
- textStyle = param.textStyle;
54237
+ textStyle = param.textStyle,
54238
+ isNegative = param.isNegative;
53960
54239
  var ctx = param.context;
53961
54240
  var sx = x - width / 2;
53962
54241
  var ex = x + width / 2;
53963
54242
  var sy = y - height;
53964
54243
  var ey = y;
54244
+
54245
+ if (isNegative) {
54246
+ if (isHorizontal) {
54247
+ sx = x - width / 2 - width;
54248
+ ex = x - width / 2;
54249
+ }
54250
+ }
54251
+
53965
54252
  ctx.save();
53966
54253
  ctx.font = textStyle;
53967
54254
  ctx.fillStyle = (_opt$tipBackground = opt.tipBackground) !== null && _opt$tipBackground !== void 0 ? _opt$tipBackground : opt.tipStyle.background;
@@ -53969,44 +54256,73 @@ var element_tip_modules = {
53969
54256
  ctx.beginPath();
53970
54257
  ctx.moveTo(sx + borderRadius, sy);
53971
54258
  ctx.quadraticCurveTo(sx, sy, sx, sy + borderRadius);
53972
-
53973
- if (isHorizontal) {
53974
- ctx.lineTo(sx, sy + borderRadius + arrowSize / 2);
53975
- ctx.lineTo(sx - arrowSize, ey - height / 2);
53976
- ctx.lineTo(sx, ey - borderRadius - arrowSize / 2);
53977
- }
53978
-
53979
54259
  ctx.lineTo(sx, ey - borderRadius);
53980
54260
  ctx.quadraticCurveTo(sx, ey, sx + borderRadius, ey);
53981
-
53982
- if (!isHorizontal) {
53983
- if (type === 'left') {
53984
- ctx.lineTo(sx + borderRadius + arrowSize, ey + arrowSize);
53985
- ctx.lineTo(sx + borderRadius + arrowSize * 2, ey);
53986
- } else if (type === 'right') {
53987
- ctx.lineTo(ex - arrowSize * 2 - borderRadius, ey);
53988
- ctx.lineTo(ex - arrowSize - borderRadius, ey + arrowSize);
53989
- } else {
53990
- ctx.lineTo(x - arrowSize, ey);
53991
- ctx.lineTo(x, ey + arrowSize);
53992
- ctx.lineTo(x + arrowSize, ey);
53993
- }
53994
- }
53995
-
53996
54261
  ctx.lineTo(ex - borderRadius, ey);
53997
54262
  ctx.quadraticCurveTo(ex, ey, ex, ey - borderRadius);
53998
54263
  ctx.lineTo(ex, sy + borderRadius);
53999
54264
  ctx.quadraticCurveTo(ex, sy, ex - borderRadius, sy);
54000
54265
  ctx.lineTo(sx + borderRadius, sy);
54001
54266
  ctx.closePath();
54002
- ctx.fill();
54267
+ ctx.fill(); // draw arrow
54268
+
54269
+ ctx.beginPath();
54270
+
54271
+ if (isHorizontal) {
54272
+ if (isNegative) {
54273
+ ctx.moveTo(ex, ey);
54274
+ ctx.lineTo(ex, sy + borderRadius + arrowSize / 2);
54275
+ ctx.lineTo(ex + arrowSize, ey - height / 2);
54276
+ ctx.lineTo(ex, ey - borderRadius - arrowSize / 2);
54277
+ } else {
54278
+ ctx.moveTo(sx, sy);
54279
+ ctx.lineTo(sx, sy + borderRadius + arrowSize / 2);
54280
+ ctx.lineTo(sx - arrowSize, ey - height / 2);
54281
+ ctx.lineTo(sx, ey - borderRadius - arrowSize / 2);
54282
+ }
54283
+
54284
+ ctx.closePath();
54285
+ ctx.fill();
54286
+ } else {
54287
+ if (isNegative) {
54288
+ if (type === 'left') {
54289
+ ctx.lineTo(sx + borderRadius + arrowSize, ey + arrowSize);
54290
+ ctx.lineTo(sx + borderRadius + arrowSize * 2, ey);
54291
+ } else if (type === 'right') {
54292
+ ctx.lineTo(ex - arrowSize * 2 - borderRadius, ey);
54293
+ ctx.lineTo(ex - arrowSize - borderRadius, ey + arrowSize);
54294
+ } else {
54295
+ ctx.lineTo(x - arrowSize, ey);
54296
+ ctx.lineTo(x, ey + arrowSize);
54297
+ ctx.lineTo(x + arrowSize, ey);
54298
+ }
54299
+ } else if (!isNegative) {
54300
+ if (type === 'left') {
54301
+ ctx.moveTo(sx, sy);
54302
+ ctx.lineTo(sx + borderRadius + arrowSize, ey + arrowSize);
54303
+ ctx.lineTo(sx + borderRadius + arrowSize * 2, ey);
54304
+ } else if (type === 'right') {
54305
+ ctx.moveTo(ex, sy);
54306
+ ctx.lineTo(ex - arrowSize * 2 - borderRadius, ey);
54307
+ ctx.lineTo(ex - arrowSize - borderRadius, ey + arrowSize);
54308
+ } else {
54309
+ ctx.lineTo(x - arrowSize, ey);
54310
+ ctx.lineTo(x, ey + arrowSize);
54311
+ ctx.lineTo(x + arrowSize, ey);
54312
+ }
54313
+ }
54314
+
54315
+ ctx.closePath();
54316
+ ctx.fill();
54317
+ }
54318
+
54003
54319
  ctx.restore();
54004
54320
  ctx.save();
54005
54321
  ctx.font = textStyle;
54006
54322
  ctx.fillStyle = (_opt$tipTextColor = opt.tipTextColor) !== null && _opt$tipTextColor !== void 0 ? _opt$tipTextColor : opt.tipStyle.textColor;
54007
54323
  ctx.textBaseline = 'middle';
54008
54324
  ctx.textAlign = 'center';
54009
- ctx.fillText("".concat(text), x, sy + height / 2);
54325
+ ctx.fillText("".concat(text), sx + width / 2, sy + height / 2);
54010
54326
  ctx.restore();
54011
54327
  },
54012
54328