@visactor/vchart 2.0.20-alpha.2 → 2.0.20-alpha.3

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.
Files changed (128) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +194 -98
  3. package/build/index.js +194 -98
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/compile/compiler.d.ts +0 -2
  7. package/cjs/compile/compiler.js +2 -14
  8. package/cjs/compile/compiler.js.map +1 -1
  9. package/cjs/compile/mark/interface.d.ts +1 -0
  10. package/cjs/compile/mark/interface.js.map +1 -1
  11. package/cjs/compile/mark/mark-state-manager.d.ts +1 -0
  12. package/cjs/compile/mark/mark-state-manager.js +3 -0
  13. package/cjs/compile/mark/mark-state-manager.js.map +1 -1
  14. package/cjs/component/axis/base-axis.d.ts +9 -1
  15. package/cjs/component/axis/base-axis.js +37 -7
  16. package/cjs/component/axis/base-axis.js.map +1 -1
  17. package/cjs/component/axis/cartesian/axis.js +4 -3
  18. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  19. package/cjs/component/axis/cartesian/interface/spec.d.ts +1 -0
  20. package/cjs/component/axis/cartesian/interface/spec.js.map +1 -1
  21. package/cjs/component/axis/mixin/band-axis-mixin.d.ts +1 -0
  22. package/cjs/component/axis/mixin/band-axis-mixin.js +1 -1
  23. package/cjs/component/axis/mixin/band-axis-mixin.js.map +1 -1
  24. package/cjs/component/axis/mixin/linear-axis-mixin.d.ts +1 -0
  25. package/cjs/component/axis/mixin/linear-axis-mixin.js +1 -1
  26. package/cjs/component/axis/mixin/linear-axis-mixin.js.map +1 -1
  27. package/cjs/component/axis/polar/axis.js +1 -1
  28. package/cjs/component/axis/polar/axis.js.map +1 -1
  29. package/cjs/component/legend/continuous/interface.d.ts +5 -2
  30. package/cjs/component/legend/continuous/interface.js.map +1 -1
  31. package/cjs/component/legend/continuous/util.js +12 -4
  32. package/cjs/component/legend/continuous/util.js.map +1 -1
  33. package/cjs/constant/funnel.js +1 -1
  34. package/cjs/constant/gradient.js +1 -1
  35. package/cjs/constant/hierarchy.js +1 -1
  36. package/cjs/constant/label.js +1 -1
  37. package/cjs/constant/layout.js +1 -1
  38. package/cjs/constant/marker.js +1 -1
  39. package/cjs/constant/polar.js +1 -1
  40. package/cjs/constant/scatter.js +1 -1
  41. package/cjs/constant/scroll-bar.js +2 -1
  42. package/cjs/constant/sunburst.js +1 -1
  43. package/cjs/constant/waterfall.js +1 -1
  44. package/cjs/constant/word-cloud.js +1 -1
  45. package/cjs/core/interface.js +1 -1
  46. package/cjs/core/util.js +1 -1
  47. package/cjs/core/vchart.js +1 -1
  48. package/cjs/data/initialize.js +1 -1
  49. package/cjs/data/register.js +1 -1
  50. package/cjs/env/env.js +1 -1
  51. package/cjs/env/index.js +1 -1
  52. package/cjs/event/bubble.js +1 -1
  53. package/cjs/event/event-dispatcher.js +1 -1
  54. package/cjs/event/event.js +1 -1
  55. package/cjs/event/index.js +1 -1
  56. package/cjs/event/interface.js +1 -2
  57. package/cjs/mark/base/base-mark.d.ts +1 -0
  58. package/cjs/mark/base/base-mark.js +11 -4
  59. package/cjs/mark/base/base-mark.js.map +1 -1
  60. package/cjs/mark/interface/common.d.ts +1 -0
  61. package/cjs/mark/interface/common.js.map +1 -1
  62. package/cjs/series/base/base-series.js +1 -1
  63. package/cjs/series/base/base-series.js.map +1 -1
  64. package/cjs/series/pie/pie.d.ts +2 -0
  65. package/cjs/series/pie/pie.js +6 -4
  66. package/cjs/series/pie/pie.js.map +1 -1
  67. package/esm/compile/compiler.d.ts +0 -2
  68. package/esm/compile/compiler.js +2 -14
  69. package/esm/compile/compiler.js.map +1 -1
  70. package/esm/compile/mark/interface.d.ts +1 -0
  71. package/esm/compile/mark/interface.js.map +1 -1
  72. package/esm/compile/mark/mark-state-manager.d.ts +1 -0
  73. package/esm/compile/mark/mark-state-manager.js +3 -0
  74. package/esm/compile/mark/mark-state-manager.js.map +1 -1
  75. package/esm/component/axis/base-axis.d.ts +9 -1
  76. package/esm/component/axis/base-axis.js +37 -7
  77. package/esm/component/axis/base-axis.js.map +1 -1
  78. package/esm/component/axis/cartesian/axis.js +4 -3
  79. package/esm/component/axis/cartesian/axis.js.map +1 -1
  80. package/esm/component/axis/cartesian/interface/spec.d.ts +1 -0
  81. package/esm/component/axis/cartesian/interface/spec.js.map +1 -1
  82. package/esm/component/axis/mixin/band-axis-mixin.d.ts +1 -0
  83. package/esm/component/axis/mixin/band-axis-mixin.js +1 -1
  84. package/esm/component/axis/mixin/band-axis-mixin.js.map +1 -1
  85. package/esm/component/axis/mixin/linear-axis-mixin.d.ts +1 -0
  86. package/esm/component/axis/mixin/linear-axis-mixin.js +1 -1
  87. package/esm/component/axis/mixin/linear-axis-mixin.js.map +1 -1
  88. package/esm/component/axis/polar/axis.js +1 -1
  89. package/esm/component/axis/polar/axis.js.map +1 -1
  90. package/esm/component/legend/continuous/interface.d.ts +5 -2
  91. package/esm/component/legend/continuous/interface.js.map +1 -1
  92. package/esm/component/legend/continuous/util.js +9 -2
  93. package/esm/component/legend/continuous/util.js.map +1 -1
  94. package/esm/constant/funnel.js +1 -1
  95. package/esm/constant/gradient.js +1 -1
  96. package/esm/constant/hierarchy.js +1 -1
  97. package/esm/constant/label.js +1 -1
  98. package/esm/constant/layout.js +1 -1
  99. package/esm/constant/marker.js +1 -1
  100. package/esm/constant/polar.js +1 -1
  101. package/esm/constant/scatter.js +1 -1
  102. package/esm/constant/scroll-bar.js +2 -1
  103. package/esm/constant/sunburst.js +1 -1
  104. package/esm/constant/waterfall.js +1 -1
  105. package/esm/constant/word-cloud.js +1 -1
  106. package/esm/core/interface.js +1 -1
  107. package/esm/core/util.js +1 -1
  108. package/esm/core/vchart.js +1 -1
  109. package/esm/data/initialize.js +1 -1
  110. package/esm/data/register.js +1 -1
  111. package/esm/env/env.js +1 -1
  112. package/esm/env/index.js +1 -1
  113. package/esm/event/bubble.js +1 -1
  114. package/esm/event/event-dispatcher.js +1 -1
  115. package/esm/event/event.js +1 -1
  116. package/esm/event/index.js +1 -1
  117. package/esm/event/interface.js +1 -2
  118. package/esm/mark/base/base-mark.d.ts +1 -0
  119. package/esm/mark/base/base-mark.js +12 -4
  120. package/esm/mark/base/base-mark.js.map +1 -1
  121. package/esm/mark/interface/common.d.ts +1 -0
  122. package/esm/mark/interface/common.js.map +1 -1
  123. package/esm/series/base/base-series.js +1 -1
  124. package/esm/series/base/base-series.js.map +1 -1
  125. package/esm/series/pie/pie.d.ts +2 -0
  126. package/esm/series/pie/pie.js +7 -4
  127. package/esm/series/pie/pie.js.map +1 -1
  128. package/package.json +7 -7
