@visactor/vchart 2.0.20-alpha.1 → 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 (102) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +178 -69
  3. package/build/index.js +178 -69
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/component/axis/base-axis.d.ts +9 -1
  7. package/cjs/component/axis/base-axis.js +37 -7
  8. package/cjs/component/axis/base-axis.js.map +1 -1
  9. package/cjs/component/axis/cartesian/axis.js +4 -3
  10. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  11. package/cjs/component/axis/cartesian/interface/spec.d.ts +1 -0
  12. package/cjs/component/axis/cartesian/interface/spec.js.map +1 -1
  13. package/cjs/component/axis/mixin/band-axis-mixin.d.ts +1 -0
  14. package/cjs/component/axis/mixin/band-axis-mixin.js +1 -1
  15. package/cjs/component/axis/mixin/band-axis-mixin.js.map +1 -1
  16. package/cjs/component/axis/mixin/linear-axis-mixin.d.ts +1 -0
  17. package/cjs/component/axis/mixin/linear-axis-mixin.js +1 -1
  18. package/cjs/component/axis/mixin/linear-axis-mixin.js.map +1 -1
  19. package/cjs/component/axis/polar/axis.js +1 -1
  20. package/cjs/component/axis/polar/axis.js.map +1 -1
  21. package/cjs/component/legend/continuous/interface.d.ts +5 -2
  22. package/cjs/component/legend/continuous/interface.js.map +1 -1
  23. package/cjs/component/legend/continuous/util.js +12 -4
  24. package/cjs/component/legend/continuous/util.js.map +1 -1
  25. package/cjs/constant/funnel.js +1 -1
  26. package/cjs/constant/gradient.js +1 -1
  27. package/cjs/constant/hierarchy.js +1 -1
  28. package/cjs/constant/label.js +1 -1
  29. package/cjs/constant/layout.js +1 -1
  30. package/cjs/constant/marker.js +1 -1
  31. package/cjs/constant/polar.js +1 -1
  32. package/cjs/constant/scatter.js +1 -1
  33. package/cjs/constant/scroll-bar.js +2 -1
  34. package/cjs/constant/sunburst.js +1 -1
  35. package/cjs/constant/waterfall.js +1 -1
  36. package/cjs/constant/word-cloud.js +1 -1
  37. package/cjs/core/interface.js +1 -1
  38. package/cjs/core/util.js +1 -1
  39. package/cjs/core/vchart.js +1 -1
  40. package/cjs/data/initialize.js +1 -1
  41. package/cjs/data/register.js +1 -1
  42. package/cjs/env/env.js +1 -1
  43. package/cjs/env/index.js +1 -1
  44. package/cjs/event/bubble.js +1 -1
  45. package/cjs/event/event-dispatcher.js +1 -1
  46. package/cjs/event/event.js +1 -1
  47. package/cjs/event/index.js +1 -1
  48. package/cjs/event/interface.js +1 -2
  49. package/cjs/mark/base/base-mark.js +2 -2
  50. package/cjs/mark/base/base-mark.js.map +1 -1
  51. package/cjs/series/pie/pie.d.ts +2 -0
  52. package/cjs/series/pie/pie.js +6 -4
  53. package/cjs/series/pie/pie.js.map +1 -1
  54. package/esm/component/axis/base-axis.d.ts +9 -1
  55. package/esm/component/axis/base-axis.js +37 -7
  56. package/esm/component/axis/base-axis.js.map +1 -1
  57. package/esm/component/axis/cartesian/axis.js +4 -3
  58. package/esm/component/axis/cartesian/axis.js.map +1 -1
  59. package/esm/component/axis/cartesian/interface/spec.d.ts +1 -0
  60. package/esm/component/axis/cartesian/interface/spec.js.map +1 -1
  61. package/esm/component/axis/mixin/band-axis-mixin.d.ts +1 -0
  62. package/esm/component/axis/mixin/band-axis-mixin.js +1 -1
  63. package/esm/component/axis/mixin/band-axis-mixin.js.map +1 -1
  64. package/esm/component/axis/mixin/linear-axis-mixin.d.ts +1 -0
  65. package/esm/component/axis/mixin/linear-axis-mixin.js +1 -1
  66. package/esm/component/axis/mixin/linear-axis-mixin.js.map +1 -1
  67. package/esm/component/axis/polar/axis.js +1 -1
  68. package/esm/component/axis/polar/axis.js.map +1 -1
  69. package/esm/component/legend/continuous/interface.d.ts +5 -2
  70. package/esm/component/legend/continuous/interface.js.map +1 -1
  71. package/esm/component/legend/continuous/util.js +9 -2
  72. package/esm/component/legend/continuous/util.js.map +1 -1
  73. package/esm/constant/funnel.js +1 -1
  74. package/esm/constant/gradient.js +1 -1
  75. package/esm/constant/hierarchy.js +1 -1
  76. package/esm/constant/label.js +1 -1
  77. package/esm/constant/layout.js +1 -1
  78. package/esm/constant/marker.js +1 -1
  79. package/esm/constant/polar.js +1 -1
  80. package/esm/constant/scatter.js +1 -1
  81. package/esm/constant/scroll-bar.js +2 -1
  82. package/esm/constant/sunburst.js +1 -1
  83. package/esm/constant/waterfall.js +1 -1
  84. package/esm/constant/word-cloud.js +1 -1
  85. package/esm/core/interface.js +1 -1
  86. package/esm/core/util.js +1 -1
  87. package/esm/core/vchart.js +1 -1
  88. package/esm/data/initialize.js +1 -1
  89. package/esm/data/register.js +1 -1
  90. package/esm/env/env.js +1 -1
  91. package/esm/env/index.js +1 -1
  92. package/esm/event/bubble.js +1 -1
  93. package/esm/event/event-dispatcher.js +1 -1
  94. package/esm/event/event.js +1 -1
  95. package/esm/event/index.js +1 -1
  96. package/esm/event/interface.js +1 -2
  97. package/esm/mark/base/base-mark.js +3 -2
  98. package/esm/mark/base/base-mark.js.map +1 -1
  99. package/esm/series/pie/pie.d.ts +2 -0
  100. package/esm/series/pie/pie.js +7 -4
  101. package/esm/series/pie/pie.js.map +1 -1
  102. package/package.json +9 -9
