@visactor/vchart 2.0.5-alpha.5 → 2.0.6

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 (80) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +195 -65
  3. package/build/index.js +196 -64
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/animation/utils.js +1 -1
  7. package/cjs/animation/utils.js.map +1 -1
  8. package/cjs/chart/waterfall/waterfall-transformer.js +1 -1
  9. package/cjs/chart/waterfall/waterfall-transformer.js.map +1 -1
  10. package/cjs/component/geo/geo-coordinate.js +12 -7
  11. package/cjs/component/geo/geo-coordinate.js.map +1 -1
  12. package/cjs/component/marker/interface.d.ts +1 -0
  13. package/cjs/component/marker/interface.js.map +1 -1
  14. package/cjs/component/marker/mark-area/cartesian-mark-area.js +4 -4
  15. package/cjs/component/marker/mark-area/cartesian-mark-area.js.map +1 -1
  16. package/cjs/component/marker/mark-line/cartesian-mark-line.js +7 -5
  17. package/cjs/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
  18. package/cjs/component/marker/utils.d.ts +1 -1
  19. package/cjs/component/marker/utils.js +45 -14
  20. package/cjs/component/marker/utils.js.map +1 -1
  21. package/cjs/core/index.d.ts +1 -1
  22. package/cjs/core/index.js +1 -1
  23. package/cjs/core/index.js.map +1 -1
  24. package/cjs/data/transforms/waterfall.d.ts +2 -0
  25. package/cjs/data/transforms/waterfall.js +5 -3
  26. package/cjs/data/transforms/waterfall.js.map +1 -1
  27. package/cjs/index.d.ts +1 -0
  28. package/cjs/index.js +11 -11
  29. package/cjs/index.js.map +1 -1
  30. package/cjs/layout/grid-layout/grid-layout.js +2 -0
  31. package/cjs/layout/grid-layout/grid-layout.js.map +1 -1
  32. package/cjs/plugin/chart/formatter/formatter.d.ts +3 -0
  33. package/cjs/plugin/chart/formatter/formatter.js +23 -1
  34. package/cjs/plugin/chart/formatter/formatter.js.map +1 -1
  35. package/cjs/plugin/components/tooltip-handler/utils/svg.js +8 -5
  36. package/cjs/plugin/components/tooltip-handler/utils/svg.js.map +1 -1
  37. package/cjs/region/interface.d.ts +2 -0
  38. package/cjs/region/interface.js.map +1 -1
  39. package/cjs/series/waterfall/interface.d.ts +1 -0
  40. package/cjs/series/waterfall/interface.js.map +1 -1
  41. package/cjs/series/waterfall/waterfall.js +10 -6
  42. package/cjs/series/waterfall/waterfall.js.map +1 -1
  43. package/esm/animation/utils.js +1 -1
  44. package/esm/animation/utils.js.map +1 -1
  45. package/esm/chart/waterfall/waterfall-transformer.js +1 -1
  46. package/esm/chart/waterfall/waterfall-transformer.js.map +1 -1
  47. package/esm/component/geo/geo-coordinate.js +12 -7
  48. package/esm/component/geo/geo-coordinate.js.map +1 -1
  49. package/esm/component/marker/interface.d.ts +1 -0
  50. package/esm/component/marker/interface.js.map +1 -1
  51. package/esm/component/marker/mark-area/cartesian-mark-area.js +4 -4
  52. package/esm/component/marker/mark-area/cartesian-mark-area.js.map +1 -1
  53. package/esm/component/marker/mark-line/cartesian-mark-line.js +7 -5
  54. package/esm/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
  55. package/esm/component/marker/utils.d.ts +1 -1
  56. package/esm/component/marker/utils.js +45 -14
  57. package/esm/component/marker/utils.js.map +1 -1
  58. package/esm/core/index.d.ts +1 -1
  59. package/esm/core/index.js +1 -1
  60. package/esm/core/index.js.map +1 -1
  61. package/esm/data/transforms/waterfall.d.ts +2 -0
  62. package/esm/data/transforms/waterfall.js +5 -3
  63. package/esm/data/transforms/waterfall.js.map +1 -1
  64. package/esm/index.d.ts +1 -0
  65. package/esm/index.js +2 -0
  66. package/esm/index.js.map +1 -1
  67. package/esm/layout/grid-layout/grid-layout.js +2 -0
  68. package/esm/layout/grid-layout/grid-layout.js.map +1 -1
  69. package/esm/plugin/chart/formatter/formatter.d.ts +3 -0
  70. package/esm/plugin/chart/formatter/formatter.js +23 -1
  71. package/esm/plugin/chart/formatter/formatter.js.map +1 -1
  72. package/esm/plugin/components/tooltip-handler/utils/svg.js +8 -6
  73. package/esm/plugin/components/tooltip-handler/utils/svg.js.map +1 -1
  74. package/esm/region/interface.d.ts +2 -0
  75. package/esm/region/interface.js.map +1 -1
  76. package/esm/series/waterfall/interface.d.ts +1 -0
  77. package/esm/series/waterfall/interface.js.map +1 -1
  78. package/esm/series/waterfall/waterfall.js +10 -6
  79. package/esm/series/waterfall/waterfall.js.map +1 -1
  80. package/package.json +8 -8
package/build/index.js CHANGED
@@ -7593,7 +7593,15 @@
7593
7593
  const VGlobal = Symbol.for("VGlobal");
7594
7594
  const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
7595
7595
 
