@visactor/vchart 1.1.3-beta.1 → 1.1.3
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/index.js +155 -84
- package/build/index.min.js +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/series/map/map.js +2 -2
- package/cjs/series/map/map.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/series/map/map.js +2 -2
- package/esm/series/map/map.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -17808,11 +17808,13 @@
|
|
|
17808
17808
|
return console.error("暂不支持该函数"), nodes;
|
|
17809
17809
|
}
|
|
17810
17810
|
insertBefore(newNode, referenceNode) {
|
|
17811
|
+
if (!referenceNode) return this.appendChild(newNode);
|
|
17811
17812
|
if (this._uid === newNode._uid) return null;
|
|
17812
17813
|
if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");
|
|
17813
17814
|
return referenceNode.parent !== this ? null : (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, newNode._prev = referenceNode._prev, referenceNode._prev ? referenceNode._prev._next = newNode : this._firstChild = newNode, referenceNode._prev = newNode, newNode._next = referenceNode, this._idMap || (this._idMap = new Map()), this._idMap.set(newNode._uid, newNode), this._structEdit = !0, this.setCount(newNode.count), newNode);
|
|
17814
17815
|
}
|
|
17815
17816
|
insertAfter(newNode, referenceNode) {
|
|
17817
|
+
if (!referenceNode) return this.appendChild(newNode);
|
|
17816
17818
|
if (this._uid === newNode._uid) return null;
|
|
17817
17819
|
if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");
|
|
17818
17820
|
return referenceNode.parent !== this ? null : (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, referenceNode._next ? (referenceNode._next._prev = newNode, newNode._next = referenceNode._next) : this._lastChild = newNode, referenceNode._next = newNode, newNode._prev = referenceNode, this._idMap || (this._idMap = new Map()), this._idMap.set(newNode._uid, newNode), this._structEdit = !0, this.setCount(newNode.count), newNode);
|
|
@@ -35622,10 +35624,12 @@
|
|
|
35622
35624
|
};
|
|
35623
35625
|
|
|
35624
35626
|
const transform$9 = (options, upstreamData) => {
|
|
35627
|
+
var _a;
|
|
35625
35628
|
const positiveValues = new Map(),
|
|
35626
35629
|
negativeValues = new Map(),
|
|
35627
35630
|
needSum = options.asPercentStack || options.asPrevPercentStack || options.asPercent || options.asSum,
|
|
35628
|
-
|
|
35631
|
+
orient = null !== (_a = options.orient) && void 0 !== _a ? _a : "positive",
|
|
35632
|
+
data = "negative" === orient ? upstreamData.slice().reverse() : upstreamData,
|
|
35629
35633
|
defaultDimValue = Symbol("dim");
|
|
35630
35634
|
let stackedValues = data.map(datum => {
|
|
35631
35635
|
var _a, _b, _c;
|
|
@@ -35656,7 +35660,7 @@
|
|
|
35656
35660
|
newDatum = Object.assign({}, datum),
|
|
35657
35661
|
sum = null !== (_a = (value >= 0 ? positiveValues : negativeValues).get(dimension)) && void 0 !== _a ? _a : 0;
|
|
35658
35662
|
return options.asSum && (newDatum[options.asSum] = sum), options.asPercent && (newDatum[options.asPercent] = 0 === sum ? 0 : value / sum), options.asPercentStack && (newDatum[options.asPercentStack] = 0 === sum ? 0 : stack / sum), options.asPrevPercentStack && (newDatum[options.asPrevPercentStack] = 0 === sum ? 0 : prevStack / sum), options.asPrevStack && (newDatum[options.asPrevStack] = prevStack), newDatum[null !== (_b = options.asStack) && void 0 !== _b ? _b : options.stackField] = stack, newDatum;
|
|
35659
|
-
})), "negative" ===
|
|
35663
|
+
})), "negative" === orient ? stackedValues.reverse() : stackedValues;
|
|
35660
35664
|
};
|
|
35661
35665
|
|
|
35662
35666
|
const transform$8 = (options, upstreamData) => {
|
|
@@ -36127,9 +36131,9 @@
|
|
|
36127
36131
|
}
|
|
36128
36132
|
}],
|
|
36129
36133
|
[GrammarMarkType.area]: [{
|
|
36130
|
-
channels: ["x", "y", "x1", "y1"
|
|
36134
|
+
channels: ["x", "y", "x1", "y1"],
|
|
36131
36135
|
transform: (graphicAttributes, nextAttrs, storedAttrs) => {
|
|
36132
|
-
graphicAttributes.x = 0, graphicAttributes.y = 0;
|
|
36136
|
+
graphicAttributes.x = 0, graphicAttributes.y = 0, graphicAttributes.x1 = 0, graphicAttributes.y1 = 0;
|
|
36133
36137
|
}
|
|
36134
36138
|
}],
|
|
36135
36139
|
[GrammarMarkType.line]: [{
|
|
@@ -37959,7 +37963,7 @@
|
|
|
37959
37963
|
y: y
|
|
37960
37964
|
}
|
|
37961
37965
|
};
|
|
37962
|
-
return isValidNumber(min) && (animateAttributes.to.min = center, animateAttributes.from.min = min), isValidNumber(max) && (animateAttributes.to.max = center, animateAttributes.from.max = max), isValidNumber(q1) && (animateAttributes.to.q1 = center, animateAttributes.from.q1 = q1), isValidNumber(q3) && (animateAttributes.to.q3 = center, animateAttributes.from.q3 = q3), isValidNumber(median) && (animateAttributes.to.median = center, animateAttributes.from.median =
|
|
37966
|
+
return isValidNumber(min) && (animateAttributes.to.min = center, animateAttributes.from.min = min), isValidNumber(max) && (animateAttributes.to.max = center, animateAttributes.from.max = max), isValidNumber(q1) && (animateAttributes.to.q1 = center, animateAttributes.from.q1 = q1), isValidNumber(q3) && (animateAttributes.to.q3 = center, animateAttributes.from.q3 = q3), isValidNumber(median) && (animateAttributes.to.median = center, animateAttributes.from.median = median), animateAttributes;
|
|
37963
37967
|
},
|
|
37964
37968
|
computeBoxplotCenter = (glyphElement, direction, options) => {
|
|
37965
37969
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
@@ -38045,6 +38049,8 @@
|
|
|
38045
38049
|
x1: x + width / 2
|
|
38046
38050
|
}))), attributes;
|
|
38047
38051
|
};
|
|
38052
|
+
const boxplotScaleIn = scaleIn(computeBoxplotCenter);
|
|
38053
|
+
const boxplotScaleOut = scaleOut(computeBoxplotCenter);
|
|
38048
38054
|
function registerBoxplotGlyph() {
|
|
38049
38055
|
registerGlyph("boxplot", {
|
|
38050
38056
|
shaft: "rule",
|
|
@@ -38162,7 +38168,7 @@
|
|
|
38162
38168
|
median: {
|
|
38163
38169
|
visible: !1
|
|
38164
38170
|
}
|
|
38165
|
-
})), registerAnimationType("boxplotScaleIn",
|
|
38171
|
+
})), registerAnimationType("boxplotScaleIn", boxplotScaleIn), registerAnimationType("boxplotScaleOut", boxplotScaleOut);
|
|
38166
38172
|
}
|
|
38167
38173
|
const computeBarBoxplotCenter = (glyphElement, direction, options) => {
|
|
38168
38174
|
var _a, _b, _c, _d;
|
|
@@ -38240,6 +38246,8 @@
|
|
|
38240
38246
|
x1: x + width / 2
|
|
38241
38247
|
}))), attributes;
|
|
38242
38248
|
};
|
|
38249
|
+
const barBoxplotScaleIn = scaleIn(computeBarBoxplotCenter);
|
|
38250
|
+
const barBoxplotScaleOut = scaleOut(computeBarBoxplotCenter);
|
|
38243
38251
|
function registerBarBoxplotGlyph() {
|
|
38244
38252
|
registerGlyph("barBoxplot", {
|
|
38245
38253
|
minMaxBox: "rect",
|
|
@@ -38334,7 +38342,7 @@
|
|
|
38334
38342
|
median: {
|
|
38335
38343
|
visible: !1
|
|
38336
38344
|
}
|
|
38337
|
-
})), registerAnimationType("barBoxplotScaleIn",
|
|
38345
|
+
})), registerAnimationType("barBoxplotScaleIn", barBoxplotScaleIn), registerAnimationType("barBoxplotScaleOut", barBoxplotScaleOut);
|
|
38338
38346
|
}
|
|
38339
38347
|
|
|
38340
38348
|
const getHorizontalPath = (options, ratio) => {
|
|
@@ -38585,7 +38593,7 @@
|
|
|
38585
38593
|
Object.keys(from).forEach(channel => {
|
|
38586
38594
|
isNil(from[channel]) && delete from[channel];
|
|
38587
38595
|
});
|
|
38588
|
-
const computePoints = isValidPointsChannel(Object.keys(from), element.mark.markType);
|
|
38596
|
+
const computePoints = isValidPointsChannel(Object.keys(from), element.mark.markType) && !isValid(from.segments);
|
|
38589
38597
|
if (computePoints) {
|
|
38590
38598
|
const items = element.items.map(item => Object.assign({}, item, {
|
|
38591
38599
|
nextAttrs: from
|
|
@@ -38598,7 +38606,7 @@
|
|
|
38598
38606
|
Object.keys(to).forEach(channel => {
|
|
38599
38607
|
isNil(to[channel]) && delete to[channel];
|
|
38600
38608
|
});
|
|
38601
|
-
const computePoints = isValidPointsChannel(Object.keys(to), element.mark.markType);
|
|
38609
|
+
const computePoints = isValidPointsChannel(Object.keys(to), element.mark.markType) && !isValid(to.segments);
|
|
38602
38610
|
if (computePoints) {
|
|
38603
38611
|
const items = element.items.map(item => Object.assign({}, item, {
|
|
38604
38612
|
nextAttrs: to
|
|
@@ -39408,10 +39416,11 @@
|
|
|
39408
39416
|
});
|
|
39409
39417
|
}
|
|
39410
39418
|
encodeCustom(nextAttrs) {
|
|
39419
|
+
var _a;
|
|
39411
39420
|
let customEncodeValues = {};
|
|
39412
39421
|
const channelEncoder = this.glyphMeta.getChannelEncoder(),
|
|
39413
39422
|
functionEncoder = this.glyphMeta.getFunctionEncoder();
|
|
39414
|
-
if (functionEncoder && (customEncodeValues = functionEncoder.call(null, nextAttrs, this.getDatum(), this, this.mark.getGlyphConfig())), channelEncoder) {
|
|
39423
|
+
if (functionEncoder && (customEncodeValues = functionEncoder.call(null, Object.assign({}, null === (_a = this.graphicItem) || void 0 === _a ? void 0 : _a.attribute, nextAttrs), this.getDatum(), this, this.mark.getGlyphConfig())), channelEncoder) {
|
|
39415
39424
|
let allAttrs;
|
|
39416
39425
|
Object.keys(channelEncoder).forEach(channel => {
|
|
39417
39426
|
var _a;
|
|
@@ -39797,7 +39806,7 @@
|
|
|
39797
39806
|
}
|
|
39798
39807
|
getScalesByChannel() {
|
|
39799
39808
|
const encoders = this.spec.encode;
|
|
39800
|
-
if (!encoders) return;
|
|
39809
|
+
if (!encoders) return {};
|
|
39801
39810
|
const res = {},
|
|
39802
39811
|
params = this.parameters();
|
|
39803
39812
|
return Object.keys(encoders).forEach(state => {
|
|
@@ -40538,8 +40547,7 @@
|
|
|
40538
40547
|
maxWidth: maxWidth,
|
|
40539
40548
|
padding = 4,
|
|
40540
40549
|
visible: visible,
|
|
40541
|
-
state: state
|
|
40542
|
-
formatMethod: formatMethod
|
|
40550
|
+
state: state
|
|
40543
40551
|
} = this.attribute,
|
|
40544
40552
|
parsedPadding = normalizePadding$1(padding),
|
|
40545
40553
|
group = this.createOrUpdateChild("tag-content", {
|
|
@@ -40571,7 +40579,7 @@
|
|
|
40571
40579
|
}
|
|
40572
40580
|
tagWidth += symbolPlaceWidth, textX += symbolPlaceWidth;
|
|
40573
40581
|
const textAttrs = Object.assign(Object.assign({
|
|
40574
|
-
text:
|
|
40582
|
+
text: text,
|
|
40575
40583
|
visible: isValid(text) && !1 !== visible,
|
|
40576
40584
|
lineHeight: null == textStyle ? void 0 : textStyle.fontSize
|
|
40577
40585
|
}, textStyle), {
|
|
@@ -41378,6 +41386,24 @@
|
|
|
41378
41386
|
function defaultLabelPosition(type) {
|
|
41379
41387
|
return "rect" === type ? DefaultRectPositions : DefaultPositions;
|
|
41380
41388
|
}
|
|
41389
|
+
function clampText(text, width, height) {
|
|
41390
|
+
const {
|
|
41391
|
+
x1: x1,
|
|
41392
|
+
x2: x2,
|
|
41393
|
+
y1: y1,
|
|
41394
|
+
y2: y2
|
|
41395
|
+
} = text.AABBBounds,
|
|
41396
|
+
minX = Math.min(x1, x2),
|
|
41397
|
+
maxX = Math.max(x1, x2),
|
|
41398
|
+
minY = Math.min(y1, y2),
|
|
41399
|
+
maxY = Math.max(y1, y2);
|
|
41400
|
+
let dx = 0,
|
|
41401
|
+
dy = 0;
|
|
41402
|
+
return minX < 0 && maxX - minX <= width ? dx = -minX : maxX > width && minX - (maxX - width) >= 0 && (dx = width - maxX), minY < 0 && maxY - minY <= height ? dy = -minY : maxY > height && minY - (maxY - height) >= 0 && (dy = height - maxY), {
|
|
41403
|
+
dx: dx,
|
|
41404
|
+
dy: dy
|
|
41405
|
+
};
|
|
41406
|
+
}
|
|
41381
41407
|
|
|
41382
41408
|
const fadeIn = function () {
|
|
41383
41409
|
let textAttribute = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -41456,9 +41482,17 @@
|
|
|
41456
41482
|
this._bmpTool = bmpTool;
|
|
41457
41483
|
}
|
|
41458
41484
|
render() {
|
|
41459
|
-
|
|
41460
|
-
|
|
41461
|
-
|
|
41485
|
+
this._prepare();
|
|
41486
|
+
const {
|
|
41487
|
+
overlap: overlap,
|
|
41488
|
+
smartInvert: smartInvert,
|
|
41489
|
+
dataFilter: dataFilter,
|
|
41490
|
+
customLayoutFunc: customLayoutFunc,
|
|
41491
|
+
customOverlapFunc: customOverlapFunc
|
|
41492
|
+
} = this.attribute;
|
|
41493
|
+
let labels,
|
|
41494
|
+
data = this.attribute.data;
|
|
41495
|
+
isFunction(dataFilter) && (data = dataFilter(data)), isFunction(customLayoutFunc) ? labels = customLayoutFunc(data, d => this._idToGraphic.get(d.id)) : (labels = this.layout(data), isFunction(customOverlapFunc) ? labels = customOverlapFunc(labels, d => this._idToGraphic.get(d.id)) : !1 !== overlap && (labels = this._overlapping(labels))), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels);
|
|
41462
41496
|
}
|
|
41463
41497
|
_bindEvent(target) {
|
|
41464
41498
|
if (!target) return;
|
|
@@ -41477,52 +41511,53 @@
|
|
|
41477
41511
|
const text = createText(attributes);
|
|
41478
41512
|
return this._bindEvent(text), this._setStates(text), text;
|
|
41479
41513
|
}
|
|
41480
|
-
|
|
41514
|
+
_prepare() {
|
|
41481
41515
|
var _a;
|
|
41482
41516
|
const baseMarks = this.getBaseMarks(),
|
|
41483
41517
|
currentBaseMarks = [];
|
|
41484
|
-
|
|
41518
|
+
if (baseMarks.forEach(mark => {
|
|
41485
41519
|
"willRelease" !== mark.releaseStatus && currentBaseMarks.push(mark);
|
|
41486
|
-
}),
|
|
41487
|
-
}
|
|
41488
|
-
layout(currentMarks) {
|
|
41520
|
+
}), null === (_a = this._idToGraphic) || void 0 === _a || _a.clear(), this._baseMarks = currentBaseMarks, !currentBaseMarks || 0 === currentBaseMarks.length) return;
|
|
41489
41521
|
const {
|
|
41490
|
-
textStyle: textStyle,
|
|
41491
|
-
position: position,
|
|
41492
|
-
offset: offset
|
|
41493
|
-
} = this.attribute;
|
|
41494
|
-
let {
|
|
41495
41522
|
data: data
|
|
41496
41523
|
} = this.attribute;
|
|
41497
|
-
if (
|
|
41498
|
-
|
|
41499
|
-
|
|
41524
|
+
if (data && 0 !== data.length) {
|
|
41525
|
+
this._idToGraphic || (this._idToGraphic = new Map());
|
|
41526
|
+
for (let i = 0; i < currentBaseMarks.length; i++) {
|
|
41527
|
+
const textData = data[i],
|
|
41528
|
+
baseMark = currentBaseMarks[i];
|
|
41529
|
+
textData && baseMark && (isValid(textData.id) || (textData.id = `vrender-component-${this.name}-${i}`), this._idToGraphic.set(textData.id, baseMark));
|
|
41530
|
+
}
|
|
41531
|
+
}
|
|
41532
|
+
}
|
|
41533
|
+
layout() {
|
|
41534
|
+
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
41535
|
+
const {
|
|
41536
|
+
textStyle = {},
|
|
41537
|
+
position: position,
|
|
41538
|
+
offset: offset
|
|
41539
|
+
} = this.attribute,
|
|
41540
|
+
labels = [];
|
|
41500
41541
|
for (let i = 0; i < data.length; i++) {
|
|
41501
41542
|
const textData = data[i],
|
|
41502
|
-
baseMark =
|
|
41503
|
-
labelAttribute = Object.assign(Object.assign(
|
|
41504
|
-
|
|
41505
|
-
|
|
41506
|
-
|
|
41507
|
-
|
|
41508
|
-
|
|
41509
|
-
|
|
41510
|
-
|
|
41511
|
-
|
|
41512
|
-
y: textData.y
|
|
41513
|
-
}),
|
|
41514
|
-
textAttributes = this.labeling(textBounds, graphicBounds, isFunction(position) ? position(textData) : position, offset);
|
|
41515
|
-
if (!textAttributes) continue;
|
|
41516
|
-
labelAttribute.x = textAttributes.x, labelAttribute.y = textAttributes.y, labels.push(labelAttribute);
|
|
41517
|
-
}
|
|
41543
|
+
baseMark = this._idToGraphic.get(textData.id),
|
|
41544
|
+
labelAttribute = Object.assign(Object.assign({}, textStyle), textData),
|
|
41545
|
+
text = this._createLabelText(labelAttribute),
|
|
41546
|
+
textBounds = this.getGraphicBounds(text),
|
|
41547
|
+
graphicBounds = this.getGraphicBounds(baseMark, {
|
|
41548
|
+
x: textData.x,
|
|
41549
|
+
y: textData.y
|
|
41550
|
+
}),
|
|
41551
|
+
textLocation = this.labeling(textBounds, graphicBounds, isFunction(position) ? position(textData) : position, offset);
|
|
41552
|
+
textLocation && (labelAttribute.x = textLocation.x, labelAttribute.y = textLocation.y, text.setAttributes(textLocation), labels.push(text));
|
|
41518
41553
|
}
|
|
41519
|
-
return
|
|
41554
|
+
return labels;
|
|
41520
41555
|
}
|
|
41521
|
-
|
|
41522
|
-
|
|
41523
|
-
var _a, _b, _c, _d, _e;
|
|
41556
|
+
_overlapping(labels) {
|
|
41557
|
+
var _a, _b, _c, _d;
|
|
41524
41558
|
if (0 === labels.length) return [];
|
|
41525
|
-
const
|
|
41559
|
+
const option = this.attribute.overlap,
|
|
41560
|
+
result = [],
|
|
41526
41561
|
baseMarkGroup = this.getBaseMarkGroup(),
|
|
41527
41562
|
size = null !== (_a = option.size) && void 0 !== _a ? _a : {
|
|
41528
41563
|
width: null !== (_b = null == baseMarkGroup ? void 0 : baseMarkGroup.AABBBounds.width()) && void 0 !== _b ? _b : 0,
|
|
@@ -41543,27 +41578,45 @@
|
|
|
41543
41578
|
}));
|
|
41544
41579
|
for (let i = 0; i < labels.length; i++) {
|
|
41545
41580
|
if (!1 === labels[i].visible) continue;
|
|
41546
|
-
const text =
|
|
41547
|
-
baseMark =
|
|
41581
|
+
const text = labels[i],
|
|
41582
|
+
baseMark = this._idToGraphic.get(text.attribute.id);
|
|
41548
41583
|
if (text.update(), canPlace(bmpTool, bitmap, text.AABBBounds, clampForce)) {
|
|
41549
41584
|
if (!checkBounds) {
|
|
41550
|
-
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(
|
|
41585
|
+
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
|
|
41551
41586
|
continue;
|
|
41552
41587
|
}
|
|
41553
41588
|
if (checkBounds && (null == baseMark ? void 0 : baseMark.AABBBounds) && canPlaceInside(text.AABBBounds, null == baseMark ? void 0 : baseMark.AABBBounds)) {
|
|
41554
|
-
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(
|
|
41589
|
+
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
|
|
41555
41590
|
continue;
|
|
41556
41591
|
}
|
|
41557
41592
|
}
|
|
41558
41593
|
let hasPlace = !1;
|
|
41559
41594
|
for (let j = 0; j < strategy.length; j++) if (hasPlace = place$2(bmpTool, bitmap, strategy[j], this.attribute, text, this.getGraphicBounds(baseMark, labels[i]), this.labeling), !1 !== hasPlace) {
|
|
41560
|
-
|
|
41595
|
+
text.setAttributes({
|
|
41561
41596
|
x: hasPlace.x,
|
|
41562
41597
|
y: hasPlace.y
|
|
41563
|
-
}));
|
|
41598
|
+
}), result.push(text);
|
|
41564
41599
|
break;
|
|
41565
41600
|
}
|
|
41566
|
-
|
|
41601
|
+
if (clampForce) {
|
|
41602
|
+
const {
|
|
41603
|
+
dx = 0,
|
|
41604
|
+
dy = 0
|
|
41605
|
+
} = clampText(text, bmpTool.width, bmpTool.height);
|
|
41606
|
+
if ((0 !== dx || 0 !== dy) && canPlace(bmpTool, bitmap, {
|
|
41607
|
+
x1: text.AABBBounds.x1 + dx,
|
|
41608
|
+
x2: text.AABBBounds.x2 + dx,
|
|
41609
|
+
y1: text.AABBBounds.y1 + dy,
|
|
41610
|
+
y2: text.AABBBounds.y2 + dy
|
|
41611
|
+
})) {
|
|
41612
|
+
text.setAttributes({
|
|
41613
|
+
x: text.attribute.x + dx,
|
|
41614
|
+
y: text.attribute.y + dy
|
|
41615
|
+
}), bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
|
|
41616
|
+
continue;
|
|
41617
|
+
}
|
|
41618
|
+
}
|
|
41619
|
+
!hasPlace && !hideOnHit && result.push(text);
|
|
41567
41620
|
}
|
|
41568
41621
|
return isFunction(this.onAfterLabelOverlap) && this.onAfterLabelOverlap(bitmap), result;
|
|
41569
41622
|
}
|
|
@@ -41595,17 +41648,16 @@
|
|
|
41595
41648
|
easing = null !== (_d = animationConfig.easing) && void 0 !== _d ? _d : DefaultLabelAnimation.easing,
|
|
41596
41649
|
delay = null !== (_e = animationConfig.delay) && void 0 !== _e ? _e : 0,
|
|
41597
41650
|
currentTextMap = new Map(),
|
|
41598
|
-
prevTextMap = this.
|
|
41651
|
+
prevTextMap = this._graphicToText || new Map(),
|
|
41599
41652
|
texts = [];
|
|
41600
|
-
labels.forEach((
|
|
41601
|
-
const
|
|
41602
|
-
relatedGraphic = this._relationMap.get(label._relatedIndex),
|
|
41653
|
+
labels.forEach((text, index) => {
|
|
41654
|
+
const relatedGraphic = this._idToGraphic.get(text.attribute.id),
|
|
41603
41655
|
state = (null == prevTextMap ? void 0 : prevTextMap.get(relatedGraphic)) ? "update" : "enter";
|
|
41604
41656
|
if ("enter" === state) if (texts.push(text), currentTextMap.set(relatedGraphic, text), !disableAnimation && relatedGraphic) {
|
|
41605
41657
|
const {
|
|
41606
41658
|
from: from,
|
|
41607
41659
|
to: to
|
|
41608
|
-
} = getAnimationAttributes(
|
|
41660
|
+
} = getAnimationAttributes(text.attribute, "fadeIn");
|
|
41609
41661
|
this.add(text), relatedGraphic.onAnimateBind = () => {
|
|
41610
41662
|
text.setAttributes(from);
|
|
41611
41663
|
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, {
|
|
@@ -41630,7 +41682,7 @@
|
|
|
41630
41682
|
disableAnimation ? this.removeChild(label) : null == label || label.animate().to(getAnimationAttributes(label.attribute, "fadeOut").to, duration, easing).onEnd(() => {
|
|
41631
41683
|
this.removeChild(label);
|
|
41632
41684
|
});
|
|
41633
|
-
}), this.
|
|
41685
|
+
}), this._graphicToText = currentTextMap;
|
|
41634
41686
|
}
|
|
41635
41687
|
_afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, _ref) {
|
|
41636
41688
|
let {
|
|
@@ -41673,21 +41725,32 @@
|
|
|
41673
41725
|
return listener;
|
|
41674
41726
|
}
|
|
41675
41727
|
_smartInvert(labels) {
|
|
41676
|
-
|
|
41677
|
-
|
|
41678
|
-
|
|
41728
|
+
const option = this.attribute.smartInvert || {},
|
|
41729
|
+
{
|
|
41730
|
+
textType: textType,
|
|
41731
|
+
contrastRatiosThreshold: contrastRatiosThreshold,
|
|
41732
|
+
alternativeColors: alternativeColors
|
|
41733
|
+
} = option;
|
|
41734
|
+
for (let i = 0; i < labels.length; i++) {
|
|
41735
|
+
const label = labels[i];
|
|
41679
41736
|
if (!label) continue;
|
|
41680
|
-
const
|
|
41681
|
-
|
|
41682
|
-
|
|
41683
|
-
|
|
41684
|
-
|
|
41685
|
-
|
|
41686
|
-
|
|
41687
|
-
label.
|
|
41688
|
-
|
|
41689
|
-
|
|
41690
|
-
|
|
41737
|
+
const baseMark = this._idToGraphic.get(label.attribute.id),
|
|
41738
|
+
isInside = canPlaceInside(label.AABBBounds, null == baseMark ? void 0 : baseMark.AABBBounds);
|
|
41739
|
+
if (label.attribute.stroke && label.attribute.lineWidth > 0) label.setAttributes({
|
|
41740
|
+
fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors)
|
|
41741
|
+
});else if (isInside) {
|
|
41742
|
+
const backgroundColor = baseMark.attribute.fill,
|
|
41743
|
+
foregroundColor = label.attribute.fill;
|
|
41744
|
+
label.setAttributes({
|
|
41745
|
+
fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors)
|
|
41746
|
+
});
|
|
41747
|
+
} else if (label.attribute.lineWidth > 0) {
|
|
41748
|
+
const backgroundColor = label.attribute.stroke,
|
|
41749
|
+
foregroundColor = label.attribute.fill;
|
|
41750
|
+
label.setAttributes({
|
|
41751
|
+
stroke: baseMark.attribute.fill,
|
|
41752
|
+
fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors)
|
|
41753
|
+
});
|
|
41691
41754
|
}
|
|
41692
41755
|
}
|
|
41693
41756
|
}
|
|
@@ -42070,6 +42133,9 @@
|
|
|
42070
42133
|
line.name = "line", line.id = this._getNodeId("line"), isEmpty(null == state ? void 0 : state.line) || (line.states = state.line), this.line = line, this.add(line);
|
|
42071
42134
|
}
|
|
42072
42135
|
renderSymbol(attribute, dim) {
|
|
42136
|
+
const {
|
|
42137
|
+
autoRotate = !0
|
|
42138
|
+
} = attribute;
|
|
42073
42139
|
let symbol;
|
|
42074
42140
|
if (null == attribute ? void 0 : attribute.visible) {
|
|
42075
42141
|
const startAngle = this._startAngle,
|
|
@@ -42098,7 +42164,7 @@
|
|
|
42098
42164
|
}, rotate = endAngle + Math.PI / 2), symbol = createSymbol(Object.assign(Object.assign(Object.assign({}, position), {
|
|
42099
42165
|
symbolType: symbolType,
|
|
42100
42166
|
size: size,
|
|
42101
|
-
angle: rotate + refAngle,
|
|
42167
|
+
angle: autoRotate ? rotate + refAngle : 0,
|
|
42102
42168
|
strokeBoundsBuffer: 0
|
|
42103
42169
|
}), style)), symbol.name = `${dim}-symbol`, symbol.id = this._getNodeId(`${dim}-symbol`), isEmpty(null == state ? void 0 : state.symbol) || (symbol.states = state.symbol), this.add(symbol);
|
|
42104
42170
|
}
|
|
@@ -42119,6 +42185,7 @@
|
|
|
42119
42185
|
},
|
|
42120
42186
|
startSymbol: {
|
|
42121
42187
|
visible: !1,
|
|
42188
|
+
autoRotate: !0,
|
|
42122
42189
|
symbolType: "triangle",
|
|
42123
42190
|
size: 12,
|
|
42124
42191
|
refX: 0,
|
|
@@ -42131,6 +42198,7 @@
|
|
|
42131
42198
|
},
|
|
42132
42199
|
endSymbol: {
|
|
42133
42200
|
visible: !1,
|
|
42201
|
+
autoRotate: !0,
|
|
42134
42202
|
symbolType: "triangle",
|
|
42135
42203
|
size: 12,
|
|
42136
42204
|
refX: 0,
|
|
@@ -47803,7 +47871,7 @@
|
|
|
47803
47871
|
super(view, ComponentEnum.axis, group), this.spec.componentType = ComponentEnum.axis, this.spec.axisType = "line", this.mode = mode;
|
|
47804
47872
|
}
|
|
47805
47873
|
parseAddition(spec) {
|
|
47806
|
-
return super.parseAddition(spec), this.tickCount(spec.tickCount), this.inside(spec.inside), this.baseValue(spec.baseValue), this;
|
|
47874
|
+
return super.parseAddition(spec), this.axisType(spec.axisType), this.tickCount(spec.tickCount), this.inside(spec.inside), this.baseValue(spec.baseValue), this;
|
|
47807
47875
|
}
|
|
47808
47876
|
axisType(axisType) {
|
|
47809
47877
|
return this.spec.axisType = axisType, this._axisComponentType = null, this._prepareRejoin(), this.commit(), this;
|
|
@@ -58042,7 +58110,7 @@
|
|
|
58042
58110
|
VChart.useMark([ComponentMark, GroupMark, ImageMark]);
|
|
58043
58111
|
Factory.registerRegion('region', Region);
|
|
58044
58112
|
Factory.registerLayout('base', Layout);
|
|
58045
|
-
const version = "1.1.3
|
|
58113
|
+
const version = "1.1.3";
|
|
58046
58114
|
Logger.getInstance(LoggerLevel.Error);
|
|
58047
58115
|
|
|
58048
58116
|
var SeriesMarkNameEnum;
|
|
@@ -65283,7 +65351,9 @@
|
|
|
65283
65351
|
spec?.nameMap !== nameMap ||
|
|
65284
65352
|
spec?.valueField !== valueField ||
|
|
65285
65353
|
spec?.nameProperty !== nameProperty) {
|
|
65354
|
+
result.change = true;
|
|
65286
65355
|
result.reRender = true;
|
|
65356
|
+
result.reMake = true;
|
|
65287
65357
|
}
|
|
65288
65358
|
return result;
|
|
65289
65359
|
}
|
|
@@ -68812,7 +68882,7 @@
|
|
|
68812
68882
|
for (this.data = data; i < n;) {
|
|
68813
68883
|
if (this.layoutWord(i) && i++, this.progressiveIndex = i, this.exceedTime()) break;
|
|
68814
68884
|
}
|
|
68815
|
-
if (!this.options.clip && this.options.enlarge && this.shrinkBoard(this._bounds), ["cardioid", "triangle", "triangle-upright"].includes(this.options.shape)) {
|
|
68885
|
+
if (!this.options.clip && this.options.enlarge && this._bounds && this.shrinkBoard(this._bounds), this._bounds && ["cardioid", "triangle", "triangle-upright"].includes(this.options.shape)) {
|
|
68816
68886
|
const currentCenterY = (this._bounds[0].y + this._bounds[1].y) / 2;
|
|
68817
68887
|
this._dy = -(currentCenterY - this._size[1] / 2);
|
|
68818
68888
|
}
|
|
@@ -69337,8 +69407,9 @@
|
|
|
69337
69407
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
69338
69408
|
if (options.size && (!options.size[0] || !options.size[1])) return upstreamData;
|
|
69339
69409
|
const data = upstreamData,
|
|
69340
|
-
canvasSize = null !== (_a = options.size) && void 0 !== _a ? _a : [500, 500]
|
|
69341
|
-
|
|
69410
|
+
canvasSize = (null !== (_a = options.size) && void 0 !== _a ? _a : [500, 500]).slice();
|
|
69411
|
+
canvasSize[0] = Math.floor(canvasSize[0]), canvasSize[1] = Math.floor(canvasSize[1]);
|
|
69412
|
+
const fontFamily = options.fontFamily ? field$1(options.fontFamily) : "sans-serif",
|
|
69342
69413
|
fontStyle = options.fontStyle ? field$1(options.fontStyle) : "normal",
|
|
69343
69414
|
fontWeight = options.fontWeight ? field$1(options.fontWeight) : "normal",
|
|
69344
69415
|
rotate = options.rotate ? field$1(options.rotate) : 0,
|