package/build/index.es.js CHANGED
@@ -22135,9 +22135,10 @@ class DefaultTextBackgroundRenderContribution extends DefaultBaseBackgroundRende
22135
22135
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
22136
22136
  } else {
22137
22137
  const {
22138
- backgroundCornerRadius: backgroundCornerRadius
22138
+ backgroundCornerRadius: backgroundCornerRadius,
22139
+ backgroundOpacity = 1
22139
22140
  } = graphic.attribute;
22140
- context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = background, backgroundCornerRadius ? (createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius, !0), context.fill()) : context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
22141
+ context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.globalAlpha = backgroundOpacity, context.fillStyle = background, backgroundCornerRadius ? (createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius, !0), context.fill()) : context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
22141
22142
  }
22142
22143
  shouldReCalBounds && boundsAllocate.free(b), restore();
22143
22144
  }
@@ -44071,8 +44072,9 @@ class LabelBase extends AnimateComponent {
44071
44072
  const label = labels[i];
44072
44073
  if (!label) continue;
44073
44074
  const baseMark = this.getRelatedGraphic(label.attribute);
44074
- let backgroundColor = baseMark.getAttributes(!0).fill,
44075
- foregroundColor = label.attribute.fill;
44075
+ let backgroundColor = baseMark.getAttributes(!0).fill;
44076
+ const backgroundOpacity = baseMark.getAttributes(!0).fillOpacity;
44077
+ let foregroundColor = label.attribute.fill;
44076
44078
  if (isObject$2(backgroundColor) && backgroundColor.gradient) {
44077
44079
  const firstStopColor = null === (_g = null === (_f = backgroundColor.stops) || void 0 === _f ? void 0 : _f[0]) || void 0 === _g ? void 0 : _g.color;
44078
44080
  firstStopColor && (backgroundColor = firstStopColor, foregroundColor = firstStopColor);
@@ -44086,11 +44088,26 @@ class LabelBase extends AnimateComponent {
44086
44088
  if (fill && label.setAttributes({
44087
44089
  fill: fill
44088
44090
  }), 0 === label.attribute.lineWidth || 0 === label.attribute.strokeOpacity) continue;
44089
- const stroke = smartInvertStrategy(strokeStrategy, backgroundColor, invertColor, similarColor);
44090
- stroke && label.setAttributes({
44091
- stroke: stroke
44092
- });
44091
+ if ("background" === interactInvertType) label.setAttributes({
44092
+ stroke: !1
44093
+ });else {
44094
+ const stroke = smartInvertStrategy(strokeStrategy, backgroundColor, invertColor, similarColor);
44095
+ stroke && label.setAttributes({
44096
+ stroke: stroke
44097
+ });
44098
+ }
44093
44099
  } else if (isIntersect && "none" !== interactInvertType) {
44100
+ if ("background" === interactInvertType) {
44101
+ const fill = smartInvertStrategy(fillStrategy, backgroundColor, invertColor, similarColor);
44102
+ fill && label.setAttributes({
44103
+ fill: fill
44104
+ }), label.setAttributes({
44105
+ stroke: !1,
44106
+ background: backgroundColor,
44107
+ backgroundOpacity: backgroundOpacity
44108
+ });
44109
+ continue;
44110
+ }
44094
44111
  if (0 === label.attribute.lineWidth || 0 === label.attribute.strokeOpacity) continue;
44095
44112
  if (label.attribute.stroke) {
44096
44113
  label.setAttributes({
@@ -44107,6 +44124,9 @@ class LabelBase extends AnimateComponent {
44107
44124
  stroke: stroke
44108
44125
  });
44109
44126
  }
44127
+ !1 === isInside && "background" === interactInvertType && label.setAttributes({
44128
+ background: null
44129
+ });
44110
44130
  }
44111
44131
  }
44112
44132
  _canPlaceInside(textBound, shapeBound) {
@@ -49650,7 +49670,31 @@ class Slider extends AbstractComponent {
49650
49670
  return graphicCreator.symbol(style);
49651
49671
  }
49652
49672
  _renderHandlerText(value, position) {
49653
- var _a, _b, _c;
49673
+ return graphicCreator.text(this._getHandlerTextAttributes(value, position));
49674
+ }
49675
+ _getHandlerPosition(isStart) {
49676
+ return this.attribute.range && isStart ? "start" : "end";
49677
+ }
49678
+ _getHandlerTextStyle(value, position) {
49679
+ const {
49680
+ align: align,
49681
+ handlerSize = 14,
49682
+ handlerText = {},
49683
+ railHeight: railHeight,
49684
+ railWidth: railWidth,
49685
+ slidable: slidable
49686
+ } = this.attribute;
49687
+ return isFunction$1(handlerText.style) ? handlerText.style(value, position, {
49688
+ layout: this.attribute.layout,
49689
+ align: align,
49690
+ railWidth: railWidth,
49691
+ railHeight: railHeight,
49692
+ handlerSize: handlerSize,
49693
+ slidable: slidable
49694
+ }) : handlerText.style;
49695
+ }
49696
+ _getHandlerTextAttributes(value, position) {
49697
+ var _a, _b;
49654
49698
  const {
49655
49699
  align: align,
49656
49700
  handlerSize = 14,
@@ -49662,13 +49706,13 @@ class Slider extends AbstractComponent {
49662
49706
  isHorizontal = this._isHorizontal,
49663
49707
  pos = this.calculatePosByValue(value, position),
49664
49708
  textSpace = null !== (_a = handlerText.space) && void 0 !== _a ? _a : 4,
49709
+ handlerTextStyle = this._getHandlerTextStyle(value, position),
49665
49710
  textStyle = {
49666
49711
  text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_b = handlerText.precision) && void 0 !== _b ? _b : 0),
49667
- lineHeight: null === (_c = handlerText.style) || void 0 === _c ? void 0 : _c.lineHeight,
49712
+ lineHeight: null == handlerTextStyle ? void 0 : handlerTextStyle.lineHeight,
49668
49713
  cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
49669
49714
  };
49670
- isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = pos) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = pos);
49671
- return graphicCreator.text(Object.assign(Object.assign({}, textStyle), handlerText.style));
49715
+ return isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = pos) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = pos), Object.assign(Object.assign({}, textStyle), handlerTextStyle);
49672
49716
  }
