evui 3.3.8 → 3.3.9

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
@@ -7895,7 +7895,7 @@ $({ target: 'Number', stat: true }, {
7895
7895
  /***/ "9224":
7896
7896
  /***/ (function(module) {
7897
7897
 
7898
- module.exports = JSON.parse("{\"a\":\"3.3.8\"}");
7898
+ module.exports = JSON.parse("{\"a\":\"3.3.9\"}");
7899
7899
 
7900
7900
  /***/ }),
7901
7901
 
@@ -31879,6 +31879,11 @@ var modules = {
31879
31879
  dataIndex = _ref.dataIndex;
31880
31880
  var useApproximate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
31881
31881
  var dataInfo = this.getDataByValues(seriesID, dataIndex);
31882
+
31883
+ if (!dataInfo || !(dataInfo !== null && dataInfo !== void 0 && dataInfo.xp) || !(dataInfo !== null && dataInfo !== void 0 && dataInfo.yp)) {
31884
+ return null;
31885
+ }
31886
+
31882
31887
  return this.getItemByPosition([dataInfo.xp, dataInfo.yp], useApproximate);
31883
31888
  },
31884
31889
 
@@ -32940,7 +32945,8 @@ var BAR_OPTION = {
32940
32945
  use: false,
32941
32946
  fontSize: 12,
32942
32947
  textColor: '#000000',
32943
- formatter: null
32948
+ formatter: null,
32949
+ decimalPoint: 0
32944
32950
  }
32945
32951
  };
32946
32952
  var PIE_OPTION = {
@@ -32950,6 +32956,12 @@ var PIE_OPTION = {
32950
32956
  show: true,
32951
32957
  color: '#FFFFFF',
32952
32958
  lineWidth: 2
32959
+ },
32960
+ showValue: {
32961
+ use: false,
32962
+ fontSize: 12,
32963
+ textColor: '#000000',
32964
+ formatter: null
32953
32965
  }
32954
32966
  };
32955
32967
  var AXIS_OPTION = {
@@ -34317,7 +34329,8 @@ var element_bar_Bar = /*#__PURE__*/function () {
34317
34329
  fontSize = _this$showValue.fontSize,
34318
34330
  textColor = _this$showValue.textColor,
34319
34331
  align = _this$showValue.align,
34320
- formatter = _this$showValue.formatter;
34332
+ formatter = _this$showValue.formatter,
34333
+ decimalPoint = _this$showValue.decimalPoint;
34321
34334
  var x = positions.x,
34322
34335
  y = positions.y,
34323
34336
  w = positions.w,
@@ -34348,7 +34361,7 @@ var element_bar_Bar = /*#__PURE__*/function () {
34348
34361
  }
34349
34362
 
34350
34363
  if (!formatter || typeof formattedTxt !== 'string') {
34351
- formattedTxt = helpers_util.labelSignFormat(value);
34364
+ formattedTxt = helpers_util.labelSignFormat(value, decimalPoint);
34352
34365
  }
34353
34366
 
34354
34367
  var vw = Math.round(ctx.measureText(formattedTxt).width);
@@ -34798,6 +34811,7 @@ var element_pie_Pie = /*#__PURE__*/function () {
34798
34811
  this.centerX = 0;
34799
34812
  this.centerY = 0;
34800
34813
  this.radius = 0;
34814
+ this.doughnutHoleSize = 0;
34801
34815
  this.startAngle = 0;
34802
34816
  this.endAngle = 0;
34803
34817
  this.slice = null;
@@ -34818,9 +34832,12 @@ var element_pie_Pie = /*#__PURE__*/function () {
34818
34832
  _createClass(Pie, [{
34819
34833
  key: "draw",
34820
34834
  value: function draw(context, strokeOptions) {
34835
+ var _this$showValue;
34836
+
34821
34837
  var ctx = context !== null && context !== void 0 ? context : this.ctx;
34822
34838
  var slice = new Path2D();
34823
34839
  var radius = this.isSelect ? this.radius + 5 : this.radius;
34840
+ var doughnutHoleRadius = this.radius * this.doughnutHoleSize;
34824
34841
  var color = this.color;
34825
34842
  var noneDownplayOpacity = color.includes('rgba') ? helpers_util.getOpacity(color) : 1;
34826
34843
  var opacity = this.state === 'downplay' ? 0.1 : noneDownplayOpacity;
@@ -34838,6 +34855,10 @@ var element_pie_Pie = /*#__PURE__*/function () {
34838
34855
  ctx.stroke(slice);
34839
34856
  }
34840
34857
 
34858
+ if ((_this$showValue = this.showValue) !== null && _this$showValue !== void 0 && _this$showValue.use) {
34859
+ this.drawValueLabels(ctx, doughnutHoleRadius);
34860
+ }
34861
+
34841
34862
  ctx.closePath();
34842
34863
  this.slice = slice;
34843
34864
  this.ctx = ctx;
@@ -34887,8 +34908,11 @@ var element_pie_Pie = /*#__PURE__*/function () {
34887
34908
  }, {
34888
34909
  key: "itemHighlight",
34889
34910
  value: function itemHighlight(item, context) {
34911
+ var _this$showValue2;
34912
+
34890
34913
  var ctx = context;
34891
34914
  var radius = this.isSelect ? this.radius + 5 : this.radius;
34915
+ var doughnutHoleRadius = this.radius * this.doughnutHoleSize;
34892
34916
  ctx.save();
34893
34917
  ctx.shadowOffsetX = 0;
34894
34918
  ctx.shadowOffsetY = 0;
@@ -34901,9 +34925,62 @@ var element_pie_Pie = /*#__PURE__*/function () {
34901
34925
  ctx.arc(this.centerX, this.centerY, radius, this.startAngle, this.endAngle);
34902
34926
  ctx.lineTo(this.centerX, this.centerY);
34903
34927
  ctx.fill();
34928
+
34929
+ if ((_this$showValue2 = this.showValue) !== null && _this$showValue2 !== void 0 && _this$showValue2.use) {
34930
+ this.drawValueLabels(ctx, doughnutHoleRadius);
34931
+ }
34932
+
34904
34933
  ctx.closePath();
34905
34934
  ctx.restore();
34906
34935
  }
34936
+ /**
34937
+ * Draw value label if series 'use' of showValue option is true
34938
+ *
34939
+ * @param context canvas context
34940
+ */
34941
+
34942
+ }, {
34943
+ key: "drawValueLabels",
34944
+ value: function drawValueLabels(context) {
34945
+ var _this$showValue3 = this.showValue,
34946
+ fontSize = _this$showValue3.fontSize,
34947
+ textColor = _this$showValue3.textColor,
34948
+ formatter = _this$showValue3.formatter;
34949
+ var ctx = context;
34950
+ ctx.save();
34951
+ ctx.beginPath();
34952
+ ctx.font = "normal normal normal ".concat(fontSize, "px Roboto");
34953
+ ctx.fillStyle = textColor;
34954
+ ctx.lineWidth = 1;
34955
+ ctx.textAlign = 'center';
34956
+ ctx.textBaseline = 'middle';
34957
+ var value = this.data.o;
34958
+ var formattedTxt;
34959
+
34960
+ if (formatter) {
34961
+ formattedTxt = formatter(value);
34962
+ }
34963
+
34964
+ if (!formatter || typeof formattedTxt !== 'string') {
34965
+ formattedTxt = helpers_util.labelSignFormat(value);
34966
+ }
34967
+
34968
+ var ratio = 1.8;
34969
+ var radius = this.radius - this.doughnutHoleSize;
34970
+ var innerAngle = (this.endAngle - this.startAngle) * 180 / Math.PI;
34971
+ var valueHeight = fontSize + 4;
34972
+ var valueWidth = Math.round(ctx.measureText(formattedTxt).width);
34973
+
34974
+ if (innerAngle >= valueWidth * ratio && innerAngle >= valueHeight * ratio && radius >= valueWidth * ratio && radius >= valueHeight * ratio) {
34975
+ var halfRadius = radius / 2 + this.doughnutHoleSize;
34976
+ var centerAngle = (this.endAngle - this.startAngle) / 2 + this.startAngle;
34977
+ var xPos = halfRadius * Math.cos(centerAngle) + this.centerX;
34978
+ var yPos = halfRadius * Math.sin(centerAngle) + this.centerY;
34979
+ ctx.fillText(formattedTxt, xPos, yPos);
34980
+ }
34981
+
34982
+ ctx.restore();
34983
+ }
34907
34984
  }]);
34908
34985
 
34909
34986
  return Pie;
@@ -38578,6 +38655,8 @@ var plugins_pie_modules = {
38578
38655
  series = this.seriesList[slice.id];
38579
38656
 
38580
38657
  if (value) {
38658
+ var _pieOption$doughnutHo;
38659
+
38581
38660
  var strokeOptions = _objectSpread2({}, pieOption.pieStroke);
38582
38661
 
38583
38662
  if (pie.data.length === 1 && pieOption.pieStroke.use) {
@@ -38593,6 +38672,7 @@ var plugins_pie_modules = {
38593
38672
  series.centerX = centerX;
38594
38673
  series.centerY = centerY;
38595
38674
  series.radius = radius;
38675
+ series.doughnutHoleSize = radius * ((_pieOption$doughnutHo = pieOption.doughnutHoleSize) !== null && _pieOption$doughnutHo !== void 0 ? _pieOption$doughnutHo : 0);
38596
38676
  series.startAngle = startAngle;
38597
38677
  series.endAngle = endAngle;
38598
38678
  series.data = {
@@ -38674,6 +38754,8 @@ var plugins_pie_modules = {
38674
38754
  series = this.seriesList[slice.id];
38675
38755
 
38676
38756
  if (slice.value) {
38757
+ var _pieOption$doughnutHo2;
38758
+
38677
38759
  var strokeOptions = _objectSpread2({}, pieOption.pieStroke);
38678
38760
 
38679
38761
  if (pie.data.length === 1 && pieOption.pieStroke.use) {
@@ -38689,6 +38771,7 @@ var plugins_pie_modules = {
38689
38771
  series.centerX = centerX;
38690
38772
  series.centerY = centerY;
38691
38773
  series.radius = radius;
38774
+ series.doughnutHoleSize = radius * ((_pieOption$doughnutHo2 = pieOption.doughnutHoleSize) !== null && _pieOption$doughnutHo2 !== void 0 ? _pieOption$doughnutHo2 : 0);
38692
38775
  series.startAngle = slice.sa;
38693
38776
  series.endAngle = slice.ea;
38694
38777
  series.data = {