@visactor/vchart 2.1.0-alpha.11 → 2.1.0-alpha.12

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 (42) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +18 -6
  3. package/build/index.js +18 -6
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/index.js +1 -1
  7. package/cjs/chart/stack.js +1 -1
  8. package/cjs/chart/util.js +1 -1
  9. package/cjs/component/index.js +1 -2
  10. package/cjs/component/legend/base-legend.js +1 -1
  11. package/cjs/component/legend/base-legend.js.map +1 -1
  12. package/cjs/constant/attribute.js +2 -1
  13. package/cjs/constant/funnel.js +1 -2
  14. package/cjs/constant/scroll-bar.js +1 -1
  15. package/cjs/constant/sunburst.js +1 -1
  16. package/cjs/constant/waterfall.js +2 -1
  17. package/cjs/constant/word-cloud.js +1 -1
  18. package/cjs/core/vchart.js +1 -1
  19. package/cjs/mark/base/base-line.js +2 -2
  20. package/cjs/mark/base/base-line.js.map +1 -1
  21. package/cjs/series/waterfall/waterfall.d.ts +2 -0
  22. package/cjs/series/waterfall/waterfall.js +12 -4
  23. package/cjs/series/waterfall/waterfall.js.map +1 -1
  24. package/esm/chart/index.js +1 -1
  25. package/esm/chart/stack.js +1 -1
  26. package/esm/chart/util.js +1 -1
  27. package/esm/component/index.js +1 -2
  28. package/esm/component/legend/base-legend.js +1 -1
  29. package/esm/component/legend/base-legend.js.map +1 -1
  30. package/esm/constant/attribute.js +2 -1
  31. package/esm/constant/funnel.js +1 -2
  32. package/esm/constant/scroll-bar.js +1 -1
  33. package/esm/constant/sunburst.js +1 -1
  34. package/esm/constant/waterfall.js +2 -1
  35. package/esm/constant/word-cloud.js +1 -1
  36. package/esm/core/vchart.js +1 -1
  37. package/esm/mark/base/base-line.js +2 -2
  38. package/esm/mark/base/base-line.js.map +1 -1
  39. package/esm/series/waterfall/waterfall.d.ts +2 -0
  40. package/esm/series/waterfall/waterfall.js +12 -4
  41. package/esm/series/waterfall/waterfall.js.map +1 -1
  42. package/package.json +4 -4
package/build/index.es.js CHANGED
@@ -71418,7 +71418,7 @@ class BaseLineMark extends BaseMark {
71418
71418
  : null));
71419
71419
  }
71420
71420
  _runPointsEncoder(newStyles, g, attrs = {}) {
71421
- var _a, _b, _c;
71421
+ var _a, _b;
71422
71422
  const data = g.context.data;
71423
71423
  const lineAttrs = [];
71424
71424
  const points = [];
@@ -71443,7 +71443,7 @@ class BaseLineMark extends BaseMark {
71443
71443
  points[index].context = (_a = this._keyGetter(datum)) !== null && _a !== void 0 ? _a : index;
71444
71444
  });
71445
71445
  if (progressive) {
71446
- const segments = (_c = (_b = g.attribute) === null || _b === void 0 ? void 0 : _b.segments) !== null && _c !== void 0 ? _c : [];
71446
+ const segments = ((_b = g.attribute) === null || _b === void 0 ? void 0 : _b.segments) ? [...g.attribute.segments] : [];
71447
71447
  segments.push({
71448
71448
  points
71449
71449
  });
@@ -83113,6 +83113,17 @@ class WaterfallSeries extends BarSeries {
83113
83113
  bandPosition: this._bandPosition
83114
83114
  }));
83115
83115
  }
83116
+ _isCategoryAxisInverse() {
83117
+ var _a, _b, _c, _e;
83118
+ return this._direction === "horizontal"
83119
+ ? (_b = (_a = this._yAxisHelper) === null || _a === void 0 ? void 0 : _a.isInverse) === null || _b === void 0 ? void 0 : _b.call(_a)
83120
+ : (_e = (_c = this._xAxisHelper) === null || _c === void 0 ? void 0 : _c.isInverse) === null || _e === void 0 ? void 0 : _e.call(_c);
83121
+ }
83122
+ _getLeaderLineCategoryPos(isStart, isDecrease) {
83123
+ const inverse = !!this._isCategoryAxisInverse();
83124
+ const normalPos = isStart ? (isDecrease ? 0 : 1) : isDecrease ? 1 : 0;
83125
+ return inverse ? 1 - normalPos : normalPos;
83126
+ }
83116
83127
  initMarkStyle() {
83117
83128
  super.initMarkStyle();
83118
83129
  const isDecrease = this._spec.calculationMode === 'decrease';
@@ -83126,9 +83137,9 @@ class WaterfallSeries extends BarSeries {
83126
83137
  if (!datum.lastIndex) {
83127
83138
  return 0;
83128
83139
  }
83129
- return this.totalPositionY(datum, 'lastIndex', isDecrease ? 0 : 1);
83140
+ return this.totalPositionY(datum, 'lastIndex', this._getLeaderLineCategoryPos(true, isDecrease));
83130
83141
  },
83131
- y1: (datum) => this.totalPositionY(datum, 'index', isDecrease ? 1 : 0)
83142
+ y1: (datum) => this.totalPositionY(datum, 'index', this._getLeaderLineCategoryPos(false, isDecrease))
83132
83143
  }, 'normal', AttributeLevel.Series);
83133
83144
  }
