@visactor/vchart 2.0.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.
- package/build/es5/index.js +1 -1
- package/build/index.es.js +106 -42
- package/build/index.js +106 -42
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/waterfall/waterfall-transformer.js +1 -1
- package/cjs/chart/waterfall/waterfall-transformer.js.map +1 -1
- package/cjs/component/marker/mark-line/cartesian-mark-line.js +7 -5
- package/cjs/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/data/transforms/waterfall.d.ts +2 -0
- package/cjs/data/transforms/waterfall.js +5 -3
- package/cjs/data/transforms/waterfall.js.map +1 -1
- package/cjs/plugin/chart/formatter/formatter.d.ts +3 -0
- package/cjs/plugin/chart/formatter/formatter.js +23 -1
- package/cjs/plugin/chart/formatter/formatter.js.map +1 -1
- package/cjs/series/waterfall/interface.d.ts +1 -0
- package/cjs/series/waterfall/interface.js.map +1 -1
- package/cjs/series/waterfall/waterfall.js +10 -6
- package/cjs/series/waterfall/waterfall.js.map +1 -1
- package/esm/chart/waterfall/waterfall-transformer.js +1 -1
- package/esm/chart/waterfall/waterfall-transformer.js.map +1 -1
- package/esm/component/marker/mark-line/cartesian-mark-line.js +7 -5
- package/esm/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/data/transforms/waterfall.d.ts +2 -0
- package/esm/data/transforms/waterfall.js +5 -3
- package/esm/data/transforms/waterfall.js.map +1 -1
- package/esm/plugin/chart/formatter/formatter.d.ts +3 -0
- package/esm/plugin/chart/formatter/formatter.js +23 -1
- package/esm/plugin/chart/formatter/formatter.js.map +1 -1
- package/esm/series/waterfall/interface.d.ts +1 -0
- package/esm/series/waterfall/interface.js.map +1 -1
- package/esm/series/waterfall/waterfall.js +10 -6
- package/esm/series/waterfall/waterfall.js.map +1 -1
- 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
|
-
|
|
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.
|
|
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.
|
|
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 !== (
|
|
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.
|
|
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 !== (
|
|
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
|
|
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.
|
|
58334
|
+
const version = "2.0.6";
|
|
58320
58335
|
|
|
58321
58336
|
const addVChartProperty = (data, op) => {
|
|
58322
58337
|
const context = op.beforeCall();
|
|
@@ -71424,10 +71439,13 @@
|
|
|
71424
71439
|
if (!lastData || lastData.length === 0) {
|
|
71425
71440
|
return lastData;
|
|
71426
71441
|
}
|
|
71427
|
-
const { indexField, total: totalSpec, groupData } = op;
|
|
71442
|
+
const { indexField, total: totalSpec, groupData, calculationMode } = op;
|
|
71428
71443
|
const totalData = [];
|
|
71429
71444
|
const { dimensionValues, dimensionData } = groupData().latestData;
|
|
71430
|
-
|
|
71445
|
+
let indexValues = Array.from(dimensionValues[indexField]);
|
|
71446
|
+
if (calculationMode === 'decrease') {
|
|
71447
|
+
indexValues = indexValues.reverse();
|
|
71448
|
+
}
|
|
71431
71449
|
let temp = {
|
|
71432
71450
|
start: 0,
|
|
71433
71451
|
end: 0,
|
|
@@ -71634,7 +71652,7 @@
|
|
|
71634
71652
|
if (!data) {
|
|
71635
71653
|
return data;
|
|
71636
71654
|
}
|
|
71637
|
-
const { indexField, valueField, total, seriesField } = op;
|
|
71655
|
+
const { indexField, valueField, total, seriesField, calculationMode } = op;
|
|
71638
71656
|
const totalData = {
|
|
71639
71657
|
[indexField]: (total === null || total === void 0 ? void 0 : total.text) || 'total',
|
|
71640
71658
|
[valueField]: data.reduce((pre, cur) => precisionAdd(pre, +cur[valueField]), 0)
|
|
@@ -71642,7 +71660,12 @@
|
|
|
71642
71660
|
if (seriesField) {
|
|
71643
71661
|
totalData[seriesField] = 'total';
|
|
71644
71662
|
}
|
|
71645
|
-
|
|
71663
|
+
if (calculationMode === 'decrease') {
|
|
71664
|
+
data.unshift(totalData);
|
|
71665
|
+
}
|
|
71666
|
+
else {
|
|
71667
|
+
data.push(totalData);
|
|
71668
|
+
}
|
|
71646
71669
|
return data;
|
|
71647
71670
|
};
|
|
71648
71671
|
|
|
@@ -72253,7 +72276,7 @@
|
|
|
72253
72276
|
return super.getSeriesKeys();
|
|
72254
72277
|
}
|
|
72255
72278
|
initData() {
|
|
72256
|
-
var _a;
|
|
72279
|
+
var _a, _b, _c;
|
|
72257
72280
|
super.initData();
|
|
72258
72281
|
registerDataSetInstanceTransform(this._dataSet, 'waterfallFillTotal', waterfallFillTotal);
|
|
72259
72282
|
registerDataSetInstanceTransform(this._dataSet, 'waterfall', waterfall$1);
|
|
@@ -72266,6 +72289,7 @@
|
|
|
72266
72289
|
seriesField: this.getSeriesField(),
|
|
72267
72290
|
seriesFieldName: this._theme.seriesFieldName,
|
|
72268
72291
|
total: this._spec.total,
|
|
72292
|
+
calculationMode: (_b = this._spec.calculationMode) !== null && _b !== void 0 ? _b : 'increase',
|
|
72269
72293
|
stackInverse: this.getRegion().getStackInverse()
|
|
72270
72294
|
}
|
|
72271
72295
|
}, false);
|
|
@@ -72285,6 +72309,7 @@
|
|
|
72285
72309
|
startAs: STACK_FIELD_START,
|
|
72286
72310
|
endAs: STACK_FIELD_END,
|
|
72287
72311
|
total: this._spec.total,
|
|
72312
|
+
calculationMode: (_c = this._spec.calculationMode) !== null && _c !== void 0 ? _c : 'increase',
|
|
72288
72313
|
groupData: () => this.getGroups().groupData,
|
|
72289
72314
|
stackInverse: this.getRegion().getStackInverse()
|
|
72290
72315
|
}
|
|
@@ -72409,6 +72434,7 @@
|
|
|
72409
72434
|
}
|
|
72410
72435
|
initMarkStyle() {
|
|
72411
72436
|
super.initMarkStyle();
|
|
72437
|
+
const isDecrease = this._spec.calculationMode === 'decrease';
|
|
72412
72438
|
if (this._leaderLineMark) {
|
|
72413
72439
|
if (this._direction === "horizontal") {
|
|
72414
72440
|
this.setMarkStyle(this._leaderLineMark, {
|
|
@@ -72419,9 +72445,9 @@
|
|
|
72419
72445
|
if (!datum.lastIndex) {
|
|
72420
72446
|
return 0;
|
|
72421
72447
|
}
|
|
72422
|
-
return this.totalPositionY(datum, 'lastIndex', 1);
|
|
72448
|
+
return this.totalPositionY(datum, 'lastIndex', isDecrease ? 0 : 1);
|
|
72423
72449
|
},
|
|
72424
|
-
y1: (datum) => this.totalPositionY(datum, 'index', 0)
|
|
72450
|
+
y1: (datum) => this.totalPositionY(datum, 'index', isDecrease ? 1 : 0)
|
|
72425
72451
|
}, 'normal', exports.AttributeLevel.Series);
|
|
72426
72452
|
}
|
|
72427
72453
|
else {
|
|
@@ -72431,9 +72457,9 @@
|
|
|
72431
72457
|
if (!datum.lastIndex) {
|
|
72432
72458
|
return 0;
|
|
72433
72459
|
}
|
|
72434
|
-
return this.totalPositionX(datum, 'lastIndex', 1);
|
|
72460
|
+
return this.totalPositionX(datum, 'lastIndex', isDecrease ? 0 : 1);
|
|
72435
72461
|
},
|
|
72436
|
-
x1: (datum) => this.totalPositionX(datum, 'index', 0),
|
|
72462
|
+
x1: (datum) => this.totalPositionX(datum, 'index', isDecrease ? 1 : 0),
|
|
72437
72463
|
y: (datum) => this.totalPositionY(datum, 'lastEnd', 0),
|
|
72438
72464
|
y1: (datum) => this.totalPositionY(datum, datum.isTotal ? 'end' : 'start', 0)
|
|
72439
72465
|
}, 'normal', exports.AttributeLevel.Series);
|
|
@@ -89401,6 +89427,7 @@
|
|
|
89401
89427
|
series.stackLabel = spec.stackLabel;
|
|
89402
89428
|
series.leaderLine = spec.leaderLine;
|
|
89403
89429
|
series.total = spec.total;
|
|
89430
|
+
series.calculationMode = spec.calculationMode;
|
|
89404
89431
|
return series;
|
|
89405
89432
|
}
|
|
89406
89433
|
}
|
|
@@ -95734,7 +95761,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
95734
95761
|
return { points };
|
|
95735
95762
|
}
|
|
95736
95763
|
_markerLayout() {
|
|
95737
|
-
var _a, _b, _c, _d;
|
|
95764
|
+
var _a, _b, _c, _d, _e;
|
|
95738
95765
|
const updateAttrs = this._getUpdateMarkerAttrs();
|
|
95739
95766
|
if (this._spec.type === 'type-step') {
|
|
95740
95767
|
const startRelativeSeries = this._startRelativeSeries;
|
|
@@ -95762,6 +95789,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
95762
95789
|
expandDistanceValue = expandDistance;
|
|
95763
95790
|
}
|
|
95764
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
|
+
}
|
|
95765
95796
|
const joinPoints = getInsertPoints(points[0], points[1], connectDirection, expandDistanceValue);
|
|
95766
95797
|
let labelPositionAttrs;
|
|
95767
95798
|
if (multiSegment && isValid$1(mainSegmentIndex)) {
|
|
@@ -95773,11 +95804,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
95773
95804
|
else {
|
|
95774
95805
|
labelPositionAttrs = Object.assign({ position: 'start', autoRotate: false }, getTextOffset(points[0], points[1], connectDirection, expandDistanceValue));
|
|
95775
95806
|
}
|
|
95776
|
-
const markerComponentAttr = (
|
|
95807
|
+
const markerComponentAttr = (_c = (_b = this._markerComponent) === null || _b === void 0 ? void 0 : _b.attribute) !== null && _c !== void 0 ? _c : {};
|
|
95777
95808
|
const prevLabelAttrs = array(markerComponentAttr.label);
|
|
95778
95809
|
const updateLabels = array(updateAttrs.label);
|
|
95779
95810
|
const labelsInSpec = array(this._spec.label);
|
|
95780
|
-
(
|
|
95811
|
+
(_d = this._markerComponent) === null || _d === void 0 ? void 0 : _d.setAttributes({
|
|
95781
95812
|
points: multiSegment
|
|
95782
95813
|
? [
|
|
95783
95814
|
[joinPoints[0], joinPoints[1]],
|
|
@@ -95817,7 +95848,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
95817
95848
|
});
|
|
95818
95849
|
}
|
|
95819
95850
|
else {
|
|
95820
|
-
(
|
|
95851
|
+
(_e = this._markerComponent) === null || _e === void 0 ? void 0 : _e.setAttributes(updateAttrs);
|
|
95821
95852
|
}
|
|
95822
95853
|
}
|
|
95823
95854
|
_computeOptions() {
|
|
@@ -100270,8 +100301,41 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
100270
100301
|
else if (formatter.includes('%') && this._timeFormatter) {
|
|
100271
100302
|
return this._timeFormatter(formatter, text);
|
|
100272
100303
|
}
|
|
100304
|
+
else if (formatter.startsWith('calc(')) {
|
|
100305
|
+
return this._calcFormatter(formatter, text);
|
|
100306
|
+
}
|
|
100273
100307
|
return text;
|
|
100274
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
|
+
}
|
|
100275
100339
|
release() {
|
|
100276
100340
|
super.release();
|
|
100277
100341
|
this._format = null;
|