package/build/index.js CHANGED
@@ -22141,9 +22141,10 @@
22141
22141
  }), context.highPerformanceRestore(), context.setTransformForCurrent();
22142
22142
  } else {
22143
22143
  const {
22144
- backgroundCornerRadius: backgroundCornerRadius
22144
+ backgroundCornerRadius: backgroundCornerRadius,
22145
+ backgroundOpacity = 1
22145
22146
  } = graphic.attribute;
22146
- 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();
22147
+ 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();
22147
22148
  }
22148
22149
  shouldReCalBounds && boundsAllocate.free(b), restore();
22149
22150
  }
@@ -44077,8 +44078,9 @@
44077
44078
  const label = labels[i];
44078
44079
  if (!label) continue;
44079
44080
  const baseMark = this.getRelatedGraphic(label.attribute);
44080
- let backgroundColor = baseMark.getAttributes(!0).fill,
44081
- foregroundColor = label.attribute.fill;
44081
+ let backgroundColor = baseMark.getAttributes(!0).fill;
44082
+ const backgroundOpacity = baseMark.getAttributes(!0).fillOpacity;
44083
+ let foregroundColor = label.attribute.fill;
44082
44084
  if (isObject$2(backgroundColor) && backgroundColor.gradient) {
44083
44085
  const firstStopColor = null === (_g = null === (_f = backgroundColor.stops) || void 0 === _f ? void 0 : _f[0]) || void 0 === _g ? void 0 : _g.color;
44084
44086
  firstStopColor && (backgroundColor = firstStopColor, foregroundColor = firstStopColor);
@@ -44092,11 +44094,26 @@
44092
44094
  if (fill && label.setAttributes({
44093
44095
  fill: fill
44094
44096
  }), 0 === label.attribute.lineWidth || 0 === label.attribute.strokeOpacity) continue;
44095
- const stroke = smartInvertStrategy(strokeStrategy, backgroundColor, invertColor, similarColor);
44096
- stroke && label.setAttributes({
44097
- stroke: stroke
44098
- });
44097
+ if ("background" === interactInvertType) label.setAttributes({
44098
+ stroke: !1
44099
+ });else {
44100
+ const stroke = smartInvertStrategy(strokeStrategy, backgroundColor, invertColor, similarColor);
44101
+ stroke && label.setAttributes({
44102
+ stroke: stroke
44103
+ });
44104
+ }
44099
44105
  } else if (isIntersect && "none" !== interactInvertType) {
44106
+ if ("background" === interactInvertType) {
44107
+ const fill = smartInvertStrategy(fillStrategy, backgroundColor, invertColor, similarColor);
44108
+ fill && label.setAttributes({
44109
+ fill: fill
44110
+ }), label.setAttributes({
44111
+ stroke: !1,
44112
+ background: backgroundColor,
44113
+ backgroundOpacity: backgroundOpacity
44114
+ });
44115
+ continue;
44116
+ }
44100
44117
  if (0 === label.attribute.lineWidth || 0 === label.attribute.strokeOpacity) continue;
44101
44118
  if (label.attribute.stroke) {
44102
44119
  label.setAttributes({
@@ -44113,6 +44130,9 @@
44113
44130
  stroke: stroke
44114
44131
  });
44115
44132
  }
44133
+ !1 === isInside && "background" === interactInvertType && label.setAttributes({
44134
+ background: null
44135
+ });
44116
44136
  }
