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.
package/dist/evui.umd.js CHANGED
@@ -7966,7 +7966,7 @@ $({ target: 'Number', stat: true }, {
7966
7966
  /***/ "9224":
7967
7967
  /***/ (function(module) {
7968
7968
 
7969
- module.exports = JSON.parse("{\"a\":\"3.3.17\"}");
7969
+ module.exports = JSON.parse("{\"a\":\"3.3.18\"}");
7970
7970
 
7971
7971
  /***/ }),
7972
7972
 
@@ -32003,7 +32003,15 @@ function reverse(array) {
32003
32003
  * @returns {string} computed value
32004
32004
  */
32005
32005
  getLabelStyle: function getLabelStyle(style) {
32006
- return "normal normal ".concat(style.fontWeight, " ").concat(style.fontSize, "px ").concat(style.fontFamily);
32006
+ var _style$fontStyle = style.fontStyle,
32007
+ fontStyle = _style$fontStyle === void 0 ? 'normal' : _style$fontStyle,
32008
+ _style$fontWeight = style.fontWeight,
32009
+ fontWeight = _style$fontWeight === void 0 ? 'norma' : _style$fontWeight,
32010
+ _style$fontSize = style.fontSize,
32011
+ fontSize = _style$fontSize === void 0 ? '12' : _style$fontSize,
32012
+ _style$fontFamily = style.fontFamily,
32013
+ fontFamily = _style$fontFamily === void 0 ? 'Roboto' : _style$fontFamily;
32014
+ return "".concat(fontStyle, " normal ").concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily);
32007
32015
  },
32008
32016
 
32009
32017
  /**
@@ -34185,6 +34193,16 @@ var AXIS_OPTION = {
34185
34193
  fontWeight: 400,
34186
34194
  fitWidth: false,
34187
34195
  fitDir: 'right'
34196
+ },
34197
+ title: {
34198
+ use: false,
34199
+ text: null,
34200
+ fontWeight: 400,
34201
+ fontSize: 12,
34202
+ fontFamily: 'Roboto',
34203
+ textAlign: 'right',
34204
+ fontStyle: 'normal',
34205
+ color: '#808080'
34188
34206
  }
34189
34207
  };
34190
34208
  var PLOT_LINE_OPTION = {
@@ -37078,6 +37096,52 @@ var scale_Scale = /*#__PURE__*/function () {
37078
37096
  graphMax: graphMax
37079
37097
  };
37080
37098
  }
37099
+ /**
37100
+ * Draw Axis Title
37101
+ *
37102
+ * @param {object} chartRect min/max information
37103
+ * @param {object} labelOffset label offset information
37104
+ *
37105
+ * @returns {undefined}
37106
+ */
37107
+
37108
+ }, {
37109
+ key: "drawAxisTitle",
37110
+ value: function drawAxisTitle(chartRect, labelOffset) {
37111
+ var titleOpt = this.title;
37112
+
37113
+ if (!(titleOpt !== null && titleOpt !== void 0 && titleOpt.use) || isNaN(titleOpt.fontSize)) {
37114
+ return;
37115
+ }
37116
+
37117
+ var ctx = this.ctx;
37118
+ ctx.save();
37119
+ ctx.font = helpers_util.getLabelStyle(titleOpt);
37120
+ ctx.fillStyle = titleOpt.color;
37121
+ ctx.textAlign = titleOpt.textAlign;
37122
+ var axisLinePosition = {
37123
+ xLeft: chartRect.x1 + labelOffset.left,
37124
+ xRight: chartRect.x2 - labelOffset.right,
37125
+ yTop: chartRect.y1
37126
+ };
37127
+ var titleXPos;
37128
+ var titleYPos;
37129
+ var margin = 10;
37130
+
37131
+ if (this.type === 'x') {
37132
+ titleXPos = axisLinePosition.xRight;
37133
+ titleYPos = chartRect.y2 + titleOpt.fontSize + margin;
37134
+ } else {
37135
+ titleYPos = axisLinePosition.yTop - titleOpt.fontSize - margin;
37136
+ titleXPos = axisLinePosition.xLeft;
37137
+ }
37138
+
37139
+ if (titleXPos > 0 && titleYPos > 0) {
37140
+ ctx.fillText(titleOpt.text, titleXPos, titleYPos);
37141
+ }
37142
+
37143
+ ctx.restore();
37144
+ }
37081
37145
  /**
37082
37146
  * Draw axis
37083
37147
  * @param {object} chartRect min/max information
@@ -37111,7 +37175,8 @@ var scale_Scale = /*#__PURE__*/function () {
37111
37175
  var endPoint = aPos[this.units.rectEnd];
37112
37176
  var offsetPoint = aPos[this.units.rectOffset(this.position)];
37113
37177
  var offsetCounterPoint = aPos[this.units.rectOffsetCounter(this.position)];
37114
- var aliasPixel; // label font 설정
37178
+ var aliasPixel;
37179
+ this.drawAxisTitle(chartRect, labelOffset); // label font 설정
37115
37180
 
37116
37181
  ctx.font = helpers_util.getLabelStyle(this.labelStyle);
37117
37182
  ctx.fillStyle = this.labelStyle.color;
@@ -38148,6 +38213,7 @@ var scale_step_StepScale = /*#__PURE__*/function (_Scale) {
38148
38213
  var offsetPoint = aPos[this.units.rectOffset(this.position)];
38149
38214
  var offsetCounterPoint = aPos[this.units.rectOffsetCounter(this.position)];
38150
38215
  var maxWidth = chartRect.chartWidth / (this.labels.length + 2);
38216
+ this.drawAxisTitle(chartRect, labelOffset);
38151
38217
 
38152
38218
  if ((_this$labelStyle = this.labelStyle) !== null && _this$labelStyle !== void 0 && _this$labelStyle.show) {
38153
38219
  // label font 설정
@@ -38561,7 +38627,8 @@ var scale_time_category_TimeCategoryScale = /*#__PURE__*/function (_Scale) {
38561
38627
  var startPoint = aPos[this.units.rectStart];
38562
38628
  var endPoint = aPos[this.units.rectEnd];
38563
38629
  var offsetPoint = aPos[this.units.rectOffset(this.position)];
38564
- var offsetCounterPoint = aPos[this.units.rectOffsetCounter(this.position)]; // label font 설정
38630
+ var offsetCounterPoint = aPos[this.units.rectOffsetCounter(this.position)];
38631
+ this.drawAxisTitle(chartRect, labelOffset); // label font 설정
38565
38632
 
38566
38633
  ctx.font = helpers_util.getLabelStyle(this.labelStyle);
38567
38634
 
@@ -40687,6 +40754,8 @@ var plugins_tooltip_modules = {
40687
40754
  * @returns {undefined}
40688
40755
  */
40689
40756
  drawTooltip: function drawTooltip(hitInfo, context) {
40757
+ var _opt$formatter, _opt$formatter2;
40758
+
40690
40759
  var ctx = context;
40691
40760
  var items = hitInfo.items;
40692
40761
  var sId = hitInfo.hitId;
@@ -40704,10 +40773,19 @@ var plugins_tooltip_modules = {
40704
40773
  l: 16
40705
40774
  };
40706
40775
  var isHorizontal = this.options.horizontal;
40707
- var opt = this.options.tooltip; // draw tooltip Title(axis label) and add style class for wrap line about too much long label.
40776
+ var opt = this.options.tooltip;
40777
+ var valueFormatter = typeof opt.formatter === 'function' ? opt.formatter : (_opt$formatter = opt.formatter) === null || _opt$formatter === void 0 ? void 0 : _opt$formatter.value;
40778
+ 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.
40708
40779
 
40709
40780
  if (this.axesX.length && this.axesY.length) {
40710
- this.tooltipHeaderDOM.textContent = this.options.horizontal ? this.axesY[hitAxis.y].getLabelFormat(hitItem.y) : this.axesX[hitAxis.x].getLabelFormat(hitItem.x);
40781
+ if (titleFormatter) {
40782
+ this.tooltipHeaderDOM.textContent = titleFormatter({
40783
+ x: hitItem.x,
40784
+ y: hitItem.y
40785
+ });
40786
+ } else {
40787
+ this.tooltipHeaderDOM.textContent = this.options.horizontal ? this.axesY[hitAxis.y].getLabelFormat(hitItem.y) : this.axesX[hitAxis.x].getLabelFormat(hitItem.x);
40788
+ }
40711
40789
  }
40712
40790
 
40713
40791
  if (opt.textOverflow) {
@@ -40828,14 +40906,14 @@ var plugins_tooltip_modules = {
40828
40906
 
40829
40907
  var formattedTxt = void 0;
40830
40908
 
40831
- if (opt.formatter) {
40909
+ if (valueFormatter) {
40832
40910
  if (this.options.type === 'pie') {
40833
- formattedTxt = opt.formatter({
40911
+ formattedTxt = valueFormatter({
40834
40912
  value: value,
40835
40913
  name: name
40836
40914
  });
40837
40915
  } else {
40838
- formattedTxt = opt.formatter({
40916
+ formattedTxt = valueFormatter({
40839
40917
  x: this.options.horizontal ? value : hitItem.x,
40840
40918
  y: this.options.horizontal ? hitItem.y : value,
40841
40919
  name: name
@@ -40843,7 +40921,7 @@ var plugins_tooltip_modules = {
40843
40921
  }
40844
40922
  }
40845
40923
 
40846
- if (!opt.formatter || typeof formattedTxt !== 'string') {
40924
+ if (!valueFormatter || typeof formattedTxt !== 'string') {
40847
40925
  formattedTxt = numberWithComma(value);
40848
40926
  }
40849
40927
 
@@ -40868,7 +40946,7 @@ var plugins_tooltip_modules = {
40868
40946
  * @returns {undefined}
40869
40947
  */
40870
40948
  drawToolTipForHeatMap: function drawToolTipForHeatMap(hitInfo, context) {
40871
- var _colorAxis$find;
40949
+ var _opt$formatter3, _opt$formatter4, _colorAxis$find;
40872
40950
 
40873
40951
  var ctx = context;
40874
40952
  var items = hitInfo.items;
@@ -40884,6 +40962,8 @@ var plugins_tooltip_modules = {
40884
40962
  };
40885
40963
  var isHorizontal = this.options.horizontal;
40886
40964
  var opt = this.options.tooltip;
40965
+ var valueFormatter = typeof opt.formatter === 'function' ? opt.formatter : (_opt$formatter3 = opt.formatter) === null || _opt$formatter3 === void 0 ? void 0 : _opt$formatter3.value;
40966
+ var titleFormatter = (_opt$formatter4 = opt.formatter) === null || _opt$formatter4 === void 0 ? void 0 : _opt$formatter4.title;
40887
40967
  var colorAxis = Object.values(this.seriesList)[0].colorAxis;
40888
40968
  var isShow = (_colorAxis$find = colorAxis.find(function (_ref) {
40889
40969
  var id = _ref.id;
@@ -40893,14 +40973,18 @@ var plugins_tooltip_modules = {
40893
40973
  if (!isShow) {
40894
40974
  this.tooltipClear();
40895
40975
  return;
40896
- }
40976
+ } // draw tooltip Title(axis label) and add style class for wrap line about too much long label.
40897
40977
 
40898
- var xValue = '';
40899
- var yValue = ''; // draw tooltip Title(axis label) and add style class for wrap line about too much long label.
40900
40978
 
40901
40979
  if (this.axesX.length) {
40902
- xValue = this.axesX[hitAxis.x].getLabelFormat(hitItem.x);
40903
- this.tooltipHeaderDOM.textContent = xValue;
40980
+ if (titleFormatter) {
40981
+ this.tooltipHeaderDOM.textContent = titleFormatter({
40982
+ x: hitItem.x,
40983
+ y: hitItem.y
40984
+ });
40985
+ } else {
40986
+ this.tooltipHeaderDOM.textContent = this.axesX[hitAxis.x].getLabelFormat(hitItem.x);
40987
+ }
40904
40988
  }
40905
40989
 
40906
40990
  if (opt.textOverflow) {
@@ -40939,22 +41023,21 @@ var plugins_tooltip_modules = {
40939
41023
  ctx.textBaseline = 'Bottom';
40940
41024
 
40941
41025
  if (this.axesY.length) {
40942
- yValue = this.axesY[hitAxis.y].getLabelFormat(hitItem.y);
40943
- ctx.fillText(yValue, itemX + COLOR_MARGIN, itemY);
41026
+ ctx.fillText(this.axesY[hitAxis.y].getLabelFormat(hitItem.y), itemX + COLOR_MARGIN, itemY);
40944
41027
  } // 3. Draw value
40945
41028
 
40946
41029
 
40947
41030
  var formattedTxt = itemValue;
40948
41031
 
40949
- if (opt.formatter) {
40950
- formattedTxt = opt.formatter({
40951
- x: xValue,
40952
- y: yValue,
41032
+ if (valueFormatter) {
41033
+ formattedTxt = valueFormatter({
41034
+ x: hitItem.x,
41035
+ y: hitItem.y,
40953
41036
  value: itemValue
40954
41037
  });
40955
41038
  }
40956
41039
 
40957
- if ((!opt.formatter || typeof formattedTxt !== 'string') && itemValue !== 'error') {
41040
+ if ((!valueFormatter || typeof formattedTxt !== 'string') && itemValue !== 'error') {
40958
41041
  formattedTxt = numberWithComma(itemValue);
40959
41042
  }
40960
41043
 
@@ -41028,6 +41111,8 @@ var plugins_tooltip_modules = {
41028
41111
  var textLineCnt = 1;
41029
41112
 
41030
41113
  for (var ix = 0; ix < seriesList.length; ix++) {
41114
+ var _opt$formatter5;
41115
+
41031
41116
  var gdata = seriesList[ix].data;
41032
41117
  var color = seriesList[ix].color;
41033
41118
  var name = seriesList[ix].name;
@@ -41098,16 +41183,17 @@ var plugins_tooltip_modules = {
41098
41183
  ctx.save(); // 3. Draw value
41099
41184
 
41100
41185
  var formattedTxt = void 0;
41186
+ var formatter = typeof opt.formatter === 'function' ? opt.formatter : (_opt$formatter5 = opt.formatter) === null || _opt$formatter5 === void 0 ? void 0 : _opt$formatter5.value;
41101
41187
 
41102
- if (opt.formatter) {
41103
- formattedTxt = opt.formatter({
41188
+ if (formatter) {
41189
+ formattedTxt = formatter({
41104
41190
  x: xValue,
41105
41191
  y: yValue,
41106
41192
  name: name
41107
41193
  });
41108
41194
  }
41109
41195
 
41110
- if (!opt.formatter || typeof formattedTxt !== 'string') {
41196
+ if (!formatter || typeof formattedTxt !== 'string') {
41111
41197
  var formattedXValue = xAxisOpt.type === 'time' ? dayjs_min_default()(xValue).format(xAxisOpt.timeFormat) : numberWithComma(xValue);
41112
41198
  var formattedYValue = numberWithComma(yValue);
41113
41199
  formattedTxt = "".concat(formattedXValue, ", ").concat(formattedYValue);
@@ -42650,19 +42736,39 @@ var chart_core_EvChart = /*#__PURE__*/function () {
42650
42736
  }, {
42651
42737
  key: "getChartRect",
42652
42738
  value: function getChartRect() {
42739
+ var _this$options$axesX$, _this$options$axesY$;
42740
+
42653
42741
  var _this$getChartDOMRect = this.getChartDOMRect(),
42654
42742
  width = _this$getChartDOMRect.width,
42655
42743
  height = _this$getChartDOMRect.height;
42656
42744
 
42657
42745
  var padding = this.options.padding;
42746
+ var xAxisTitleOpt = (_this$options$axesX$ = this.options.axesX[0]) === null || _this$options$axesX$ === void 0 ? void 0 : _this$options$axesX$.title;
42747
+ var yAxisTitleOpt = (_this$options$axesY$ = this.options.axesY[0]) === null || _this$options$axesY$ === void 0 ? void 0 : _this$options$axesY$.title;
42748
+ var titleMargin = 10;
42749
+ var xAxisTitleHeight = 0;
42750
+
42751
+ if (xAxisTitleOpt !== null && xAxisTitleOpt !== void 0 && xAxisTitleOpt.use && xAxisTitleOpt !== null && xAxisTitleOpt !== void 0 && xAxisTitleOpt.text) {
42752
+ var fontSize = isNaN(xAxisTitleOpt === null || xAxisTitleOpt === void 0 ? void 0 : xAxisTitleOpt.fontSize) ? 12 : xAxisTitleOpt === null || xAxisTitleOpt === void 0 ? void 0 : xAxisTitleOpt.fontSize;
42753
+ xAxisTitleHeight = fontSize + titleMargin;
42754
+ }
42755
+
42756
+ var yAxisTitleHeight = 0;
42757
+
42758
+ if (yAxisTitleOpt !== null && yAxisTitleOpt !== void 0 && yAxisTitleOpt.use && yAxisTitleOpt !== null && yAxisTitleOpt !== void 0 && yAxisTitleOpt.text) {
42759
+ var _fontSize = isNaN(yAxisTitleOpt === null || yAxisTitleOpt === void 0 ? void 0 : yAxisTitleOpt.fontSize) ? 12 : yAxisTitleOpt === null || yAxisTitleOpt === void 0 ? void 0 : yAxisTitleOpt.fontSize;
42760
+
42761
+ yAxisTitleHeight = _fontSize + titleMargin;
42762
+ }
42763
+
42658
42764
  var horizontalPadding = padding.left + padding.right;
42659
- var verticalPadding = padding.top + padding.bottom;
42765
+ var verticalPadding = padding.top + padding.bottom + xAxisTitleHeight + yAxisTitleHeight;
42660
42766
  var chartWidth = width > horizontalPadding ? width - horizontalPadding : width;
42661
42767
  var chartHeight = height > verticalPadding ? height - verticalPadding : height;
42662
42768
  var x1 = padding.left;
42663
42769
  var x2 = Math.max(width - padding.right, x1 + 2);
42664
- var y1 = padding.top;
42665
- var y2 = Math.max(height - padding.bottom, y1 + 2);
42770
+ var y1 = padding.top + yAxisTitleHeight;
42771
+ var y2 = Math.max(height - padding.bottom - xAxisTitleHeight, y1 + 2);
42666
42772
  return {
42667
42773
  x1: x1,
42668
42774
  x2: x2,