49673
49717
  _renderTooltip() {
49674
49718
  var _a;
@@ -49796,31 +49840,19 @@ class Slider extends AbstractComponent {
49796
49840
  }
49797
49841
  }
49798
49842
  _updateHandler(handler, position, value) {
49799
- var _a;
49800
49843
  const isHorizontal = this._isHorizontal;
49801
49844
  handler.setAttribute(isHorizontal ? "x" : "y", position);
49802
49845
  const updateHandlerText = handler.name === SLIDER_ELEMENT_NAME.startHandler ? this._startHandlerText : this._endHandlerText;
49803
49846
  if (updateHandlerText) {
49804
- const {
49805
- handlerText = {}
49806
- } = this.attribute;
49807
- updateHandlerText.setAttributes({
49808
- text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_a = handlerText.precision) && void 0 !== _a ? _a : 0),
49809
- [isHorizontal ? "x" : "y"]: position
49810
- });
49847
+ const handlerPosition = this._getHandlerPosition(handler.name === SLIDER_ELEMENT_NAME.startHandler);
49848
+ updateHandlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
49811
49849
  }
49812
49850
  handler.name === SLIDER_ELEMENT_NAME.startHandler ? (this._currentValue.startValue = value, this._currentValue.startPos = position) : (this._currentValue.endValue = value, this._currentValue.endPos = position);
