@visactor/vchart 2.0.5 → 2.0.7-alpha.0
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 +124 -48
- package/build/index.js +124 -48
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/interface.js +2 -1
- package/cjs/chart/waterfall/waterfall-transformer.js +1 -1
- package/cjs/chart/waterfall/waterfall-transformer.js.map +1 -1
- package/cjs/compile/grammar-item.js +1 -2
- 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/constant/attribute.js +2 -1
- package/cjs/constant/gradient.js +1 -2
- package/cjs/constant/sunburst.js +1 -1
- package/cjs/constant/waterfall.js +2 -1
- package/cjs/constant/word-cloud.js +1 -1
- package/cjs/core/expression-function.js +1 -2
- 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/core/vchart.js +1 -1
- package/cjs/data/initialize.js +1 -1
- package/cjs/data/register.js +1 -1
- package/cjs/data/transforms/waterfall.d.ts +2 -0
- package/cjs/data/transforms/waterfall.js +23 -9
- 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/animation/interface.js +2 -1
- package/esm/chart/waterfall/waterfall-transformer.js +1 -1
- package/esm/chart/waterfall/waterfall-transformer.js.map +1 -1
- package/esm/compile/grammar-item.js +1 -2
- 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/constant/attribute.js +2 -1
- package/esm/constant/gradient.js +1 -2
- package/esm/constant/sunburst.js +1 -1
- package/esm/constant/waterfall.js +2 -1
- package/esm/constant/word-cloud.js +1 -1
- package/esm/core/expression-function.js +1 -2
- 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/core/vchart.js +1 -1
- package/esm/data/initialize.js +1 -1
- package/esm/data/register.js +1 -1
- package/esm/data/transforms/waterfall.d.ts +2 -0
- package/esm/data/transforms/waterfall.js +23 -8
- 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 +7 -7
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.7-alpha.0";
|
|
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,
|
|
@@ -71485,9 +71503,9 @@
|
|
|
71485
71503
|
const { valueField, startAs, endAs, total: totalSpec } = op;
|
|
71486
71504
|
const _normalTemp = [];
|
|
71487
71505
|
const _totalTemp = [];
|
|
71488
|
-
indexData.forEach(d => {
|
|
71506
|
+
indexData.forEach((d, index) => {
|
|
71489
71507
|
if (isTotalCheck(d)) {
|
|
71490
|
-
_totalTemp.push(d);
|
|
71508
|
+
_totalTemp.push(Object.assign(Object.assign({}, d), { [`_vchart_waterfall_waterfall_temp`]: index }));
|
|
71491
71509
|
}
|
|
71492
71510
|
else {
|
|
71493
71511
|
_normalTemp.push(d);
|
|
@@ -71509,6 +71527,15 @@
|
|
|
71509
71527
|
let positive = start;
|
|
71510
71528
|
let navigate = start;
|
|
71511
71529
|
let valueTemp = end - start;
|
|
71530
|
+
const tempTotalValue = _normalTemp.reduce((pre, cur) => precisionSub(pre, +cur[valueField]), valueTemp);
|
|
71531
|
+
_totalTemp.forEach(d => {
|
|
71532
|
+
const tempTotalData = {
|
|
71533
|
+
[startAs]: start,
|
|
71534
|
+
[endAs]: end,
|
|
71535
|
+
[valueField]: tempTotalValue
|
|
71536
|
+
};
|
|
71537
|
+
_normalTemp.splice(d._vchart_waterfall_waterfall_temp, 0, tempTotalData);
|
|
71538
|
+
});
|
|
71512
71539
|
_normalTemp.forEach(d => {
|
|
71513
71540
|
const value = +d[valueField];
|
|
71514
71541
|
if (value >= 0) {
|
|
@@ -71523,10 +71550,13 @@
|
|
|
71523
71550
|
start = precisionAdd(start, value);
|
|
71524
71551
|
valueTemp = precisionSub(valueTemp, value);
|
|
71525
71552
|
});
|
|
71526
|
-
_totalTemp.forEach(
|
|
71527
|
-
|
|
71528
|
-
|
|
71529
|
-
d
|
|
71553
|
+
_totalTemp.forEach(_d => {
|
|
71554
|
+
const index = _d._vchart_waterfall_waterfall_temp;
|
|
71555
|
+
_d = _normalTemp[index];
|
|
71556
|
+
const d = indexData[index];
|
|
71557
|
+
d[startAs] = _d[startAs];
|
|
71558
|
+
d[endAs] = _d[endAs];
|
|
71559
|
+
d[valueField] = _d[valueField];
|
|
71530
71560
|
});
|
|
71531
71561
|
return Object.assign(Object.assign({}, total), { lastIndex: key });
|
|
71532
71562
|
}
|
|
@@ -71634,7 +71664,7 @@
|
|
|
71634
71664
|
if (!data) {
|
|
71635
71665
|
return data;
|
|
71636
71666
|
}
|
|
71637
|
-
const { indexField, valueField, total, seriesField } = op;
|
|
71667
|
+
const { indexField, valueField, total, seriesField, calculationMode } = op;
|
|
71638
71668
|
const totalData = {
|
|
71639
71669
|
[indexField]: (total === null || total === void 0 ? void 0 : total.text) || 'total',
|
|
71640
71670
|
[valueField]: data.reduce((pre, cur) => precisionAdd(pre, +cur[valueField]), 0)
|
|
@@ -71642,7 +71672,12 @@
|
|
|
71642
71672
|
if (seriesField) {
|
|
71643
71673
|
totalData[seriesField] = 'total';
|
|
71644
71674
|
}
|
|
71645
|
-
|
|
71675
|
+
if (calculationMode === 'decrease') {
|
|
71676
|
+
data.unshift(totalData);
|
|
71677
|
+
}
|
|
71678
|
+
else {
|
|
71679
|
+
data.push(totalData);
|
|
71680
|
+
}
|
|
71646
71681
|
return data;
|
|
71647
71682
|
};
|
|
71648
71683
|
|
|
@@ -72253,7 +72288,7 @@
|
|
|
72253
72288
|
return super.getSeriesKeys();
|
|
72254
72289
|
}
|
|
72255
72290
|
initData() {
|
|
72256
|
-
var _a;
|
|
72291
|
+
var _a, _b, _c;
|
|
72257
72292
|
super.initData();
|
|
72258
72293
|
registerDataSetInstanceTransform(this._dataSet, 'waterfallFillTotal', waterfallFillTotal);
|
|
72259
72294
|
registerDataSetInstanceTransform(this._dataSet, 'waterfall', waterfall$1);
|
|
@@ -72266,6 +72301,7 @@
|
|
|
72266
72301
|
seriesField: this.getSeriesField(),
|
|
72267
72302
|
seriesFieldName: this._theme.seriesFieldName,
|
|
72268
72303
|
total: this._spec.total,
|
|
72304
|
+
calculationMode: (_b = this._spec.calculationMode) !== null && _b !== void 0 ? _b : 'increase',
|
|
72269
72305
|
stackInverse: this.getRegion().getStackInverse()
|
|
72270
72306
|
}
|
|
72271
72307
|
}, false);
|
|
@@ -72285,6 +72321,7 @@
|
|
|
72285
72321
|
startAs: STACK_FIELD_START,
|
|
72286
72322
|
endAs: STACK_FIELD_END,
|
|
72287
72323
|
total: this._spec.total,
|
|
72324
|
+
calculationMode: (_c = this._spec.calculationMode) !== null && _c !== void 0 ? _c : 'increase',
|
|
72288
72325
|
groupData: () => this.getGroups().groupData,
|
|
72289
72326
|
stackInverse: this.getRegion().getStackInverse()
|
|
72290
72327
|
}
|
|
@@ -72409,6 +72446,7 @@
|
|
|
72409
72446
|
}
|
|
72410
72447
|
initMarkStyle() {
|
|
72411
72448
|
super.initMarkStyle();
|
|
72449
|
+
const isDecrease = this._spec.calculationMode === 'decrease';
|
|
72412
72450
|
if (this._leaderLineMark) {
|
|
72413
72451
|
if (this._direction === "horizontal") {
|
|
72414
72452
|
this.setMarkStyle(this._leaderLineMark, {
|
|
@@ -72419,9 +72457,9 @@
|
|
|
72419
72457
|
if (!datum.lastIndex) {
|
|
72420
72458
|
return 0;
|
|
72421
72459
|
}
|
|
72422
|
-
return this.totalPositionY(datum, 'lastIndex', 1);
|
|
72460
|
+
return this.totalPositionY(datum, 'lastIndex', isDecrease ? 0 : 1);
|
|
72423
72461
|
},
|
|
72424
|
-
y1: (datum) => this.totalPositionY(datum, 'index', 0)
|
|
72462
|
+
y1: (datum) => this.totalPositionY(datum, 'index', isDecrease ? 1 : 0)
|
|
72425
72463
|
}, 'normal', exports.AttributeLevel.Series);
|
|
72426
72464
|
}
|
|
72427
72465
|
else {
|
|
@@ -72431,9 +72469,9 @@
|
|
|
72431
72469
|
if (!datum.lastIndex) {
|
|
72432
72470
|
return 0;
|
|
72433
72471
|
}
|
|
72434
|
-
return this.totalPositionX(datum, 'lastIndex', 1);
|
|
72472
|
+
return this.totalPositionX(datum, 'lastIndex', isDecrease ? 0 : 1);
|
|
72435
72473
|
},
|
|
72436
|
-
x1: (datum) => this.totalPositionX(datum, 'index', 0),
|
|
72474
|
+
x1: (datum) => this.totalPositionX(datum, 'index', isDecrease ? 1 : 0),
|
|
72437
72475
|
y: (datum) => this.totalPositionY(datum, 'lastEnd', 0),
|
|
72438
72476
|
y1: (datum) => this.totalPositionY(datum, datum.isTotal ? 'end' : 'start', 0)
|
|
72439
72477
|
}, 'normal', exports.AttributeLevel.Series);
|
|
@@ -89401,6 +89439,7 @@
|
|
|
89401
89439
|
series.stackLabel = spec.stackLabel;
|
|
89402
89440
|
series.leaderLine = spec.leaderLine;
|
|
89403
89441
|
series.total = spec.total;
|
|
89442
|
+
series.calculationMode = spec.calculationMode;
|
|
89404
89443
|
return series;
|
|
89405
89444
|
}
|
|
89406
89445
|
}
|
|
@@ -95734,7 +95773,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
95734
95773
|
return { points };
|
|
95735
95774
|
}
|
|
95736
95775
|
_markerLayout() {
|
|
95737
|
-
var _a, _b, _c, _d;
|
|
95776
|
+
var _a, _b, _c, _d, _e;
|
|
95738
95777
|
const updateAttrs = this._getUpdateMarkerAttrs();
|
|
95739
95778
|
if (this._spec.type === 'type-step') {
|
|
95740
95779
|
const startRelativeSeries = this._startRelativeSeries;
|
|
@@ -95762,6 +95801,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
95762
95801
|
expandDistanceValue = expandDistance;
|
|
95763
95802
|
}
|
|
95764
95803
|
const { points, limitRect } = updateAttrs;
|
|
95804
|
+
if (!points || points.length < 2) {
|
|
95805
|
+
(_a = this._markerComponent) === null || _a === void 0 ? void 0 : _a.setAttributes(updateAttrs);
|
|
95806
|
+
return;
|
|
95807
|
+
}
|
|
95765
95808
|
const joinPoints = getInsertPoints(points[0], points[1], connectDirection, expandDistanceValue);
|
|
95766
95809
|
let labelPositionAttrs;
|
|
95767
95810
|
if (multiSegment && isValid$1(mainSegmentIndex)) {
|
|
@@ -95773,11 +95816,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
95773
95816
|
else {
|
|
95774
95817
|
labelPositionAttrs = Object.assign({ position: 'start', autoRotate: false }, getTextOffset(points[0], points[1], connectDirection, expandDistanceValue));
|
|
95775
95818
|
}
|
|
95776
|
-
const markerComponentAttr = (
|
|
95819
|
+
const markerComponentAttr = (_c = (_b = this._markerComponent) === null || _b === void 0 ? void 0 : _b.attribute) !== null && _c !== void 0 ? _c : {};
|
|
95777
95820
|
const prevLabelAttrs = array(markerComponentAttr.label);
|
|
95778
95821
|
const updateLabels = array(updateAttrs.label);
|
|
95779
95822
|
const labelsInSpec = array(this._spec.label);
|
|
95780
|
-
(
|
|
95823
|
+
(_d = this._markerComponent) === null || _d === void 0 ? void 0 : _d.setAttributes({
|
|
95781
95824
|
points: multiSegment
|
|
95782
95825
|
? [
|
|
95783
95826
|
[joinPoints[0], joinPoints[1]],
|
|
@@ -95817,7 +95860,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
95817
95860
|
});
|
|
95818
95861
|
}
|
|
95819
95862
|
else {
|
|
95820
|
-
(
|
|
95863
|
+
(_e = this._markerComponent) === null || _e === void 0 ? void 0 : _e.setAttributes(updateAttrs);
|
|
95821
95864
|
}
|
|
95822
95865
|
}
|
|
95823
95866
|
_computeOptions() {
|
|
@@ -100270,8 +100313,41 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
100270
100313
|
else if (formatter.includes('%') && this._timeFormatter) {
|
|
100271
100314
|
return this._timeFormatter(formatter, text);
|
|
100272
100315
|
}
|
|
100316
|
+
else if (formatter.startsWith('calc(')) {
|
|
100317
|
+
return this._calcFormatter(formatter, text);
|
|
100318
|
+
}
|
|
100273
100319
|
return text;
|
|
100274
100320
|
}
|
|
100321
|
+
_calcFormatter(formatter, text) {
|
|
100322
|
+
try {
|
|
100323
|
+
const expression = formatter.slice(5, -1).replace(/v/g, String(text));
|
|
100324
|
+
return this._calculateMathExpression(expression, text);
|
|
100325
|
+
}
|
|
100326
|
+
catch (e) {
|
|
100327
|
+
return text;
|
|
100328
|
+
}
|
|
100329
|
+
}
|
|
100330
|
+
_calculateMathExpression(expression, text) {
|
|
100331
|
+
const cleanExpression = expression.replace(/\s+/g, '');
|
|
100332
|
+
if (!this._isValidMathExpression(cleanExpression)) {
|
|
100333
|
+
return text;
|
|
100334
|
+
}
|
|
100335
|
+
try {
|
|
100336
|
+
const safeFunction = new Function('return (' + cleanExpression + ')');
|
|
100337
|
+
const result = safeFunction();
|
|
100338
|
+
if (typeof result !== 'number' || isNaN(result) || !isFinite(result)) {
|
|
100339
|
+
throw new Error('Invalid calculation result');
|
|
100340
|
+
}
|
|
100341
|
+
return result;
|
|
100342
|
+
}
|
|
100343
|
+
catch (error) {
|
|
100344
|
+
return text;
|
|
100345
|
+
}
|
|
100346
|
+
}
|
|
100347
|
+
_isValidMathExpression(expression) {
|
|
100348
|
+
const validPattern = /^[0-9+\-*/().]+$/;
|
|
100349
|
+
return validPattern.test(expression);
|
|
100350
|
+
}
|
|
100275
100351
|
release() {
|
|
100276
100352
|
super.release();
|
|
100277
100353
|
this._format = null;
|