@visactor/vchart 1.5.3 → 1.5.4
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.js +187 -69
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/bar/bar.js +2 -1
- package/cjs/chart/bar/bar.js.map +1 -1
- package/cjs/chart/correlation/correlation.js.map +1 -1
- package/cjs/chart/range-column/range-column.js +2 -1
- package/cjs/chart/range-column/range-column.js.map +1 -1
- package/cjs/chart/stack.js +2 -1
- package/cjs/component/index.js +1 -2
- package/cjs/component/tooltip/handler/utils/common.js +14 -31
- package/cjs/component/tooltip/handler/utils/common.js.map +1 -1
- package/cjs/constant/base.js +1 -2
- package/cjs/constant/waterfall.js +2 -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/funnel.js +2 -2
- package/cjs/data/transforms/funnel.js.map +1 -1
- package/cjs/series/bar/bar.d.ts +13 -2
- package/cjs/series/bar/bar.js +99 -13
- package/cjs/series/bar/bar.js.map +1 -1
- package/cjs/series/bar/constant.js +4 -0
- package/cjs/series/bar/constant.js.map +1 -1
- package/cjs/series/bar/interface.d.ts +2 -0
- package/cjs/series/bar/interface.js.map +1 -1
- package/cjs/series/interface/type.d.ts +2 -1
- package/cjs/series/interface/type.js +2 -1
- package/cjs/series/interface/type.js.map +1 -1
- package/cjs/series/range-column/range-column.js +8 -7
- package/cjs/series/range-column/range-column.js.map +1 -1
- package/cjs/series/waterfall/waterfall.js +4 -4
- package/cjs/series/waterfall/waterfall.js.map +1 -1
- package/cjs/theme/builtin/common/mark.js +10 -0
- package/cjs/theme/builtin/common/mark.js.map +1 -1
- package/esm/chart/bar/bar.js +2 -1
- package/esm/chart/bar/bar.js.map +1 -1
- package/esm/chart/correlation/correlation.js.map +1 -1
- package/esm/chart/range-column/range-column.js +2 -1
- package/esm/chart/range-column/range-column.js.map +1 -1
- package/esm/chart/stack.js +2 -1
- package/esm/component/index.js +1 -2
- package/esm/component/tooltip/handler/utils/common.js +15 -32
- package/esm/component/tooltip/handler/utils/common.js.map +1 -1
- package/esm/constant/base.js +1 -2
- package/esm/constant/waterfall.js +2 -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/funnel.js +1 -1
- package/esm/data/transforms/funnel.js.map +1 -1
- package/esm/series/bar/bar.d.ts +13 -2
- package/esm/series/bar/bar.js +108 -12
- package/esm/series/bar/bar.js.map +1 -1
- package/esm/series/bar/constant.js +4 -0
- package/esm/series/bar/constant.js.map +1 -1
- package/esm/series/bar/interface.d.ts +2 -0
- package/esm/series/bar/interface.js.map +1 -1
- package/esm/series/interface/type.d.ts +2 -1
- package/esm/series/interface/type.js +2 -1
- package/esm/series/interface/type.js.map +1 -1
- package/esm/series/range-column/range-column.js +8 -7
- package/esm/series/range-column/range-column.js.map +1 -1
- package/esm/series/waterfall/waterfall.js +4 -4
- package/esm/series/waterfall/waterfall.js.map +1 -1
- package/esm/theme/builtin/common/mark.js +10 -0
- package/esm/theme/builtin/common/mark.js.map +1 -1
- package/package.json +3 -3
package/build/index.js
CHANGED
|
@@ -49342,6 +49342,12 @@
|
|
|
49342
49342
|
style: {
|
|
49343
49343
|
stroke: false
|
|
49344
49344
|
}
|
|
49345
|
+
},
|
|
49346
|
+
barBackground: {
|
|
49347
|
+
visible: false,
|
|
49348
|
+
style: {
|
|
49349
|
+
fill: { type: 'palette', key: 'primaryFontColor', a: 0.06 }
|
|
49350
|
+
}
|
|
49345
49351
|
}
|
|
49346
49352
|
};
|
|
49347
49353
|
|
|
@@ -50475,6 +50481,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
50475
50481
|
SeriesMarkNameEnum["ripplePoint"] = "ripplePoint";
|
|
50476
50482
|
SeriesMarkNameEnum["centerPoint"] = "centerPoint";
|
|
50477
50483
|
SeriesMarkNameEnum["centerLabel"] = "centerLabel";
|
|
50484
|
+
SeriesMarkNameEnum["barBackground"] = "barBackground";
|
|
50478
50485
|
})(SeriesMarkNameEnum || (SeriesMarkNameEnum = {}));
|
|
50479
50486
|
const seriesMarkNameSet = new Set(Object.values(SeriesMarkNameEnum));
|
|
50480
50487
|
|
|
@@ -50507,7 +50514,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
50507
50514
|
[SeriesMarkNameEnum.label]: { name: SeriesMarkNameEnum.label, type: MarkTypeEnum.text }
|
|
50508
50515
|
};
|
|
50509
50516
|
|
|
50510
|
-
const barSeriesMark = Object.assign(Object.assign({}, baseSeriesMark), { [SeriesMarkNameEnum.bar]: { name: SeriesMarkNameEnum.bar, type: MarkTypeEnum.rect } });
|
|
50517
|
+
const barSeriesMark = Object.assign(Object.assign({}, baseSeriesMark), { [SeriesMarkNameEnum.bar]: { name: SeriesMarkNameEnum.bar, type: MarkTypeEnum.rect }, [SeriesMarkNameEnum.barBackground]: { name: SeriesMarkNameEnum.barBackground, type: MarkTypeEnum.rect } });
|
|
50511
50518
|
const bar3dSeriesMark = Object.assign(Object.assign({}, baseSeriesMark), { [SeriesMarkNameEnum.bar3d]: { name: SeriesMarkNameEnum.bar3d, type: MarkTypeEnum.rect3d } });
|
|
50512
50519
|
|
|
50513
50520
|
const lineLikeSeriesMark = {
|
|
@@ -58371,7 +58378,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
58371
58378
|
};
|
|
58372
58379
|
registerVChartCore();
|
|
58373
58380
|
|
|
58374
|
-
const version = "1.5.
|
|
58381
|
+
const version = "1.5.4";
|
|
58375
58382
|
|
|
58376
58383
|
class ChartData {
|
|
58377
58384
|
get dataList() {
|
|
@@ -62861,7 +62868,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
62861
62868
|
large: this._spec.large,
|
|
62862
62869
|
largeThreshold: this._spec.largeThreshold
|
|
62863
62870
|
};
|
|
62864
|
-
this.
|
|
62871
|
+
this._initBarBackgroundMark(progressive);
|
|
62872
|
+
this._barMark = this._createMark(Object.assign(Object.assign({}, BarSeries.mark.bar), { name: this._barMarkName, type: this._barMarkType }), {
|
|
62865
62873
|
morph: shouldDoMorph(this._spec.animation, this._spec.morph, userAnimationConfig(this.type, this._spec)),
|
|
62866
62874
|
defaultMorphElementKey: this.getDimensionField()[0],
|
|
62867
62875
|
groupKey: this._seriesField,
|
|
@@ -62870,13 +62878,22 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
62870
62878
|
progressive
|
|
62871
62879
|
});
|
|
62872
62880
|
}
|
|
62881
|
+
_initBarBackgroundMark(progressive) {
|
|
62882
|
+
var _a;
|
|
62883
|
+
if ((_a = this._spec.barBackground) === null || _a === void 0 ? void 0 : _a.visible) {
|
|
62884
|
+
this._barBackgroundMark = this._createMark(BarSeries.mark.barBackground, {
|
|
62885
|
+
dataView: this._barBackgroundViewData.getDataView(),
|
|
62886
|
+
dataProductId: this._barBackgroundViewData.getProductId(),
|
|
62887
|
+
progressive
|
|
62888
|
+
});
|
|
62889
|
+
}
|
|
62890
|
+
}
|
|
62873
62891
|
initMarkStyle() {
|
|
62874
|
-
|
|
62875
|
-
|
|
62876
|
-
this.setMarkStyle(rectMark, {
|
|
62892
|
+
if (this._barMark) {
|
|
62893
|
+
this.setMarkStyle(this._barMark, {
|
|
62877
62894
|
fill: this.getColorAttribute()
|
|
62878
62895
|
}, 'normal', AttributeLevel.Series);
|
|
62879
|
-
this._trigger.registerMark(
|
|
62896
|
+
this._trigger.registerMark(this._barMark);
|
|
62880
62897
|
}
|
|
62881
62898
|
}
|
|
62882
62899
|
initLabelMarkStyle(textMark) {
|
|
@@ -62893,7 +62910,52 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
62893
62910
|
}
|
|
62894
62911
|
initTooltip() {
|
|
62895
62912
|
super.initTooltip();
|
|
62896
|
-
this.
|
|
62913
|
+
this._barMark && this._tooltipHelper.activeTriggerSet.mark.add(this._barMark);
|
|
62914
|
+
}
|
|
62915
|
+
_statisticViewData() {
|
|
62916
|
+
var _a, _b;
|
|
62917
|
+
super._statisticViewData();
|
|
62918
|
+
if (!((_a = this._spec.barBackground) === null || _a === void 0 ? void 0 : _a.visible)) {
|
|
62919
|
+
return;
|
|
62920
|
+
}
|
|
62921
|
+
const dimensionItems = ([data], op) => {
|
|
62922
|
+
var _a;
|
|
62923
|
+
let dataCollect = [{}];
|
|
62924
|
+
const fields = this.getDimensionField();
|
|
62925
|
+
for (let i = 0; i < fields.length; i++) {
|
|
62926
|
+
const field = fields[i];
|
|
62927
|
+
const values = (_a = data.latestData[field]) === null || _a === void 0 ? void 0 : _a.values;
|
|
62928
|
+
if (!(values === null || values === void 0 ? void 0 : values.length)) {
|
|
62929
|
+
continue;
|
|
62930
|
+
}
|
|
62931
|
+
const newDataCollect = [];
|
|
62932
|
+
for (let j = 0; j < values.length; j++) {
|
|
62933
|
+
for (let k = 0; k < dataCollect.length; k++) {
|
|
62934
|
+
newDataCollect.push(Object.assign(Object.assign({}, dataCollect[k]), { [field]: values[j] }));
|
|
62935
|
+
}
|
|
62936
|
+
}
|
|
62937
|
+
dataCollect = newDataCollect;
|
|
62938
|
+
}
|
|
62939
|
+
return dataCollect;
|
|
62940
|
+
};
|
|
62941
|
+
registerDataSetInstanceTransform(this._option.dataSet, 'addVChartProperty', addVChartProperty);
|
|
62942
|
+
registerDataSetInstanceTransform(this._option.dataSet, 'dimensionItems', dimensionItems);
|
|
62943
|
+
const barBackgroundData = new DataView(this._option.dataSet)
|
|
62944
|
+
.parse([this._viewDataStatistics], {
|
|
62945
|
+
type: 'dataview'
|
|
62946
|
+
})
|
|
62947
|
+
.transform({
|
|
62948
|
+
type: 'dimensionItems'
|
|
62949
|
+
}, false)
|
|
62950
|
+
.transform({
|
|
62951
|
+
type: 'addVChartProperty',
|
|
62952
|
+
options: {
|
|
62953
|
+
beforeCall: initKeyMap,
|
|
62954
|
+
call: addDataKey.bind(this)
|
|
62955
|
+
}
|
|
62956
|
+
}, false);
|
|
62957
|
+
(_b = this._viewDataStatistics) === null || _b === void 0 ? void 0 : _b.target.addListener('change', barBackgroundData.reRunAllTransform);
|
|
62958
|
+
this._barBackgroundViewData = new SeriesData(this._option, barBackgroundData);
|
|
62897
62959
|
}
|
|
62898
62960
|
init(option) {
|
|
62899
62961
|
var _a, _b;
|
|
@@ -62986,7 +63048,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
62986
63048
|
const xScale = (_b = (_a = this._xAxisHelper) === null || _a === void 0 ? void 0 : _a.getScale) === null || _b === void 0 ? void 0 : _b.call(_a, 0);
|
|
62987
63049
|
const yScale = (_d = (_c = this._yAxisHelper) === null || _c === void 0 ? void 0 : _c.getScale) === null || _d === void 0 ? void 0 : _d.call(_c, 0);
|
|
62988
63050
|
if (this.direction === Direction.horizontal) {
|
|
62989
|
-
this.setMarkStyle(this.
|
|
63051
|
+
this.setMarkStyle(this._barMark, {
|
|
62990
63052
|
x: (datum) => {
|
|
62991
63053
|
if (this._shouldDoPreCalculate()) {
|
|
62992
63054
|
this._calculateStackRectPosition(false);
|
|
@@ -63009,7 +63071,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63009
63071
|
}, 'normal', AttributeLevel.Series);
|
|
63010
63072
|
}
|
|
63011
63073
|
else {
|
|
63012
|
-
this.setMarkStyle(this.
|
|
63074
|
+
this.setMarkStyle(this._barMark, {
|
|
63013
63075
|
x: (datum) => this._getPosition(this.direction, datum),
|
|
63014
63076
|
y: (datum, ctx, opt, dataView) => {
|
|
63015
63077
|
if (this._shouldDoPreCalculate()) {
|
|
@@ -63033,13 +63095,56 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63033
63095
|
}
|
|
63034
63096
|
}, 'normal', AttributeLevel.Series);
|
|
63035
63097
|
}
|
|
63098
|
+
this._initBarBackgroundMarkStyle();
|
|
63099
|
+
}
|
|
63100
|
+
_initBarBackgroundMarkStyle() {
|
|
63101
|
+
var _a, _b, _c, _d;
|
|
63102
|
+
if (!this._barBackgroundMark) {
|
|
63103
|
+
return;
|
|
63104
|
+
}
|
|
63105
|
+
const xScale = (_b = (_a = this._xAxisHelper) === null || _a === void 0 ? void 0 : _a.getScale) === null || _b === void 0 ? void 0 : _b.call(_a, 0);
|
|
63106
|
+
const yScale = (_d = (_c = this._yAxisHelper) === null || _c === void 0 ? void 0 : _c.getScale) === null || _d === void 0 ? void 0 : _d.call(_c, 0);
|
|
63107
|
+
if (this.direction === Direction.horizontal) {
|
|
63108
|
+
this.setMarkStyle(this._barBackgroundMark, {
|
|
63109
|
+
x: () => {
|
|
63110
|
+
const range = xScale.range();
|
|
63111
|
+
const min = Math.min(range[0], range[range.length - 1]);
|
|
63112
|
+
return min;
|
|
63113
|
+
},
|
|
63114
|
+
x1: () => {
|
|
63115
|
+
const range = xScale.range();
|
|
63116
|
+
const max = Math.max(range[0], range[range.length - 1]);
|
|
63117
|
+
return max;
|
|
63118
|
+
},
|
|
63119
|
+
y: (datum) => this._getPosition(this.direction, datum),
|
|
63120
|
+
height: () => this._getBarWidth(this._yAxisHelper)
|
|
63121
|
+
}, 'normal', AttributeLevel.Series);
|
|
63122
|
+
}
|
|
63123
|
+
else {
|
|
63124
|
+
this.setMarkStyle(this._barBackgroundMark, {
|
|
63125
|
+
x: (datum) => this._getPosition(this.direction, datum),
|
|
63126
|
+
y: () => {
|
|
63127
|
+
const range = yScale.range();
|
|
63128
|
+
const min = Math.min(range[0], range[range.length - 1]);
|
|
63129
|
+
return min;
|
|
63130
|
+
},
|
|
63131
|
+
y1: () => {
|
|
63132
|
+
const range = yScale.range();
|
|
63133
|
+
const max = Math.max(range[0], range[range.length - 1]);
|
|
63134
|
+
return max;
|
|
63135
|
+
},
|
|
63136
|
+
width: () => {
|
|
63137
|
+
return this._getBarWidth(this._xAxisHelper);
|
|
63138
|
+
}
|
|
63139
|
+
}, 'normal', AttributeLevel.Series);
|
|
63140
|
+
}
|
|
63036
63141
|
}
|
|
63037
63142
|
initLinearRectMarkStyle() {
|
|
63038
63143
|
var _a, _b, _c, _d;
|
|
63039
63144
|
const xScale = (_b = (_a = this._xAxisHelper) === null || _a === void 0 ? void 0 : _a.getScale) === null || _b === void 0 ? void 0 : _b.call(_a, 0);
|
|
63040
63145
|
const yScale = (_d = (_c = this._yAxisHelper) === null || _c === void 0 ? void 0 : _c.getScale) === null || _d === void 0 ? void 0 : _d.call(_c, 0);
|
|
63041
63146
|
if (this.direction === Direction.vertical) {
|
|
63042
|
-
this.setMarkStyle(this.
|
|
63147
|
+
this.setMarkStyle(this._barMark, {
|
|
63043
63148
|
x: (datum) => valueInScaleRange(this.dataToPositionX(datum), xScale),
|
|
63044
63149
|
x1: (datum) => valueInScaleRange(this.dataToPositionX1(datum), xScale),
|
|
63045
63150
|
y: (datum, ctx, opt, dataView) => {
|
|
@@ -63062,7 +63167,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63062
63167
|
}, 'normal', AttributeLevel.Series);
|
|
63063
63168
|
}
|
|
63064
63169
|
else {
|
|
63065
|
-
this.setMarkStyle(this.
|
|
63170
|
+
this.setMarkStyle(this._barMark, {
|
|
63066
63171
|
x: (datum) => {
|
|
63067
63172
|
if (this._shouldDoPreCalculate()) {
|
|
63068
63173
|
this._calculateStackRectPosition(false);
|
|
@@ -63105,7 +63210,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63105
63210
|
const xIndex = (_c = (_b = (_a = this.getViewDataStatistics()) === null || _a === void 0 ? void 0 : _a.latestData) === null || _b === void 0 ? void 0 : _b[this._fieldX[0]]) === null || _c === void 0 ? void 0 : _c.values.indexOf(xValue);
|
|
63106
63211
|
return xIndex || 0;
|
|
63107
63212
|
};
|
|
63108
|
-
this.
|
|
63213
|
+
this._barMark.setAnimationConfig(animationConfig((_c = Factory.getAnimationInKey('bar')) === null || _c === void 0 ? void 0 : _c(animationParams, appearPreset), userAnimationConfig(this._barMarkName, this._spec), { dataIndex }));
|
|
63109
63214
|
}
|
|
63110
63215
|
_getBarWidth(axisHelper) {
|
|
63111
63216
|
var _a, _b;
|
|
@@ -63141,7 +63246,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63141
63246
|
dataToPosition = this.dataToPositionX.bind(this);
|
|
63142
63247
|
}
|
|
63143
63248
|
const scale = axisHelper.getScale(0);
|
|
63144
|
-
const size = this.
|
|
63249
|
+
const size = this._barMark.getAttribute(sizeAttribute, datum);
|
|
63145
63250
|
const bandWidth = (_b = (_a = axisHelper.getBandwidth) === null || _a === void 0 ? void 0 : _a.call(axisHelper, this._groups ? this._groups.fields.length - 1 : 0)) !== null && _b !== void 0 ? _b : DefaultBandWidth$2;
|
|
63146
63251
|
if (((_d = (_c = this._groups) === null || _c === void 0 ? void 0 : _c.fields) === null || _d === void 0 ? void 0 : _d.length) > 1 && isValid$1(this._spec.barGapInGroup)) {
|
|
63147
63252
|
const groupFields = this._groups.fields;
|
|
@@ -63179,7 +63284,29 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63179
63284
|
return 'square';
|
|
63180
63285
|
}
|
|
63181
63286
|
getActiveMarks() {
|
|
63182
|
-
return [this.
|
|
63287
|
+
return [this._barMark];
|
|
63288
|
+
}
|
|
63289
|
+
compileData() {
|
|
63290
|
+
var _a;
|
|
63291
|
+
super.compileData();
|
|
63292
|
+
(_a = this._barBackgroundViewData) === null || _a === void 0 ? void 0 : _a.compile();
|
|
63293
|
+
}
|
|
63294
|
+
fillData() {
|
|
63295
|
+
var _a, _b;
|
|
63296
|
+
super.fillData();
|
|
63297
|
+
(_b = (_a = this._barBackgroundViewData) === null || _a === void 0 ? void 0 : _a.getDataView()) === null || _b === void 0 ? void 0 : _b.reRunAllTransform();
|
|
63298
|
+
}
|
|
63299
|
+
viewDataUpdate(d) {
|
|
63300
|
+
var _a, _b, _c;
|
|
63301
|
+
super.viewDataUpdate(d);
|
|
63302
|
+
(_b = (_a = this._barBackgroundViewData) === null || _a === void 0 ? void 0 : _a.getDataView()) === null || _b === void 0 ? void 0 : _b.reRunAllTransform();
|
|
63303
|
+
(_c = this._barBackgroundViewData) === null || _c === void 0 ? void 0 : _c.updateData();
|
|
63304
|
+
}
|
|
63305
|
+
release() {
|
|
63306
|
+
var _a;
|
|
63307
|
+
super.release();
|
|
63308
|
+
(_a = this._barBackgroundViewData) === null || _a === void 0 ? void 0 : _a.release();
|
|
63309
|
+
this._barBackgroundViewData = null;
|
|
63183
63310
|
}
|
|
63184
63311
|
}
|
|
63185
63312
|
BarSeries.type = SeriesTypeEnum.bar;
|
|
@@ -63197,7 +63324,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63197
63324
|
this.seriesType = SeriesTypeEnum.bar;
|
|
63198
63325
|
}
|
|
63199
63326
|
_getDefaultSeriesSpec(spec) {
|
|
63200
|
-
return Object.assign(Object.assign({}, super._getDefaultSeriesSpec(spec)), { barWidth: spec.barWidth, barMaxWidth: spec.barMaxWidth, barMinWidth: spec.barMinWidth, barGapInGroup: spec.barGapInGroup, barMinHeight: spec.barMinHeight });
|
|
63327
|
+
return Object.assign(Object.assign({}, super._getDefaultSeriesSpec(spec)), { barWidth: spec.barWidth, barMaxWidth: spec.barMaxWidth, barMinWidth: spec.barMinWidth, barGapInGroup: spec.barGapInGroup, barMinHeight: spec.barMinHeight, barBackground: spec.barBackground });
|
|
63201
63328
|
}
|
|
63202
63329
|
transformSpec(spec) {
|
|
63203
63330
|
super.transformSpec(spec);
|
|
@@ -71555,8 +71682,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
71555
71682
|
const currentValue = Number.parseFloat(d[valueField]);
|
|
71556
71683
|
const lastValue = Number.parseFloat((_a = data[i - 1]) === null || _a === void 0 ? void 0 : _a[valueField]);
|
|
71557
71684
|
const nextValue = Number.parseFloat((_b = data[i + 1]) === null || _b === void 0 ? void 0 : _b[valueField]);
|
|
71558
|
-
const transformRatio = !isValidNumber$1(nextValue * currentValue) ?
|
|
71559
|
-
const reachRatio = !isValidNumber$1(currentValue *
|
|
71685
|
+
const transformRatio = !isValidNumber$1(nextValue * currentValue) || currentValue === 0 ? 0 : nextValue / currentValue;
|
|
71686
|
+
const reachRatio = !isValidNumber$1(currentValue * lastValue) || lastValue === 0 ? 0 : currentValue / lastValue;
|
|
71560
71687
|
asLastValue && (d[asLastValue] = lastValue);
|
|
71561
71688
|
asNextValue && (d[asNextValue] = nextValue);
|
|
71562
71689
|
asTransformRatio && (d[asTransformRatio] = transformRatio);
|
|
@@ -72980,8 +73107,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
72980
73107
|
}
|
|
72981
73108
|
initMark() {
|
|
72982
73109
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
73110
|
+
this._initBarBackgroundMark();
|
|
72983
73111
|
const labelPosition = (_a = this._spec.label) === null || _a === void 0 ? void 0 : _a.position;
|
|
72984
|
-
this.
|
|
73112
|
+
this._barMark = this._createMark(RangeColumnSeries.mark.bar, {
|
|
72985
73113
|
morph: shouldDoMorph(this._spec.animation, this._spec.morph, userAnimationConfig('bar', this._spec)),
|
|
72986
73114
|
defaultMorphElementKey: this.getDimensionField()[0],
|
|
72987
73115
|
groupKey: this._seriesField,
|
|
@@ -73019,16 +73147,16 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
73019
73147
|
});
|
|
73020
73148
|
const position = (_d = minLabelSpec === null || minLabelSpec === void 0 ? void 0 : minLabelSpec.position) !== null && _d !== void 0 ? _d : 'end';
|
|
73021
73149
|
const offset = (_e = minLabelSpec === null || minLabelSpec === void 0 ? void 0 : minLabelSpec.offset) !== null && _e !== void 0 ? _e : (this._direction === 'vertical' ? -20 : -25);
|
|
73022
|
-
setRectLabelPos(this, minLabelMark, position, offset, (datum) => this.
|
|
73150
|
+
setRectLabelPos(this, minLabelMark, position, offset, (datum) => this._barMark.getAttribute('x', datum), (datum) => {
|
|
73023
73151
|
return this._direction === 'vertical'
|
|
73024
|
-
? this.
|
|
73025
|
-
this.
|
|
73026
|
-
: this.
|
|
73027
|
-
}, (datum) => this.
|
|
73152
|
+
? this._barMark.getAttribute('x', datum) +
|
|
73153
|
+
this._barMark.getAttribute('width', datum)
|
|
73154
|
+
: this._barMark.getAttribute('x1', datum);
|
|
73155
|
+
}, (datum) => this._barMark.getAttribute('y', datum), (datum) => {
|
|
73028
73156
|
return this._direction === 'vertical'
|
|
73029
|
-
? this.
|
|
73030
|
-
: this.
|
|
73031
|
-
this.
|
|
73157
|
+
? this._barMark.getAttribute('y1', datum)
|
|
73158
|
+
: this._barMark.getAttribute('y', datum) +
|
|
73159
|
+
this._barMark.getAttribute('height', datum);
|
|
73032
73160
|
}, () => this._direction);
|
|
73033
73161
|
}
|
|
73034
73162
|
const maxLabelMark = this._maxLabelMark;
|
|
@@ -73046,16 +73174,16 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
73046
73174
|
});
|
|
73047
73175
|
const position = (_j = maxLabelSpec === null || maxLabelSpec === void 0 ? void 0 : maxLabelSpec.position) !== null && _j !== void 0 ? _j : 'start';
|
|
73048
73176
|
const offset = (_k = maxLabelSpec === null || maxLabelSpec === void 0 ? void 0 : maxLabelSpec.offset) !== null && _k !== void 0 ? _k : (this._direction === 'vertical' ? -20 : -25);
|
|
73049
|
-
setRectLabelPos(this, maxLabelMark, position, offset, (datum) => this.
|
|
73177
|
+
setRectLabelPos(this, maxLabelMark, position, offset, (datum) => this._barMark.getAttribute('x', datum), (datum) => {
|
|
73050
73178
|
return this._direction === 'vertical'
|
|
73051
|
-
? this.
|
|
73052
|
-
this.
|
|
73053
|
-
: this.
|
|
73054
|
-
}, (datum) => this.
|
|
73179
|
+
? this._barMark.getAttribute('x', datum) +
|
|
73180
|
+
this._barMark.getAttribute('width', datum)
|
|
73181
|
+
: this._barMark.getAttribute('x1', datum);
|
|
73182
|
+
}, (datum) => this._barMark.getAttribute('y', datum), (datum) => {
|
|
73055
73183
|
return this._direction === 'vertical'
|
|
73056
|
-
? this.
|
|
73057
|
-
: this.
|
|
73058
|
-
this.
|
|
73184
|
+
? this._barMark.getAttribute('y1', datum)
|
|
73185
|
+
: this._barMark.getAttribute('y', datum) +
|
|
73186
|
+
this._barMark.getAttribute('height', datum);
|
|
73059
73187
|
}, () => this._direction);
|
|
73060
73188
|
}
|
|
73061
73189
|
}
|
|
@@ -73087,7 +73215,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
73087
73215
|
const yScale = (_d = (_c = this._yAxisHelper) === null || _c === void 0 ? void 0 : _c.getScale) === null || _d === void 0 ? void 0 : _d.call(_c, 0);
|
|
73088
73216
|
const { dataToPosition } = this.direction === Direction.horizontal ? this._xAxisHelper : this._yAxisHelper;
|
|
73089
73217
|
if (this.direction === Direction.horizontal) {
|
|
73090
|
-
this.setMarkStyle(this.
|
|
73218
|
+
this.setMarkStyle(this._barMark, {
|
|
73091
73219
|
x: (datum) => valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._spec.xField[0]), {
|
|
73092
73220
|
bandPosition: this._bandPosition
|
|
73093
73221
|
}), xScale),
|
|
@@ -73099,7 +73227,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
73099
73227
|
}, 'normal', AttributeLevel.Series);
|
|
73100
73228
|
}
|
|
73101
73229
|
else {
|
|
73102
|
-
this.setMarkStyle(this.
|
|
73230
|
+
this.setMarkStyle(this._barMark, {
|
|
73103
73231
|
x: (datum) => this._getPosition(this.direction, datum),
|
|
73104
73232
|
y: (datum) => valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._spec.yField[0]), {
|
|
73105
73233
|
bandPosition: this._bandPosition
|
|
@@ -73112,6 +73240,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
73112
73240
|
}
|
|
73113
73241
|
}, 'normal', AttributeLevel.Series);
|
|
73114
73242
|
}
|
|
73243
|
+
this._initBarBackgroundMarkStyle();
|
|
73115
73244
|
}
|
|
73116
73245
|
initAnimation() {
|
|
73117
73246
|
var _a, _b, _c, _d, _e;
|
|
@@ -73122,7 +73251,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
73122
73251
|
return xIndex || 0;
|
|
73123
73252
|
};
|
|
73124
73253
|
const appearPreset = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.animationAppear) === null || _b === void 0 ? void 0 : _b.preset;
|
|
73125
|
-
this.
|
|
73254
|
+
this._barMark.setAnimationConfig(animationConfig((_c = Factory.getAnimationInKey('rangeColumn')) === null || _c === void 0 ? void 0 : _c({ direction: this.direction }, appearPreset), userAnimationConfig(SeriesMarkNameEnum.bar, this._spec), { dataIndex }));
|
|
73126
73255
|
if (this._minLabelMark) {
|
|
73127
73256
|
this._minLabelMark.setAnimationConfig(animationConfig((_d = Factory.getAnimationInKey('fadeInOut')) === null || _d === void 0 ? void 0 : _d(), userAnimationConfig(SeriesMarkNameEnum.label, this._spec), { dataIndex }));
|
|
73128
73257
|
}
|
|
@@ -73155,7 +73284,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
73155
73284
|
}
|
|
73156
73285
|
_getDefaultSeriesSpec(spec) {
|
|
73157
73286
|
var _a, _b;
|
|
73158
|
-
const series = Object.assign(Object.assign({}, super._getDefaultSeriesSpec(spec)), { barGapInGroup: spec.barGapInGroup });
|
|
73287
|
+
const series = Object.assign(Object.assign({}, super._getDefaultSeriesSpec(spec)), { barGapInGroup: spec.barGapInGroup, barBackground: spec.barBackground });
|
|
73159
73288
|
series.bar = spec.bar;
|
|
73160
73289
|
if (spec.direction === Direction.horizontal) {
|
|
73161
73290
|
series.xField = (_a = spec.xField) !== null && _a !== void 0 ? _a : [spec.minField, spec.maxField];
|
|
@@ -75885,7 +76014,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
75885
76014
|
const xIndex = (_c = (_b = (_a = this.getViewDataStatistics()) === null || _a === void 0 ? void 0 : _a.latestData) === null || _b === void 0 ? void 0 : _b[this._fieldX[0]]) === null || _c === void 0 ? void 0 : _c.values.indexOf(xValue);
|
|
75886
76015
|
return xIndex || 0;
|
|
75887
76016
|
};
|
|
75888
|
-
this.
|
|
76017
|
+
this._barMark.setAnimationConfig(animationConfig((_c = Factory.getAnimationInKey('waterfall')) === null || _c === void 0 ? void 0 : _c(animationParams, appearPreset), userAnimationConfig(SeriesMarkNameEnum.bar, this._spec), { dataIndex }));
|
|
75889
76018
|
if (this._leaderLineMark) {
|
|
75890
76019
|
this._leaderLineMark.setAnimationConfig(animationConfig((_d = Factory.getAnimationInKey('fadeInOut')) === null || _d === void 0 ? void 0 : _d(), userAnimationConfig(SeriesMarkNameEnum.leaderLine, this._spec)));
|
|
75891
76020
|
}
|
|
@@ -75914,7 +76043,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
75914
76043
|
leaderLine.setDataView(this._totalData.getDataView(), this._totalData.getProductId());
|
|
75915
76044
|
}
|
|
75916
76045
|
if ((_a = this._spec.stackLabel) === null || _a === void 0 ? void 0 : _a.visible) {
|
|
75917
|
-
this.
|
|
76046
|
+
this._barMark.addLabelSpec(this._spec.stackLabel);
|
|
75918
76047
|
}
|
|
75919
76048
|
}
|
|
75920
76049
|
initLabelMarkStyle(labelMark) {
|
|
@@ -75945,7 +76074,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
75945
76074
|
bandPosition: this._bandPosition
|
|
75946
76075
|
}) +
|
|
75947
76076
|
getBandwidth(0) * 0.5 -
|
|
75948
|
-
this.
|
|
76077
|
+
this._barMark.getAttribute('width', datum) * (0.5 - pos));
|
|
75949
76078
|
}
|
|
75950
76079
|
return valueInScaleRange(dataToPosition([datum[field]], {
|
|
75951
76080
|
bandPosition: this._bandPosition
|
|
@@ -75962,7 +76091,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
75962
76091
|
bandPosition: this._bandPosition
|
|
75963
76092
|
}) +
|
|
75964
76093
|
getBandwidth(0) * 0.5 -
|
|
75965
|
-
this.
|
|
76094
|
+
this._barMark.getAttribute('height', datum) * (0.5 - pos));
|
|
75966
76095
|
}
|
|
75967
76096
|
initMarkStyle() {
|
|
75968
76097
|
super.initMarkStyle();
|
|
@@ -82475,35 +82604,24 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
82475
82604
|
const measureTooltipText = (text, style) => {
|
|
82476
82605
|
var _a;
|
|
82477
82606
|
text = (text !== null && text !== void 0 ? text : '').toString();
|
|
82478
|
-
|
|
82479
|
-
if (
|
|
82480
|
-
|
|
82481
|
-
|
|
82482
|
-
width,
|
|
82483
|
-
height,
|
|
82484
|
-
text
|
|
82485
|
-
};
|
|
82607
|
+
let textLines;
|
|
82608
|
+
if (style.multiLine) {
|
|
82609
|
+
textLines = text.split('\n');
|
|
82610
|
+
textLines = textLines.map((line, i) => (i < textLines.length - 1 ? line + '\n' : line));
|
|
82486
82611
|
}
|
|
82487
|
-
|
|
82488
|
-
|
|
82489
|
-
const { width, height } = measure.fullMeasure(textLines);
|
|
82490
|
-
if (style.maxWidth && style.maxWidth <= width) {
|
|
82491
|
-
const bound = getRichTextBounds({
|
|
82492
|
-
wordBreak: (_a = style.wordBreak) !== null && _a !== void 0 ? _a : 'break-word',
|
|
82493
|
-
maxWidth: style.maxWidth,
|
|
82494
|
-
width: 0,
|
|
82495
|
-
height: 0,
|
|
82496
|
-
textConfig: textLines.map((line, i) => (Object.assign(Object.assign({}, style), { text: line })))
|
|
82497
|
-
});
|
|
82498
|
-
return {
|
|
82499
|
-
width: bound.width(),
|
|
82500
|
-
height: bound.height(),
|
|
82501
|
-
text: textLines
|
|
82502
|
-
};
|
|
82612
|
+
else {
|
|
82613
|
+
textLines = [text];
|
|
82503
82614
|
}
|
|
82615
|
+
const bound = getRichTextBounds({
|
|
82616
|
+
wordBreak: (_a = style.wordBreak) !== null && _a !== void 0 ? _a : 'break-word',
|
|
82617
|
+
maxWidth: style.maxWidth ? style.maxWidth : undefined,
|
|
82618
|
+
width: 0,
|
|
82619
|
+
height: 0,
|
|
82620
|
+
textConfig: textLines.map(line => (Object.assign(Object.assign({}, style), { text: line })))
|
|
82621
|
+
});
|
|
82504
82622
|
return {
|
|
82505
|
-
width,
|
|
82506
|
-
height,
|
|
82623
|
+
width: bound.width(),
|
|
82624
|
+
height: bound.height(),
|
|
82507
82625
|
text: textLines
|
|
82508
82626
|
};
|
|
82509
82627
|
};
|