evui 3.3.17 → 3.3.18

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.
@@ -7957,7 +7957,7 @@ $({ target: 'Number', stat: true }, {
7957
7957
  /***/ "9224":
7958
7958
  /***/ (function(module) {
7959
7959
 
7960
- module.exports = JSON.parse("{\"a\":\"3.3.17\"}");
7960
+ module.exports = JSON.parse("{\"a\":\"3.3.18\"}");
7961
7961
 
7962
7962
  /***/ }),
7963
7963
 
@@ -31994,7 +31994,15 @@ function reverse(array) {
31994
31994
  * @returns {string} computed value
31995
31995
  */
31996
31996
  getLabelStyle: function getLabelStyle(style) {
31997
- return "normal normal ".concat(style.fontWeight, " ").concat(style.fontSize, "px ").concat(style.fontFamily);
31997
+ var _style$fontStyle = style.fontStyle,
31998
+ fontStyle = _style$fontStyle === void 0 ? 'normal' : _style$fontStyle,
31999
+ _style$fontWeight = style.fontWeight,
32000
+ fontWeight = _style$fontWeight === void 0 ? 'norma' : _style$fontWeight,
32001
+ _style$fontSize = style.fontSize,
32002
+ fontSize = _style$fontSize === void 0 ? '12' : _style$fontSize,
32003
+ _style$fontFamily = style.fontFamily,
32004
+ fontFamily = _style$fontFamily === void 0 ? 'Roboto' : _style$fontFamily;
32005
+ return "".concat(fontStyle, " normal ").concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily);
31998
32006
  },
31999
32007
 
32000
32008
  /**
@@ -34176,6 +34184,16 @@ var AXIS_OPTION = {
34176
34184
  fontWeight: 400,
34177
34185
  fitWidth: false,
34178
34186
  fitDir: 'right'
34187
+ },
34188
+ title: {
34189
+ use: false,
34190
+ text: null,
34191
+ fontWeight: 400,
34192
+ fontSize: 12,
34193
+ fontFamily: 'Roboto',
34194
+ textAlign: 'right',
34195
+ fontStyle: 'normal',
34196
+ color: '#808080'
34179
34197
  }
34180
34198
  };
34181
34199
  var PLOT_LINE_OPTION = {
@@ -37069,6 +37087,52 @@ var scale_Scale = /*#__PURE__*/function () {
37069
37087
  graphMax: graphMax
37070
37088
  };
37071
37089
  }
37090
+ /**
37091
+ * Draw Axis Title
37092
+ *
37093
+ * @param {object} chartRect min/max information
37094
+ * @param {object} labelOffset label offset information
37095
+ *
37096
+ * @returns {undefined}
37097
+ */
37098
+
37099
+ }, {
37100
+ key: "drawAxisTitle",
37101
+ value: function drawAxisTitle(chartRect, labelOffset) {
37102
+ var titleOpt = this.title;
37103
+
37104
+ if (!(titleOpt !== null && titleOpt !== void 0 && titleOpt.use) || isNaN(titleOpt.fontSize)) {
37105
+ return;
37106
+ }
37107
+
37108
+ var ctx = this.ctx;
37109
+ ctx.save();
37110
+ ctx.font = helpers_util.getLabelStyle(titleOpt);
37111
+ ctx.fillStyle = titleOpt.color;
37112
+ ctx.textAlign = titleOpt.textAlign;
37113
+ var axisLinePosition = {
37114
+ xLeft: chartRect.x1 + labelOffset.left,
37115
+ xRight: chartRect.x2 - labelOffset.right,
37116
+ yTop: chartRect.y1
37117
+ };
37118
+ var titleXPos;
37119
+ var titleYPos;
37120
+ var margin = 10;
37121
+
37122
+ if (this.type === 'x') {
37123
+ titleXPos = axisLinePosition.xRight;
37124
+ titleYPos = chartRect.y2 + titleOpt.fontSize + margin;
37125
+ } else {
37126
+ titleYPos = axisLinePosition.yTop - titleOpt.fontSize - margin;
37127
+ titleXPos = axisLinePosition.xLeft;
37128
+ }
37129
+
37130
+ if (titleXPos > 0 && titleYPos > 0) {
37131
+ ctx.fillText(titleOpt.text, titleXPos, titleYPos);
37132
+ }
37133
+
37134
+ ctx.restore();
37135
+ }
37072
37136
  /**
37073
37137
  * Draw axis
37074
37138
  * @param {object} chartRect min/max information
@@ -37102,7 +37166,8 @@ var scale_Scale = /*#__PURE__*/function () {
37102
37166
  var endPoint = aPos[this.units.rectEnd];
37103
37167
  var offsetPoint = aPos[this.units.rectOffset(this.position)];
37104
37168
  var offsetCounterPoint = aPos[this.units.rectOffsetCounter(this.position)];
37105
- var aliasPixel; // label font 설정
37169
+ var aliasPixel;
37170
+ this.drawAxisTitle(chartRect, labelOffset); // label font 설정
37106
37171
 
37107
37172
  ctx.font = helpers_util.getLabelStyle(this.labelStyle);
37108
37173
  ctx.fillStyle = this.labelStyle.color;
@@ -38139,6 +38204,7 @@ var scale_step_StepScale = /*#__PURE__*/function (_Scale) {
38139
38204
  var offsetPoint = aPos[this.units.rectOffset(this.position)];
38140
38205
  var offsetCounterPoint = aPos[this.units.rectOffsetCounter(this.position)];
38141
38206
  var maxWidth = chartRect.chartWidth / (this.labels.length + 2);
38207
+ this.drawAxisTitle(chartRect, labelOffset);
38142
38208
 
38143
38209
  if ((_this$labelStyle = this.labelStyle) !== null && _this$labelStyle !== void 0 && _this$labelStyle.show) {
38144
38210
  // label font 설정
@@ -38552,7 +38618,8 @@ var scale_time_category_TimeCategoryScale = /*#__PURE__*/function (_Scale) {
38552
38618
  var startPoint = aPos[this.units.rectStart];
38553
38619
  var endPoint = aPos[this.units.rectEnd];
38554
38620
  var offsetPoint = aPos[this.units.rectOffset(this.position)];
38555
- var offsetCounterPoint = aPos[this.units.rectOffsetCounter(this.position)]; // label font 설정
38621
+ var offsetCounterPoint = aPos[this.units.rectOffsetCounter(this.position)];
38622
+ this.drawAxisTitle(chartRect, labelOffset); // label font 설정
38556
38623
 
38557
38624
  ctx.font = helpers_util.getLabelStyle(this.labelStyle);
38558
38625
 
@@ -40678,6 +40745,8 @@ var plugins_tooltip_modules = {
40678
40745
  * @returns {undefined}
40679
40746
  */
40680
40747
  drawTooltip: function drawTooltip(hitInfo, context) {
40748
+ var _opt$formatter, _opt$formatter2;
40749
+
40681
40750
  var ctx = context;
40682
40751
  var items = hitInfo.items;
40683
40752
  var sId = hitInfo.hitId;
@@ -40695,10 +40764,19 @@ var plugins_tooltip_modules = {
40695
40764
  l: 16
40696
40765
  };
40697
40766
  var isHorizontal = this.options.horizontal;
40698
- var opt = this.options.tooltip; // draw tooltip Title(axis label) and add style class for wrap line about too much long label.
40767
+ var opt = this.options.tooltip;
40768
+ var valueFormatter = typeof opt.formatter === 'function' ? opt.formatter : (_opt$formatter = opt.formatter) === null || _opt$formatter === void 0 ? void 0 : _opt$formatter.value;
40769
+ var titleFormatter = (_opt$formatter2 = opt.formatter) === null || _opt$formatter2 === void 0 ? void 0 : _opt$formatter2.title; // draw tooltip Title(axis label) and add style class for wrap line about too much long label.
40699
40770
 
40700
40771
  if (this.axesX.length && this.axesY.length) {
40701
- this.tooltipHeaderDOM.textContent = this.options.horizontal ? this.axesY[hitAxis.y].getLabelFormat(hitItem.y) : this.axesX[hitAxis.x].getLabelFormat(hitItem.x);
40772
+ if (titleFormatter) {
40773
+ this.tooltipHeaderDOM.textContent = titleFormatter({
40774
+ x: hitItem.x,
40775
+ y: hitItem.y
40776
+ });
40777
+ } else {
40778
+ this.tooltipHeaderDOM.textContent = this.options.horizontal ? this.axesY[hitAxis.y].getLabelFormat(hitItem.y) : this.axesX[hitAxis.x].getLabelFormat(hitItem.x);
40779
+ }
40702
40780
  }
40703
40781
 
40704
40782
  if (opt.textOverflow) {
@@ -40819,14 +40897,14 @@ var plugins_tooltip_modules = {
40819
40897
 
40820
40898
  var formattedTxt = void 0;
40821
40899
 
40822
- if (opt.formatter) {
40900
+ if (valueFormatter) {
40823
40901
  if (this.options.type === 'pie') {
40824
- formattedTxt = opt.formatter({
40902
+ formattedTxt = valueFormatter({
40825
40903
  value: value,
40826
40904
  name: name
40827
40905
  });
40828
40906
  } else {
40829
- formattedTxt = opt.formatter({
40907
+ formattedTxt = valueFormatter({
40830
40908
  x: this.options.horizontal ? value : hitItem.x,
40831
40909
  y: this.options.horizontal ? hitItem.y : value,
40832
40910
  name: name
@@ -40834,7 +40912,7 @@ var plugins_tooltip_modules = {
40834
40912
  }
40835
40913
  }
40836
40914
 
40837
- if (!opt.formatter || typeof formattedTxt !== 'string') {
40915
+ if (!valueFormatter || typeof formattedTxt !== 'string') {
40838
40916
  formattedTxt = numberWithComma(value);
40839
40917
  }
40840
40918
 
@@ -40859,7 +40937,7 @@ var plugins_tooltip_modules = {
40859
40937
  * @returns {undefined}
40860
40938
  */
40861
40939
  drawToolTipForHeatMap: function drawToolTipForHeatMap(hitInfo, context) {
40862
- var _colorAxis$find;
40940
+ var _opt$formatter3, _opt$formatter4, _colorAxis$find;
40863
40941
 
40864
40942
  var ctx = context;
40865
40943
  var items = hitInfo.items;
@@ -40875,6 +40953,8 @@ var plugins_tooltip_modules = {
40875
40953
  };
40876
40954
  var isHorizontal = this.options.horizontal;
40877
40955
  var opt = this.options.tooltip;
40956
+ var valueFormatter = typeof opt.formatter === 'function' ? opt.formatter : (_opt$formatter3 = opt.formatter) === null || _opt$formatter3 === void 0 ? void 0 : _opt$formatter3.value;
40957
+ var titleFormatter = (_opt$formatter4 = opt.formatter) === null || _opt$formatter4 === void 0 ? void 0 : _opt$formatter4.title;
40878
40958
  var colorAxis = Object.values(this.seriesList)[0].colorAxis;
40879
40959
  var isShow = (_colorAxis$find = colorAxis.find(function (_ref) {
40880
40960
  var id = _ref.id;
@@ -40884,14 +40964,18 @@ var plugins_tooltip_modules = {
40884
40964
  if (!isShow) {
40885
40965
  this.tooltipClear();
40886
40966
  return;
40887
- }
40967
+ } // draw tooltip Title(axis label) and add style class for wrap line about too much long label.
40888
40968
 
40889
- var xValue = '';
40890
- var yValue = ''; // draw tooltip Title(axis label) and add style class for wrap line about too much long label.
40891
40969
 
40892
40970
  if (this.axesX.length) {
40893
- xValue = this.axesX[hitAxis.x].getLabelFormat(hitItem.x);
40894
- this.tooltipHeaderDOM.textContent = xValue;
40971
+ if (titleFormatter) {
40972
+ this.tooltipHeaderDOM.textContent = titleFormatter({
40973
+ x: hitItem.x,
40974
+ y: hitItem.y
40975
+ });
40976
+ } else {
40977
+ this.tooltipHeaderDOM.textContent = this.axesX[hitAxis.x].getLabelFormat(hitItem.x);
40978
+ }
40895
40979
  }
40896
40980
 
40897
40981
  if (opt.textOverflow) {
@@ -40930,22 +41014,21 @@ var plugins_tooltip_modules = {
40930
41014
  ctx.textBaseline = 'Bottom';
40931
41015
 
40932
41016
  if (this.axesY.length) {
40933
- yValue = this.axesY[hitAxis.y].getLabelFormat(hitItem.y);
40934
- ctx.fillText(yValue, itemX + COLOR_MARGIN, itemY);
41017
+ ctx.fillText(this.axesY[hitAxis.y].getLabelFormat(hitItem.y), itemX + COLOR_MARGIN, itemY);
40935
41018
  } // 3. Draw value
40936
41019
 
40937
41020
 
40938
41021
  var formattedTxt = itemValue;
40939
41022
 
40940
- if (opt.formatter) {
40941
- formattedTxt = opt.formatter({
40942
- x: xValue,
40943
- y: yValue,
41023
+ if (valueFormatter) {
41024
+ formattedTxt = valueFormatter({
41025
+ x: hitItem.x,
41026
+ y: hitItem.y,
40944
41027
  value: itemValue
40945
41028
  });
40946
41029
  }
40947
41030
 
40948
- if ((!opt.formatter || typeof formattedTxt !== 'string') && itemValue !== 'error') {
41031
+ if ((!valueFormatter || typeof formattedTxt !== 'string') && itemValue !== 'error') {
40949
41032
  formattedTxt = numberWithComma(itemValue);
40950
41033
  }
40951
41034
 
@@ -41019,6 +41102,8 @@ var plugins_tooltip_modules = {
41019
41102
  var textLineCnt = 1;
41020
41103
 
41021
41104
  for (var ix = 0; ix < seriesList.length; ix++) {
41105
+ var _opt$formatter5;
41106
+
41022
41107
  var gdata = seriesList[ix].data;
41023
41108
  var color = seriesList[ix].color;
41024
41109
  var name = seriesList[ix].name;
@@ -41089,16 +41174,17 @@ var plugins_tooltip_modules = {
41089
41174
  ctx.save(); // 3. Draw value
41090
41175
 
41091
41176
  var formattedTxt = void 0;
41177
+ var formatter = typeof opt.formatter === 'function' ? opt.formatter : (_opt$formatter5 = opt.formatter) === null || _opt$formatter5 === void 0 ? void 0 : _opt$formatter5.value;
41092
41178
 
41093
- if (opt.formatter) {
41094
- formattedTxt = opt.formatter({
41179
+ if (formatter) {
41180
+ formattedTxt = formatter({
41095
41181
  x: xValue,
41096
41182
  y: yValue,
41097
41183
  name: name
41098
41184
  });
41099
41185
  }
41100
41186
 
41101
- if (!opt.formatter || typeof formattedTxt !== 'string') {
41187
+ if (!formatter || typeof formattedTxt !== 'string') {
41102
41188
  var formattedXValue = xAxisOpt.type === 'time' ? dayjs_min_default()(xValue).format(xAxisOpt.timeFormat) : numberWithComma(xValue);
41103
41189
  var formattedYValue = numberWithComma(yValue);
41104
41190
  formattedTxt = "".concat(formattedXValue, ", ").concat(formattedYValue);
@@ -42641,19 +42727,39 @@ var chart_core_EvChart = /*#__PURE__*/function () {
42641
42727
  }, {
42642
42728
  key: "getChartRect",
42643
42729
  value: function getChartRect() {
42730
+ var _this$options$axesX$, _this$options$axesY$;
42731
+
42644
42732
  var _this$getChartDOMRect = this.getChartDOMRect(),
42645
42733
  width = _this$getChartDOMRect.width,
42646
42734
  height = _this$getChartDOMRect.height;
42647
42735
 
42648
42736
  var padding = this.options.padding;
42737
+ var xAxisTitleOpt = (_this$options$axesX$ = this.options.axesX[0]) === null || _this$options$axesX$ === void 0 ? void 0 : _this$options$axesX$.title;
42738
+ var yAxisTitleOpt = (_this$options$axesY$ = this.options.axesY[0]) === null || _this$options$axesY$ === void 0 ? void 0 : _this$options$axesY$.title;
42739
+ var titleMargin = 10;
42740
+ var xAxisTitleHeight = 0;
42741
+
42742
+ if (xAxisTitleOpt !== null && xAxisTitleOpt !== void 0 && xAxisTitleOpt.use && xAxisTitleOpt !== null && xAxisTitleOpt !== void 0 && xAxisTitleOpt.text) {
42743
+ var fontSize = isNaN(xAxisTitleOpt === null || xAxisTitleOpt === void 0 ? void 0 : xAxisTitleOpt.fontSize) ? 12 : xAxisTitleOpt === null || xAxisTitleOpt === void 0 ? void 0 : xAxisTitleOpt.fontSize;
42744
+ xAxisTitleHeight = fontSize + titleMargin;
42745
+ }
42746
+
42747
+ var yAxisTitleHeight = 0;
42748
+
42749
+ if (yAxisTitleOpt !== null && yAxisTitleOpt !== void 0 && yAxisTitleOpt.use && yAxisTitleOpt !== null && yAxisTitleOpt !== void 0 && yAxisTitleOpt.text) {
42750
+ var _fontSize = isNaN(yAxisTitleOpt === null || yAxisTitleOpt === void 0 ? void 0 : yAxisTitleOpt.fontSize) ? 12 : yAxisTitleOpt === null || yAxisTitleOpt === void 0 ? void 0 : yAxisTitleOpt.fontSize;
42751
+
42752
+ yAxisTitleHeight = _fontSize + titleMargin;
42753
+ }
42754
+
42649
42755
  var horizontalPadding = padding.left + padding.right;
42650
- var verticalPadding = padding.top + padding.bottom;
42756
+ var verticalPadding = padding.top + padding.bottom + xAxisTitleHeight + yAxisTitleHeight;
42651
42757
  var chartWidth = width > horizontalPadding ? width - horizontalPadding : width;
42652
42758
  var chartHeight = height > verticalPadding ? height - verticalPadding : height;
42653
42759
  var x1 = padding.left;
42654
42760
  var x2 = Math.max(width - padding.right, x1 + 2);
42655
- var y1 = padding.top;
42656
- var y2 = Math.max(height - padding.bottom, y1 + 2);
42761
+ var y1 = padding.top + yAxisTitleHeight;
42762
+ var y2 = Math.max(height - padding.bottom - xAxisTitleHeight, y1 + 2);
42657
42763
  return {
42658
42764
  x1: x1,
42659
42765
  x2: x2,