44117
44137
  }
44118
44138
  _canPlaceInside(textBound, shapeBound) {
@@ -49656,7 +49676,31 @@
49656
49676
  return graphicCreator.symbol(style);
49657
49677
  }
49658
49678
  _renderHandlerText(value, position) {
49659
- var _a, _b, _c;
49679
+ return graphicCreator.text(this._getHandlerTextAttributes(value, position));
49680
+ }
49681
+ _getHandlerPosition(isStart) {
49682
+ return this.attribute.range && isStart ? "start" : "end";
49683
+ }
49684
+ _getHandlerTextStyle(value, position) {
49685
+ const {
49686
+ align: align,
49687
+ handlerSize = 14,
49688
+ handlerText = {},
49689
+ railHeight: railHeight,
49690
+ railWidth: railWidth,
49691
+ slidable: slidable
49692
+ } = this.attribute;
49693
+ return isFunction$1(handlerText.style) ? handlerText.style(value, position, {
49694
+ layout: this.attribute.layout,
49695
+ align: align,
49696
+ railWidth: railWidth,
49697
+ railHeight: railHeight,
49698
+ handlerSize: handlerSize,
49699
+ slidable: slidable
49700
+ }) : handlerText.style;
49701
+ }
49702
+ _getHandlerTextAttributes(value, position) {
49703
+ var _a, _b;
49660
49704
  const {
49661
49705
  align: align,
49662
49706
  handlerSize = 14,
@@ -49668,13 +49712,13 @@
49668
49712
  isHorizontal = this._isHorizontal,
49669
49713
  pos = this.calculatePosByValue(value, position),
49670
49714
  textSpace = null !== (_a = handlerText.space) && void 0 !== _a ? _a : 4,
49715
+ handlerTextStyle = this._getHandlerTextStyle(value, position),
49671
49716
  textStyle = {
49672
49717
  text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_b = handlerText.precision) && void 0 !== _b ? _b : 0),
49673
- lineHeight: null === (_c = handlerText.style) || void 0 === _c ? void 0 : _c.lineHeight,
49718
+ lineHeight: null == handlerTextStyle ? void 0 : handlerTextStyle.lineHeight,
49674
49719
  cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
49675
49720
  };
49676
- 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);
49677
- return graphicCreator.text(Object.assign(Object.assign({}, textStyle), handlerText.style));
49721
+ 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);
49678
49722
  }
49679
49723
  _renderTooltip() {
49680
49724
  var _a;
@@ -49802,31 +49846,19 @@
49802
49846
  }
49803
49847
  }
49804
49848
  _updateHandler(handler, position, value) {
49805
- var _a;
49806
49849
  const isHorizontal = this._isHorizontal;
49807
49850
  handler.setAttribute(isHorizontal ? "x" : "y", position);
49808
49851
  const updateHandlerText = handler.name === SLIDER_ELEMENT_NAME.startHandler ? this._startHandlerText : this._endHandlerText;
49809
49852
  if (updateHandlerText) {
49810
- const {
49811
- handlerText = {}
49812
- } = this.attribute;
49813
- updateHandlerText.setAttributes({
49814
- text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_a = handlerText.precision) && void 0 !== _a ? _a : 0),
49815
- [isHorizontal ? "x" : "y"]: position
49816
- });
49853
+ const handlerPosition = this._getHandlerPosition(handler.name === SLIDER_ELEMENT_NAME.startHandler);
49854
+ updateHandlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
49817
49855
  }