7596
- class Application {}
7596
+ const container = new Container();
7597
+
7598
+ const RenderService = Symbol.for("RenderService");
7599
+
7600
+ class Application {
7601
+ get renderService() {
7602
+ return this._renderService || (this._renderService = container.get(RenderService)), this._renderService;
7603
+ }
7604
+ }
7597
7605
  const application = new Application();
7598
7606
 
7599
7607
  let idx = 0;
@@ -10011,6 +10019,9 @@
10011
10019
  return c > 3 && r && Object.defineProperty(target, key, r), r;
10012
10020
  };
10013
10021
  let ATextMeasure = class {
10022
+ constructor() {
10023
+ this.id = "ATextMeasure";
10024
+ }
10014
10025
  configure(service, env) {
10015
10026
  this.canvas = service.canvas, this.context = service.context, service.bindTextMeasure(this);
10016
10027
  }
@@ -10403,11 +10414,13 @@
10403
10414
  return c > 3 && r && Object.defineProperty(target, key, r), r;
10404
10415
  };
10405
10416
  const TextMeasureContribution = Symbol.for("TextMeasureContribution");
10406
- let DefaultTextMeasureContribution = class extends ATextMeasure {};
10417
+ let DefaultTextMeasureContribution = class extends ATextMeasure {
10418
+ constructor() {
10419
+ super(...arguments), this.id = "DefaultTextMeasureContribution";
10420
+ }
10421
+ };
10407
10422
  DefaultTextMeasureContribution = __decorate$1t([injectable()], DefaultTextMeasureContribution);
10408
10423
 
10409
- const container = new Container();
10410
-
10411
10424
  const CanvasFactory = Symbol.for("CanvasFactory");
10412
10425
  const Context2dFactory = Symbol.for("Context2dFactory");
10413
10426
 
@@ -10984,13 +10997,17 @@
10984
10997
  return this.tryInitCanvas(), this._context;
10985
10998
  }