49813
49851
  }
49814
49852
  _updateHandlerText(handlerText, position, value) {
49815
- var _a;
49816
49853
  const isHorizontal = this._isHorizontal,
49817
- {
49818
- handlerText: handlerTextAttr = {}
49819
- } = this.attribute;
49820
- handlerText.setAttributes({
49821
- [isHorizontal ? "x" : "y"]: position,
49822
- text: handlerTextAttr.formatter ? handlerTextAttr.formatter(value) : value.toFixed(null !== (_a = handlerTextAttr.precision) && void 0 !== _a ? _a : 0)
49823
- });
49854
+ handlerPosition = this._getHandlerPosition(handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText);
49855
+ handlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
49824
49856
  const updateHandler = handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText ? this._startHandler : this._endHandler;
49825
49857
  updateHandler && updateHandler.setAttributes({
49826
49858
  [isHorizontal ? "x" : "y"]: position
@@ -55091,33 +55123,6 @@ class Compiler {
55091
55123
  updateLayoutTag() {
55092
55124
  this._layoutState = LayoutState.before;
55093
55125
  }
55094
- _isGeoRegionRoamDragEnabled() {
55095
- var _a, _b;
55096
- const chartSpec = (_b = (_a = this._compileChart) === null || _a === void 0 ? void 0 : _a.getSpec) === null || _b === void 0 ? void 0 : _b.call(_a);
55097
- const regions = chartSpec === null || chartSpec === void 0 ? void 0 : chartSpec.region;
55098
- if (!isArray$1(regions)) {
55099
- return false;
55100
- }
55101
- return regions.some((region) => {
55102
- var _a;
55103
- if ((region === null || region === void 0 ? void 0 : region.coordinate) !== 'geo' || !region.roam) {
55104
- return false;
55105
- }
55106
- if (region.roam === true) {
55107
- return true;
55108
- }
55109
- return (_a = region.roam.drag) !== null && _a !== void 0 ? _a : true;
55110
- });
55111
- }
55112
- _shouldDisableCanvasTouchAction() {
55113
- if (!isTrueBrowser(this._option.mode)) {
55114
- return false;
55115
- }
55116
- const supportsTouchEvents = isValid$1(this._option.supportsTouchEvents)
55117
- ? this._option.supportsTouchEvents
55118
- : vglobal.supportsTouchEvents;
55119
- return supportsTouchEvents === false && this._isGeoRegionRoamDragEnabled();
55120
- }
55121
55126
  _setCanvasStyle() {
55122
55127
  if (!this._stage) {
55123
55128
  return;
@@ -55128,7 +55133,6 @@ class Compiler {
55128
55133
  const canvas = this.getCanvas();
55129
55134
  if (canvas) {
55130
55135
  canvas.style.display = 'block';
55131
- canvas.style.touchAction = this._shouldDisableCanvasTouchAction() ? 'none' : '';
55132
55136
  }
55133
55137
  }
55134
55138
  }
@@ -55147,7 +55151,6 @@ class Compiler {
55147
55151
  this._cachedMarks = null;
55148
55152
  }
55149
55153
  chart.compile();
55150
- this._setCanvasStyle();
55151
55154
  chart.afterCompile();
55152
55155
  }
55153
55156
  clearNextRender() {
@@ -57727,6 +57730,9 @@ class MarkStateManager extends StateManager {
57727
57730
  }
57728
57731
  });
57729
57732
  }
57733
+ clearAllStateInfo() {
57734
+ this._stateInfoList = [];
57735
+ }
57730
57736
  _isMultiMark() {
57731
57737
  return !this._mark || isMultiDatumMark(this._mark.type);
57732
57738
  }
@@ -58740,7 +58746,11 @@ class BaseMark extends GrammarItem {
58740
58746
  return;
58741
58747
  }
58742
58748
  this._product = mark.getProduct();
58749
+ this._product.clearStates();
58743
58750
  this._graphics = mark.getGraphics();
58751
+ this._graphics.forEach(g => {
58752
+ g.clearStates();
58753
+ });
58744
58754
  this._graphicMap = mark._graphicMap;
58745
58755
  this._graphicMap.forEach(g => {
58746
58756
  g.context = Object.assign(Object.assign({}, g.context), this._getCommonContext());
@@ -59235,6 +59245,9 @@ class BaseMark extends GrammarItem {
59235
59245
  if (this.isCommited()) {
59236
59246
  if (this.getVisible() &&
59237
59247
  (!this._skipBeforeLayouted || this.getCompiler().getLayoutState() !== LayoutState.before)) {
59248
+ if (!this._product) {
59249
+ this._initProduct();
59250
+ }
59238
59251
  log(`render mark: ${this.getProductId()}, type is ${this.type}`);
59239
59252
  this.renderInner();
59240
59253
  }
@@ -59449,6 +59462,14 @@ class BaseMark extends GrammarItem {
59449
59462
  runAnimation() {
59450
59463
  this._runStateAnimation(this.getGraphics());
59451
59464
  }
59465
+ clearBeforeReInit() {
59466
+ this.state.clearAllStateInfo();
59467
+ this.uncommit();
59468
+ this.stateStyle = {};
59469
+ this.getGraphics().forEach(g => {
59470
+ g.clearStates();
59471
+ });
59472
+ }
59452
59473
  }
59453
59474
 
59454
59475
  var MarkTypeEnum;
@@ -63548,6 +63569,7 @@ class BaseSeries extends BaseModel {
63548
63569
  super.reInit(spec);
63549
63570
  const marks = this.getMarksWithoutRoot();
63550
63571
  marks.forEach(mark => {
63572
+ mark.clearBeforeReInit();
63551
63573
  this._spec[mark.name] && this.initMarkStyleWithSpec(mark, this._spec[mark.name]);
63552
63574
  });
63553
63575
  this.initMarkStyle();
@@ -66145,6 +66167,9 @@ class AxisComponent extends BaseComponent {
66145
66167
  getTickData(index = 0) {
66146
66168
  return this._tickData[index];
66147
66169
  }
66170
+ getVisible() {
66171
+ return this._visible;
66172
+ }
66148
66173
  get visible() {
66149
66174
  return this._visible;
66150
66175
  }
@@ -66155,20 +66180,34 @@ class AxisComponent extends BaseComponent {
66155
66180
  return this._coordinateType;
66156
66181
  }
66157
66182
  constructor(spec, options) {
66158
- var _a;
66183
+ var _a, _b;
66159
66184
  super(spec, options);
66160
66185
  this.specKey = 'axes';
66161
66186
  this._scales = [];
66162
66187
  this._tickData = [];
66163
66188
  this._visible = true;
66189
+ this._specVisible = true;
66190
+ this._hideWhenEmpty = false;
66164
66191
  this._tick = undefined;
66165
66192
  this._onTickDataChange = (tickData) => {
66166
66193
  this._forceLayout();
66167
66194
  tickData === null || tickData === void 0 ? void 0 : tickData.updateData();
66168
66195
  };
66169
- this._visible = (_a = spec.visible) !== null && _a !== void 0 ? _a : true;
66196
+ this._specVisible = (_a = spec.visible) !== null && _a !== void 0 ? _a : true;
66197
+ this._hideWhenEmpty = (_b = spec.hideWhenEmpty) !== null && _b !== void 0 ? _b : false;
66198
+ this._visible = this._specVisible;
66170
66199
  this._coordinateType = 'none';
66171
66200
  }
66201
+ setAttrFromSpec() {
66202
+ var _a, _b;
66203
+ super.setAttrFromSpec();
66204
+ this._specVisible = (_a = this._spec.visible) !== null && _a !== void 0 ? _a : true;
66205
+ this._hideWhenEmpty = (_b = this._spec.hideWhenEmpty) !== null && _b !== void 0 ? _b : false;
66206
+ this._visible = this._specVisible;
66207
+ if (this._scale) {
66208
+ this._refreshVisibilityByData();
66209
+ }
66210
+ }
66172
66211
  getVRenderComponents() {
66173
66212
  var _a, _b;
66174
66213
  return [(_a = this._axisMark) === null || _a === void 0 ? void 0 : _a.getProduct(), (_b = this._gridMark) === null || _b === void 0 ? void 0 : _b.getProduct()].filter(isValid$1);
@@ -66180,8 +66219,9 @@ class AxisComponent extends BaseComponent {
66180
66219
  this.initEvent();
66181
66220
  this.initScales();
66182
66221
  this.updateSeriesScale();
66222
+ this._refreshVisibilityByData();
66183
66223
  this._shouldComputeTickData() && this._initData();
66184
- if (this._visible) {
66224
+ if (this._specVisible) {
66185
66225
  const axisMark = this._createMark({ type: 'component', name: `axis-${this.getOrient()}` }, {
66186
66226
  componentType: this.getOrient() === 'angle' ? AxisEnum.circleAxis : AxisEnum.lineAxis,
66187
66227
  mode: this._spec.mode
@@ -66211,6 +66251,7 @@ class AxisComponent extends BaseComponent {
66211
66251
  this._marks.addMark(gridMark);
66212
66252
  this._gridMark = gridMark;
66213
66253
  }
66254
+ this._syncComponentVisibility();
66214
66255
  if (((_h = this._option.globalInstance) === null || _h === void 0 ? void 0 : _h.isAnimationEnable()) &&
66215
66256
  get$1(this._option.getChart().getSpec(), 'animation') !== false &&
66216
66257
  this._spec.animation === true) {
@@ -66231,7 +66272,7 @@ class AxisComponent extends BaseComponent {
66231
66272
  }
66232
66273
  }
66233
66274
  _shouldComputeTickData() {
66234
- return this.getVisible() || this._spec.forceInitTick;
66275
+ return this._specVisible && (this.getVisible() || this._spec.forceInitTick || this._hideWhenEmpty);
66235
66276
  }
66236
66277
  _initData() {
66237
66278
  const tickData = this._initTickDataSet(this._tickTransformOption());
@@ -66243,40 +66284,41 @@ class AxisComponent extends BaseComponent {
66243
66284
  }
66244
66285
  collectData(depth, rawData) {
66245
66286
  const data = [];
66246
- eachSeries(this._regions, s => {
66247
- var _a;
66248
- let field = this.collectSeriesField(depth, s);
66249
- field = (isArray$1(field) ? (isContinuous(this._scale.type) ? field : [field[0]]) : [field]);
66250
- if (!depth) {
66251
- this._dataFieldText = s.getFieldAlias(field[0]);
66252
- }
66253
- if (field) {
66254
- const viewData = s.getViewData();
66255
- if (rawData) {
66256
- field.forEach(f => {
66257
- data.push(s.getRawDataStatisticsByField(f, !!isContinuous(this._scale.type)));
66258
- });
66259
- }
66260
- else if (viewData && viewData.latestData && viewData.latestData.length) {
66261
- const seriesData = (_a = s.getViewDataStatistics) === null || _a === void 0 ? void 0 : _a.call(s);
66262
- const userSetBreaks = this.type === ComponentTypeEnum.cartesianLinearAxis && this._spec.breaks && this._spec.breaks.length;
66263
- field.forEach(f => {
66264
- var _a;
66265
- if ((_a = seriesData === null || seriesData === void 0 ? void 0 : seriesData.latestData) === null || _a === void 0 ? void 0 : _a[f]) {
66266
- if (userSetBreaks) {
66267
- data.push(Object.assign(Object.assign({}, seriesData.latestData[f]), { values: viewData.latestData.map((obj) => obj[f]) }));
66268
- }
66269
- else {
66270
- data.push(seriesData.latestData[f]);
66287
+ this._regions &&
66288
+ eachSeries(this._regions, s => {
66289
+ var _a;
66290
+ let field = this.collectSeriesField(depth, s);
66291
+ field = (isArray$1(field) ? (isContinuous(this._scale.type) ? field : [field[0]]) : [field]);
66292
+ if (!depth) {
66293
+ this._dataFieldText = s.getFieldAlias(field[0]);
66294
+ }
66295
+ if (field) {
66296
+ const viewData = s.getViewData();
66297
+ if (rawData) {
66298
+ field.forEach(f => {
66299
+ data.push(s.getRawDataStatisticsByField(f, !!isContinuous(this._scale.type)));
66300
+ });
66301
+ }
66302
+ else if (viewData && viewData.latestData && viewData.latestData.length) {
66303
+ const seriesData = (_a = s.getViewDataStatistics) === null || _a === void 0 ? void 0 : _a.call(s);
66304
+ const userSetBreaks = this.type === ComponentTypeEnum.cartesianLinearAxis && this._spec.breaks && this._spec.breaks.length;
66305
+ field.forEach(f => {
66306
+ var _a;
66307
+ if ((_a = seriesData === null || seriesData === void 0 ? void 0 : seriesData.latestData) === null || _a === void 0 ? void 0 : _a[f]) {
66308
+ if (userSetBreaks) {
66309
+ data.push(Object.assign(Object.assign({}, seriesData.latestData[f]), { values: viewData.latestData.map((obj) => obj[f]) }));
66310
+ }
66311
+ else {
66312
+ data.push(seriesData.latestData[f]);
66313
+ }
66271
66314
  }
66272
- }
66273
- });
66315
+ });
66316
+ }
66274
66317
  }
66275
- }
66276
- }, {
66277
- userId: this._seriesUserId,
66278
- specIndex: this._seriesIndex
66279
- });
66318
+ }, {
66319
+ userId: this._seriesUserId,
66320
+ specIndex: this._seriesIndex
66321
+ });
66280
66322
  return data;
66281
66323
  }
66282
66324
  isSeriesDataEnable() {
@@ -66336,6 +66378,30 @@ class AxisComponent extends BaseComponent {
66336
66378
  }
66337
66379
  updateScaleDomain() {
66338
66380
  }
66381
+ _hasCollectedSeriesData() {
66382
+ return this.collectData(0).length > 0;
66383
+ }
66384
+ _refreshVisibilityByData() {
66385
+ const nextVisible = this._specVisible && (!this._hideWhenEmpty || this._hasCollectedSeriesData());
66386
+ const changed = this._visible !== nextVisible;
66387
+ this._visible = nextVisible;
66388
+ if (this._axisMark || this._gridMark) {
66389
+ this._syncComponentVisibility();
66390
+ }
66391
+ if (changed) {
66392
+ this._forceLayout();
66393
+ }
66394
+ return changed;
66395
+ }
66396
+ _syncComponentVisibility() {
66397
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
66398
+ (_a = this._axisMark) === null || _a === void 0 ? void 0 : _a.setVisible(this._visible);
66399
+ (_b = this._gridMark) === null || _b === void 0 ? void 0 : _b.setVisible(this._visible && ((_c = this._spec.grid) === null || _c === void 0 ? void 0 : _c.visible) !== false);
66400
+ (_g = (_f = (_e = (_d = this._axisMark) === null || _d === void 0 ? void 0 : _d.getComponent) === null || _e === void 0 ? void 0 : _e.call(_d)) === null || _f === void 0 ? void 0 : _f.setAttributes) === null || _g === void 0 ? void 0 : _g.call(_f, { visibleAll: this._visible });
66401
+ (_l = (_k = (_j = (_h = this._gridMark) === null || _h === void 0 ? void 0 : _h.getComponent) === null || _j === void 0 ? void 0 : _j.call(_h)) === null || _k === void 0 ? void 0 : _k.setAttributes) === null || _l === void 0 ? void 0 : _l.call(_k, {
66402
+ visibleAll: this._visible && ((_m = this._spec.grid) === null || _m === void 0 ? void 0 : _m.visible) !== false
66403
+ });
66404
+ }
66339
66405
  _clearRawDomain() {
66340
66406
  }
66341
66407
  onLayoutEnd() {
@@ -66797,6 +66863,10 @@ class CartesianAxis extends AxisComponent {
66797
66863
  return padding;
66798
66864
  };
66799
66865
  this._updateAxisLayout = () => {
66866
+ if (!this._visible) {
66867
+ this._syncComponentVisibility();
66868
+ return;
66869
+ }
66800
66870
  const startPoint = this.getLayoutStartPoint();
66801
66871
  const _a = this._getUpdateAttribute(false), { grid: updateGridAttrs } = _a, updateAxisAttrs = __rest$e(_a, ["grid"]);
66802
66872
  const axisAttrs = mergeSpec({ x: startPoint.x, y: startPoint.y }, this._axisStyle, updateAxisAttrs);
@@ -66804,6 +66874,7 @@ class CartesianAxis extends AxisComponent {
66804
66874
  if (this._gridMark) {
66805
66875
  this._gridMark.setSimpleStyle(mergeSpec({ x: startPoint.x, y: startPoint.y }, this._getGridAttributes(), updateGridAttrs));
66806
66876
  }
66877
+ this._syncComponentVisibility();
66807
66878
  };
66808
66879
  this._fixAxisOnZero = () => {
66809
66880
  const { onZero, visible } = this._spec.domainLine;
@@ -66970,7 +67041,7 @@ class CartesianAxis extends AxisComponent {
66970
67041
  setAttrFromSpec() {
66971
67042
  var _a;
66972
67043
  super.setAttrFromSpec();
66973
- if (this.visible) {
67044
+ if (this._specVisible) {
66974
67045
  const isX = isXAxis(this.getOrient());
66975
67046
  if (isX) {
66976
67047
  if (isUndefined$1(this._spec.maxHeight)) {
@@ -67300,7 +67371,7 @@ class CartesianAxis extends AxisComponent {
67300
67371
  }
67301
67372
  initEvent() {
67302
67373
  super.initEvent();
67303
- if (this.visible) {
67374
+ if (this._specVisible) {
67304
67375
  this.event.on(ChartEvent.layoutEnd, this._updateAxisLayout);
67305
67376
  this.event.on(ChartEvent.layoutEnd, this._fixAxisOnZero);
67306
67377
  this.event.on(ChartEvent.layoutRectUpdate, () => {
@@ -67819,6 +67890,7 @@ class LinearAxisMixin {
67819
67890
  }
67820
67891
  this._updateNiceLabelFormatter(domain);
67821
67892
  this._domainAfterSpec = this._scale.domain();
67893
+ this._refreshVisibilityByData();
67822
67894
  this.event.emit(ChartEvent.scaleDomainUpdate, { model: this });
67823
67895
  this.event.emit(ChartEvent.scaleUpdate, { model: this, value: 'domain' });
67824
67896
  }
@@ -68217,6 +68289,7 @@ class BandAxisMixin {
68217
68289
  }
68218
68290
  }
68219
68291
  this.transformScaleDomain();
68292
+ this._refreshVisibilityByData();
68220
68293
  this.event.emit(ChartEvent.scaleDomainUpdate, { model: this });
68221
68294
  this.event.emit(ChartEvent.scaleUpdate, { model: this, value: 'domain' });
68222
68295
  }
@@ -78438,6 +78511,14 @@ class BasePieSeries extends PolarSeries {
78438
78511
  this._labelMark = null;
78439
78512
  this._labelLineMark = null;
78440
78513
  this._emptyArcMark = null;
78514
+ this._pendingViewDataLabelUpdate = false;
78515
+ this.flushViewDataLabelUpdate = () => {
78516
+ if (!this._pendingViewDataLabelUpdate) {
78517
+ return;
78518
+ }
78519
+ this._pendingViewDataLabelUpdate = false;
78520
+ this._viewDataLabel.getDataView().reRunAllTransform();
78521
+ };
78441
78522
  this.dataToCentralPosition = (datum) => {
78442
78523
  const angle = datum[ARC_MIDDLE_ANGLE];
78443
78524
  if (isNil$1(angle)) {
@@ -78613,12 +78694,13 @@ class BasePieSeries extends PolarSeries {
78613
78694
  var _a;
78614
78695
  super.initEvent();
78615
78696
  (_a = this._viewDataLabel.getDataView()) === null || _a === void 0 ? void 0 : _a.target.addListener('change', this.viewDataLabelUpdate.bind(this));
78697
+ this.event.on(ChartEvent.afterRender, this.flushViewDataLabelUpdate);
78616
78698
  }
78617
78699
  initGroups() {
78618
78700
  return;
78619
78701
  }
78620
78702
  onLayoutEnd() {
78621
- this._viewDataLabel.getDataView().reRunAllTransform();
78703
+ this._pendingViewDataLabelUpdate = true;
78622
78704
  this.onMarkPositionUpdate();
78623
78705
  super.onLayoutEnd();
78624
78706
  }
@@ -79022,7 +79104,7 @@ class PolarAxis extends AxisComponent {
79022
79104
  }
79023
79105
  setAttrFromSpec() {
79024
79106
  super.setAttrFromSpec();
79025
- if (this.visible) {
79107
+ if (this._specVisible) {
79026
79108
  this._axisStyle = this._getAxisAttributes();
79027
79109
  this._gridStyle = this._getGridAttributes();
79028
79110
  }
@@ -95548,6 +95630,20 @@ const continuousLegendFilter = (data, op) => {
95548
95630
  return data;
95549
95631
  };
95550
95632
 
95633
+ function transformHandlerText(handlerText) {
95634
+ if (!handlerText) {
95635
+ return handlerText;
95636
+ }
95637
+ const nextHandlerText = Object.assign({}, handlerText);
95638
+ const handlerTextStyle = handlerText.style;
95639
+ if (isFunction$1(handlerTextStyle)) {
95640
+ nextHandlerText.style = (value, position, context) => transformToGraphic(handlerTextStyle(value, position, context));
95641
+ }
95642
+ else if (!isEmpty(handlerTextStyle)) {
95643
+ nextHandlerText.style = transformToGraphic(handlerTextStyle);
95644
+ }
95645
+ return nextHandlerText;
95646
+ }
95551
95647
  function getContinuousLegendAttributes(spec) {
95552
95648
  const _a = mergeSpec({}, spec), { title = {}, handler = {}, rail = {}, track = {}, startText, endText, handlerText, sizeBackground, background = {}, type, id, visible, orient, position, data, defaultSelected, field, filter, regionId, regionIndex, seriesIndex, seriesId, padding } = _a, restSpec = __rest$e(_a, ["title", "handler", "rail", "track", "startText", "endText", "handlerText", "sizeBackground", "background", "type", "id", "visible", "orient", "position", "data", "defaultSelected", "field", "filter", "regionId", "regionIndex", "seriesIndex", "seriesId", "padding"]);
95553
95649
  const attrs = restSpec;
@@ -95575,7 +95671,7 @@ function getContinuousLegendAttributes(spec) {
95575
95671
  }
95576
95672
  attrs.startText = transformComponentStyle(startText);
95577
95673
  attrs.endText = transformComponentStyle(endText);
95578
- attrs.handlerText = transformComponentStyle(handlerText);
95674
+ attrs.handlerText = transformHandlerText(handlerText);
95579
95675
  if (!isEmpty(sizeBackground)) {
95580
95676
  attrs.sizeBackground = transformToGraphic(sizeBackground);
95581
95677
  }