49818
49856
  handler.name === SLIDER_ELEMENT_NAME.startHandler ? (this._currentValue.startValue = value, this._currentValue.startPos = position) : (this._currentValue.endValue = value, this._currentValue.endPos = position);
49819
49857
  }
49820
49858
  _updateHandlerText(handlerText, position, value) {
49821
- var _a;
49822
49859
  const isHorizontal = this._isHorizontal,
49823
- {
49824
- handlerText: handlerTextAttr = {}
49825
- } = this.attribute;
49826
- handlerText.setAttributes({
49827
- [isHorizontal ? "x" : "y"]: position,
49828
- text: handlerTextAttr.formatter ? handlerTextAttr.formatter(value) : value.toFixed(null !== (_a = handlerTextAttr.precision) && void 0 !== _a ? _a : 0)
49829
- });
49860
+ handlerPosition = this._getHandlerPosition(handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText);
49861
+ handlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
49830
49862
  const updateHandler = handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText ? this._startHandler : this._endHandler;
49831
49863
  updateHandler && updateHandler.setAttributes({
49832
49864
  [isHorizontal ? "x" : "y"]: position
@@ -59219,6 +59251,9 @@
59219
59251
  if (this.isCommited()) {
59220
59252
  if (this.getVisible() &&
59221
59253
  (!this._skipBeforeLayouted || this.getCompiler().getLayoutState() !== LayoutState.before)) {
59254
+ if (!this._product) {
59255
+ this._initProduct();
59256
+ }
59222
59257
  log(`render mark: ${this.getProductId()}, type is ${this.type}`);
59223
59258
  this.renderInner();
59224
59259
  }
@@ -66138,6 +66173,9 @@
66138
66173
  getTickData(index = 0) {
66139
66174
  return this._tickData[index];
66140
66175
  }
66176
+ getVisible() {
66177
+ return this._visible;
66178
+ }
66141
66179
  get visible() {
66142
66180
  return this._visible;
66143
66181
  }
@@ -66148,20 +66186,34 @@
66148
66186
  return this._coordinateType;
66149
66187
  }
66150
66188
  constructor(spec, options) {
66151
- var _a;
66189
+ var _a, _b;
66152
66190
  super(spec, options);
66153
66191
  this.specKey = 'axes';
66154
66192
  this._scales = [];
66155
66193
  this._tickData = [];
66156
66194
  this._visible = true;
66195
+ this._specVisible = true;
66196
+ this._hideWhenEmpty = false;
66157
66197
  this._tick = undefined;
66158
66198
  this._onTickDataChange = (tickData) => {
66159
66199
  this._forceLayout();
66160
66200
  tickData === null || tickData === void 0 ? void 0 : tickData.updateData();
66161
66201
  };
66162
- this._visible = (_a = spec.visible) !== null && _a !== void 0 ? _a : true;
66202
+ this._specVisible = (_a = spec.visible) !== null && _a !== void 0 ? _a : true;
66203
+ this._hideWhenEmpty = (_b = spec.hideWhenEmpty) !== null && _b !== void 0 ? _b : false;
66204
+ this._visible = this._specVisible;
66163
66205
  this._coordinateType = 'none';
66164
66206
  }
66207
+ setAttrFromSpec() {
66208
+ var _a, _b;
66209
+ super.setAttrFromSpec();
66210
+ this._specVisible = (_a = this._spec.visible) !== null && _a !== void 0 ? _a : true;
66211
+ this._hideWhenEmpty = (_b = this._spec.hideWhenEmpty) !== null && _b !== void 0 ? _b : false;
66212
+ this._visible = this._specVisible;
66213
+ if (this._scale) {
66214
+ this._refreshVisibilityByData();
66215
+ }
66216
+ }
66165
66217
  getVRenderComponents() {
66166
66218
  var _a, _b;
66167
66219
  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);
@@ -66173,8 +66225,9 @@
66173
66225
  this.initEvent();
66174
66226
  this.initScales();
66175
66227
  this.updateSeriesScale();
66228
+ this._refreshVisibilityByData();
66176
66229
  this._shouldComputeTickData() && this._initData();
66177
- if (this._visible) {
66230
+ if (this._specVisible) {
66178
66231
  const axisMark = this._createMark({ type: 'component', name: `axis-${this.getOrient()}` }, {
66179
66232
  componentType: this.getOrient() === 'angle' ? AxisEnum.circleAxis : AxisEnum.lineAxis,
66180
66233
  mode: this._spec.mode
@@ -66204,6 +66257,7 @@
66204
66257
  this._marks.addMark(gridMark);
66205
66258
  this._gridMark = gridMark;
66206
66259
  }
66260
+ this._syncComponentVisibility();
66207
66261
  if (((_h = this._option.globalInstance) === null || _h === void 0 ? void 0 : _h.isAnimationEnable()) &&
66208
66262
  get$1(this._option.getChart().getSpec(), 'animation') !== false &&
66209
66263
  this._spec.animation === true) {
@@ -66224,7 +66278,7 @@
66224
66278
  }
66225
66279
  }
66226
66280
  _shouldComputeTickData() {
66227
- return this.getVisible() || this._spec.forceInitTick;
66281
+ return this._specVisible && (this.getVisible() || this._spec.forceInitTick || this._hideWhenEmpty);
66228
66282
  }
66229
66283
  _initData() {
66230
66284
  const tickData = this._initTickDataSet(this._tickTransformOption());
@@ -66236,40 +66290,41 @@
66236
66290
  }
66237
66291
  collectData(depth, rawData) {
66238
66292
  const data = [];
66239
- eachSeries(this._regions, s => {
66240
- var _a;
66241
- let field = this.collectSeriesField(depth, s);
66242
- field = (isArray$1(field) ? (isContinuous(this._scale.type) ? field : [field[0]]) : [field]);
66243
- if (!depth) {
66244
- this._dataFieldText = s.getFieldAlias(field[0]);
66245
- }
66246
- if (field) {
66247
- const viewData = s.getViewData();
66248
- if (rawData) {
66249
- field.forEach(f => {
66250
- data.push(s.getRawDataStatisticsByField(f, !!isContinuous(this._scale.type)));
66251
- });
66252
- }
66253
- else if (viewData && viewData.latestData && viewData.latestData.length) {
66254
- const seriesData = (_a = s.getViewDataStatistics) === null || _a === void 0 ? void 0 : _a.call(s);
66255
- const userSetBreaks = this.type === ComponentTypeEnum.cartesianLinearAxis && this._spec.breaks && this._spec.breaks.length;
66256
- field.forEach(f => {
66257
- var _a;
66258
- if ((_a = seriesData === null || seriesData === void 0 ? void 0 : seriesData.latestData) === null || _a === void 0 ? void 0 : _a[f]) {
66259
- if (userSetBreaks) {
66260
- data.push(Object.assign(Object.assign({}, seriesData.latestData[f]), { values: viewData.latestData.map((obj) => obj[f]) }));
66261
- }
66262
- else {
66263
- data.push(seriesData.latestData[f]);
66293
+ this._regions &&
66294
+ eachSeries(this._regions, s => {
66295
+ var _a;
66296
+ let field = this.collectSeriesField(depth, s);
66297
+ field = (isArray$1(field) ? (isContinuous(this._scale.type) ? field : [field[0]]) : [field]);
66298
+ if (!depth) {
66299
+ this._dataFieldText = s.getFieldAlias(field[0]);
66300
+ }
66301
+ if (field) {
66302
+ const viewData = s.getViewData();
66303
+ if (rawData) {
66304
+ field.forEach(f => {
66305
+ data.push(s.getRawDataStatisticsByField(f, !!isContinuous(this._scale.type)));
66306
+ });
66307
+ }
66308
+ else if (viewData && viewData.latestData && viewData.latestData.length) {
66309
+ const seriesData = (_a = s.getViewDataStatistics) === null || _a === void 0 ? void 0 : _a.call(s);
66310
+ const userSetBreaks = this.type === ComponentTypeEnum.cartesianLinearAxis && this._spec.breaks && this._spec.breaks.length;
66311
+ field.forEach(f => {
66312
+ var _a;
66313
+ if ((_a = seriesData === null || seriesData === void 0 ? void 0 : seriesData.latestData) === null || _a === void 0 ? void 0 : _a[f]) {
66314
+ if (userSetBreaks) {
66315
+ data.push(Object.assign(Object.assign({}, seriesData.latestData[f]), { values: viewData.latestData.map((obj) => obj[f]) }));
66316
+ }
66317
+ else {
66318
+ data.push(seriesData.latestData[f]);
66319
+ }
66264
66320
  }
66265
- }
66266
- });
66321
+ });
66322
+ }
66267
66323
  }
66268
- }
66269
- }, {
66270
- userId: this._seriesUserId,
66271
- specIndex: this._seriesIndex
66272
- });
66324
+ }, {
66325
+ userId: this._seriesUserId,
66326
+ specIndex: this._seriesIndex
66327
+ });
66273
66328
  return data;
66274
66329
  }
66275
66330
  isSeriesDataEnable() {
@@ -66329,6 +66384,30 @@
66329
66384
  }
66330
66385
  updateScaleDomain() {
66331
66386
  }
66387
+ _hasCollectedSeriesData() {
66388
+ return this.collectData(0).length > 0;
66389
+ }
66390
+ _refreshVisibilityByData() {
66391
+ const nextVisible = this._specVisible && (!this._hideWhenEmpty || this._hasCollectedSeriesData());
66392
+ const changed = this._visible !== nextVisible;
66393
+ this._visible = nextVisible;
66394
+ if (this._axisMark || this._gridMark) {
66395
+ this._syncComponentVisibility();
66396
+ }
66397
+ if (changed) {
66398
+ this._forceLayout();
66399
+ }
66400
+ return changed;
66401
+ }
66402
+ _syncComponentVisibility() {
66403
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
66404
+ (_a = this._axisMark) === null || _a === void 0 ? void 0 : _a.setVisible(this._visible);
66405
+ (_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);
66406
+ (_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 });
66407
+ (_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, {
66408
+ visibleAll: this._visible && ((_m = this._spec.grid) === null || _m === void 0 ? void 0 : _m.visible) !== false
66409
+ });
66410
+ }
66332
66411
  _clearRawDomain() {
66333
66412
  }
66334
66413
  onLayoutEnd() {
@@ -66790,6 +66869,10 @@
66790
66869
  return padding;
66791
66870
  };
66792
66871
  this._updateAxisLayout = () => {
66872
+ if (!this._visible) {
66873
+ this._syncComponentVisibility();
66874
+ return;
66875
+ }
66793
66876
  const startPoint = this.getLayoutStartPoint();
66794
66877
  const _a = this._getUpdateAttribute(false), { grid: updateGridAttrs } = _a, updateAxisAttrs = __rest$e(_a, ["grid"]);
66795
66878
  const axisAttrs = mergeSpec({ x: startPoint.x, y: startPoint.y }, this._axisStyle, updateAxisAttrs);
@@ -66797,6 +66880,7 @@
66797
66880
  if (this._gridMark) {
66798
66881
  this._gridMark.setSimpleStyle(mergeSpec({ x: startPoint.x, y: startPoint.y }, this._getGridAttributes(), updateGridAttrs));
66799
66882
  }
66883
+ this._syncComponentVisibility();
66800
66884
  };
66801
66885
  this._fixAxisOnZero = () => {
66802
66886
  const { onZero, visible } = this._spec.domainLine;
@@ -66963,7 +67047,7 @@
66963
67047
  setAttrFromSpec() {
66964
67048
  var _a;
66965
67049
  super.setAttrFromSpec();
66966
- if (this.visible) {
67050
+ if (this._specVisible) {
66967
67051
  const isX = isXAxis(this.getOrient());
66968
67052
  if (isX) {
66969
67053
  if (isUndefined$1(this._spec.maxHeight)) {
@@ -67293,7 +67377,7 @@
67293
67377
  }
67294
67378
  initEvent() {
67295
67379
  super.initEvent();
67296
- if (this.visible) {
67380
+ if (this._specVisible) {
67297
67381
  this.event.on(exports.ChartEvent.layoutEnd, this._updateAxisLayout);
67298
67382
  this.event.on(exports.ChartEvent.layoutEnd, this._fixAxisOnZero);
67299
67383
  this.event.on(exports.ChartEvent.layoutRectUpdate, () => {
@@ -67812,6 +67896,7 @@
67812
67896
  }
67813
67897
  this._updateNiceLabelFormatter(domain);
67814
67898
  this._domainAfterSpec = this._scale.domain();
67899
+ this._refreshVisibilityByData();
67815
67900
  this.event.emit(exports.ChartEvent.scaleDomainUpdate, { model: this });
67816
67901
  this.event.emit(exports.ChartEvent.scaleUpdate, { model: this, value: 'domain' });
67817
67902
  }
@@ -68210,6 +68295,7 @@
68210
68295
  }
68211
68296
  }
68212
68297
  this.transformScaleDomain();
68298
+ this._refreshVisibilityByData();
68213
68299
  this.event.emit(exports.ChartEvent.scaleDomainUpdate, { model: this });
68214
68300
  this.event.emit(exports.ChartEvent.scaleUpdate, { model: this, value: 'domain' });
68215
68301
  }
@@ -78431,6 +78517,14 @@
78431
78517
  this._labelMark = null;
78432
78518
  this._labelLineMark = null;
78433
78519
  this._emptyArcMark = null;
78520
+ this._pendingViewDataLabelUpdate = false;
78521
+ this.flushViewDataLabelUpdate = () => {
78522
+ if (!this._pendingViewDataLabelUpdate) {
78523
+ return;
78524
+ }
78525
+ this._pendingViewDataLabelUpdate = false;
78526
+ this._viewDataLabel.getDataView().reRunAllTransform();
78527
+ };
78434
78528
  this.dataToCentralPosition = (datum) => {
78435
78529
  const angle = datum[ARC_MIDDLE_ANGLE];
78436
78530
  if (isNil$1(angle)) {
@@ -78606,12 +78700,13 @@
78606
78700
  var _a;
78607
78701
  super.initEvent();
78608
78702
  (_a = this._viewDataLabel.getDataView()) === null || _a === void 0 ? void 0 : _a.target.addListener('change', this.viewDataLabelUpdate.bind(this));
78703
+ this.event.on(exports.ChartEvent.afterRender, this.flushViewDataLabelUpdate);
78609
78704
  }
78610
78705
  initGroups() {
78611
78706
  return;
78612
78707
  }
78613
78708
  onLayoutEnd() {
78614
- this._viewDataLabel.getDataView().reRunAllTransform();
78709
+ this._pendingViewDataLabelUpdate = true;
78615
78710
  this.onMarkPositionUpdate();
78616
78711
  super.onLayoutEnd();
78617
78712
  }
@@ -79015,7 +79110,7 @@
79015
79110
  }
79016
79111
  setAttrFromSpec() {
79017
79112
  super.setAttrFromSpec();
79018
- if (this.visible) {
79113
+ if (this._specVisible) {
79019
79114
  this._axisStyle = this._getAxisAttributes();
79020
79115
  this._gridStyle = this._getGridAttributes();
79021
79116
  }
@@ -95541,6 +95636,20 @@
95541
95636
  return data;
95542
95637
  };
95543
95638
 
95639
+ function transformHandlerText(handlerText) {
95640
+ if (!handlerText) {
95641
+ return handlerText;
95642
+ }
95643
+ const nextHandlerText = Object.assign({}, handlerText);
95644
+ const handlerTextStyle = handlerText.style;
95645
+ if (isFunction$1(handlerTextStyle)) {
95646
+ nextHandlerText.style = (value, position, context) => transformToGraphic(handlerTextStyle(value, position, context));
95647
+ }
95648
+ else if (!isEmpty(handlerTextStyle)) {
95649
+ nextHandlerText.style = transformToGraphic(handlerTextStyle);
95650
+ }
95651
+ return nextHandlerText;
95652
+ }
95544
95653
  function getContinuousLegendAttributes(spec) {
95545
95654
  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"]);
95546
95655
  const attrs = restSpec;
@@ -95568,7 +95677,7 @@
95568
95677
  }
95569
95678
  attrs.startText = transformComponentStyle(startText);
95570
95679
  attrs.endText = transformComponentStyle(endText);
95571
- attrs.handlerText = transformComponentStyle(handlerText);
95680
+ attrs.handlerText = transformHandlerText(handlerText);
95572
95681
  if (!isEmpty(sizeBackground)) {
95573
95682
  attrs.sizeBackground = transformToGraphic(sizeBackground);
95574
95683
  }