10986
10999
  constructor(contributions) {
10987
- this.contributions = contributions, this.configured = !1, this.global = application.global, this.global.hooks.onSetEnv.tap("graphic-util", (lastEnv, env, global) => {
11000
+ this.contributions = contributions, this.configured = !1, this.global = application.global, this._textMeasureMap = new Map(), this.global.hooks.onSetEnv.tap("graphic-util", (lastEnv, env, global) => {
10988
11001
  this.configured = !1, this.configure(global, env);
10989
11002
  });
10990
11003
  }
10991
11004
  get textMeasure() {
10992
11005
  return this._textMeasure || this.configure(this.global, this.global.env), this._textMeasure;
10993
11006
  }
11007
+ getTextMeasureInstance(textMeasureId) {
11008
+ if (!textMeasureId) return this.textMeasure;
11009
+ return this._textMeasureMap.get(textMeasureId) || this.textMeasure;
11010
+ }
10994
11011
  configure(global, env) {
10995
11012
  this.configured || (this.contributions.getContributions().forEach(contribution => {
10996
11013
  contribution.configure(this, env);
@@ -11003,7 +11020,7 @@
11003
11020
  }
11004
11021
  }
11005
11022
  bindTextMeasure(tm) {
11006
- this._textMeasure = tm;
11023
+ this._textMeasure && "DefaultTextMeasureContribution" !== tm.id || (this._textMeasure = tm), this._textMeasureMap.has(tm.id) || this._textMeasureMap.set(tm.id, tm);
11007
11024
  }
11008
11025
  measureText(text, tc, method = "native") {
11009
11026
  var _a;
@@ -15629,7 +15646,7 @@
15629
15646
  this.cache.layoutData.lines.forEach(item => {
15630
15647
  mergedText += item.str;
15631
15648
  });
15632
- return (Array.isArray(text) ? text.join("") : text) !== mergedText;
15649
+ return (Array.isArray(text) ? text.join("") : text).toString() !== mergedText;
15633
15650
  }
15634
15651
  return "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(item => item.text).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString();
15635
15652
  }
@@ -15728,7 +15745,7 @@
15728
15745
  return fontSize ? .1 * fontSize : 0;
15729
15746
  }
15730
15747
  updateHorizontalMultilineAABBBounds(text) {
15731
- var _a;
15748
+ var _a, _b;
15732
15749
  const textTheme = this.getGraphicTheme(),
15733
15750
  attribute = this.attribute,
15734
15751
  {
@@ -15755,7 +15772,7 @@
15755
15772
  const bbox = this.cache.layoutData.bbox;
15756
15773
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
15757
15774
  }
15758
- const textMeasure = application.graphicUtil.textMeasure,
15775
+ const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
15759
15776
  layoutData = new CanvasTextLayout(fontFamily, {
15760
15777
  fontSize: fontSize,
15761
15778
  fontWeight: fontWeight,
@@ -15773,7 +15790,7 @@
15773
15790
  return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
15774
15791
  }
15775
15792
  updateWrapAABBBounds(text) {
15776
- var _a, _b, _c;
15793
+ var _a, _b, _c, _d;
15777
15794
  const textTheme = this.getGraphicTheme(),
15778
15795
  {
15779
15796
  fontFamily = textTheme.fontFamily,
@@ -15799,7 +15816,7 @@
15799
15816
  const bbox = this.cache.layoutData.bbox;
15800
15817
  return this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
15801
15818
  }
15802
- const textMeasure = application.graphicUtil.textMeasure,
15819
+ const textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_b = this.stage) || void 0 === _b ? void 0 : _b.textMeasureId)),
15803
15820
  textOptions = {
15804
15821
  fontSize: fontSize,
15805
15822
  fontWeight: fontWeight,
@@ -15831,7 +15848,7 @@
15831
15848
  if ("" !== str && "" === clip.str || clip.wordBreaked) {
15832
15849
  if (ellipsis) {
15833
15850
  const clipEllipsis = textMeasure.clipTextWithSuffix(str, textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
15834
- clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
15851
+ clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
15835
15852
  } else clip.str = "", clip.width = 0;
15836
15853
  needCut = !1;
15837
15854
  }
@@ -15894,9 +15911,9 @@
15894
15911
  return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
15895
15912
  }
15896
15913
  updateVerticalMultilineAABBBounds(text) {
15897
- var _a, _b;
15914
+ var _a, _b, _c;
15898
15915
  const textTheme = this.getGraphicTheme(),
15899
- textMeasure = application.graphicUtil.textMeasure;
15916
+ textMeasure = application.graphicUtil.getTextMeasureInstance(this.textMeasureId || (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.textMeasureId));
15900
15917
  let width;
15901
15918
  const attribute = this.attribute,
15902
15919
  {
@@ -15917,7 +15934,7 @@
15917
15934
  } = attribute;
15918
15935
  if (!verticalMode) {
15919
15936
  const t = textAlign;
15920
- textAlign = null !== (_a = Text.baselineMapAlign[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = Text.alignMapBaseline[t]) && void 0 !== _b ? _b : "top";
15937
+ textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left", textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
15921
15938
  }
15922
15939
  if (width = 0, !this.shouldUpdateShape() && this.cache) {
15923
15940
  this.cache.verticalList.forEach(item => {
@@ -18928,7 +18945,7 @@
18928
18945
  doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
18929
18946
  }
18930
18947
  _runStroke(arc, context, x, y, arcAttribute, doStroke, isFullStroke, sVisible, strokeCb) {
18931
- doStroke && isFullStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
18948
+ doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
18932
18949
  }
18933
18950
  draw(arc, renderService, drawContext, params) {
18934
18951
  const arcAttribute = getTheme$1(arc, null == params ? void 0 : params.theme).arc;
@@ -20589,7 +20606,6 @@
20589
20606
  decorator(target, key, paramIndex);
20590
20607
  };
20591
20608
  };
20592
- const RenderService = Symbol.for("RenderService");
20593
20609
  let DefaultRenderService = class {
20594
20610
  constructor(drawContribution) {
20595
20611
  this.drawContribution = drawContribution;
@@ -21478,8 +21494,6 @@
21478
21494
  application.transformUtil = transformUtil;
21479
21495
  const graphicService = container.get(GraphicService);
21480
21496
  application.graphicService = graphicService;
21481
- const renderService = container.get(RenderService);
21482
- application.renderService = renderService;
21483
21497
  const layerService = container.get(LayerService);
21484
21498
  application.layerService = layerService;
21485
21499
 
@@ -32566,12 +32580,12 @@
32566
32580
  const parsedParams = this.parseParams(params, isTimeline);
32567
32581
  return animate = isTimeline ? this.executeTimelineItem(parsedParams, graphic, index, count) : this.executeTypeConfigItem(parsedParams, graphic, index, count), animate && this._trackAnimation(animate), animate;
32568
32582
  }
32569
- stop(type) {
32583
+ stop(type, callEnd = !0) {
32570
32584
  for (; this._animates.length > 0;) {
32571
32585
  const animate = this._animates.pop();
32572
- null == animate || animate.stop(type);
32586
+ !1 === callEnd && (animate.status = AnimateStatus.END), null == animate || animate.stop(type);
32573
32587
  }
32574
- this._animates = [], this._activeCount = 0, this._started && (this._started = !1, this.onEnd());
32588
+ this._animates = [], this._activeCount = 0, this._started && (this._started = !1, callEnd && this.onEnd());
32575
32589
  }
32576
32590
  }
32577
32591
  AnimateExecutor.builtInAnimateMap = {};
@@ -32631,7 +32645,7 @@
32631
32645
  executor: new AnimateExecutor(this.graphic)
32632
32646
  });
32633
32647
  }), shouldStopState.forEach(state => {
32634
- state.executor.stop();
32648
+ state.executor.stop(null, !1);
32635
32649
  }), shouldApplyState.length) {
32636
32650
  shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
32637
32651
  for (let i = 0; i < shouldApplyState.length; i++) {
@@ -32682,7 +32696,7 @@
32682
32696
  clearState() {
32683
32697
  var _a;
32684
32698
  null === (_a = this.stateList) || void 0 === _a || _a.forEach(state => {
32685
- state.executor.stop();
32699
+ state.executor.stop(null, !1);
32686
32700
  }), this.stateList = null;
32687
32701
  }
32688
32702
  reApplyState(state) {
@@ -40640,7 +40654,7 @@
40640
40654
  const text = result[i],
40641
40655
  bounds = text.AABBBounds,
40642
40656
  range = boundToRange(bmpTool, bounds, !0);
40643
- if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) bitmap.setRange(range);else {
40657
+ if (canPlace(bmpTool, bitmap, bounds, clampForce || hideOnOverflow, overlapPadding)) bitmap.setRange(range);else {
40644
40658
  if (hideOnOverflow) {
40645
40659
  if (this._processHideOnOverflow(text, bmpTool)) continue;
40646
40660
  } else if (clampForce && this._processClampForce(text, bmpTool, bitmap, overlapPadding)) continue;
@@ -40703,7 +40717,7 @@
40703
40717
  const text = labels[i],
40704
40718
  baseMark = this.getRelatedGraphic(text.attribute);
40705
40719
  if (text.update(), !this.isMarkInsideRect(baseMark, bmpTool)) continue;
40706
- if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce, overlapPadding)) {
40720
+ if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce || hideOnOverflow, overlapPadding)) {
40707
40721
  if (!checkBounds) {
40708
40722
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
40709
40723
  continue;
@@ -45611,7 +45625,7 @@
45611
45625
  width: width,
45612
45626
  height: height
45613
45627
  } = item.attribute;
45614
- contentWidth < startX + width && (startX = 0, startY += height + spaceRow, pages += 1), index > 0 && item.setAttributes({
45628
+ contentWidth < startX + width && index > 0 && (startX = 0, startY += height + spaceRow, pages += 1), index > 0 && item.setAttributes({
45615
45629
  x: startX,
45616
45630
  y: startY
45617
45631
  }), startX += spaceCol + width;
@@ -45622,9 +45636,10 @@
45622
45636
  if (compWidth = this._itemMaxWidth * maxCol + (maxCol - 1) * spaceCol, compHeight = maxHeight, contentWidth = compWidth, comp = this._createPager(compStyle), this._pagerComponent = comp, this._innerView.add(comp), contentHeight = maxHeight - comp.AABBBounds.height() - pagerSpace - renderStartY, contentHeight <= 0) return this._innerView.removeChild(comp), !1;
45623
45637
  itemsContainer.getChildren().forEach((item, index) => {
45624
45638
  const {
45639
+ width: width,
45625
45640
  height: height
45626
45641
  } = item.attribute;
45627
- contentHeight < startY + height && (startY = 0, startX += this._itemMaxWidth + spaceCol, pages += 1), index > 0 && item.setAttributes({
45642
+ contentHeight < startY + height && index > 0 && (startY = 0, startX += this._itemMaxWidth + spaceCol, pages += 1), index > 0 && item.setAttributes({
45628
45643
  x: startX,
45629
45644
  y: startY
45630
45645
  }), startY += spaceRow + height;
@@ -58316,7 +58331,7 @@
58316
58331
  });
58317
58332
  };
58318
58333
 
58319
- const version = "2.0.5-alpha.5";
58334
+ const version = "2.0.6";
58320
58335
 
58321
58336
  const addVChartProperty = (data, op) => {
58322
58337
  const context = op.beforeCall();
@@ -59065,7 +59080,7 @@
59065
59080
  traverseSpec(spec[index], transform, excludeKeys);
59066
59081
  });
59067
59082
  }
59068
- else if (isObject$2(spec)) {
59083
+ else if (isObject$2(spec) && typeof spec !== 'function') {
59069
59084
  for (const key in spec) {
59070
59085
  if (!excludeKeys.includes(key)) {
59071
59086
  spec[key] = transform(spec[key], key);
@@ -70909,11 +70924,20 @@
70909
70924
  }
70910
70925
  }
70911
70926
  initEvent() {
70927
+ var _a, _b, _c;
70912
70928
  this.event.on(exports.ChartEvent.scaleUpdate, { filter: ({ model }) => (model === null || model === void 0 ? void 0 : model.id) === this.id }, this.effect.scaleUpdate.bind(this));
70913
70929
  const { roam } = this._spec;
70914
70930
  if (roam) {
70915
- this.initZoomEventOfRegions(this._regions, null, this._handleChartZoom);
70916
- this.initDragEventOfRegions(this._regions, roam.blank ? null : () => true, this.pan);
70931
+ let zoom = true;
70932
+ let drag = true;
70933
+ let blank = false;
70934
+ if (roam !== true) {
70935
+ zoom = (_a = roam.zoom) !== null && _a !== void 0 ? _a : true;
70936
+ drag = (_b = roam.drag) !== null && _b !== void 0 ? _b : true;
70937
+ blank = (_c = roam.blank) !== null && _c !== void 0 ? _c : false;
70938
+ }
70939
+ zoom && this.initZoomEventOfRegions(this._regions, null, this._handleChartZoom);
70940
+ drag && this.initDragEventOfRegions(this._regions, blank ? null : () => true, this.pan);
70917
70941
  this._regions.forEach(r => {
70918
70942
  r.getSeries().forEach(s => {
70919
70943
  s.event.on('zoom', e => {
@@ -71415,10 +71439,13 @@
71415
71439
  if (!lastData || lastData.length === 0) {
71416
71440
  return lastData;
71417
71441
  }
71418
- const { indexField, total: totalSpec, groupData } = op;
71442
+ const { indexField, total: totalSpec, groupData, calculationMode } = op;
71419
71443
  const totalData = [];
71420
71444
  const { dimensionValues, dimensionData } = groupData().latestData;
71421
- const indexValues = Array.from(dimensionValues[indexField]);
71445
+ let indexValues = Array.from(dimensionValues[indexField]);
71446
+ if (calculationMode === 'decrease') {
71447
+ indexValues = indexValues.reverse();
71448
+ }
71422
71449
  let temp = {
71423
71450
  start: 0,
71424
71451
  end: 0,
@@ -71625,7 +71652,7 @@
71625
71652
  if (!data) {
71626
71653
  return data;
71627
71654
  }
71628
- const { indexField, valueField, total, seriesField } = op;
71655
+ const { indexField, valueField, total, seriesField, calculationMode } = op;
71629
71656
  const totalData = {
71630
71657
  [indexField]: (total === null || total === void 0 ? void 0 : total.text) || 'total',
71631
71658
  [valueField]: data.reduce((pre, cur) => precisionAdd(pre, +cur[valueField]), 0)
@@ -71633,7 +71660,12 @@
71633
71660
  if (seriesField) {
71634
71661
  totalData[seriesField] = 'total';
71635
71662
  }
71636
- data.push(totalData);
71663
+ if (calculationMode === 'decrease') {
71664
+ data.unshift(totalData);
71665
+ }
71666
+ else {
71667
+ data.push(totalData);
71668
+ }
71637
71669
  return data;
71638
71670
  };
71639
71671
 
@@ -72244,7 +72276,7 @@
72244
72276
  return super.getSeriesKeys();
72245
72277
  }
72246
72278
  initData() {
72247
- var _a;
72279
+ var _a, _b, _c;
72248
72280
  super.initData();
72249
72281
  registerDataSetInstanceTransform(this._dataSet, 'waterfallFillTotal', waterfallFillTotal);
72250
72282
  registerDataSetInstanceTransform(this._dataSet, 'waterfall', waterfall$1);
@@ -72257,6 +72289,7 @@
72257
72289
  seriesField: this.getSeriesField(),
72258
72290
  seriesFieldName: this._theme.seriesFieldName,
72259
72291
  total: this._spec.total,
72292
+ calculationMode: (_b = this._spec.calculationMode) !== null && _b !== void 0 ? _b : 'increase',
72260
72293
  stackInverse: this.getRegion().getStackInverse()
72261
72294
  }
72262
72295
  }, false);
@@ -72276,6 +72309,7 @@
72276
72309
  startAs: STACK_FIELD_START,
72277
72310
  endAs: STACK_FIELD_END,
72278
72311
  total: this._spec.total,
72312
+ calculationMode: (_c = this._spec.calculationMode) !== null && _c !== void 0 ? _c : 'increase',
72279
72313
  groupData: () => this.getGroups().groupData,
72280
72314
  stackInverse: this.getRegion().getStackInverse()
72281
72315
  }
@@ -72400,6 +72434,7 @@
72400
72434
  }
72401
72435
  initMarkStyle() {
72402
72436
  super.initMarkStyle();
72437
+ const isDecrease = this._spec.calculationMode === 'decrease';
72403
72438
  if (this._leaderLineMark) {
72404
72439
  if (this._direction === "horizontal") {
72405
72440
  this.setMarkStyle(this._leaderLineMark, {
@@ -72410,9 +72445,9 @@
72410
72445
  if (!datum.lastIndex) {
72411
72446
  return 0;
72412
72447
  }
72413
- return this.totalPositionY(datum, 'lastIndex', 1);
72448
+ return this.totalPositionY(datum, 'lastIndex', isDecrease ? 0 : 1);
72414
72449
  },
72415
- y1: (datum) => this.totalPositionY(datum, 'index', 0)
72450
+ y1: (datum) => this.totalPositionY(datum, 'index', isDecrease ? 1 : 0)
72416
72451
  }, 'normal', exports.AttributeLevel.Series);
72417
72452
  }
72418
72453
  else {
@@ -72422,9 +72457,9 @@
72422
72457
  if (!datum.lastIndex) {
72423
72458
  return 0;
72424
72459
  }
72425
- return this.totalPositionX(datum, 'lastIndex', 1);
72460
+ return this.totalPositionX(datum, 'lastIndex', isDecrease ? 0 : 1);
72426
72461
  },
72427
- x1: (datum) => this.totalPositionX(datum, 'index', 0),
72462
+ x1: (datum) => this.totalPositionX(datum, 'index', isDecrease ? 1 : 0),
72428
72463
  y: (datum) => this.totalPositionY(datum, 'lastEnd', 0),
72429
72464
  y1: (datum) => this.totalPositionY(datum, datum.isTotal ? 'end' : 'start', 0)
72430
72465
  }, 'normal', exports.AttributeLevel.Series);
@@ -89392,6 +89427,7 @@
89392
89427
  series.stackLabel = spec.stackLabel;
89393
89428
  series.leaderLine = spec.leaderLine;
89394
89429
  series.total = spec.total;
89430
+ series.calculationMode = spec.calculationMode;
89395
89431
  return series;
89396
89432
  }
89397
89433
  }
@@ -94562,7 +94598,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
94562
94598
  function isAggrSpec(spec) {
94563
94599
  return AGGR_TYPE.includes(spec);
94564
94600
  }
94565
- function xyLayout(data, startRelativeSeries, endRelativeSeries, relativeSeries, autoRange) {
94601
+ function xyLayout(data, startRelativeSeries, endRelativeSeries, relativeSeries, autoRange, includeFullBand = false) {
94566
94602
  const regionStart = startRelativeSeries.getRegion();
94567
94603
  const regionStartLayoutStartPoint = regionStart.getLayoutStartPoint();
94568
94604
  const regionEnd = endRelativeSeries.getRegion();
@@ -94578,20 +94614,31 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
94578
94614
  };
94579
94615
  const lines = [];
94580
94616
  const dataPoints = data.latestData[0] && data.latestData[0].latestData ? data.latestData[0].latestData : data.latestData;
94581
- const xDomain = relativeSeries.getXAxisHelper().getScale(0).domain();
94582
- const yDomain = relativeSeries.getYAxisHelper().getScale(0).domain();
94617
+ const xAxisHelper = relativeSeries.getXAxisHelper();
94618
+ const yAxisHelper = relativeSeries.getXAxisHelper();
94619
+ const xDomain = xAxisHelper.getScale(0).domain();
94620
+ const yDomain = yAxisHelper.getScale(0).domain();
94621
+ const isXExpand = includeFullBand && !xAxisHelper.isContinuous && !!xAxisHelper.getBandwidth;
94622
+ const isyExpand = includeFullBand && !yAxisHelper.isContinuous && !!yAxisHelper.getBandwidth;
94623
+ const xTemp = { min: null, max: null };
94624
+ const yTemp = { min: null, max: null };
94583
94625
  dataPoints.forEach((datum) => {
94584
94626
  const isValidX = isValid$1(datum.x);
94585
94627
  const isValidY = isValid$1(datum.y);
94628
+ let x;
94629
+ let y;
94586
94630
  if (isValidX && isValidY) {
94587
- const x = getXValue(datum, xDomain, autoRange, refSeries, regionWidth, regionStartLayoutStartPoint);
94588
- const y = getYValue(datum, yDomain, autoRange, refSeries, regionHeight, regionStartLayoutStartPoint);
94631
+ x = getXValue(datum, xDomain, autoRange, refSeries, regionWidth, regionStartLayoutStartPoint);
94632
+ y = getYValue(datum, yDomain, autoRange, refSeries, regionHeight, regionStartLayoutStartPoint);
94633
+ setTempWithValid(x, isXExpand, xTemp, lines.length);
94634
+ setTempWithValid(y, isyExpand, yTemp, lines.length);
94589
94635
  lines.push([{ x, y }]);
94590
94636
  }
94591
94637
  else if (isValidX) {
94592
- const x = getXValue(datum, xDomain, autoRange, refSeries, regionWidth, regionStartLayoutStartPoint);
94593
- const y = Math.max(regionStartLayoutStartPoint.y + regionStart.getLayoutRect().height, regionEndLayoutStartPoint.y + regionEnd.getLayoutRect().height);
94638
+ x = getXValue(datum, xDomain, autoRange, refSeries, regionWidth, regionStartLayoutStartPoint);
94639
+ y = Math.max(regionStartLayoutStartPoint.y + regionStart.getLayoutRect().height, regionEndLayoutStartPoint.y + regionEnd.getLayoutRect().height);
94594
94640
  const y1 = Math.min(regionStartLayoutStartPoint.y, regionEndLayoutStartPoint.y);
94641
+ setTempWithValid(x, isXExpand, xTemp, lines.length);
94595
94642
  lines.push([
94596
94643
  {
94597
94644
  x: x,
@@ -94604,9 +94651,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
94604
94651
  ]);
94605
94652
  }
94606
94653
  else if (isValidY) {
94607
- const x = Math.min(regionStartLayoutStartPoint.x, regionEndLayoutStartPoint.x);
94608
- const y = getYValue(datum, yDomain, autoRange, refSeries, regionHeight, regionStartLayoutStartPoint);
94654
+ x = Math.min(regionStartLayoutStartPoint.x, regionEndLayoutStartPoint.x);
94655
+ y = getYValue(datum, yDomain, autoRange, refSeries, regionHeight, regionStartLayoutStartPoint);
94609
94656
  const x1 = Math.max(regionStartLayoutStartPoint.x + regionStart.getLayoutRect().width, regionEndLayoutStartPoint.x + regionEnd.getLayoutRect().width);
94657
+ setTempWithValid(y, isyExpand, yTemp, lines.length);
94610
94658
  lines.push([
94611
94659
  {
94612
94660
  x: x,
@@ -94619,8 +94667,46 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
94619
94667
  ]);
94620
94668
  }
94621
94669
  });
94670
+ setTempToLines(lines, xAxisHelper, yAxisHelper, xTemp, yTemp);
94622
94671
  return lines;
94623
94672
  }
94673
+ function setTempToLines(lines, xAxisHelper, yAxisHelper, xTemp, yTemp) {
94674
+ if (xTemp.min || xTemp.max) {
94675
+ const xBandSize = xAxisHelper.getBandwidth(0) * (1 + xAxisHelper.getScale(0).paddingInner());
94676
+ if (xTemp.min) {
94677
+ lines[xTemp.min.index].forEach(p => (p.x -= xBandSize / 2));
94678
+ }
94679
+ if (xTemp.max) {
94680
+ lines[xTemp.max.index].forEach(p => (p.x += xBandSize / 2));
94681
+ }
94682
+ }
94683
+ if (yTemp.min || yTemp.max) {
94684
+ const yBandSize = yAxisHelper.getBandwidth(0) * (1 + yAxisHelper.getScale(0).paddingInner());
94685
+ if (yTemp.min) {
94686
+ lines[yTemp.min.index].forEach(p => (p.y -= yBandSize / 2));
94687
+ }
94688
+ if (yTemp.max) {
94689
+ lines[yTemp.max.index].forEach(p => (p.y += yBandSize / 2));
94690
+ }
94691
+ }
94692
+ }
94693
+ function setTempWithValid(v, isExpand, temp, index) {
94694
+ if (isExpand) {
94695
+ if (temp.min === null || temp.min.value > v) {
94696
+ temp.min = {
94697
+ value: v,
94698
+ index
94699
+ };
94700
+ }
94701
+ if (temp.max === null || temp.max.value < v) {
94702
+ temp.max = {
94703
+ value: v,
94704
+ index
94705
+ };
94706
+ }
94707
+ }
94708
+ return v;
94709
+ }
94624
94710
  function polarLayout(data, startRelativeSeries, endRelativeSeries, relativeSeries, autoRange) {
94625
94711
  const refSeries = {
94626
94712
  relativeSeries,
@@ -95675,7 +95761,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
95675
95761
  return { points };
95676
95762
  }
95677
95763
  _markerLayout() {
95678
- var _a, _b, _c, _d;
95764
+ var _a, _b, _c, _d, _e;
95679
95765
  const updateAttrs = this._getUpdateMarkerAttrs();
95680
95766
  if (this._spec.type === 'type-step') {
95681
95767
  const startRelativeSeries = this._startRelativeSeries;
@@ -95703,6 +95789,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
95703
95789
  expandDistanceValue = expandDistance;
95704
95790
  }
95705
95791
  const { points, limitRect } = updateAttrs;
95792
+ if (!points || points.length < 2) {
95793
+ (_a = this._markerComponent) === null || _a === void 0 ? void 0 : _a.setAttributes(updateAttrs);
95794
+ return;
95795
+ }
95706
95796
  const joinPoints = getInsertPoints(points[0], points[1], connectDirection, expandDistanceValue);
95707
95797
  let labelPositionAttrs;
95708
95798
  if (multiSegment && isValid$1(mainSegmentIndex)) {
@@ -95714,11 +95804,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
95714
95804
  else {
95715
95805
  labelPositionAttrs = Object.assign({ position: 'start', autoRotate: false }, getTextOffset(points[0], points[1], connectDirection, expandDistanceValue));
95716
95806
  }
95717
- const markerComponentAttr = (_b = (_a = this._markerComponent) === null || _a === void 0 ? void 0 : _a.attribute) !== null && _b !== void 0 ? _b : {};
95807
+ const markerComponentAttr = (_c = (_b = this._markerComponent) === null || _b === void 0 ? void 0 : _b.attribute) !== null && _c !== void 0 ? _c : {};
95718
95808
  const prevLabelAttrs = array(markerComponentAttr.label);
95719
95809
  const updateLabels = array(updateAttrs.label);
95720
95810
  const labelsInSpec = array(this._spec.label);
95721
- (_c = this._markerComponent) === null || _c === void 0 ? void 0 : _c.setAttributes({
95811
+ (_d = this._markerComponent) === null || _d === void 0 ? void 0 : _d.setAttributes({
95722
95812
  points: multiSegment
95723
95813
  ? [
95724
95814
  [joinPoints[0], joinPoints[1]],
@@ -95758,7 +95848,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
95758
95848
  });
95759
95849
  }
95760
95850
  else {
95761
- (_d = this._markerComponent) === null || _d === void 0 ? void 0 : _d.setAttributes(updateAttrs);
95851
+ (_e = this._markerComponent) === null || _e === void 0 ? void 0 : _e.setAttributes(updateAttrs);
95762
95852
  }
95763
95853
  }
95764
95854
  _computeOptions() {
@@ -96251,7 +96341,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96251
96341
  return new MarkArea(attr);
96252
96342
  }
96253
96343
  _computePointsAttr() {
96254
- var _a;
96344
+ var _a, _b;
96255
96345
  const spec = this._spec;
96256
96346
  const data = this._markerData;
96257
96347
  const startRelativeSeries = this._startRelativeSeries;
@@ -96260,10 +96350,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96260
96350
  const { doXProcess, doYProcess, doXYProcess, doCoordinatesProcess } = getMarkAreaProcessInfo(spec);
96261
96351
  const isPositionLayout = isValid$1(spec.positions);
96262
96352
  const autoRange = (_a = spec.autoRange) !== null && _a !== void 0 ? _a : false;
96353
+ const includeFullBand = (_b = spec.includeFullBand) !== null && _b !== void 0 ? _b : false;
96263
96354
  let points = [];
96264
96355
  let lines = [];
96265
96356
  if (doXYProcess) {
96266
- lines = xyLayout(data, startRelativeSeries, endRelativeSeries, relativeSeries, autoRange);
96357
+ lines = xyLayout(data, startRelativeSeries, endRelativeSeries, relativeSeries, autoRange, includeFullBand);
96267
96358
  const [start, end] = lines;
96268
96359
  if (start && start.length && end && end.length) {
96269
96360
  points = [
@@ -96281,7 +96372,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96281
96372
  }
96282
96373
  }
96283
96374
  else if (doXProcess || doYProcess) {
96284
- lines = xyLayout(data, startRelativeSeries, endRelativeSeries, relativeSeries, autoRange);
96375
+ lines = xyLayout(data, startRelativeSeries, endRelativeSeries, relativeSeries, autoRange, includeFullBand);
96285
96376
  const [start, end] = lines;
96286
96377
  if (start && start.length && end && end.length) {
96287
96378
  points = [...start, end[1], end[0]];
@@ -98624,6 +98715,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98624
98715
  });
98625
98716
  }
98626
98717
  clearLayoutSize() {
98718
+ this._gridInfo.colWidth &&
98719
+ this.setSizeFromUserSetting(this._gridInfo.colWidth, this._colSize, this._col, this._chartLayoutRect.width);
98720
+ this._gridInfo.rowHeight &&
98721
+ this.setSizeFromUserSetting(this._gridInfo.rowHeight, this._rowSize, this._row, this._chartLayoutRect.height);
98627
98722
  this._colSize.forEach(c => {
98628
98723
  c.isLayoutSetting = false;
98629
98724
  if (!c.isUserSetting) {
@@ -99398,7 +99493,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
99398
99493
  return '';
99399
99494
  }
99400
99495
  const styleString = `style="display:inline-block;vertical-align:middle;"`;
99401
- const { shapeType, shapeFill, shapeStroke, shapeHollow = false } = option;
99496
+ const { shapeType, shapeStroke, shapeHollow = false, shapeFill } = option;
99402
99497
  const size = (_a = option.shapeSize) !== null && _a !== void 0 ? _a : 8;
99403
99498
  const lineWidth = option.shapeLineWidth ? escapeHTML(option.shapeLineWidth) + 'px' : '0px';
99404
99499
  let fillString = 'currentColor';
@@ -99427,7 +99522,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
99427
99522
  const lw = Number(lineWidth.slice(0, -2));
99428
99523
  viewBox = `${x - lw / 2} ${y - lw / 2} ${w + lw} ${h + lw}`;
99429
99524
  }
99430
- if (!shapeFill || isString$1(shapeFill) || shapeHollow) {
99525
+ const isFillGradientStr = GradientParser.IsGradientStr(shapeFill);
99526
+ if (!shapeFill || (isString$1(shapeFill) && !isFillGradientStr) || shapeHollow) {
99431
99527
  fillString = shapeHollow ? 'none' : shapeFill ? escapeHTML(shapeFill) : 'currentColor';
99432
99528
  return `
99433
99529
  <svg ${styleString} width="${size}" height="${size}" viewBox="${viewBox}">
@@ -99438,19 +99534,20 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
99438
99534
  </path>
99439
99535
  </svg>`;
99440
99536
  }
99441
- if (isObject$2(shapeFill)) {
99537
+ const shapeFillObject = isFillGradientStr ? GradientParser.Parse(shapeFill) : isObject$2(shapeFill) ? shapeFill : null;
99538
+ if (shapeFillObject) {
99442
99539
  fillString = 'gradientColor' + (gradientId !== null && gradientId !== void 0 ? gradientId : '');
99443
99540
  let gradient = '';
99444
- const stops = ((_b = shapeFill.stops) !== null && _b !== void 0 ? _b : [])
99541
+ const stops = ((_b = shapeFillObject.stops) !== null && _b !== void 0 ? _b : [])
99445
99542
  .map(s => `<stop offset="${escapeHTML(s.offset.toString())}" stop-color="${escapeHTML(s.color)}"/>`)
99446
99543
  .join('');
99447
- if (shapeFill.gradient === 'radial') {
99544
+ if (shapeFillObject.gradient === 'radial') {
99448
99545
  gradient = `<radialGradient id="${fillString}" cx="50%" cy="50%" r="50%" fx="0%" fy="0%">
99449
99546
  ${stops}
99450
99547
  </radialGradient>`;
99451
99548
  }
99452
- else if (shapeFill.gradient === 'linear') {
99453
- gradient = `<linearGradient id="${fillString}" x1="${((_c = shapeFill.x0) !== null && _c !== void 0 ? _c : 0) * 100}%" y1="${((_d = shapeFill.y0) !== null && _d !== void 0 ? _d : 0) * 100}%" x2="${((_e = shapeFill.x1) !== null && _e !== void 0 ? _e : 0) * 100}%" y2="${((_f = shapeFill.y1) !== null && _f !== void 0 ? _f : 0) * 100}%">
99549
+ else if (shapeFillObject.gradient === 'linear') {
99550
+ gradient = `<linearGradient id="${fillString}" x1="${((_c = shapeFillObject.x0) !== null && _c !== void 0 ? _c : 0) * 100}%" y1="${((_d = shapeFillObject.y0) !== null && _d !== void 0 ? _d : 0) * 100}%" x2="${((_e = shapeFillObject.x1) !== null && _e !== void 0 ? _e : 0) * 100}%" y2="${((_f = shapeFillObject.y1) !== null && _f !== void 0 ? _f : 0) * 100}%">
99454
99551
  ${stops}
99455
99552
  </linearGradient>`;
99456
99553
  }
@@ -100204,8 +100301,41 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
100204
100301
  else if (formatter.includes('%') && this._timeFormatter) {
100205
100302
  return this._timeFormatter(formatter, text);
100206
100303
  }
100304
+ else if (formatter.startsWith('calc(')) {
100305
+ return this._calcFormatter(formatter, text);
100306
+ }
100207
100307
  return text;
100208
100308
  }
100309
+ _calcFormatter(formatter, text) {
100310
+ try {
100311
+ const expression = formatter.slice(5, -1).replace(/v/g, String(text));
100312
+ return this._calculateMathExpression(expression, text);
100313
+ }
100314
+ catch (e) {
100315
+ return text;
100316
+ }
100317
+ }
100318
+ _calculateMathExpression(expression, text) {
100319
+ const cleanExpression = expression.replace(/\s+/g, '');
100320
+ if (!this._isValidMathExpression(cleanExpression)) {
100321
+ return text;
100322
+ }
100323
+ try {
100324
+ const safeFunction = new Function('return (' + cleanExpression + ')');
100325
+ const result = safeFunction();
100326
+ if (typeof result !== 'number' || isNaN(result) || !isFinite(result)) {
100327
+ throw new Error('Invalid calculation result');
100328
+ }
100329
+ return result;
100330
+ }
100331
+ catch (error) {
100332
+ return text;
100333
+ }
100334
+ }
100335
+ _isValidMathExpression(expression) {
100336
+ const validPattern = /^[0-9+\-*/().]+$/;
100337
+ return validPattern.test(expression);
100338
+ }
100209
100339
  release() {
100210
100340
  super.release();
100211
100341
  this._format = null;
@@ -101826,6 +101956,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
101826
101956
  exports.ScatterSeries = ScatterSeries;
101827
101957
  exports.ScrollBar = ScrollBar;
101828
101958
  exports.SequenceChart = SequenceChart;
101959
+ exports.Stack = Stack;
101960
+ exports.StackChartMixin = StackChartMixin;
101829
101961
  exports.StreamLight = StreamLight;
101830
101962
  exports.SunburstChart = SunburstChart;
101831
101963
  exports.SunburstSeries = SunburstSeries;