@visactor/vchart 1.7.3 → 1.7.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 +331 -302
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/base-chart.js +1 -1
- package/cjs/chart/base-chart.js.map +1 -1
- package/cjs/component/label/label.d.ts +2 -1
- package/cjs/component/label/label.js +13 -8
- package/cjs/component/label/label.js.map +1 -1
- package/cjs/component/label/util.d.ts +1 -8
- package/cjs/component/label/util.js +6 -11
- package/cjs/component/label/util.js.map +1 -1
- package/cjs/constant/index.d.ts +2 -1
- package/cjs/constant/index.js +1 -1
- package/cjs/constant/index.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/event/events/index.d.ts +1 -0
- package/cjs/event/events/index.js +16 -1
- package/cjs/event/events/index.js.map +1 -1
- package/cjs/event/index.d.ts +2 -0
- package/cjs/event/index.js +21 -0
- package/cjs/event/index.js.map +1 -0
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +2 -1
- package/cjs/index.js.map +1 -1
- package/cjs/interaction/interface.js +1 -1
- package/cjs/region/interface.d.ts +1 -0
- package/cjs/region/interface.js.map +1 -1
- package/cjs/region/region.d.ts +3 -0
- package/cjs/region/region.js +26 -14
- package/cjs/region/region.js.map +1 -1
- package/cjs/series/base/base-series.js +2 -1
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/mixin/line-mixin.js +1 -0
- package/cjs/series/mixin/line-mixin.js.map +1 -1
- package/cjs/series/waterfall/waterfall.js +2 -2
- package/cjs/series/waterfall/waterfall.js.map +1 -1
- package/esm/chart/base-chart.js +1 -1
- package/esm/chart/base-chart.js.map +1 -1
- package/esm/component/label/label.d.ts +2 -1
- package/esm/component/label/label.js +12 -8
- package/esm/component/label/label.js.map +1 -1
- package/esm/component/label/util.d.ts +1 -8
- package/esm/component/label/util.js +2 -8
- package/esm/component/label/util.js.map +1 -1
- package/esm/constant/index.d.ts +2 -1
- package/esm/constant/index.js +1 -1
- package/esm/constant/index.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/event/events/index.d.ts +1 -0
- package/esm/event/events/index.js +2 -0
- package/esm/event/events/index.js.map +1 -1
- package/esm/event/index.d.ts +2 -0
- package/esm/event/index.js +4 -0
- package/esm/event/index.js.map +1 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -0
- package/esm/index.js.map +1 -1
- package/esm/interaction/interface.js +1 -1
- package/esm/region/interface.d.ts +1 -0
- package/esm/region/interface.js.map +1 -1
- package/esm/region/region.d.ts +3 -0
- package/esm/region/region.js +26 -14
- package/esm/region/region.js.map +1 -1
- package/esm/series/base/base-series.js +2 -1
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/mixin/line-mixin.js +1 -0
- package/esm/series/mixin/line-mixin.js.map +1 -1
- package/esm/series/waterfall/waterfall.js +1 -3
- package/esm/series/waterfall/waterfall.js.map +1 -1
- package/package.json +2 -2
package/build/index.js
CHANGED
|
@@ -53255,6 +53255,7 @@
|
|
|
53255
53255
|
LayoutZIndex[LayoutZIndex["Label"] = 500] = "Label";
|
|
53256
53256
|
LayoutZIndex[LayoutZIndex["Brush"] = 500] = "Brush";
|
|
53257
53257
|
LayoutZIndex[LayoutZIndex["CustomMark"] = 500] = "CustomMark";
|
|
53258
|
+
LayoutZIndex[LayoutZIndex["Interaction"] = 700] = "Interaction";
|
|
53258
53259
|
})(exports.LayoutZIndex || (exports.LayoutZIndex = {}));
|
|
53259
53260
|
exports.LayoutLevel = void 0;
|
|
53260
53261
|
(function (LayoutLevel) {
|
|
@@ -55936,15 +55937,15 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
55936
55937
|
}
|
|
55937
55938
|
}
|
|
55938
55939
|
|
|
55939
|
-
|
|
55940
|
+
exports.DimensionEventEnum = void 0;
|
|
55940
55941
|
(function (DimensionEventEnum) {
|
|
55941
55942
|
DimensionEventEnum["dimensionHover"] = "dimensionHover";
|
|
55942
55943
|
DimensionEventEnum["dimensionClick"] = "dimensionClick";
|
|
55943
|
-
})(DimensionEventEnum || (DimensionEventEnum = {}));
|
|
55944
|
+
})(exports.DimensionEventEnum || (exports.DimensionEventEnum = {}));
|
|
55944
55945
|
|
|
55945
55946
|
const ComposedEventMapper = {
|
|
55946
|
-
[DimensionEventEnum.dimensionHover]: DimensionHoverEvent,
|
|
55947
|
-
[DimensionEventEnum.dimensionClick]: DimensionClickEvent
|
|
55947
|
+
[exports.DimensionEventEnum.dimensionHover]: DimensionHoverEvent,
|
|
55948
|
+
[exports.DimensionEventEnum.dimensionClick]: DimensionClickEvent
|
|
55948
55949
|
};
|
|
55949
55950
|
|
|
55950
55951
|
let Event$1 = class Event {
|
|
@@ -57263,7 +57264,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
57263
57264
|
}
|
|
57264
57265
|
initEvent() {
|
|
57265
57266
|
const event = this.event;
|
|
57266
|
-
event.on(DimensionEventEnum.dimensionHover, this.onHover);
|
|
57267
|
+
event.on(exports.DimensionEventEnum.dimensionHover, this.onHover);
|
|
57267
57268
|
}
|
|
57268
57269
|
releaseEvent() {
|
|
57269
57270
|
this.event.release();
|
|
@@ -58413,6 +58414,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
58413
58414
|
getGroupMark() {
|
|
58414
58415
|
return this._groupMark;
|
|
58415
58416
|
}
|
|
58417
|
+
getInteractionMark() {
|
|
58418
|
+
return this._interactionMark;
|
|
58419
|
+
}
|
|
58416
58420
|
getStackInverse() {
|
|
58417
58421
|
return this._spec.stackInverse === true;
|
|
58418
58422
|
}
|
|
@@ -58468,24 +58472,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
58468
58472
|
this._spec = cloneDeepSpec(this._originalSpec);
|
|
58469
58473
|
}
|
|
58470
58474
|
created() {
|
|
58471
|
-
var _a
|
|
58475
|
+
var _a;
|
|
58472
58476
|
this.initLayout();
|
|
58473
58477
|
super.created();
|
|
58474
|
-
this._groupMark = this._createMark({ type: MarkTypeEnum.group, name: 'regionGroup' });
|
|
58475
|
-
this._groupMark.setUserId(this.userId);
|
|
58476
|
-
this._groupMark.setZIndex(this.layoutZIndex);
|
|
58477
58478
|
const clip = (_a = this._spec.clip) !== null && _a !== void 0 ? _a : this._getClipDefaultValue();
|
|
58478
|
-
this.
|
|
58479
|
-
|
|
58480
|
-
y: () => this.getLayoutStartPoint().y,
|
|
58481
|
-
width: () => this.getLayoutRect().width,
|
|
58482
|
-
height: () => this.getLayoutRect().height,
|
|
58483
|
-
clip
|
|
58484
|
-
}, 'normal', exports.AttributeLevel.Built_In);
|
|
58485
|
-
this.setMarkStyle(this._groupMark, {
|
|
58486
|
-
cornerRadius: (_b = this._spec.style) === null || _b === void 0 ? void 0 : _b.cornerRadius
|
|
58487
|
-
}, 'normal', exports.AttributeLevel.User_Mark);
|
|
58488
|
-
this._marks.addMark(this._groupMark);
|
|
58479
|
+
this._groupMark = this._createGroupMark('regionGroup', this.userId, this.layoutZIndex);
|
|
58480
|
+
this._interactionMark = this._createGroupMark('regionInteractionGroup', this.userId + '_interaction', exports.LayoutZIndex.Interaction);
|
|
58489
58481
|
if (this._spec.style) {
|
|
58490
58482
|
this._backgroundMark = this._createMark({ type: MarkTypeEnum.rect, name: 'regionBackground' });
|
|
58491
58483
|
if (clip) {
|
|
@@ -58506,6 +58498,25 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
58506
58498
|
}
|
|
58507
58499
|
this.createTrigger();
|
|
58508
58500
|
}
|
|
58501
|
+
_createGroupMark(name, userId, zIndex) {
|
|
58502
|
+
var _a, _b;
|
|
58503
|
+
const groupMark = this._createMark({ type: MarkTypeEnum.group, name });
|
|
58504
|
+
groupMark.setUserId(userId);
|
|
58505
|
+
groupMark.setZIndex(zIndex);
|
|
58506
|
+
const clip = (_a = this._spec.clip) !== null && _a !== void 0 ? _a : this._getClipDefaultValue();
|
|
58507
|
+
this.setMarkStyle(groupMark, {
|
|
58508
|
+
x: () => this.getLayoutStartPoint().x,
|
|
58509
|
+
y: () => this.getLayoutStartPoint().y,
|
|
58510
|
+
width: () => this.getLayoutRect().width,
|
|
58511
|
+
height: () => this.getLayoutRect().height,
|
|
58512
|
+
clip
|
|
58513
|
+
}, 'normal', exports.AttributeLevel.Built_In);
|
|
58514
|
+
this.setMarkStyle(groupMark, {
|
|
58515
|
+
cornerRadius: (_b = this._spec.style) === null || _b === void 0 ? void 0 : _b.cornerRadius
|
|
58516
|
+
}, 'normal', exports.AttributeLevel.User_Mark);
|
|
58517
|
+
this._marks.addMark(groupMark);
|
|
58518
|
+
return groupMark;
|
|
58519
|
+
}
|
|
58509
58520
|
init(option) {
|
|
58510
58521
|
super.init(option);
|
|
58511
58522
|
this.initMark();
|
|
@@ -61665,7 +61676,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
61665
61676
|
};
|
|
61666
61677
|
registerVChartCore();
|
|
61667
61678
|
|
|
61668
|
-
const version = "1.7.
|
|
61679
|
+
const version = "1.7.4";
|
|
61669
61680
|
|
|
61670
61681
|
class ChartData {
|
|
61671
61682
|
get dataList() {
|
|
@@ -62808,8 +62819,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
62808
62819
|
this.transformSpec(this._spec);
|
|
62809
62820
|
this.updateGlobalScaleTheme();
|
|
62810
62821
|
this._regions.forEach(r => r.setCurrentTheme());
|
|
62811
|
-
this._components.forEach(c => c.setCurrentTheme());
|
|
62812
62822
|
this._series.forEach(s => s.setCurrentTheme());
|
|
62823
|
+
this._components.forEach(c => c.setCurrentTheme());
|
|
62813
62824
|
}
|
|
62814
62825
|
clear() {
|
|
62815
62826
|
this.getAllModels().forEach(i => { var _a; return (_a = i.clear) === null || _a === void 0 ? void 0 : _a.call(i); });
|
|
@@ -63025,7 +63036,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63025
63036
|
let dimensionInfo = null;
|
|
63026
63037
|
Array.from(this._event.getComposedEventMap().values()).forEach(e => {
|
|
63027
63038
|
const { eventType, event } = e;
|
|
63028
|
-
if (eventType === DimensionEventEnum.dimensionHover || eventType === DimensionEventEnum.dimensionClick) {
|
|
63039
|
+
if (eventType === exports.DimensionEventEnum.dimensionHover || eventType === exports.DimensionEventEnum.dimensionClick) {
|
|
63029
63040
|
const info = event.dispatch(value, opt);
|
|
63030
63041
|
if (info === null || info === void 0 ? void 0 : info.length) {
|
|
63031
63042
|
dimensionInfo = info;
|
|
@@ -64605,6 +64616,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
64605
64616
|
: this.getMarksWithoutRoot().filter(mark => !isEqual$2(lastSpec[mark.name], this._spec[mark.name]));
|
|
64606
64617
|
marks.forEach(mark => {
|
|
64607
64618
|
this._spec[mark.name] && this.initMarkStyleWithSpec(mark, this._spec[mark.name]);
|
|
64619
|
+
if (mark.getLabelSpec()) {
|
|
64620
|
+
mark.setLabelSpec(this._preprocessLabelSpec(this._spec.label));
|
|
64621
|
+
}
|
|
64608
64622
|
});
|
|
64609
64623
|
this.initMarkStyle();
|
|
64610
64624
|
marks.forEach(mark => {
|
|
@@ -65454,6 +65468,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
65454
65468
|
groupKey: this._seriesField,
|
|
65455
65469
|
isSeriesMark: false,
|
|
65456
65470
|
dataView: activeData,
|
|
65471
|
+
parent: this._region.getInteractionMark(),
|
|
65457
65472
|
customShape: (_c = this._spec.point) === null || _c === void 0 ? void 0 : _c.customShape
|
|
65458
65473
|
});
|
|
65459
65474
|
this._symbolActiveMark.setVisible(false);
|
|
@@ -65484,7 +65499,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
65484
65499
|
this._trigger.registerMark(symbolMark);
|
|
65485
65500
|
if (this._symbolActiveMark && this._symbolMark.stateStyle.dimension_hover) {
|
|
65486
65501
|
this._symbolActiveMark.setVisible(true);
|
|
65487
|
-
this.event.on(DimensionEventEnum.dimensionHover, this._dimensionTrigger.bind(this));
|
|
65502
|
+
this.event.on(exports.DimensionEventEnum.dimensionHover, this._dimensionTrigger.bind(this));
|
|
65488
65503
|
for (const state in this._symbolMark.stateStyle) {
|
|
65489
65504
|
this._symbolActiveMark.stateStyle[state] = {};
|
|
65490
65505
|
for (const key in this._symbolMark.stateStyle[state]) {
|
|
@@ -79480,274 +79495,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
79480
79495
|
}
|
|
79481
79496
|
}
|
|
79482
79497
|
|
|
79483
|
-
const labelRuleMap = {
|
|
79484
|
-
rect: barLabel,
|
|
79485
|
-
symbol: symbolLabel,
|
|
79486
|
-
arc: pieLabel,
|
|
79487
|
-
point: pointLabel,
|
|
79488
|
-
'line-data': lineDataLabel,
|
|
79489
|
-
stackLabel: stackLabel,
|
|
79490
|
-
line: LineLabel,
|
|
79491
|
-
area: LineLabel
|
|
79492
|
-
};
|
|
79493
|
-
var LabelRule;
|
|
79494
|
-
(function (LabelRule) {
|
|
79495
|
-
LabelRule["rect"] = "rect";
|
|
79496
|
-
LabelRule["symbol"] = "symbol";
|
|
79497
|
-
LabelRule["arc"] = "arc";
|
|
79498
|
-
LabelRule["point"] = "point";
|
|
79499
|
-
LabelRule["stackLabel"] = "stackLabel";
|
|
79500
|
-
LabelRule["line"] = "line";
|
|
79501
|
-
})(LabelRule || (LabelRule = {}));
|
|
79502
|
-
function textAttribute(labelInfo, datum, formatMethod, formatter) {
|
|
79503
|
-
var _a;
|
|
79504
|
-
const { labelMark, series } = labelInfo;
|
|
79505
|
-
const field = series.getMeasureField()[0];
|
|
79506
|
-
const textAttribute = { text: datum[field], data: datum, textType: (_a = labelInfo.labelSpec.textType) !== null && _a !== void 0 ? _a : 'text' };
|
|
79507
|
-
const attributes = Object.keys(labelMark.stateStyle.normal);
|
|
79508
|
-
for (const key of attributes) {
|
|
79509
|
-
const attr = labelMark.getAttribute(key, datum);
|
|
79510
|
-
textAttribute[key] = attr;
|
|
79511
|
-
}
|
|
79512
|
-
if (formatMethod) {
|
|
79513
|
-
textAttribute.text = formatMethod(textAttribute.text, datum, { series });
|
|
79514
|
-
}
|
|
79515
|
-
if (formatter) {
|
|
79516
|
-
if (series.type === 'pie') {
|
|
79517
|
-
datum._percent_ = (datum[ARC_RATIO] * 100).toFixed(2) + '%';
|
|
79518
|
-
}
|
|
79519
|
-
else if (datum[STACK_FIELD_END_PERCENT]) {
|
|
79520
|
-
datum._percent_ = (datum[STACK_FIELD_END_PERCENT] * 100).toFixed(2) + '%';
|
|
79521
|
-
}
|
|
79522
|
-
textAttribute.text = substitute(formatter, datum);
|
|
79523
|
-
}
|
|
79524
|
-
return textAttribute;
|
|
79525
|
-
}
|
|
79526
|
-
function uniformLabelPosition(position) {
|
|
79527
|
-
if (isFunction$3(position)) {
|
|
79528
|
-
return (datum) => {
|
|
79529
|
-
return position(datum.data);
|
|
79530
|
-
};
|
|
79531
|
-
}
|
|
79532
|
-
return position;
|
|
79533
|
-
}
|
|
79534
|
-
function symbolLabel(labelInfo) {
|
|
79535
|
-
var _a, _b, _c;
|
|
79536
|
-
const { series, labelSpec } = labelInfo;
|
|
79537
|
-
const defaultPosition = series.direction === 'horizontal' ? 'right' : 'top';
|
|
79538
|
-
const position = (_a = uniformLabelPosition(labelSpec.position)) !== null && _a !== void 0 ? _a : defaultPosition;
|
|
79539
|
-
let overlap;
|
|
79540
|
-
if (labelSpec.overlap === false) {
|
|
79541
|
-
overlap = false;
|
|
79542
|
-
}
|
|
79543
|
-
else {
|
|
79544
|
-
overlap = {
|
|
79545
|
-
strategy: (_c = (_b = labelSpec.overlap) === null || _b === void 0 ? void 0 : _b.strategy) !== null && _c !== void 0 ? _c : symbolLabelOverlapStrategy(),
|
|
79546
|
-
avoidBaseMark: position !== 'center'
|
|
79547
|
-
};
|
|
79548
|
-
}
|
|
79549
|
-
return { position, overlap };
|
|
79550
|
-
}
|
|
79551
|
-
function lineDataLabel(labelInfo) {
|
|
79552
|
-
const result = symbolLabel(labelInfo);
|
|
79553
|
-
if (!isBoolean$3(result.overlap)) {
|
|
79554
|
-
result.overlap.avoidBaseMark = false;
|
|
79555
|
-
}
|
|
79556
|
-
return result;
|
|
79557
|
-
}
|
|
79558
|
-
function symbolLabelOverlapStrategy() {
|
|
79559
|
-
const strategy = [
|
|
79560
|
-
{
|
|
79561
|
-
type: 'position',
|
|
79562
|
-
position: ['top', 'bottom', 'right', 'left', 'top-right', 'top-left', 'bottom-left', 'bottom-right']
|
|
79563
|
-
}
|
|
79564
|
-
];
|
|
79565
|
-
return strategy;
|
|
79566
|
-
}
|
|
79567
|
-
function barLabel(labelInfo) {
|
|
79568
|
-
var _a, _b, _c, _d, _e, _f;
|
|
79569
|
-
const { series, labelSpec = {} } = labelInfo;
|
|
79570
|
-
const originPosition = (_a = uniformLabelPosition(labelSpec.position)) !== null && _a !== void 0 ? _a : 'outside';
|
|
79571
|
-
const direction = (_b = series.direction) !== null && _b !== void 0 ? _b : 'vertical';
|
|
79572
|
-
const isInverse = series.direction === 'horizontal'
|
|
79573
|
-
? (_c = series.getXAxisHelper()) === null || _c === void 0 ? void 0 : _c.isInverse()
|
|
79574
|
-
: (_d = series.getYAxisHelper()) === null || _d === void 0 ? void 0 : _d.isInverse();
|
|
79575
|
-
let position = originPosition;
|
|
79576
|
-
if (isString$3(originPosition) && position !== 'inside') {
|
|
79577
|
-
position = (data) => {
|
|
79578
|
-
const { data: datum } = data;
|
|
79579
|
-
const dataField = series.getMeasureField()[0];
|
|
79580
|
-
if (originPosition === 'outside') {
|
|
79581
|
-
const positionMap = { vertical: ['top', 'bottom'], horizontal: ['right', 'left'] };
|
|
79582
|
-
const index = ((datum === null || datum === void 0 ? void 0 : datum[dataField]) >= 0 && isInverse) || ((datum === null || datum === void 0 ? void 0 : datum[dataField]) < 0 && !isInverse) ? 1 : 0;
|
|
79583
|
-
return positionMap[direction][index];
|
|
79584
|
-
}
|
|
79585
|
-
if (originPosition === 'inside-bottom') {
|
|
79586
|
-
return series.direction === 'horizontal' ? 'inside-left' : 'inside-bottom';
|
|
79587
|
-
}
|
|
79588
|
-
if (originPosition === 'inside-top') {
|
|
79589
|
-
return series.direction === 'horizontal' ? 'inside-right' : 'inside-top';
|
|
79590
|
-
}
|
|
79591
|
-
return originPosition;
|
|
79592
|
-
};
|
|
79593
|
-
}
|
|
79594
|
-
let overlap;
|
|
79595
|
-
if (labelSpec.overlap === false) {
|
|
79596
|
-
overlap = false;
|
|
79597
|
-
}
|
|
79598
|
-
else {
|
|
79599
|
-
overlap = {
|
|
79600
|
-
strategy: (_f = (_e = labelSpec.overlap) === null || _e === void 0 ? void 0 : _e.strategy) !== null && _f !== void 0 ? _f : barLabelOverlapStrategy(series)
|
|
79601
|
-
};
|
|
79602
|
-
}
|
|
79603
|
-
let smartInvert = false;
|
|
79604
|
-
if (isString$3(originPosition) && originPosition.includes('inside')) {
|
|
79605
|
-
smartInvert = true;
|
|
79606
|
-
}
|
|
79607
|
-
return { position, overlap, smartInvert };
|
|
79608
|
-
}
|
|
79609
|
-
function barLabelOverlapStrategy(series) {
|
|
79610
|
-
const strategy = [
|
|
79611
|
-
{
|
|
79612
|
-
type: 'position',
|
|
79613
|
-
position: (data) => {
|
|
79614
|
-
var _a, _b;
|
|
79615
|
-
const { data: datum } = data;
|
|
79616
|
-
const dataField = series.getMeasureField()[0];
|
|
79617
|
-
const isInverse = series.direction === 'horizontal'
|
|
79618
|
-
? (_a = series.getXAxisHelper()) === null || _a === void 0 ? void 0 : _a.isInverse()
|
|
79619
|
-
: (_b = series.getYAxisHelper()) === null || _b === void 0 ? void 0 : _b.isInverse();
|
|
79620
|
-
if (isInverse) {
|
|
79621
|
-
if ((datum === null || datum === void 0 ? void 0 : datum[dataField]) >= 0) {
|
|
79622
|
-
return series.direction === 'horizontal' ? ['left', 'inside-left'] : ['bottom', 'inside-bottom'];
|
|
79623
|
-
}
|
|
79624
|
-
return series.direction === 'horizontal' ? ['right', 'inside-right'] : ['top', 'inside-top'];
|
|
79625
|
-
}
|
|
79626
|
-
if ((datum === null || datum === void 0 ? void 0 : datum[dataField]) >= 0) {
|
|
79627
|
-
return series.direction === 'horizontal' ? ['right', 'inside-right'] : ['top', 'inside-top'];
|
|
79628
|
-
}
|
|
79629
|
-
return series.direction === 'horizontal' ? ['left', 'inside-left'] : ['bottom', 'inside-bottom'];
|
|
79630
|
-
}
|
|
79631
|
-
}
|
|
79632
|
-
];
|
|
79633
|
-
return strategy;
|
|
79634
|
-
}
|
|
79635
|
-
function pointLabel(labelInfo) {
|
|
79636
|
-
const { labelSpec } = labelInfo;
|
|
79637
|
-
let overlap;
|
|
79638
|
-
if (labelSpec.overlap === false) {
|
|
79639
|
-
overlap = false;
|
|
79640
|
-
}
|
|
79641
|
-
else {
|
|
79642
|
-
overlap = {
|
|
79643
|
-
avoidBaseMark: false
|
|
79644
|
-
};
|
|
79645
|
-
}
|
|
79646
|
-
return { position: 'center', overlap };
|
|
79647
|
-
}
|
|
79648
|
-
function pieLabel(labelInfo) {
|
|
79649
|
-
var _a;
|
|
79650
|
-
const { labelSpec } = labelInfo;
|
|
79651
|
-
const labelPosition = (_a = uniformLabelPosition(labelSpec.position)) !== null && _a !== void 0 ? _a : 'outside';
|
|
79652
|
-
const position = labelPosition;
|
|
79653
|
-
let smartInvert;
|
|
79654
|
-
if (labelSpec.smartInvert) {
|
|
79655
|
-
smartInvert = labelSpec.smartInvert;
|
|
79656
|
-
}
|
|
79657
|
-
else {
|
|
79658
|
-
smartInvert = isString$3(labelPosition) && labelPosition.includes('inside');
|
|
79659
|
-
}
|
|
79660
|
-
return { position, smartInvert };
|
|
79661
|
-
}
|
|
79662
|
-
function stackLabel(labelInfo) {
|
|
79663
|
-
const series = labelInfo.series;
|
|
79664
|
-
const labelSpec = labelInfo.labelSpec || {};
|
|
79665
|
-
const totalData = series.getTotalData();
|
|
79666
|
-
return {
|
|
79667
|
-
customLayoutFunc: (labels) => {
|
|
79668
|
-
return labels.map(label => {
|
|
79669
|
-
const pos = labelSpec.position || 'withChange';
|
|
79670
|
-
const offset = labelSpec.offset || 0;
|
|
79671
|
-
const datum = label.data;
|
|
79672
|
-
const attribute = textAttribute(labelInfo, datum, labelSpec.formatMethod);
|
|
79673
|
-
const x = (datum) => {
|
|
79674
|
-
if (series.direction === Direction.vertical) {
|
|
79675
|
-
return series.totalPositionX(datum, 'index', 0.5);
|
|
79676
|
-
}
|
|
79677
|
-
if (pos === 'middle') {
|
|
79678
|
-
return (series.totalPositionX(datum, 'end') + series.totalPositionY(datum, 'start')) * 0.5;
|
|
79679
|
-
}
|
|
79680
|
-
else if (pos === 'max') {
|
|
79681
|
-
return series.totalPositionX(datum, datum.end >= datum.start ? 'end' : 'start') + offset;
|
|
79682
|
-
}
|
|
79683
|
-
else if (pos === 'min') {
|
|
79684
|
-
return series.totalPositionX(datum, datum.end >= datum.start ? 'start' : 'end') - offset;
|
|
79685
|
-
}
|
|
79686
|
-
return series.totalPositionX(datum, 'end') + (datum.end >= datum.start ? offset : -offset);
|
|
79687
|
-
};
|
|
79688
|
-
const y = (datum) => {
|
|
79689
|
-
if (series.direction === Direction.vertical) {
|
|
79690
|
-
if (pos === 'middle') {
|
|
79691
|
-
return (series.totalPositionY(datum, 'end') + series.totalPositionY(datum, 'start')) * 0.5;
|
|
79692
|
-
}
|
|
79693
|
-
else if (pos === 'max') {
|
|
79694
|
-
return series.totalPositionY(datum, datum.end >= datum.start ? 'end' : 'start') - offset;
|
|
79695
|
-
}
|
|
79696
|
-
else if (pos === 'min') {
|
|
79697
|
-
return series.totalPositionY(datum, datum.end >= datum.start ? 'start' : 'end') + offset;
|
|
79698
|
-
}
|
|
79699
|
-
return series.totalPositionY(datum, 'end') + (datum.end >= datum.start ? -offset : offset);
|
|
79700
|
-
}
|
|
79701
|
-
return series.totalPositionY(datum, 'index', 0.5);
|
|
79702
|
-
};
|
|
79703
|
-
attribute.x = x(datum);
|
|
79704
|
-
attribute.y = y(datum);
|
|
79705
|
-
if (series.direction === Direction.vertical) {
|
|
79706
|
-
attribute.textBaseline =
|
|
79707
|
-
pos === 'middle'
|
|
79708
|
-
? pos
|
|
79709
|
-
: (pos === 'withChange' && datum.end - datum.start >= 0) || pos === 'max'
|
|
79710
|
-
? 'bottom'
|
|
79711
|
-
: 'top';
|
|
79712
|
-
}
|
|
79713
|
-
else {
|
|
79714
|
-
attribute.textAlign =
|
|
79715
|
-
pos === 'middle'
|
|
79716
|
-
? 'center'
|
|
79717
|
-
: (pos === 'withChange' && datum.end - datum.start >= 0) || pos === 'max'
|
|
79718
|
-
? 'left'
|
|
79719
|
-
: 'right';
|
|
79720
|
-
}
|
|
79721
|
-
return createText(Object.assign(Object.assign({}, attribute), { id: label.id }));
|
|
79722
|
-
});
|
|
79723
|
-
},
|
|
79724
|
-
dataFilter: (labels) => {
|
|
79725
|
-
const result = [];
|
|
79726
|
-
totalData.forEach((total) => {
|
|
79727
|
-
const label = labels.find(labelItem => {
|
|
79728
|
-
var _a;
|
|
79729
|
-
return total.index === ((_a = labelItem.data) === null || _a === void 0 ? void 0 : _a[series.getDimensionField()[0]]);
|
|
79730
|
-
});
|
|
79731
|
-
if (label) {
|
|
79732
|
-
label.data = total;
|
|
79733
|
-
result.push(label);
|
|
79734
|
-
}
|
|
79735
|
-
});
|
|
79736
|
-
return result;
|
|
79737
|
-
},
|
|
79738
|
-
overlap: {
|
|
79739
|
-
strategy: []
|
|
79740
|
-
}
|
|
79741
|
-
};
|
|
79742
|
-
}
|
|
79743
|
-
function LineLabel(labelInfo) {
|
|
79744
|
-
var _a, _b, _c, _d;
|
|
79745
|
-
const { labelSpec, series } = labelInfo;
|
|
79746
|
-
const seriesData = (_c = (_b = (_a = series.getViewDataStatistics) === null || _a === void 0 ? void 0 : _a.call(series).latestData) === null || _b === void 0 ? void 0 : _b[series.getSeriesField()]) === null || _c === void 0 ? void 0 : _c.values;
|
|
79747
|
-
const data = seriesData ? seriesData.map((d, index) => ({ [series.getSeriesField()]: d, index })) : [];
|
|
79748
|
-
return { position: (_d = labelSpec.position) !== null && _d !== void 0 ? _d : 'end', data };
|
|
79749
|
-
}
|
|
79750
|
-
|
|
79751
79498
|
class WaterfallSeries extends BarSeries {
|
|
79752
79499
|
constructor() {
|
|
79753
79500
|
super(...arguments);
|
|
@@ -79883,7 +79630,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
79883
79630
|
}
|
|
79884
79631
|
this._stackLabelMark = labelMark;
|
|
79885
79632
|
labelMark.skipEncode = true;
|
|
79886
|
-
labelMark.setRule(
|
|
79633
|
+
labelMark.setRule('stackLabel');
|
|
79887
79634
|
labelMark.setDataView(this._totalData.getDataView(), this._totalData.getProductId());
|
|
79888
79635
|
this.setMarkStyle(labelMark, {
|
|
79889
79636
|
text: (datum) => {
|
|
@@ -93341,6 +93088,266 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
93341
93088
|
Factory.registerComponent(Player.type, Player);
|
|
93342
93089
|
};
|
|
93343
93090
|
|
|
93091
|
+
const labelRuleMap = {
|
|
93092
|
+
rect: barLabel,
|
|
93093
|
+
symbol: symbolLabel,
|
|
93094
|
+
arc: pieLabel,
|
|
93095
|
+
point: pointLabel,
|
|
93096
|
+
'line-data': lineDataLabel,
|
|
93097
|
+
stackLabel: stackLabel,
|
|
93098
|
+
line: LineLabel,
|
|
93099
|
+
area: LineLabel,
|
|
93100
|
+
rect3d: barLabel
|
|
93101
|
+
};
|
|
93102
|
+
function textAttribute(labelInfo, datum, formatMethod, formatter) {
|
|
93103
|
+
var _a;
|
|
93104
|
+
const { labelMark, series } = labelInfo;
|
|
93105
|
+
const field = series.getMeasureField()[0];
|
|
93106
|
+
const textAttribute = { text: datum[field], data: datum, textType: (_a = labelInfo.labelSpec.textType) !== null && _a !== void 0 ? _a : 'text' };
|
|
93107
|
+
const attributes = Object.keys(labelMark.stateStyle.normal);
|
|
93108
|
+
for (const key of attributes) {
|
|
93109
|
+
const attr = labelMark.getAttribute(key, datum);
|
|
93110
|
+
textAttribute[key] = attr;
|
|
93111
|
+
}
|
|
93112
|
+
if (formatMethod) {
|
|
93113
|
+
textAttribute.text = formatMethod(textAttribute.text, datum, { series });
|
|
93114
|
+
}
|
|
93115
|
+
if (formatter) {
|
|
93116
|
+
if (series.type === 'pie') {
|
|
93117
|
+
datum._percent_ = (datum[ARC_RATIO] * 100).toFixed(2) + '%';
|
|
93118
|
+
}
|
|
93119
|
+
else if (datum[STACK_FIELD_END_PERCENT]) {
|
|
93120
|
+
datum._percent_ = (datum[STACK_FIELD_END_PERCENT] * 100).toFixed(2) + '%';
|
|
93121
|
+
}
|
|
93122
|
+
textAttribute.text = substitute(formatter, datum);
|
|
93123
|
+
}
|
|
93124
|
+
return textAttribute;
|
|
93125
|
+
}
|
|
93126
|
+
function uniformLabelPosition(position) {
|
|
93127
|
+
if (isFunction$3(position)) {
|
|
93128
|
+
return (datum) => {
|
|
93129
|
+
return position(datum.data);
|
|
93130
|
+
};
|
|
93131
|
+
}
|
|
93132
|
+
return position;
|
|
93133
|
+
}
|
|
93134
|
+
function symbolLabel(labelInfo) {
|
|
93135
|
+
var _a, _b, _c;
|
|
93136
|
+
const { series, labelSpec } = labelInfo;
|
|
93137
|
+
const defaultPosition = series.direction === 'horizontal' ? 'right' : 'top';
|
|
93138
|
+
const position = (_a = uniformLabelPosition(labelSpec.position)) !== null && _a !== void 0 ? _a : defaultPosition;
|
|
93139
|
+
let overlap;
|
|
93140
|
+
if (labelSpec.overlap === false) {
|
|
93141
|
+
overlap = false;
|
|
93142
|
+
}
|
|
93143
|
+
else {
|
|
93144
|
+
overlap = {
|
|
93145
|
+
strategy: (_c = (_b = labelSpec.overlap) === null || _b === void 0 ? void 0 : _b.strategy) !== null && _c !== void 0 ? _c : symbolLabelOverlapStrategy(),
|
|
93146
|
+
avoidBaseMark: position !== 'center'
|
|
93147
|
+
};
|
|
93148
|
+
}
|
|
93149
|
+
return { position, overlap };
|
|
93150
|
+
}
|
|
93151
|
+
function lineDataLabel(labelInfo) {
|
|
93152
|
+
const result = symbolLabel(labelInfo);
|
|
93153
|
+
if (!isBoolean$3(result.overlap)) {
|
|
93154
|
+
result.overlap.avoidBaseMark = false;
|
|
93155
|
+
}
|
|
93156
|
+
return result;
|
|
93157
|
+
}
|
|
93158
|
+
function symbolLabelOverlapStrategy() {
|
|
93159
|
+
const strategy = [
|
|
93160
|
+
{
|
|
93161
|
+
type: 'position',
|
|
93162
|
+
position: ['top', 'bottom', 'right', 'left', 'top-right', 'top-left', 'bottom-left', 'bottom-right']
|
|
93163
|
+
}
|
|
93164
|
+
];
|
|
93165
|
+
return strategy;
|
|
93166
|
+
}
|
|
93167
|
+
function barLabel(labelInfo) {
|
|
93168
|
+
var _a, _b, _c, _d, _e, _f;
|
|
93169
|
+
const { series, labelSpec = {} } = labelInfo;
|
|
93170
|
+
const originPosition = (_a = uniformLabelPosition(labelSpec.position)) !== null && _a !== void 0 ? _a : 'outside';
|
|
93171
|
+
const direction = (_b = series.direction) !== null && _b !== void 0 ? _b : 'vertical';
|
|
93172
|
+
const isInverse = series.direction === 'horizontal'
|
|
93173
|
+
? (_c = series.getXAxisHelper()) === null || _c === void 0 ? void 0 : _c.isInverse()
|
|
93174
|
+
: (_d = series.getYAxisHelper()) === null || _d === void 0 ? void 0 : _d.isInverse();
|
|
93175
|
+
let position = originPosition;
|
|
93176
|
+
if (isString$3(originPosition) && position !== 'inside') {
|
|
93177
|
+
position = (data) => {
|
|
93178
|
+
const { data: datum } = data;
|
|
93179
|
+
const dataField = series.getMeasureField()[0];
|
|
93180
|
+
if (originPosition === 'outside') {
|
|
93181
|
+
const positionMap = { vertical: ['top', 'bottom'], horizontal: ['right', 'left'] };
|
|
93182
|
+
const index = ((datum === null || datum === void 0 ? void 0 : datum[dataField]) >= 0 && isInverse) || ((datum === null || datum === void 0 ? void 0 : datum[dataField]) < 0 && !isInverse) ? 1 : 0;
|
|
93183
|
+
return positionMap[direction][index];
|
|
93184
|
+
}
|
|
93185
|
+
if (originPosition === 'inside-bottom') {
|
|
93186
|
+
return series.direction === 'horizontal' ? 'inside-left' : 'inside-bottom';
|
|
93187
|
+
}
|
|
93188
|
+
if (originPosition === 'inside-top') {
|
|
93189
|
+
return series.direction === 'horizontal' ? 'inside-right' : 'inside-top';
|
|
93190
|
+
}
|
|
93191
|
+
return originPosition;
|
|
93192
|
+
};
|
|
93193
|
+
}
|
|
93194
|
+
let overlap;
|
|
93195
|
+
if (labelSpec.overlap === false) {
|
|
93196
|
+
overlap = false;
|
|
93197
|
+
}
|
|
93198
|
+
else {
|
|
93199
|
+
overlap = {
|
|
93200
|
+
strategy: (_f = (_e = labelSpec.overlap) === null || _e === void 0 ? void 0 : _e.strategy) !== null && _f !== void 0 ? _f : barLabelOverlapStrategy(series)
|
|
93201
|
+
};
|
|
93202
|
+
}
|
|
93203
|
+
let smartInvert = false;
|
|
93204
|
+
if (isString$3(originPosition) && originPosition.includes('inside')) {
|
|
93205
|
+
smartInvert = true;
|
|
93206
|
+
}
|
|
93207
|
+
return { position, overlap, smartInvert };
|
|
93208
|
+
}
|
|
93209
|
+
function barLabelOverlapStrategy(series) {
|
|
93210
|
+
const strategy = [
|
|
93211
|
+
{
|
|
93212
|
+
type: 'position',
|
|
93213
|
+
position: (data) => {
|
|
93214
|
+
var _a, _b;
|
|
93215
|
+
const { data: datum } = data;
|
|
93216
|
+
const dataField = series.getMeasureField()[0];
|
|
93217
|
+
const isInverse = series.direction === 'horizontal'
|
|
93218
|
+
? (_a = series.getXAxisHelper()) === null || _a === void 0 ? void 0 : _a.isInverse()
|
|
93219
|
+
: (_b = series.getYAxisHelper()) === null || _b === void 0 ? void 0 : _b.isInverse();
|
|
93220
|
+
if (isInverse) {
|
|
93221
|
+
if ((datum === null || datum === void 0 ? void 0 : datum[dataField]) >= 0) {
|
|
93222
|
+
return series.direction === 'horizontal' ? ['left', 'inside-left'] : ['bottom', 'inside-bottom'];
|
|
93223
|
+
}
|
|
93224
|
+
return series.direction === 'horizontal' ? ['right', 'inside-right'] : ['top', 'inside-top'];
|
|
93225
|
+
}
|
|
93226
|
+
if ((datum === null || datum === void 0 ? void 0 : datum[dataField]) >= 0) {
|
|
93227
|
+
return series.direction === 'horizontal' ? ['right', 'inside-right'] : ['top', 'inside-top'];
|
|
93228
|
+
}
|
|
93229
|
+
return series.direction === 'horizontal' ? ['left', 'inside-left'] : ['bottom', 'inside-bottom'];
|
|
93230
|
+
}
|
|
93231
|
+
}
|
|
93232
|
+
];
|
|
93233
|
+
return strategy;
|
|
93234
|
+
}
|
|
93235
|
+
function pointLabel(labelInfo) {
|
|
93236
|
+
const { labelSpec } = labelInfo;
|
|
93237
|
+
let overlap;
|
|
93238
|
+
if (labelSpec.overlap === false) {
|
|
93239
|
+
overlap = false;
|
|
93240
|
+
}
|
|
93241
|
+
else {
|
|
93242
|
+
overlap = {
|
|
93243
|
+
avoidBaseMark: false
|
|
93244
|
+
};
|
|
93245
|
+
}
|
|
93246
|
+
return { position: 'center', overlap };
|
|
93247
|
+
}
|
|
93248
|
+
function pieLabel(labelInfo) {
|
|
93249
|
+
var _a;
|
|
93250
|
+
const { labelSpec } = labelInfo;
|
|
93251
|
+
const labelPosition = (_a = uniformLabelPosition(labelSpec.position)) !== null && _a !== void 0 ? _a : 'outside';
|
|
93252
|
+
const position = labelPosition;
|
|
93253
|
+
let smartInvert;
|
|
93254
|
+
if (labelSpec.smartInvert) {
|
|
93255
|
+
smartInvert = labelSpec.smartInvert;
|
|
93256
|
+
}
|
|
93257
|
+
else {
|
|
93258
|
+
smartInvert = isString$3(labelPosition) && labelPosition.includes('inside');
|
|
93259
|
+
}
|
|
93260
|
+
return { position, smartInvert };
|
|
93261
|
+
}
|
|
93262
|
+
function stackLabel(labelInfo) {
|
|
93263
|
+
const series = labelInfo.series;
|
|
93264
|
+
const labelSpec = labelInfo.labelSpec || {};
|
|
93265
|
+
const totalData = series.getTotalData();
|
|
93266
|
+
return {
|
|
93267
|
+
customLayoutFunc: (labels) => {
|
|
93268
|
+
return labels.map(label => {
|
|
93269
|
+
const pos = labelSpec.position || 'withChange';
|
|
93270
|
+
const offset = labelSpec.offset || 0;
|
|
93271
|
+
const datum = label.data;
|
|
93272
|
+
const attribute = textAttribute(labelInfo, datum, labelSpec.formatMethod);
|
|
93273
|
+
const x = (datum) => {
|
|
93274
|
+
if (series.direction === Direction.vertical) {
|
|
93275
|
+
return series.totalPositionX(datum, 'index', 0.5);
|
|
93276
|
+
}
|
|
93277
|
+
if (pos === 'middle') {
|
|
93278
|
+
return (series.totalPositionX(datum, 'end') + series.totalPositionY(datum, 'start')) * 0.5;
|
|
93279
|
+
}
|
|
93280
|
+
else if (pos === 'max') {
|
|
93281
|
+
return series.totalPositionX(datum, datum.end >= datum.start ? 'end' : 'start') + offset;
|
|
93282
|
+
}
|
|
93283
|
+
else if (pos === 'min') {
|
|
93284
|
+
return series.totalPositionX(datum, datum.end >= datum.start ? 'start' : 'end') - offset;
|
|
93285
|
+
}
|
|
93286
|
+
return series.totalPositionX(datum, 'end') + (datum.end >= datum.start ? offset : -offset);
|
|
93287
|
+
};
|
|
93288
|
+
const y = (datum) => {
|
|
93289
|
+
if (series.direction === Direction.vertical) {
|
|
93290
|
+
if (pos === 'middle') {
|
|
93291
|
+
return (series.totalPositionY(datum, 'end') + series.totalPositionY(datum, 'start')) * 0.5;
|
|
93292
|
+
}
|
|
93293
|
+
else if (pos === 'max') {
|
|
93294
|
+
return series.totalPositionY(datum, datum.end >= datum.start ? 'end' : 'start') - offset;
|
|
93295
|
+
}
|
|
93296
|
+
else if (pos === 'min') {
|
|
93297
|
+
return series.totalPositionY(datum, datum.end >= datum.start ? 'start' : 'end') + offset;
|
|
93298
|
+
}
|
|
93299
|
+
return series.totalPositionY(datum, 'end') + (datum.end >= datum.start ? -offset : offset);
|
|
93300
|
+
}
|
|
93301
|
+
return series.totalPositionY(datum, 'index', 0.5);
|
|
93302
|
+
};
|
|
93303
|
+
attribute.x = x(datum);
|
|
93304
|
+
attribute.y = y(datum);
|
|
93305
|
+
if (series.direction === Direction.vertical) {
|
|
93306
|
+
attribute.textBaseline =
|
|
93307
|
+
pos === 'middle'
|
|
93308
|
+
? pos
|
|
93309
|
+
: (pos === 'withChange' && datum.end - datum.start >= 0) || pos === 'max'
|
|
93310
|
+
? 'bottom'
|
|
93311
|
+
: 'top';
|
|
93312
|
+
}
|
|
93313
|
+
else {
|
|
93314
|
+
attribute.textAlign =
|
|
93315
|
+
pos === 'middle'
|
|
93316
|
+
? 'center'
|
|
93317
|
+
: (pos === 'withChange' && datum.end - datum.start >= 0) || pos === 'max'
|
|
93318
|
+
? 'left'
|
|
93319
|
+
: 'right';
|
|
93320
|
+
}
|
|
93321
|
+
return createText(Object.assign(Object.assign({}, attribute), { id: label.id }));
|
|
93322
|
+
});
|
|
93323
|
+
},
|
|
93324
|
+
dataFilter: (labels) => {
|
|
93325
|
+
const result = [];
|
|
93326
|
+
totalData.forEach((total) => {
|
|
93327
|
+
const label = labels.find(labelItem => {
|
|
93328
|
+
var _a;
|
|
93329
|
+
return total.index === ((_a = labelItem.data) === null || _a === void 0 ? void 0 : _a[series.getDimensionField()[0]]);
|
|
93330
|
+
});
|
|
93331
|
+
if (label) {
|
|
93332
|
+
label.data = total;
|
|
93333
|
+
result.push(label);
|
|
93334
|
+
}
|
|
93335
|
+
});
|
|
93336
|
+
return result;
|
|
93337
|
+
},
|
|
93338
|
+
overlap: {
|
|
93339
|
+
strategy: []
|
|
93340
|
+
}
|
|
93341
|
+
};
|
|
93342
|
+
}
|
|
93343
|
+
function LineLabel(labelInfo) {
|
|
93344
|
+
var _a, _b, _c, _d;
|
|
93345
|
+
const { labelSpec, series } = labelInfo;
|
|
93346
|
+
const seriesData = (_c = (_b = (_a = series.getViewDataStatistics) === null || _a === void 0 ? void 0 : _a.call(series).latestData) === null || _b === void 0 ? void 0 : _b[series.getSeriesField()]) === null || _c === void 0 ? void 0 : _c.values;
|
|
93347
|
+
const data = seriesData ? seriesData.map((d, index) => ({ [series.getSeriesField()]: d, index })) : [];
|
|
93348
|
+
return { position: (_d = labelSpec.position) !== null && _d !== void 0 ? _d : 'end', data };
|
|
93349
|
+
}
|
|
93350
|
+
|
|
93344
93351
|
class BaseLabelComponent extends BaseComponent {
|
|
93345
93352
|
constructor(spec, options) {
|
|
93346
93353
|
super(spec, options);
|
|
@@ -93447,6 +93454,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
93447
93454
|
this._initLabelComponent();
|
|
93448
93455
|
this._initTextMarkStyle();
|
|
93449
93456
|
}
|
|
93457
|
+
reInit(theme) {
|
|
93458
|
+
this._labelInfoMap && this._labelInfoMap.clear();
|
|
93459
|
+
this._initTextMark();
|
|
93460
|
+
this._initTextMarkStyle();
|
|
93461
|
+
}
|
|
93450
93462
|
initEvent() {
|
|
93451
93463
|
this.event.on(exports.ChartEvent.dataZoomChange, () => {
|
|
93452
93464
|
this._labelComponentMap.forEach((info, component) => {
|
|
@@ -93508,7 +93520,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
93508
93520
|
name: `${mark.name}-label-${index}`
|
|
93509
93521
|
}, { noSeparateStyle: true });
|
|
93510
93522
|
labelMark.setTarget(mark);
|
|
93511
|
-
info.push({
|
|
93523
|
+
info.push({
|
|
93524
|
+
labelMark,
|
|
93525
|
+
baseMark: mark,
|
|
93526
|
+
series: s,
|
|
93527
|
+
labelSpec
|
|
93528
|
+
});
|
|
93512
93529
|
}
|
|
93513
93530
|
});
|
|
93514
93531
|
}
|
|
@@ -93526,11 +93543,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
93526
93543
|
if (component) {
|
|
93527
93544
|
component.setSkipBeforeLayouted(true);
|
|
93528
93545
|
this._marks.addMark(component);
|
|
93529
|
-
this._labelComponentMap.set(component,
|
|
93546
|
+
this._labelComponentMap.set(component, () => {
|
|
93547
|
+
return this._labelInfoMap.get(region);
|
|
93548
|
+
});
|
|
93530
93549
|
}
|
|
93531
93550
|
}
|
|
93532
93551
|
else {
|
|
93533
|
-
regionLabelInfo.forEach(labelInfo => {
|
|
93552
|
+
regionLabelInfo.forEach((labelInfo, i) => {
|
|
93534
93553
|
const component = this._createMark({ type: MarkTypeEnum.component, name: `${labelInfo.labelMark.name}-component` }, {
|
|
93535
93554
|
componentType: 'label',
|
|
93536
93555
|
noSeparateStyle: true,
|
|
@@ -93539,7 +93558,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
93539
93558
|
if (component) {
|
|
93540
93559
|
component.setSkipBeforeLayouted(true);
|
|
93541
93560
|
this._marks.addMark(component);
|
|
93542
|
-
this._labelComponentMap.set(component,
|
|
93561
|
+
this._labelComponentMap.set(component, () => {
|
|
93562
|
+
return this._labelInfoMap.get(region)[i];
|
|
93563
|
+
});
|
|
93543
93564
|
labelInfo.labelMark.setComponent(component);
|
|
93544
93565
|
}
|
|
93545
93566
|
});
|
|
@@ -93563,7 +93584,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
93563
93584
|
}
|
|
93564
93585
|
updateLayoutAttribute() {
|
|
93565
93586
|
super.updateLayoutAttribute();
|
|
93566
|
-
this._labelComponentMap.forEach((
|
|
93587
|
+
this._labelComponentMap.forEach((labelInfoCb, labelComponent) => {
|
|
93588
|
+
const labelInfo = labelInfoCb();
|
|
93567
93589
|
if (isArray$3(labelInfo)) {
|
|
93568
93590
|
this._updateMultiLabelAttribute(labelInfo, labelComponent);
|
|
93569
93591
|
}
|
|
@@ -93593,10 +93615,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
93593
93615
|
const rule = labelMark.getRule();
|
|
93594
93616
|
const configFunc = (_a = labelRuleMap[rule]) !== null && _a !== void 0 ? _a : labelRuleMap.point;
|
|
93595
93617
|
const interactive = this._interactiveConfig(labelSpec);
|
|
93596
|
-
const passiveLabelSpec = pickWithout(labelSpec, ['position', 'style', 'state']);
|
|
93618
|
+
const passiveLabelSpec = pickWithout(labelSpec, ['position', 'style', 'state', 'type']);
|
|
93597
93619
|
const centerOffset = (_c = (_b = this._spec) === null || _b === void 0 ? void 0 : _b.centerOffset) !== null && _c !== void 0 ? _c : 0;
|
|
93598
|
-
|
|
93599
|
-
type: rule,
|
|
93620
|
+
const spec = mergeSpec({
|
|
93600
93621
|
textStyle: Object.assign({ pickable: labelSpec.interactive === true }, labelSpec.style),
|
|
93601
93622
|
overlap: {
|
|
93602
93623
|
avoidMarks: this._option
|
|
@@ -93605,6 +93626,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
93605
93626
|
.map(cmp => cmp.getMarks()[0].getProductId())
|
|
93606
93627
|
}
|
|
93607
93628
|
}, configFunc(labelInfo), Object.assign(Object.assign(Object.assign({}, passiveLabelSpec), interactive), { centerOffset }));
|
|
93629
|
+
if (rule === 'line' || rule === 'area') {
|
|
93630
|
+
spec.type = rule;
|
|
93631
|
+
}
|
|
93632
|
+
return spec;
|
|
93608
93633
|
}
|
|
93609
93634
|
})
|
|
93610
93635
|
.encode((datum, element, params) => {
|
|
@@ -93621,7 +93646,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
93621
93646
|
compileMarks() {
|
|
93622
93647
|
this.getMarks().forEach(m => {
|
|
93623
93648
|
var _a;
|
|
93624
|
-
const labelInfo = this._labelComponentMap.get(m);
|
|
93649
|
+
const labelInfo = this._labelComponentMap.get(m)();
|
|
93625
93650
|
let group;
|
|
93626
93651
|
if (isArray$3(labelInfo)) {
|
|
93627
93652
|
group = labelInfo[0].series.getRegion().getGroupMark().getProduct();
|
|
@@ -95551,6 +95576,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
95551
95576
|
exports.CircularProgressSeries = CircularProgressSeries;
|
|
95552
95577
|
exports.CommonChart = CommonChart;
|
|
95553
95578
|
exports.ComponentMark = ComponentMark;
|
|
95579
|
+
exports.ComposedEventMapper = ComposedEventMapper;
|
|
95554
95580
|
exports.ContinuousLegend = ContinuousLegend;
|
|
95555
95581
|
exports.CorrelationChart = CorrelationChart;
|
|
95556
95582
|
exports.CorrelationSeries = CorrelationSeries;
|
|
@@ -95575,8 +95601,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
95575
95601
|
exports.DEFAULT_RADIAL_GRADIENT_CONFIG = DEFAULT_RADIAL_GRADIENT_CONFIG;
|
|
95576
95602
|
exports.DEFAULT_SERIES_STYLE_NAME = DEFAULT_SERIES_STYLE_NAME;
|
|
95577
95603
|
exports.DataZoom = DataZoom;
|
|
95604
|
+
exports.DimensionClickEvent = DimensionClickEvent;
|
|
95605
|
+
exports.DimensionHoverEvent = DimensionHoverEvent;
|
|
95578
95606
|
exports.DiscreteLegend = DiscreteLegend;
|
|
95579
95607
|
exports.DotSeries = DotSeries;
|
|
95608
|
+
exports.Event = Event$1;
|
|
95580
95609
|
exports.Factory = Factory;
|
|
95581
95610
|
exports.Funnel3dChart = Funnel3dChart;
|
|
95582
95611
|
exports.Funnel3dSeries = Funnel3dSeries;
|