83134
83145
  else {
@@ -83138,9 +83149,9 @@ class WaterfallSeries extends BarSeries {
83138
83149
  if (!datum.lastIndex) {
83139
83150
  return 0;
83140
83151
  }
83141
- return this.totalPositionX(datum, 'lastIndex', isDecrease ? 0 : 1);
83152
+ return this.totalPositionX(datum, 'lastIndex', this._getLeaderLineCategoryPos(true, isDecrease));
83142
83153
  },
83143
- x1: (datum) => this.totalPositionX(datum, 'index', isDecrease ? 1 : 0),
83154
+ x1: (datum) => this.totalPositionX(datum, 'index', this._getLeaderLineCategoryPos(false, isDecrease)),
83144
83155
  y: (datum) => this.totalPositionY(datum, 'lastEnd', 0),
83145
83156
  y1: (datum) => this.totalPositionY(datum, datum.isTotal ? 'end' : 'start', 0)
83146
83157
  }, 'normal', AttributeLevel.Series);
@@ -102366,6 +102377,7 @@ class BaseLegend extends BaseComponent {
102366
102377
  }
102367
102378
  clear() {
102368
102379
  super.clear();
102380
+ this._legendComponent = null;
102369
102381
  this._cacheAttrs = null;
102370
102382
  this._preSelectedData = null;
102371
102383
  }
package/build/index.js CHANGED
@@ -71424,7 +71424,7 @@
71424
71424
  : null));
71425
71425
  }
71426
71426
  _runPointsEncoder(newStyles, g, attrs = {}) {
71427
- var _a, _b, _c;
71427
+ var _a, _b;
71428
71428
  const data = g.context.data;
71429
71429
  const lineAttrs = [];
71430
71430
  const points = [];
@@ -71449,7 +71449,7 @@
71449
71449
  points[index].context = (_a = this._keyGetter(datum)) !== null && _a !== void 0 ? _a : index;
71450
71450
  });
71451
71451
  if (progressive) {
71452
- const segments = (_c = (_b = g.attribute) === null || _b === void 0 ? void 0 : _b.segments) !== null && _c !== void 0 ? _c : [];
71452
+ const segments = ((_b = g.attribute) === null || _b === void 0 ? void 0 : _b.segments) ? [...g.attribute.segments] : [];
71453
71453
  segments.push({
71454
71454
  points
71455
71455
  });
@@ -83119,6 +83119,17 @@
83119
83119
  bandPosition: this._bandPosition
83120
83120
  }));
83121
83121
  }
83122
+ _isCategoryAxisInverse() {
83123
+ var _a, _b, _c, _e;
83124
+ return this._direction === "horizontal"
83125
+ ? (_b = (_a = this._yAxisHelper) === null || _a === void 0 ? void 0 : _a.isInverse) === null || _b === void 0 ? void 0 : _b.call(_a)
83126
+ : (_e = (_c = this._xAxisHelper) === null || _c === void 0 ? void 0 : _c.isInverse) === null || _e === void 0 ? void 0 : _e.call(_c);
83127
+ }
83128
+ _getLeaderLineCategoryPos(isStart, isDecrease) {
83129
+ const inverse = !!this._isCategoryAxisInverse();
83130
+ const normalPos = isStart ? (isDecrease ? 0 : 1) : isDecrease ? 1 : 0;
83131
+ return inverse ? 1 - normalPos : normalPos;
83132
+ }
83122
83133
  initMarkStyle() {
83123
83134
  super.initMarkStyle();
83124
83135
  const isDecrease = this._spec.calculationMode === 'decrease';
@@ -83132,9 +83143,9 @@
83132
83143
  if (!datum.lastIndex) {
83133
83144
  return 0;
83134
83145
  }
83135
- return this.totalPositionY(datum, 'lastIndex', isDecrease ? 0 : 1);
83146
+ return this.totalPositionY(datum, 'lastIndex', this._getLeaderLineCategoryPos(true, isDecrease));
83136
83147
  },
83137
- y1: (datum) => this.totalPositionY(datum, 'index', isDecrease ? 1 : 0)
83148
+ y1: (datum) => this.totalPositionY(datum, 'index', this._getLeaderLineCategoryPos(false, isDecrease))
83138
83149
  }, 'normal', exports.AttributeLevel.Series);
83139
83150
  }
83140
83151
  else {
@@ -83144,9 +83155,9 @@
83144
83155
  if (!datum.lastIndex) {
83145
83156
  return 0;
83146
83157
  }
83147
- return this.totalPositionX(datum, 'lastIndex', isDecrease ? 0 : 1);
83158
+ return this.totalPositionX(datum, 'lastIndex', this._getLeaderLineCategoryPos(true, isDecrease));
83148
83159
  },
83149
- x1: (datum) => this.totalPositionX(datum, 'index', isDecrease ? 1 : 0),
83160
+ x1: (datum) => this.totalPositionX(datum, 'index', this._getLeaderLineCategoryPos(false, isDecrease)),
83150
83161
  y: (datum) => this.totalPositionY(datum, 'lastEnd', 0),
83151
83162
  y1: (datum) => this.totalPositionY(datum, datum.isTotal ? 'end' : 'start', 0)
83152
83163
  }, 'normal', exports.AttributeLevel.Series);
@@ -102372,6 +102383,7 @@
102372
102383
  }
102373
102384
  clear() {
102374
102385
  super.clear();
102386
+ this._legendComponent = null;
102375
102387
  this._cacheAttrs = null;
102376
102388
  this._preSelectedData = null;
102377
102389
  }