@visactor/vrender-components 0.20.2 → 0.20.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/cjs/axis/config.d.ts +6 -0
- package/cjs/axis/config.js +7 -1
- package/cjs/axis/config.js.map +1 -1
- package/cjs/axis/constant.d.ts +4 -1
- package/cjs/axis/constant.js +4 -3
- package/cjs/axis/constant.js.map +1 -1
- package/cjs/axis/line.d.ts +2 -0
- package/cjs/axis/line.js +62 -8
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/overlap/auto-limit.d.ts +2 -0
- package/cjs/axis/overlap/auto-limit.js +26 -5
- package/cjs/axis/overlap/auto-limit.js.map +1 -1
- package/cjs/axis/overlap/auto-wrap.d.ts +9 -0
- package/cjs/axis/overlap/auto-wrap.js +38 -0
- package/cjs/axis/overlap/auto-wrap.js.map +1 -0
- package/cjs/axis/overlap/util.d.ts +2 -0
- package/cjs/axis/overlap/util.js +15 -1
- package/cjs/axis/overlap/util.js.map +1 -1
- package/cjs/axis/tick-data/continuous.js +35 -11
- package/cjs/axis/tick-data/continuous.js.map +1 -1
- package/cjs/axis/type.d.ts +28 -4
- package/cjs/axis/type.js.map +1 -1
- package/cjs/axis/util.d.ts +2 -0
- package/cjs/axis/util.js +15 -5
- package/cjs/axis/util.js.map +1 -1
- package/cjs/brush/type.js +2 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/animate/animate.d.ts +5 -5
- package/cjs/label/animate/animate.js +4 -4
- package/cjs/label/animate/animate.js.map +1 -1
- package/cjs/label/arc.d.ts +2 -0
- package/cjs/label/arc.js +28 -27
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.d.ts +6 -5
- package/cjs/label/base.js +60 -58
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.js +1 -0
- package/cjs/label/dataLabel.js.map +1 -1
- package/cjs/label/type.d.ts +6 -5
- package/cjs/label/type.js.map +1 -1
- package/cjs/label/util.d.ts +1 -0
- package/cjs/label/util.js +6 -2
- package/cjs/label/util.js.map +1 -1
- package/cjs/tag/tag.js +4 -4
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/title/title.js +95 -96
- package/cjs/title/title.js.map +1 -1
- package/dist/index.es.js +394 -164
- package/es/axis/config.d.ts +6 -0
- package/es/axis/config.js +7 -0
- package/es/axis/config.js.map +1 -1
- package/es/axis/constant.d.ts +4 -1
- package/es/axis/constant.js +4 -1
- package/es/axis/constant.js.map +1 -1
- package/es/axis/line.d.ts +2 -0
- package/es/axis/line.js +66 -8
- package/es/axis/line.js.map +1 -1
- package/es/axis/overlap/auto-limit.d.ts +2 -0
- package/es/axis/overlap/auto-limit.js +27 -5
- package/es/axis/overlap/auto-limit.js.map +1 -1
- package/es/axis/overlap/auto-wrap.d.ts +9 -0
- package/es/axis/overlap/auto-wrap.js +31 -0
- package/es/axis/overlap/auto-wrap.js.map +1 -0
- package/es/axis/overlap/util.d.ts +2 -0
- package/es/axis/overlap/util.js +13 -1
- package/es/axis/overlap/util.js.map +1 -1
- package/es/axis/tick-data/continuous.js +34 -11
- package/es/axis/tick-data/continuous.js.map +1 -1
- package/es/axis/type.d.ts +28 -4
- package/es/axis/type.js.map +1 -1
- package/es/axis/util.d.ts +2 -0
- package/es/axis/util.js +13 -3
- package/es/axis/util.js.map +1 -1
- package/es/brush/type.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/animate/animate.d.ts +5 -5
- package/es/label/animate/animate.js +4 -4
- package/es/label/animate/animate.js.map +1 -1
- package/es/label/arc.d.ts +2 -0
- package/es/label/arc.js +29 -26
- package/es/label/arc.js.map +1 -1
- package/es/label/base.d.ts +6 -5
- package/es/label/base.js +57 -57
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.js +1 -0
- package/es/label/dataLabel.js.map +1 -1
- package/es/label/type.d.ts +6 -5
- package/es/label/type.js.map +1 -1
- package/es/label/util.d.ts +1 -0
- package/es/label/util.js +4 -0
- package/es/label/util.js.map +1 -1
- package/es/tag/tag.js +4 -4
- package/es/tag/tag.js.map +1 -1
- package/es/title/title.js +95 -94
- package/es/title/title.js.map +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -4550,7 +4550,7 @@ class Graphic extends Node {
|
|
|
4550
4550
|
return this._transMatrix || (this._transMatrix = new Matrix()), this.shouldUpdateLocalMatrix() && (this.doUpdateLocalMatrix(), clearTag && this.clearUpdateLocalPositionTag()), this._transMatrix;
|
|
4551
4551
|
}
|
|
4552
4552
|
shouldUpdateAABBBounds() {
|
|
4553
|
-
return this.shadowRoot ? !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds() : !!(this._updateTag & UpdateTag.UPDATE_BOUNDS);
|
|
4553
|
+
return this.shadowRoot ? (!!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds()) && application.graphicService.validCheck(this.attribute, this.getGraphicTheme(), this._AABBBounds, this) : !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) && application.graphicService.validCheck(this.attribute, this.getGraphicTheme(), this._AABBBounds, this);
|
|
4554
4554
|
}
|
|
4555
4555
|
shouldSelfChangeUpdateAABBBounds() {
|
|
4556
4556
|
return this.shadowRoot ? !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds() : !!(this._updateTag & UpdateTag.UPDATE_BOUNDS);
|
|
@@ -9293,7 +9293,6 @@ class Circle extends Graphic {
|
|
|
9293
9293
|
return getTheme(this).circle;
|
|
9294
9294
|
}
|
|
9295
9295
|
updateAABBBounds(attribute, circleTheme, aabbBounds, full) {
|
|
9296
|
-
if (!application.graphicService.validCheck(attribute, circleTheme, aabbBounds, this)) return aabbBounds;
|
|
9297
9296
|
this.updatePathProxyAABBBounds(aabbBounds) || (full ? this.updateCircleAABBBoundsImprecise(attribute, circleTheme, aabbBounds) : this.updateCircleAABBBoundsAccurate(attribute, circleTheme, aabbBounds));
|
|
9298
9297
|
const {
|
|
9299
9298
|
tb1: tb1,
|
|
@@ -9486,7 +9485,6 @@ class Text extends Graphic {
|
|
|
9486
9485
|
return getTheme(this).text;
|
|
9487
9486
|
}
|
|
9488
9487
|
updateAABBBounds(attribute, textTheme, aabbBounds) {
|
|
9489
|
-
if (!application.graphicService.validCheck(attribute, textTheme, aabbBounds, this)) return aabbBounds;
|
|
9490
9488
|
const {
|
|
9491
9489
|
text = textTheme.text
|
|
9492
9490
|
} = this.attribute;
|
|
@@ -10595,7 +10593,6 @@ let Symbol$1 = class Symbol extends Graphic {
|
|
|
10595
10593
|
return getTheme(this).symbol;
|
|
10596
10594
|
}
|
|
10597
10595
|
updateAABBBounds(attribute, symbolTheme, aabbBounds, full) {
|
|
10598
|
-
if (!application.graphicService.validCheck(attribute, symbolTheme, aabbBounds, this)) return aabbBounds;
|
|
10599
10596
|
this.updatePathProxyAABBBounds(aabbBounds) || (full ? this.updateSymbolAABBBoundsImprecise(attribute, symbolTheme, aabbBounds) : this.updateSymbolAABBBoundsAccurate(attribute, symbolTheme, aabbBounds));
|
|
10600
10597
|
const {
|
|
10601
10598
|
tb1: tb1,
|
|
@@ -10673,7 +10670,6 @@ let Line$1 = class Line extends Graphic {
|
|
|
10673
10670
|
return getTheme(this).line;
|
|
10674
10671
|
}
|
|
10675
10672
|
updateAABBBounds(attribute, lineTheme, aabbBounds) {
|
|
10676
|
-
if (!application.graphicService.validCheck(attribute, lineTheme, aabbBounds, this)) return aabbBounds;
|
|
10677
10673
|
this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds) : this.updateLineAABBBoundsByPoints(attribute, lineTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
10678
10674
|
const {
|
|
10679
10675
|
lineJoin = lineTheme.lineJoin
|
|
@@ -10754,7 +10750,6 @@ class Rect extends Graphic {
|
|
|
10754
10750
|
return getTheme(this).rect;
|
|
10755
10751
|
}
|
|
10756
10752
|
updateAABBBounds(attribute, rectTheme, aabbBounds) {
|
|
10757
|
-
if (!application.graphicService.validCheck(attribute, rectTheme, aabbBounds, this)) return aabbBounds;
|
|
10758
10753
|
if (!this.updatePathProxyAABBBounds(aabbBounds)) {
|
|
10759
10754
|
let {
|
|
10760
10755
|
width: width,
|
|
@@ -11079,7 +11074,6 @@ class Image extends Graphic {
|
|
|
11079
11074
|
return getTheme(this).image;
|
|
11080
11075
|
}
|
|
11081
11076
|
updateAABBBounds(attribute, imageTheme, aabbBounds) {
|
|
11082
|
-
if (!application.graphicService.validCheck(attribute, imageTheme, aabbBounds, this)) return aabbBounds;
|
|
11083
11077
|
if (!this.updatePathProxyAABBBounds(aabbBounds)) {
|
|
11084
11078
|
const {
|
|
11085
11079
|
width = imageTheme.width,
|
|
@@ -11353,7 +11347,6 @@ class RichText extends Graphic {
|
|
|
11353
11347
|
return getTheme(this).richtext;
|
|
11354
11348
|
}
|
|
11355
11349
|
updateAABBBounds(attribute, richtextTheme, aabbBounds) {
|
|
11356
|
-
if (!application.graphicService.validCheck(attribute, richtextTheme, aabbBounds, this)) return aabbBounds;
|
|
11357
11350
|
const {
|
|
11358
11351
|
width = richtextTheme.width,
|
|
11359
11352
|
height = richtextTheme.height,
|
|
@@ -11570,7 +11563,6 @@ class Path extends Graphic {
|
|
|
11570
11563
|
return getTheme(this).path;
|
|
11571
11564
|
}
|
|
11572
11565
|
updateAABBBounds(attribute, pathTheme, aabbBounds) {
|
|
11573
|
-
if (!application.graphicService.validCheck(attribute, pathTheme, aabbBounds, this)) return aabbBounds;
|
|
11574
11566
|
if (!this.updatePathProxyAABBBounds(aabbBounds)) {
|
|
11575
11567
|
const pathShape = this.getParsedPathShape();
|
|
11576
11568
|
aabbBounds.union(pathShape.getBounds());
|
|
@@ -11636,7 +11628,6 @@ class Area extends Graphic {
|
|
|
11636
11628
|
return getTheme(this).area;
|
|
11637
11629
|
}
|
|
11638
11630
|
updateAABBBounds(attribute, areaTheme, aabbBounds) {
|
|
11639
|
-
if (!application.graphicService.validCheck(attribute, areaTheme, aabbBounds, this)) return aabbBounds;
|
|
11640
11631
|
this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
11641
11632
|
const {
|
|
11642
11633
|
lineJoin = areaTheme.lineJoin
|
|
@@ -11837,7 +11828,6 @@ class Arc extends Graphic {
|
|
|
11837
11828
|
return getTheme(this).arc;
|
|
11838
11829
|
}
|
|
11839
11830
|
updateAABBBounds(attribute, arcTheme, aabbBounds, full) {
|
|
11840
|
-
if (!application.graphicService.validCheck(attribute, arcTheme, aabbBounds, this)) return aabbBounds;
|
|
11841
11831
|
this.updatePathProxyAABBBounds(aabbBounds) || (full ? this.updateArcAABBBoundsImprecise(attribute, arcTheme, aabbBounds) : this.updateArcAABBBoundsAccurate(attribute, arcTheme, aabbBounds));
|
|
11842
11832
|
const {
|
|
11843
11833
|
tb1: tb1,
|
|
@@ -11945,7 +11935,6 @@ class Polygon extends Graphic {
|
|
|
11945
11935
|
return getTheme(this).polygon;
|
|
11946
11936
|
}
|
|
11947
11937
|
updateAABBBounds(attribute, polygonTheme, aabbBounds) {
|
|
11948
|
-
if (!application.graphicService.validCheck(attribute, polygonTheme, aabbBounds, this)) return aabbBounds;
|
|
11949
11938
|
this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
11950
11939
|
const {
|
|
11951
11940
|
lineJoin = polygonTheme.lineJoin
|
|
@@ -14774,7 +14763,7 @@ class Tag extends AbstractComponent {
|
|
|
14774
14763
|
textShape = group.createOrUpdateChild('tag-text', richTextAttrs, 'richtext');
|
|
14775
14764
|
const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
|
|
14776
14765
|
if (visible && isBoolean(bgVisible)) {
|
|
14777
|
-
const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x: textShape.AABBBounds.x1, y: textShape.AABBBounds.y1, width: textShape.AABBBounds.width(), height: textShape.AABBBounds.height() }), 'rect');
|
|
14766
|
+
const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x: textShape.AABBBounds.x1 - parsedPadding[1], y: textShape.AABBBounds.y1 - parsedPadding[0], width: textShape.AABBBounds.width() + (parsedPadding[1] + parsedPadding[3]), height: textShape.AABBBounds.height() + (parsedPadding[0] + parsedPadding[2]) }), 'rect');
|
|
14778
14767
|
if (!isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
14779
14768
|
bgRect.states = state.panel;
|
|
14780
14769
|
}
|
|
@@ -15876,16 +15865,18 @@ function updateAnimation(prev, next, animationConfig) {
|
|
|
15876
15865
|
if (!isArray(animationConfig)) {
|
|
15877
15866
|
const { duration, easing, increaseEffect = true } = animationConfig;
|
|
15878
15867
|
prev.animate().to(next.attribute, duration, easing);
|
|
15879
|
-
increaseEffect &&
|
|
15868
|
+
if (increaseEffect && prev.type === 'text' && next.type === 'text') {
|
|
15869
|
+
playIncreaseCount(prev, next, duration, easing);
|
|
15870
|
+
}
|
|
15880
15871
|
return;
|
|
15881
15872
|
}
|
|
15882
|
-
animationConfig.forEach(
|
|
15873
|
+
animationConfig.forEach(cfg => {
|
|
15883
15874
|
const { duration, easing, increaseEffect = true, channel } = cfg;
|
|
15884
|
-
const {
|
|
15875
|
+
const { to } = update(prev, next, channel, cfg.options);
|
|
15885
15876
|
if (!isEmpty(to)) {
|
|
15886
15877
|
prev.animate().to(to, duration, easing);
|
|
15887
15878
|
}
|
|
15888
|
-
if (
|
|
15879
|
+
if (increaseEffect && prev.type === 'text' && next.type === 'text') {
|
|
15889
15880
|
playIncreaseCount(prev, next, duration, easing);
|
|
15890
15881
|
}
|
|
15891
15882
|
});
|
|
@@ -16112,6 +16103,15 @@ function getIntersection(dx, dy, cx, cy, w, h) {
|
|
|
16112
16103
|
}
|
|
16113
16104
|
return { x: cx + (dx * h) / Math.abs(dy), y: cy + (dy > 0 ? h : -h) };
|
|
16114
16105
|
}
|
|
16106
|
+
function getAlignOffset(align) {
|
|
16107
|
+
if (align === 'left') {
|
|
16108
|
+
return 0;
|
|
16109
|
+
}
|
|
16110
|
+
else if (align === 'right') {
|
|
16111
|
+
return 1;
|
|
16112
|
+
}
|
|
16113
|
+
return 0.5;
|
|
16114
|
+
}
|
|
16115
16115
|
|
|
16116
16116
|
function loadLabelComponent() {
|
|
16117
16117
|
registerGroup();
|
|
@@ -16297,7 +16297,7 @@ class LabelBase extends AbstractComponent {
|
|
|
16297
16297
|
return createTextGraphicByType(textAttrs, 'textType');
|
|
16298
16298
|
}
|
|
16299
16299
|
_prepare() {
|
|
16300
|
-
var _a, _b
|
|
16300
|
+
var _a, _b;
|
|
16301
16301
|
const currentBaseMarks = [];
|
|
16302
16302
|
let baseMarks;
|
|
16303
16303
|
if (isFunction(this.attribute.getBaseMarks)) {
|
|
@@ -16361,13 +16361,23 @@ class LabelBase extends AbstractComponent {
|
|
|
16361
16361
|
}
|
|
16362
16362
|
}
|
|
16363
16363
|
if (this.attribute.animation !== false) {
|
|
16364
|
-
const animation
|
|
16364
|
+
const { animation, animationEnter, animationExit, animationUpdate } = this.attribute;
|
|
16365
|
+
const animationCfg = isObject(animation) ? animation : {};
|
|
16365
16366
|
this._animationConfig = {
|
|
16366
|
-
enter: merge({}, DefaultLabelAnimation,
|
|
16367
|
-
exit: merge({}, DefaultLabelAnimation,
|
|
16368
|
-
update:
|
|
16369
|
-
?
|
|
16370
|
-
|
|
16367
|
+
enter: animationEnter !== false ? merge({}, DefaultLabelAnimation, animationCfg, animationEnter !== null && animationEnter !== void 0 ? animationEnter : {}) : false,
|
|
16368
|
+
exit: animationExit !== false ? merge({}, DefaultLabelAnimation, animationCfg, animationExit !== null && animationExit !== void 0 ? animationExit : {}) : false,
|
|
16369
|
+
update: animationUpdate !== false
|
|
16370
|
+
? isArray(animationUpdate)
|
|
16371
|
+
? animationUpdate
|
|
16372
|
+
: merge({}, DefaultLabelAnimation, animationCfg, animationUpdate !== null && animationUpdate !== void 0 ? animationUpdate : {})
|
|
16373
|
+
: false
|
|
16374
|
+
};
|
|
16375
|
+
}
|
|
16376
|
+
else {
|
|
16377
|
+
this._animationConfig = {
|
|
16378
|
+
enter: false,
|
|
16379
|
+
exit: false,
|
|
16380
|
+
update: false
|
|
16371
16381
|
};
|
|
16372
16382
|
}
|
|
16373
16383
|
}
|
|
@@ -16535,15 +16545,6 @@ class LabelBase extends AbstractComponent {
|
|
|
16535
16545
|
return { x1: x, x2: x, y1: y, y2: y };
|
|
16536
16546
|
}
|
|
16537
16547
|
_renderLabels(labels) {
|
|
16538
|
-
const disableAnimation = this._enableAnimation === false || this.attribute.animation === false;
|
|
16539
|
-
if (disableAnimation) {
|
|
16540
|
-
this._renderWithOutAnimation(labels);
|
|
16541
|
-
}
|
|
16542
|
-
else {
|
|
16543
|
-
this._renderWithAnimation(labels);
|
|
16544
|
-
}
|
|
16545
|
-
}
|
|
16546
|
-
_renderWithAnimation(labels) {
|
|
16547
16548
|
var _a;
|
|
16548
16549
|
const { syncState } = this.attribute;
|
|
16549
16550
|
const currentTextMap = new Map();
|
|
@@ -16555,8 +16556,7 @@ class LabelBase extends AbstractComponent {
|
|
|
16555
16556
|
labels.forEach((text, index) => {
|
|
16556
16557
|
var _a;
|
|
16557
16558
|
const relatedGraphic = this.getRelatedGraphic(text.attribute);
|
|
16558
|
-
const
|
|
16559
|
-
const textKey = this._isCollectionBase ? textId : relatedGraphic;
|
|
16559
|
+
const textKey = this._isCollectionBase ? text.attribute.id : relatedGraphic;
|
|
16560
16560
|
const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(textKey)) ? 'update' : 'enter';
|
|
16561
16561
|
let labelLine;
|
|
16562
16562
|
if (showLabelLine) {
|
|
@@ -16568,90 +16568,88 @@ class LabelBase extends AbstractComponent {
|
|
|
16568
16568
|
if (state === 'enter') {
|
|
16569
16569
|
texts.push(text);
|
|
16570
16570
|
currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });
|
|
16571
|
-
|
|
16572
|
-
const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');
|
|
16573
|
-
this.add(text);
|
|
16574
|
-
if (labelLine) {
|
|
16575
|
-
labelLines.push(labelLine);
|
|
16576
|
-
this.add(labelLine);
|
|
16577
|
-
}
|
|
16578
|
-
this._syncStateWithRelatedGraphic(relatedGraphic);
|
|
16579
|
-
this._animationConfig.enter.duration > 0 &&
|
|
16580
|
-
relatedGraphic.once('animate-bind', a => {
|
|
16581
|
-
text.setAttributes(from);
|
|
16582
|
-
labelLine && labelLine.setAttributes(from);
|
|
16583
|
-
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, labelLine, labelLines, index, relatedGraphic, to, this._animationConfig.enter);
|
|
16584
|
-
relatedGraphic.on('afterAttributeUpdate', listener);
|
|
16585
|
-
});
|
|
16586
|
-
}
|
|
16571
|
+
this._addLabel({ text, labelLine }, texts, labelLines, index);
|
|
16587
16572
|
}
|
|
16588
16573
|
else if (state === 'update') {
|
|
16589
16574
|
const prevLabel = prevTextMap.get(textKey);
|
|
16590
16575
|
prevTextMap.delete(textKey);
|
|
16591
16576
|
currentTextMap.set(textKey, prevLabel);
|
|
16592
|
-
|
|
16593
|
-
const { duration, easing } = this._animationConfig.update;
|
|
16594
|
-
updateAnimation(prevText, text, this._animationConfig.update);
|
|
16595
|
-
if (prevLabel.labelLine && labelLine) {
|
|
16596
|
-
prevLabel.labelLine.animate().to(labelLine.attribute, duration, easing);
|
|
16597
|
-
}
|
|
16598
|
-
}
|
|
16599
|
-
});
|
|
16600
|
-
prevTextMap.forEach(label => {
|
|
16601
|
-
var _a;
|
|
16602
|
-
(_a = label.text) === null || _a === void 0 ? void 0 : _a.animate().to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, this._animationConfig.exit.duration, this._animationConfig.exit.easing).onEnd(() => {
|
|
16603
|
-
this.removeChild(label.text);
|
|
16604
|
-
if (label.labelLine) {
|
|
16605
|
-
this.removeChild(label.labelLine);
|
|
16577
|
+
this._updateLabel(prevLabel, { text, labelLine });
|
|
16606
16578
|
}
|
|
16607
16579
|
});
|
|
16608
|
-
|
|
16580
|
+
this._removeLabel(prevTextMap);
|
|
16609
16581
|
this._graphicToText = currentTextMap;
|
|
16610
16582
|
}
|
|
16611
|
-
|
|
16612
|
-
|
|
16613
|
-
const
|
|
16614
|
-
|
|
16615
|
-
|
|
16616
|
-
|
|
16617
|
-
|
|
16618
|
-
|
|
16619
|
-
var _a;
|
|
16620
|
-
const relatedGraphic = this.getRelatedGraphic(text.attribute);
|
|
16621
|
-
const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(relatedGraphic)) ? 'update' : 'enter';
|
|
16622
|
-
const textKey = this._isCollectionBase ? text.attribute.id : relatedGraphic;
|
|
16623
|
-
let labelLine;
|
|
16624
|
-
if (showLabelLine) {
|
|
16625
|
-
labelLine = this._createLabelLine(text, relatedGraphic);
|
|
16626
|
-
}
|
|
16627
|
-
if (syncState) {
|
|
16628
|
-
this.updateStatesOfLabels([labelLine ? { text, labelLine } : { text }], (_a = relatedGraphic.currentStates) !== null && _a !== void 0 ? _a : []);
|
|
16629
|
-
}
|
|
16630
|
-
if (state === 'enter') {
|
|
16631
|
-
currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });
|
|
16583
|
+
_addLabel(label, texts, labelLines, index) {
|
|
16584
|
+
const { text, labelLine } = label;
|
|
16585
|
+
const relatedGraphic = this.getRelatedGraphic(text.attribute);
|
|
16586
|
+
this._syncStateWithRelatedGraphic(relatedGraphic);
|
|
16587
|
+
if (this._enableAnimation !== false && this._animationConfig.enter !== false) {
|
|
16588
|
+
if (relatedGraphic) {
|
|
16589
|
+
const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');
|
|
16590
|
+
if (text) {
|
|
16632
16591
|
this.add(text);
|
|
16633
|
-
if (labelLine) {
|
|
16634
|
-
this.add(labelLine);
|
|
16635
|
-
}
|
|
16636
|
-
this._syncStateWithRelatedGraphic(relatedGraphic);
|
|
16637
16592
|
}
|
|
16638
|
-
|
|
16639
|
-
|
|
16640
|
-
|
|
16641
|
-
currentTextMap.set(textKey, prevLabel);
|
|
16642
|
-
prevLabel.text.setAttributes(text.attribute);
|
|
16643
|
-
if (prevLabel.labelLine && labelLine) {
|
|
16644
|
-
prevLabel.labelLine.setAttributes(labelLine.attribute);
|
|
16645
|
-
}
|
|
16593
|
+
if (labelLine) {
|
|
16594
|
+
labelLines.push(labelLine);
|
|
16595
|
+
this.add(labelLine);
|
|
16646
16596
|
}
|
|
16647
|
-
|
|
16648
|
-
|
|
16597
|
+
this._animationConfig.enter.duration > 0 &&
|
|
16598
|
+
relatedGraphic.once('animate-bind', a => {
|
|
16599
|
+
text.setAttributes(from);
|
|
16600
|
+
labelLine && labelLine.setAttributes(from);
|
|
16601
|
+
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, labelLine, labelLines, index, relatedGraphic, to, this._animationConfig.enter);
|
|
16602
|
+
relatedGraphic.on('afterAttributeUpdate', listener);
|
|
16603
|
+
});
|
|
16604
|
+
}
|
|
16605
|
+
}
|
|
16606
|
+
else {
|
|
16607
|
+
if (text) {
|
|
16608
|
+
this.add(text);
|
|
16609
|
+
}
|
|
16610
|
+
if (labelLine) {
|
|
16611
|
+
this.add(labelLine);
|
|
16612
|
+
}
|
|
16613
|
+
}
|
|
16614
|
+
}
|
|
16615
|
+
_updateLabel(prevLabel, currentLabel) {
|
|
16616
|
+
const { text: prevText, labelLine: prevLabelLine } = prevLabel;
|
|
16617
|
+
const { text: curText, labelLine: curLabelLine } = currentLabel;
|
|
16618
|
+
if (this._enableAnimation !== false && this._animationConfig.update !== false) {
|
|
16619
|
+
const { duration, easing } = this._animationConfig.update;
|
|
16620
|
+
updateAnimation(prevText, curText, this._animationConfig.update);
|
|
16621
|
+
if (prevLabelLine && curLabelLine) {
|
|
16622
|
+
prevLabel.labelLine.animate().to(curLabelLine.attribute, duration, easing);
|
|
16623
|
+
}
|
|
16624
|
+
}
|
|
16625
|
+
else {
|
|
16626
|
+
prevLabel.text.setAttributes(curText.attribute);
|
|
16627
|
+
if (prevLabelLine && curLabelLine) {
|
|
16628
|
+
prevLabel.labelLine.setAttributes(curLabelLine.attribute);
|
|
16629
|
+
}
|
|
16630
|
+
}
|
|
16631
|
+
}
|
|
16632
|
+
_removeLabel(textMap) {
|
|
16633
|
+
const removeLabelAndLine = (label) => {
|
|
16649
16634
|
this.removeChild(label.text);
|
|
16650
16635
|
if (label.labelLine) {
|
|
16651
16636
|
this.removeChild(label.labelLine);
|
|
16652
16637
|
}
|
|
16653
|
-
}
|
|
16654
|
-
this.
|
|
16638
|
+
};
|
|
16639
|
+
if (this._enableAnimation !== false && this._animationConfig.exit !== false) {
|
|
16640
|
+
const { duration, easing } = this._animationConfig.exit;
|
|
16641
|
+
textMap.forEach(label => {
|
|
16642
|
+
var _a;
|
|
16643
|
+
(_a = label.text) === null || _a === void 0 ? void 0 : _a.animate().to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing).onEnd(() => {
|
|
16644
|
+
removeLabelAndLine(label);
|
|
16645
|
+
});
|
|
16646
|
+
});
|
|
16647
|
+
}
|
|
16648
|
+
else {
|
|
16649
|
+
textMap.forEach(label => {
|
|
16650
|
+
removeLabelAndLine(label);
|
|
16651
|
+
});
|
|
16652
|
+
}
|
|
16655
16653
|
}
|
|
16656
16654
|
updateStatesOfLabels(labels, currentStates) {
|
|
16657
16655
|
labels.forEach(label => {
|
|
@@ -16666,7 +16664,7 @@ class LabelBase extends AbstractComponent {
|
|
|
16666
16664
|
});
|
|
16667
16665
|
}
|
|
16668
16666
|
_syncStateWithRelatedGraphic(relatedGraphic) {
|
|
16669
|
-
if (this.attribute.syncState) {
|
|
16667
|
+
if (this.attribute.syncState && relatedGraphic) {
|
|
16670
16668
|
relatedGraphic.on('afterAttributeUpdate', this._handleRelatedGraphicSetState);
|
|
16671
16669
|
}
|
|
16672
16670
|
}
|
|
@@ -16989,6 +16987,8 @@ class ArcLabel extends LabelBase {
|
|
|
16989
16987
|
this._ellipsisWidth = 0;
|
|
16990
16988
|
this._arcLeft = new Map();
|
|
16991
16989
|
this._arcRight = new Map();
|
|
16990
|
+
this._line2MinLength = 0;
|
|
16991
|
+
this._alignOffset = 0;
|
|
16992
16992
|
}
|
|
16993
16993
|
_overlapping(labels) {
|
|
16994
16994
|
return labels;
|
|
@@ -17000,6 +17000,7 @@ class ArcLabel extends LabelBase {
|
|
|
17000
17000
|
return { x: 0, y: 0 };
|
|
17001
17001
|
}
|
|
17002
17002
|
_layout(texts) {
|
|
17003
|
+
var _a;
|
|
17003
17004
|
if (!texts || !texts.length) {
|
|
17004
17005
|
return;
|
|
17005
17006
|
}
|
|
@@ -17013,7 +17014,15 @@ class ArcLabel extends LabelBase {
|
|
|
17013
17014
|
ellipsisWidth = ellipsisTextBounds.x2 - ellipsisTextBounds.x1;
|
|
17014
17015
|
}
|
|
17015
17016
|
const data = labels.map(label => label.attribute);
|
|
17016
|
-
const
|
|
17017
|
+
const currentMarks = Array.from(this._idToGraphic.values());
|
|
17018
|
+
this._line2MinLength = isFunction(this.attribute.line.line2MinLength)
|
|
17019
|
+
? this.attribute.line.line2MinLength(texts, currentMarks, this.attribute)
|
|
17020
|
+
: this.attribute.line.line2MinLength;
|
|
17021
|
+
this._alignOffset =
|
|
17022
|
+
(_a = (isFunction(this.attribute.layout.alignOffset)
|
|
17023
|
+
? this.attribute.layout.alignOffset(texts, currentMarks, this.attribute)
|
|
17024
|
+
: this.attribute.layout.alignOffset)) !== null && _a !== void 0 ? _a : 0;
|
|
17025
|
+
const arcs = this.layoutArcLabels(this.attribute.position, this.attribute, currentMarks, data, textBoundsArray, ellipsisWidth);
|
|
17017
17026
|
for (let i = 0; i < data.length; i++) {
|
|
17018
17027
|
const textData = data[i];
|
|
17019
17028
|
const basedArc = arcs.find(arc => { var _a; return ((_a = arc.refDatum) === null || _a === void 0 ? void 0 : _a.id) === textData.id; });
|
|
@@ -17160,13 +17169,12 @@ class ArcLabel extends LabelBase {
|
|
|
17160
17169
|
var _a, _b, _c;
|
|
17161
17170
|
const center = { x: (_a = currentMarks[0].attribute.x) !== null && _a !== void 0 ? _a : 0, y: (_b = currentMarks[0].attribute.y) !== null && _b !== void 0 ? _b : 0 };
|
|
17162
17171
|
const height = center.y * 2;
|
|
17163
|
-
const line2MinLength = attribute.line.line2MinLength;
|
|
17164
17172
|
const labelLayout = attribute.layout;
|
|
17165
17173
|
const spaceWidth = attribute.spaceWidth;
|
|
17166
17174
|
arcs.forEach(arc => {
|
|
17167
17175
|
const direction = isQuadrantLeft(arc.quadrant) ? -1 : 1;
|
|
17168
17176
|
arc.labelPosition = {
|
|
17169
|
-
x: arc.outerCenter.x + direction * (arc.labelSize.width / 2 +
|
|
17177
|
+
x: arc.outerCenter.x + direction * (arc.labelSize.width / 2 + this._line2MinLength + spaceWidth),
|
|
17170
17178
|
y: arc.outerCenter.y
|
|
17171
17179
|
};
|
|
17172
17180
|
});
|
|
@@ -17179,11 +17187,11 @@ class ArcLabel extends LabelBase {
|
|
|
17179
17187
|
arc.labelLimit = labelSize.width;
|
|
17180
17188
|
arc.pointB = isQuadrantLeft(arc.quadrant)
|
|
17181
17189
|
? {
|
|
17182
|
-
x: labelPosition.x + labelSize.width / 2 +
|
|
17190
|
+
x: labelPosition.x + labelSize.width / 2 + this._line2MinLength + spaceWidth,
|
|
17183
17191
|
y: labelPosition.y
|
|
17184
17192
|
}
|
|
17185
17193
|
: {
|
|
17186
|
-
x: labelPosition.x - labelSize.width / 2 -
|
|
17194
|
+
x: labelPosition.x - labelSize.width / 2 - this._line2MinLength - spaceWidth,
|
|
17187
17195
|
y: labelPosition.y
|
|
17188
17196
|
};
|
|
17189
17197
|
this._computeX(arc, attribute, currentMarks);
|
|
@@ -17212,22 +17220,27 @@ class ArcLabel extends LabelBase {
|
|
|
17212
17220
|
arcs.forEach(arc => {
|
|
17213
17221
|
var _a, _b;
|
|
17214
17222
|
if (arc.labelVisible &&
|
|
17215
|
-
(isLess(arc.pointB.x,
|
|
17216
|
-
isGreater(arc.pointB.x, width -
|
|
17223
|
+
(isLess(arc.pointB.x, this._line2MinLength + spaceWidth) ||
|
|
17224
|
+
isGreater(arc.pointB.x, width - this._line2MinLength - spaceWidth))) {
|
|
17217
17225
|
arc.labelVisible = false;
|
|
17218
17226
|
}
|
|
17219
17227
|
arc.angle = (_b = (_a = attribute.textStyle) === null || _a === void 0 ? void 0 : _a.angle) !== null && _b !== void 0 ? _b : 0;
|
|
17220
17228
|
if (attribute.offsetAngle) {
|
|
17221
17229
|
arc.angle += attribute.offsetAngle;
|
|
17222
17230
|
}
|
|
17223
|
-
arc.labelLine = Object.assign({}, attribute.line);
|
|
17231
|
+
arc.labelLine = Object.assign(Object.assign({}, attribute.line), { visible: arc.labelVisible });
|
|
17224
17232
|
});
|
|
17225
17233
|
return arcs;
|
|
17226
17234
|
}
|
|
17227
17235
|
_computeX(arc, attribute, currentMarks) {
|
|
17228
17236
|
var _a;
|
|
17229
17237
|
const center = arc.circleCenter;
|
|
17230
|
-
const plotLayout = {
|
|
17238
|
+
const plotLayout = {
|
|
17239
|
+
x1: 0,
|
|
17240
|
+
x2: this.attribute.width,
|
|
17241
|
+
y1: 0,
|
|
17242
|
+
y2: this.attribute.height
|
|
17243
|
+
};
|
|
17231
17244
|
let maxRadius = 0;
|
|
17232
17245
|
currentMarks.forEach((currentMark) => {
|
|
17233
17246
|
if (currentMark.attribute.outerRadius > maxRadius) {
|
|
@@ -17236,7 +17249,6 @@ class ArcLabel extends LabelBase {
|
|
|
17236
17249
|
});
|
|
17237
17250
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
17238
17251
|
const line1MinLength = attribute.line.line1MinLength;
|
|
17239
|
-
const line2MinLength = attribute.line.line2MinLength;
|
|
17240
17252
|
const labelLayoutAlign = (_a = attribute.layout) === null || _a === void 0 ? void 0 : _a.align;
|
|
17241
17253
|
const spaceWidth = attribute.spaceWidth;
|
|
17242
17254
|
const { labelPosition, quadrant, pointB } = arc;
|
|
@@ -17248,11 +17260,10 @@ class ArcLabel extends LabelBase {
|
|
|
17248
17260
|
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);
|
|
17249
17261
|
const flag = isQuadrantLeft(quadrant) ? -1 : 1;
|
|
17250
17262
|
let cx = 0;
|
|
17251
|
-
|
|
17252
|
-
let limit = restWidth - line2MinLength - spaceWidth;
|
|
17263
|
+
let limit = (flag > 0 ? plotLayout.x2 - pointB.x : pointB.x - plotLayout.x1) - this._line2MinLength - spaceWidth;
|
|
17253
17264
|
if (labelLayoutAlign === 'labelLine') {
|
|
17254
|
-
cx = (radius + line1MinLength +
|
|
17255
|
-
limit = (flag > 0 ? plotLayout.
|
|
17265
|
+
cx = (radius + line1MinLength + this._line2MinLength) * flag + center.x;
|
|
17266
|
+
limit = (flag > 0 ? plotLayout.x2 - cx : cx - plotLayout.x1) - spaceWidth;
|
|
17256
17267
|
}
|
|
17257
17268
|
const text = this._getFormatLabelText(arc.refDatum, limit);
|
|
17258
17269
|
arc.labelText = text;
|
|
@@ -17261,24 +17272,25 @@ class ArcLabel extends LabelBase {
|
|
|
17261
17272
|
case 'labelLine':
|
|
17262
17273
|
break;
|
|
17263
17274
|
case 'edge':
|
|
17264
|
-
cx = flag > 0 ? plotLayout.
|
|
17275
|
+
cx = flag > 0 ? plotLayout.x2 - labelWidth - spaceWidth : plotLayout.x1 + labelWidth + spaceWidth;
|
|
17265
17276
|
break;
|
|
17266
17277
|
case 'arc':
|
|
17267
17278
|
default:
|
|
17268
|
-
cx = pointB.x + flag *
|
|
17279
|
+
cx = pointB.x + flag * this._line2MinLength;
|
|
17269
17280
|
break;
|
|
17270
17281
|
}
|
|
17271
17282
|
labelWidth = Math.max(this._ellipsisWidth, labelWidth);
|
|
17272
17283
|
arc.labelLimit = labelWidth;
|
|
17273
17284
|
arc.pointC = { x: cx, y: labelPosition.y };
|
|
17274
|
-
const
|
|
17285
|
+
const align = this._computeAlign(arc, attribute);
|
|
17286
|
+
const targetCenterOffset = getAlignOffset(align) * (arc.labelLimit < arc.labelSize.width ? arc.labelLimit : arc.labelSize.width);
|
|
17275
17287
|
if (labelLayoutAlign === 'edge') {
|
|
17276
|
-
|
|
17277
|
-
|
|
17288
|
+
labelPosition.x =
|
|
17289
|
+
(flag > 0 ? plotLayout.x2 : plotLayout.x1) - flag * targetCenterOffset + flag * this._alignOffset;
|
|
17290
|
+
arc.pointC.x += flag * this._alignOffset;
|
|
17278
17291
|
}
|
|
17279
17292
|
else {
|
|
17280
|
-
|
|
17281
|
-
labelPosition.x = cx + alignOffset + flag * (spaceWidth + targetCenterOffset);
|
|
17293
|
+
labelPosition.x = cx + flag * (this._alignOffset + spaceWidth + targetCenterOffset);
|
|
17282
17294
|
}
|
|
17283
17295
|
}
|
|
17284
17296
|
_computeAlign(arc, attribute) {
|
|
@@ -17736,6 +17748,10 @@ class DataLabel extends AbstractComponent {
|
|
|
17736
17748
|
if (labelComponent) {
|
|
17737
17749
|
const { baseMarkGroupName, type } = dataLabel;
|
|
17738
17750
|
const id = (_a = dataLabel.id) !== null && _a !== void 0 ? _a : `${baseMarkGroupName}-${type}-${i}`;
|
|
17751
|
+
if (dataLabel.type === 'arc') {
|
|
17752
|
+
dataLabel.width = size.width;
|
|
17753
|
+
dataLabel.height = size.height;
|
|
17754
|
+
}
|
|
17739
17755
|
let component = this._componentMap.get(id);
|
|
17740
17756
|
if (component) {
|
|
17741
17757
|
component.setBitmapTool(tool);
|
|
@@ -18090,6 +18106,8 @@ var AXIS_ELEMENT_NAME;
|
|
|
18090
18106
|
AXIS_ELEMENT_NAME["line"] = "axis-line";
|
|
18091
18107
|
AXIS_ELEMENT_NAME["background"] = "axis-background";
|
|
18092
18108
|
AXIS_ELEMENT_NAME["axisLabelBackground"] = "axis-label-background";
|
|
18109
|
+
AXIS_ELEMENT_NAME["axisBreak"] = "axis-break";
|
|
18110
|
+
AXIS_ELEMENT_NAME["axisBreakSymbol"] = "axis-break-symbol";
|
|
18093
18111
|
})(AXIS_ELEMENT_NAME || (AXIS_ELEMENT_NAME = {}));
|
|
18094
18112
|
var AxisStateValue;
|
|
18095
18113
|
(function (AxisStateValue) {
|
|
@@ -18104,6 +18122,7 @@ const DEFAULT_STATES$1 = {
|
|
|
18104
18122
|
[AxisStateValue.hover]: {},
|
|
18105
18123
|
[AxisStateValue.hoverReverse]: {}
|
|
18106
18124
|
};
|
|
18125
|
+
const TopZIndex = 999;
|
|
18107
18126
|
|
|
18108
18127
|
const DEFAULT_AXIS_THEME = {
|
|
18109
18128
|
title: {
|
|
@@ -18159,6 +18178,12 @@ const DEFAULT_AXIS_THEME = {
|
|
|
18159
18178
|
}
|
|
18160
18179
|
}
|
|
18161
18180
|
};
|
|
18181
|
+
const DEFAULT_AXIS_BREAK_SYMBOL_STYLE = {
|
|
18182
|
+
size: 8,
|
|
18183
|
+
stroke: '#000',
|
|
18184
|
+
lineWidth: 1,
|
|
18185
|
+
zIndex: 1
|
|
18186
|
+
};
|
|
18162
18187
|
|
|
18163
18188
|
const clampRadian = (angle = 0) => {
|
|
18164
18189
|
if (angle < 0) {
|
|
@@ -18216,6 +18241,13 @@ function getCircleLabelPosition(tickPosition, tickVector, text, style) {
|
|
|
18216
18241
|
const y = baseY - dy;
|
|
18217
18242
|
return { x, y };
|
|
18218
18243
|
}
|
|
18244
|
+
function getAxisBreakSymbolAttrs(props = {}) {
|
|
18245
|
+
var _a, _b;
|
|
18246
|
+
const { style = {}, angle = Math.PI * 0.5 } = props;
|
|
18247
|
+
const symbolStyle = merge({}, DEFAULT_AXIS_BREAK_SYMBOL_STYLE, style);
|
|
18248
|
+
const symbolSize = (_a = symbolStyle.size) !== null && _a !== void 0 ? _a : DEFAULT_AXIS_BREAK_SYMBOL_STYLE.size;
|
|
18249
|
+
return Object.assign(Object.assign({}, symbolStyle), { symbolType: (_b = symbolStyle.symbolType) !== null && _b !== void 0 ? _b : `M ${-symbolSize / 2} ${symbolSize * Math.sin(angle)} L ${symbolSize / 2} ${-symbolSize * Math.sin(angle)}`, symbolSize });
|
|
18250
|
+
}
|
|
18219
18251
|
function getElMap(g) {
|
|
18220
18252
|
const elMap = {};
|
|
18221
18253
|
traverseGroup(g, (el) => {
|
|
@@ -18778,6 +18810,17 @@ function itemIntersect(item1, item2) {
|
|
|
18778
18810
|
? isRotateAABBIntersect(item1.rotatedBounds, item2.rotatedBounds, true)
|
|
18779
18811
|
: true));
|
|
18780
18812
|
}
|
|
18813
|
+
const DELTA_ANGLE = Math.sin(Math.PI / 10);
|
|
18814
|
+
function isAngleVertical(angle) {
|
|
18815
|
+
const hasAngle = !isNil(angle) && angle !== 0;
|
|
18816
|
+
const cos = hasAngle ? Math.cos(angle) : 1;
|
|
18817
|
+
return hasAngle && Math.abs(cos) <= DELTA_ANGLE;
|
|
18818
|
+
}
|
|
18819
|
+
function isAngleHorizontal(angle) {
|
|
18820
|
+
const hasAngle = !isNil(angle) && angle !== 0;
|
|
18821
|
+
const sin = hasAngle ? Math.sin(angle) : 0;
|
|
18822
|
+
return !hasAngle || Math.abs(sin) <= DELTA_ANGLE;
|
|
18823
|
+
}
|
|
18781
18824
|
|
|
18782
18825
|
const methods$1 = {
|
|
18783
18826
|
parity: function (items) {
|
|
@@ -18968,20 +19011,35 @@ function getYAxisLabelAlign(orient, angle = 0) {
|
|
|
18968
19011
|
};
|
|
18969
19012
|
}
|
|
18970
19013
|
|
|
19014
|
+
function normalizeOverflowLimitLength(overflowLimitLength) {
|
|
19015
|
+
if (isValidNumber(overflowLimitLength)) {
|
|
19016
|
+
return {
|
|
19017
|
+
left: overflowLimitLength,
|
|
19018
|
+
right: overflowLimitLength
|
|
19019
|
+
};
|
|
19020
|
+
}
|
|
19021
|
+
else if (isObject(overflowLimitLength)) {
|
|
19022
|
+
return {
|
|
19023
|
+
left: overflowLimitLength.left || 0,
|
|
19024
|
+
right: overflowLimitLength.right || 0
|
|
19025
|
+
};
|
|
19026
|
+
}
|
|
19027
|
+
return { left: 0, right: 0 };
|
|
19028
|
+
}
|
|
18971
19029
|
function autoLimit(labels, config) {
|
|
18972
19030
|
const { limitLength, verticalLimitLength, ellipsis = '...', orient, axisLength } = config;
|
|
18973
19031
|
if (isEmpty(labels) || !isValidNumber(limitLength)) {
|
|
18974
19032
|
return;
|
|
18975
19033
|
}
|
|
18976
|
-
const
|
|
19034
|
+
const overflowLimitLength = normalizeOverflowLimitLength(config.overflowLimitLength);
|
|
18977
19035
|
labels.forEach(label => {
|
|
18978
19036
|
var _a;
|
|
18979
19037
|
const angle = label.attribute.angle;
|
|
18980
19038
|
const hasAngle = !isNil(angle);
|
|
18981
19039
|
const cos = hasAngle ? Math.cos(angle) : 1;
|
|
18982
19040
|
const sin = hasAngle ? Math.sin(angle) : 0;
|
|
18983
|
-
const isHorizontal =
|
|
18984
|
-
const isVertical =
|
|
19041
|
+
const isHorizontal = isAngleHorizontal(angle);
|
|
19042
|
+
const isVertical = isAngleVertical(angle);
|
|
18985
19043
|
const isX = orient === 'top' || orient === 'bottom';
|
|
18986
19044
|
if (isX) {
|
|
18987
19045
|
if (isVertical && Math.floor(label.AABBBounds.height()) <= limitLength) {
|
|
@@ -19010,14 +19068,17 @@ function autoLimit(labels, config) {
|
|
|
19010
19068
|
if (isX) {
|
|
19011
19069
|
const { x1, x2 } = label.AABBBounds;
|
|
19012
19070
|
const tan = sin / cos;
|
|
19071
|
+
const verticalSizeLimit = Math.abs(limitLength / sin);
|
|
19013
19072
|
if (tan > 0 && x1 <= axisLength && limitLength / tan + x1 > axisLength) {
|
|
19014
|
-
|
|
19073
|
+
const lengthLimit = (axisLength - x1) / Math.abs(cos) + overflowLimitLength.right;
|
|
19074
|
+
limitLabelLength = Math.min(lengthLimit, verticalSizeLimit);
|
|
19015
19075
|
}
|
|
19016
19076
|
else if (tan < 0 && x2 >= 0 && limitLength / tan + x2 < 0) {
|
|
19017
|
-
|
|
19077
|
+
const lengthLimit = x2 / Math.abs(cos) + overflowLimitLength.left;
|
|
19078
|
+
limitLabelLength = Math.min(lengthLimit, verticalSizeLimit);
|
|
19018
19079
|
}
|
|
19019
19080
|
else {
|
|
19020
|
-
limitLabelLength =
|
|
19081
|
+
limitLabelLength = verticalSizeLimit;
|
|
19021
19082
|
}
|
|
19022
19083
|
}
|
|
19023
19084
|
else {
|
|
@@ -19042,6 +19103,65 @@ function autoLimit(labels, config) {
|
|
|
19042
19103
|
});
|
|
19043
19104
|
}
|
|
19044
19105
|
|
|
19106
|
+
function autoWrap(labels, config) {
|
|
19107
|
+
const { limitLength, axisLength, ellipsis = '...', orient } = config;
|
|
19108
|
+
if (isEmpty(labels) || !isValidNumber(limitLength)) {
|
|
19109
|
+
return;
|
|
19110
|
+
}
|
|
19111
|
+
const verticalLimitLength = axisLength / labels.length;
|
|
19112
|
+
labels.forEach(label => {
|
|
19113
|
+
var _a;
|
|
19114
|
+
const angle = label.attribute.angle;
|
|
19115
|
+
const isHorizontal = isAngleHorizontal(angle);
|
|
19116
|
+
const isVertical = isAngleVertical(angle);
|
|
19117
|
+
const isX = orient === 'top' || orient === 'bottom';
|
|
19118
|
+
if (isX) {
|
|
19119
|
+
if (isVertical && Math.floor(label.AABBBounds.height()) <= limitLength) {
|
|
19120
|
+
return;
|
|
19121
|
+
}
|
|
19122
|
+
if (isHorizontal && Math.floor(label.AABBBounds.width()) <= verticalLimitLength) {
|
|
19123
|
+
return;
|
|
19124
|
+
}
|
|
19125
|
+
}
|
|
19126
|
+
else {
|
|
19127
|
+
if (isVertical && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) {
|
|
19128
|
+
return;
|
|
19129
|
+
}
|
|
19130
|
+
if (isHorizontal && Math.floor(label.AABBBounds.width()) <= limitLength) {
|
|
19131
|
+
return;
|
|
19132
|
+
}
|
|
19133
|
+
}
|
|
19134
|
+
let limitLabelLength = null;
|
|
19135
|
+
let heightLimit = null;
|
|
19136
|
+
if (isX) {
|
|
19137
|
+
if (isVertical) {
|
|
19138
|
+
limitLabelLength = limitLength;
|
|
19139
|
+
heightLimit = verticalLimitLength;
|
|
19140
|
+
}
|
|
19141
|
+
else {
|
|
19142
|
+
limitLabelLength = verticalLimitLength;
|
|
19143
|
+
heightLimit = limitLength;
|
|
19144
|
+
}
|
|
19145
|
+
}
|
|
19146
|
+
else {
|
|
19147
|
+
if (isVertical) {
|
|
19148
|
+
limitLabelLength = verticalLimitLength;
|
|
19149
|
+
heightLimit = limitLength;
|
|
19150
|
+
}
|
|
19151
|
+
else {
|
|
19152
|
+
limitLabelLength = limitLength;
|
|
19153
|
+
heightLimit = verticalLimitLength;
|
|
19154
|
+
}
|
|
19155
|
+
}
|
|
19156
|
+
label.setAttributes({
|
|
19157
|
+
maxLineWidth: limitLabelLength,
|
|
19158
|
+
ellipsis: (_a = label.attribute.ellipsis) !== null && _a !== void 0 ? _a : ellipsis,
|
|
19159
|
+
whiteSpace: 'normal',
|
|
19160
|
+
heightLimit
|
|
19161
|
+
});
|
|
19162
|
+
});
|
|
19163
|
+
}
|
|
19164
|
+
|
|
19045
19165
|
function alignAxisLabels(labels, start, containerSize, orient, align) {
|
|
19046
19166
|
if (orient === 'left' || orient === 'right') {
|
|
19047
19167
|
if (align === 'left') {
|
|
@@ -19152,7 +19272,44 @@ class LineAxis extends AxisBase {
|
|
|
19152
19272
|
}
|
|
19153
19273
|
_renderInner(container) {
|
|
19154
19274
|
var _a;
|
|
19275
|
+
this._breaks = null;
|
|
19276
|
+
if (this.attribute.breaks && this.attribute.breaks.length) {
|
|
19277
|
+
const transformedBreaks = [];
|
|
19278
|
+
for (let index = 0; index < this.attribute.breaks.length; index++) {
|
|
19279
|
+
const aBreak = this.attribute.breaks[index];
|
|
19280
|
+
const { range, breakSymbol, rawRange } = aBreak;
|
|
19281
|
+
transformedBreaks.push({
|
|
19282
|
+
startPoint: this.getTickCoord(range[0]),
|
|
19283
|
+
endPoint: this.getTickCoord(range[1]),
|
|
19284
|
+
range,
|
|
19285
|
+
breakSymbol,
|
|
19286
|
+
rawRange
|
|
19287
|
+
});
|
|
19288
|
+
}
|
|
19289
|
+
this._breaks = transformedBreaks;
|
|
19290
|
+
}
|
|
19155
19291
|
super._renderInner(container);
|
|
19292
|
+
if (this._breaks && this._breaks.length) {
|
|
19293
|
+
this._breaks.forEach((b, index) => {
|
|
19294
|
+
const { startPoint, endPoint, breakSymbol, rawRange } = b;
|
|
19295
|
+
if ((breakSymbol === null || breakSymbol === void 0 ? void 0 : breakSymbol.visible) !== false) {
|
|
19296
|
+
const axisBreakGroup = graphicCreator.group({
|
|
19297
|
+
zIndex: TopZIndex
|
|
19298
|
+
});
|
|
19299
|
+
axisBreakGroup.name = AXIS_ELEMENT_NAME.axisBreak;
|
|
19300
|
+
axisBreakGroup.id = this._getNodeId(`${AXIS_ELEMENT_NAME.axisBreak}-${index}`);
|
|
19301
|
+
axisBreakGroup.data = rawRange;
|
|
19302
|
+
const symbolStyle = getAxisBreakSymbolAttrs(breakSymbol);
|
|
19303
|
+
const shape1 = graphicCreator.symbol(Object.assign({ x: startPoint.x, y: startPoint.y }, symbolStyle));
|
|
19304
|
+
shape1.name = AXIS_ELEMENT_NAME.axisBreakSymbol;
|
|
19305
|
+
const shape2 = graphicCreator.symbol(Object.assign({ x: endPoint.x, y: endPoint.y }, symbolStyle));
|
|
19306
|
+
shape2.name = AXIS_ELEMENT_NAME.axisBreakSymbol;
|
|
19307
|
+
axisBreakGroup.add(shape1);
|
|
19308
|
+
axisBreakGroup.add(shape2);
|
|
19309
|
+
container.add(axisBreakGroup);
|
|
19310
|
+
}
|
|
19311
|
+
});
|
|
19312
|
+
}
|
|
19156
19313
|
const { panel } = this.attribute;
|
|
19157
19314
|
if (panel && panel.visible) {
|
|
19158
19315
|
const axisContainer = this.axisContainer;
|
|
@@ -19166,9 +19323,24 @@ class LineAxis extends AxisBase {
|
|
|
19166
19323
|
}
|
|
19167
19324
|
renderLine(container) {
|
|
19168
19325
|
const { start, end, line } = this.attribute;
|
|
19169
|
-
const _a = line, { startSymbol, endSymbol, style,
|
|
19170
|
-
const lineAttrs = Object.assign({
|
|
19326
|
+
const _a = line, { startSymbol, endSymbol, style, state } = _a, restLineAttrs = __rest(_a, ["startSymbol", "endSymbol", "style", "state"]);
|
|
19327
|
+
const lineAttrs = Object.assign({ startSymbol,
|
|
19171
19328
|
endSymbol, lineStyle: style }, restLineAttrs);
|
|
19329
|
+
if (this._breaks && this._breaks.length) {
|
|
19330
|
+
const linePoints = [];
|
|
19331
|
+
let lastStartPoint = start;
|
|
19332
|
+
this._breaks.forEach(b => {
|
|
19333
|
+
const { startPoint, endPoint } = b;
|
|
19334
|
+
linePoints.push([lastStartPoint, startPoint]);
|
|
19335
|
+
lastStartPoint = endPoint;
|
|
19336
|
+
});
|
|
19337
|
+
linePoints.push([lastStartPoint, end]);
|
|
19338
|
+
lineAttrs.points = linePoints;
|
|
19339
|
+
lineAttrs.multiSegment = true;
|
|
19340
|
+
}
|
|
19341
|
+
else {
|
|
19342
|
+
lineAttrs.points = [start, end];
|
|
19343
|
+
}
|
|
19172
19344
|
if (!isEmpty(state)) {
|
|
19173
19345
|
lineAttrs.state = {
|
|
19174
19346
|
line: merge({}, DEFAULT_STATES$1, state),
|
|
@@ -19441,7 +19613,7 @@ class LineAxis extends AxisBase {
|
|
|
19441
19613
|
}
|
|
19442
19614
|
const { verticalLimitSize, label, orient } = this.attribute;
|
|
19443
19615
|
const limitLength = this._getAxisLabelLimitLength(verticalLimitSize, layerCount);
|
|
19444
|
-
const { layoutFunc, autoRotate: autoRotate$1, autoRotateAngle, autoLimit: autoLimit$1, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, lastVisible } = label;
|
|
19616
|
+
const { layoutFunc, autoRotate: autoRotate$1, autoRotateAngle, autoLimit: autoLimit$1, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, lastVisible, autoWrap: autoWrap$1, overflowLimitLength } = label;
|
|
19445
19617
|
if (isFunction(layoutFunc)) {
|
|
19446
19618
|
layoutFunc(labelShapes, labelData, layer, this);
|
|
19447
19619
|
}
|
|
@@ -19452,7 +19624,14 @@ class LineAxis extends AxisBase {
|
|
|
19452
19624
|
orient
|
|
19453
19625
|
});
|
|
19454
19626
|
}
|
|
19455
|
-
if (
|
|
19627
|
+
else if (autoWrap$1) {
|
|
19628
|
+
const isVertical = orient === 'left' || orient === 'right';
|
|
19629
|
+
const axisLength = isVertical
|
|
19630
|
+
? Math.abs(this.attribute.start.y - this.attribute.end.y)
|
|
19631
|
+
: Math.abs(this.attribute.start.x - this.attribute.end.x);
|
|
19632
|
+
autoWrap(labelShapes, { orient, limitLength, axisLength, ellipsis: limitEllipsis });
|
|
19633
|
+
}
|
|
19634
|
+
if (!autoWrap$1 && autoLimit$1 && isValidNumber(limitLength) && limitLength > 0) {
|
|
19456
19635
|
const isVertical = orient === 'left' || orient === 'right';
|
|
19457
19636
|
const axisLength = isVertical
|
|
19458
19637
|
? Math.abs(this.attribute.start.y - this.attribute.end.y)
|
|
@@ -19467,7 +19646,8 @@ class LineAxis extends AxisBase {
|
|
|
19467
19646
|
verticalLimitLength,
|
|
19468
19647
|
ellipsis: limitEllipsis,
|
|
19469
19648
|
orient,
|
|
19470
|
-
axisLength
|
|
19649
|
+
axisLength,
|
|
19650
|
+
overflowLimitLength
|
|
19471
19651
|
});
|
|
19472
19652
|
}
|
|
19473
19653
|
if (autoHide$1) {
|
|
@@ -19554,6 +19734,10 @@ class LineAxis extends AxisBase {
|
|
|
19554
19734
|
}
|
|
19555
19735
|
return limitLength;
|
|
19556
19736
|
}
|
|
19737
|
+
release() {
|
|
19738
|
+
super.release();
|
|
19739
|
+
this._breaks = null;
|
|
19740
|
+
}
|
|
19557
19741
|
}
|
|
19558
19742
|
LineAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
19559
19743
|
mixin(LineAxis, LineAxisMixin);
|
|
@@ -19923,8 +20107,32 @@ const isAxisHorizontal = (axisOrientType) => {
|
|
|
19923
20107
|
return ['bottom', 'top', 'z'].includes(axisOrientType);
|
|
19924
20108
|
};
|
|
19925
20109
|
|
|
20110
|
+
function getScaleTicks(op, scale, count, getTicks) {
|
|
20111
|
+
let scaleTicks;
|
|
20112
|
+
const { breakData } = op;
|
|
20113
|
+
if (breakData && breakData()) {
|
|
20114
|
+
const { breakDomains } = breakData();
|
|
20115
|
+
const domain = scale.domain();
|
|
20116
|
+
scaleTicks = [];
|
|
20117
|
+
for (let i = 0; i < domain.length - 1; i++) {
|
|
20118
|
+
const subDomain = [domain[i], domain[i + 1]];
|
|
20119
|
+
const ticks = getTicks(count, subDomain);
|
|
20120
|
+
ticks.forEach(tick => {
|
|
20121
|
+
if (!breakDomains.some(breakDomain => tick >= breakDomain[0] && tick <= breakDomain[1])) {
|
|
20122
|
+
scaleTicks.push(tick);
|
|
20123
|
+
}
|
|
20124
|
+
});
|
|
20125
|
+
}
|
|
20126
|
+
scale.domain(domain);
|
|
20127
|
+
}
|
|
20128
|
+
else {
|
|
20129
|
+
scaleTicks = getTicks(count);
|
|
20130
|
+
}
|
|
20131
|
+
return scaleTicks;
|
|
20132
|
+
}
|
|
19926
20133
|
const DEFAULT_CONTINUOUS_TICK_COUNT = 5;
|
|
19927
20134
|
const continuousTicks = (scale, op) => {
|
|
20135
|
+
var _a, _b;
|
|
19928
20136
|
if (!isContinuous(scale.type)) {
|
|
19929
20137
|
return convertDomainToTickData(scale.domain());
|
|
19930
20138
|
}
|
|
@@ -19933,22 +20141,37 @@ const continuousTicks = (scale, op) => {
|
|
|
19933
20141
|
if (rangeSize < 2) {
|
|
19934
20142
|
return convertDomainToTickData([scale.domain()[0]]);
|
|
19935
20143
|
}
|
|
19936
|
-
const { tickCount, forceTickCount, tickStep, noDecimals = false, labelStyle } = op;
|
|
20144
|
+
const { tickCount, forceTickCount, tickStep, noDecimals = false, labelStyle, breakData } = op;
|
|
19937
20145
|
let scaleTicks;
|
|
19938
20146
|
if (isValid(tickStep)) {
|
|
19939
20147
|
scaleTicks = scale.stepTicks(tickStep);
|
|
19940
20148
|
}
|
|
19941
20149
|
else if (isValid(forceTickCount)) {
|
|
19942
|
-
scaleTicks = scale
|
|
20150
|
+
scaleTicks = getScaleTicks(op, scale, forceTickCount, (count, subDomain) => {
|
|
20151
|
+
if (subDomain && subDomain.length) {
|
|
20152
|
+
return scale.domain(subDomain, true).forceTicks(count);
|
|
20153
|
+
}
|
|
20154
|
+
return scale.forceTicks(count);
|
|
20155
|
+
});
|
|
19943
20156
|
}
|
|
19944
20157
|
else if (op.tickMode === 'd3') {
|
|
19945
|
-
const count = isFunction(tickCount) ? tickCount({ axisLength: rangeSize, labelStyle }) : tickCount;
|
|
19946
|
-
scaleTicks =
|
|
20158
|
+
const count = (_a = (isFunction(tickCount) ? tickCount({ axisLength: rangeSize, labelStyle }) : tickCount)) !== null && _a !== void 0 ? _a : DEFAULT_CONTINUOUS_TICK_COUNT;
|
|
20159
|
+
scaleTicks = getScaleTicks(op, scale, count, (count, subDomain) => {
|
|
20160
|
+
if (subDomain && subDomain.length) {
|
|
20161
|
+
return scale.domain(subDomain, true).d3Ticks(count, { noDecimals });
|
|
20162
|
+
}
|
|
20163
|
+
return scale.d3Ticks(count, { noDecimals });
|
|
20164
|
+
});
|
|
19947
20165
|
}
|
|
19948
20166
|
else {
|
|
19949
|
-
const count = isFunction(tickCount) ? tickCount({ axisLength: rangeSize, labelStyle }) : tickCount;
|
|
20167
|
+
const count = (_b = (isFunction(tickCount) ? tickCount({ axisLength: rangeSize, labelStyle }) : tickCount)) !== null && _b !== void 0 ? _b : DEFAULT_CONTINUOUS_TICK_COUNT;
|
|
19950
20168
|
const customTicks = isFunction(op.tickMode) ? op.tickMode : undefined;
|
|
19951
|
-
scaleTicks =
|
|
20169
|
+
scaleTicks = getScaleTicks(op, scale, count, (count, subDomain) => {
|
|
20170
|
+
if (subDomain && subDomain.length) {
|
|
20171
|
+
return scale.domain(subDomain, true).ticks(count, { noDecimals, customTicks });
|
|
20172
|
+
}
|
|
20173
|
+
return scale.ticks(count, { noDecimals, customTicks });
|
|
20174
|
+
});
|
|
19952
20175
|
}
|
|
19953
20176
|
if (op.sampling) {
|
|
19954
20177
|
if (op.coordinateType === 'cartesian' || (op.coordinateType === 'polar' && op.axisOrientType === 'radius')) {
|
|
@@ -19957,8 +20180,9 @@ const continuousTicks = (scale, op) => {
|
|
|
19957
20180
|
AABBBounds: bounds,
|
|
19958
20181
|
value: scaleTicks[i]
|
|
19959
20182
|
}));
|
|
20183
|
+
const samplingMethod = breakData && breakData() ? methods.greedy : methods.parity;
|
|
19960
20184
|
while (items.length >= 3 && hasOverlap(items, labelGap)) {
|
|
19961
|
-
items =
|
|
20185
|
+
items = samplingMethod(items, labelGap);
|
|
19962
20186
|
}
|
|
19963
20187
|
const ticks = items.map(item => item.value);
|
|
19964
20188
|
if (ticks.length < 3 && labelFlush) {
|
|
@@ -25945,46 +26169,58 @@ class Title extends AbstractComponent {
|
|
|
25945
26169
|
this.name = 'title';
|
|
25946
26170
|
}
|
|
25947
26171
|
render() {
|
|
25948
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t
|
|
26172
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
25949
26173
|
const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
|
|
25950
26174
|
const parsedPadding = normalizePadding(padding);
|
|
25951
26175
|
const group = this.createOrUpdateChild('title-container', { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 }, 'group');
|
|
25952
26176
|
if (this.attribute.visible !== false && textStyle.visible !== false) {
|
|
26177
|
+
const { width: mainTitleWidth, height: mainTitleHeight, maxHeight: mainTitleMaxHeight, maxWidth: mainTitleMaxWidth, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', maxWidth, lineClamp } = textStyle;
|
|
25953
26178
|
if (textType === 'rich' || isValid(textStyle.character)) {
|
|
25954
|
-
const attr = Object.assign({ x
|
|
26179
|
+
const attr = Object.assign({ x,
|
|
26180
|
+
y, width: (_a = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _a !== void 0 ? _a : 0, height: (_b = mainTitleHeight !== null && mainTitleHeight !== void 0 ? mainTitleHeight : height) !== null && _b !== void 0 ? _b : 0, ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : true, wordBreak: wordBreak !== null && wordBreak !== void 0 ? wordBreak : 'break-word', maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: (_c = textStyle.character) !== null && _c !== void 0 ? _c : text }, textStyle);
|
|
25955
26181
|
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
25956
26182
|
}
|
|
25957
26183
|
else if (textType === 'html') {
|
|
25958
|
-
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: text }, DEFAULT_HTML_TEXT_SPEC), textStyle), x
|
|
26184
|
+
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: text }, DEFAULT_HTML_TEXT_SPEC), textStyle), x,
|
|
26185
|
+
y, width: (_d = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _d !== void 0 ? _d : 0, height: (_e = mainTitleHeight !== null && mainTitleHeight !== void 0 ? mainTitleHeight : height) !== null && _e !== void 0 ? _e : 0, ellipsis,
|
|
26186
|
+
wordBreak, maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: [] }, textStyle);
|
|
25959
26187
|
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
25960
26188
|
}
|
|
25961
26189
|
else if (isValid(text)) {
|
|
25962
|
-
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: isArray(text) ? text : [text],
|
|
26190
|
+
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: isArray(text) ? text : [text], whiteSpace: 'normal' }, textStyle), { maxLineWidth: (_g = (_f = textStyle.maxLineWidth) !== null && _f !== void 0 ? _f : mainTitleWidth) !== null && _g !== void 0 ? _g : width, heightLimit: mainTitleHeight !== null && mainTitleHeight !== void 0 ? mainTitleHeight : maxHeight, lineClamp,
|
|
26191
|
+
ellipsis,
|
|
26192
|
+
x,
|
|
26193
|
+
y }), 'text');
|
|
25963
26194
|
}
|
|
25964
26195
|
}
|
|
25965
26196
|
const maintextHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;
|
|
25966
26197
|
const maintextWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;
|
|
25967
26198
|
if (this.attribute.visible !== false && subtextStyle.visible !== false) {
|
|
26199
|
+
const { width: subTitleWidth, height: subTitleHeight, maxWidth: subTitleMaxWidth, maxHeight: subTitleMaxHeight, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', lineClamp } = subtextStyle;
|
|
26200
|
+
const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - maintextHeight);
|
|
25968
26201
|
if (subtextType === 'rich' || isValid(subtextStyle.character)) {
|
|
25969
|
-
const attr = Object.assign({ x
|
|
26202
|
+
const attr = Object.assign({ x,
|
|
26203
|
+
y, width: (_h = subTitleWidth !== null && subTitleWidth !== void 0 ? subTitleWidth : width) !== null && _h !== void 0 ? _h : 0, height: (_j = subTitleHeight !== null && subTitleHeight !== void 0 ? subTitleHeight : height) !== null && _j !== void 0 ? _j : 0, ellipsis,
|
|
26204
|
+
wordBreak, maxHeight: subTitleMaxHeight !== null && subTitleMaxHeight !== void 0 ? subTitleMaxHeight : maxSubTextHeight, maxWidth: subTitleMaxWidth !== null && subTitleMaxWidth !== void 0 ? subTitleMaxWidth : maxWidth, textConfig: (_k = subtextStyle.character) !== null && _k !== void 0 ? _k : subtext }, subtextStyle);
|
|
25970
26205
|
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
25971
26206
|
}
|
|
25972
26207
|
else if (subtextType === 'html') {
|
|
25973
|
-
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: subtext }, DEFAULT_HTML_TEXT_SPEC), subtextStyle), x
|
|
26208
|
+
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: subtext }, DEFAULT_HTML_TEXT_SPEC), subtextStyle), x,
|
|
26209
|
+
y, width: (_l = subTitleWidth !== null && subTitleWidth !== void 0 ? subTitleWidth : width) !== null && _l !== void 0 ? _l : 0, height: (_m = subTitleHeight !== null && subTitleHeight !== void 0 ? subTitleHeight : height) !== null && _m !== void 0 ? _m : 0, ellipsis,
|
|
26210
|
+
wordBreak, maxHeight: subTitleMaxHeight !== null && subTitleMaxHeight !== void 0 ? subTitleMaxHeight : maxSubTextHeight, maxWidth: subTitleMaxWidth !== null && subTitleMaxWidth !== void 0 ? subTitleMaxWidth : maxWidth, textConfig: [] }, subtextStyle);
|
|
25974
26211
|
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
25975
26212
|
}
|
|
25976
26213
|
else if (isValid(subtext)) {
|
|
25977
|
-
this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: isArray(subtext) ? subtext : [subtext],
|
|
26214
|
+
this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: isArray(subtext) ? subtext : [subtext], whiteSpace: 'normal' }, subtextStyle), { maxLineWidth: (_o = subtextStyle.maxLineWidth) !== null && _o !== void 0 ? _o : width, heightLimit: (_p = subtextStyle.heightLimit) !== null && _p !== void 0 ? _p : maxSubTextHeight, lineClamp,
|
|
26215
|
+
ellipsis, x: 0, y: maintextHeight }), 'text');
|
|
25978
26216
|
}
|
|
25979
26217
|
}
|
|
25980
26218
|
const subtextHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;
|
|
25981
26219
|
const subtextWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
|
|
25982
26220
|
let titleWidth = Math.max(maintextWidth, subtextWidth);
|
|
25983
|
-
let titleHeight = maintextHeight + ((
|
|
26221
|
+
let titleHeight = maintextHeight + ((_q = subtextStyle.height) !== null && _q !== void 0 ? _q : subtextHeight);
|
|
25984
26222
|
if (isValid(width)) {
|
|
25985
26223
|
titleWidth = width;
|
|
25986
|
-
this._mainTitle && this._mainTitle.setAttribute('maxLineWidth', width);
|
|
25987
|
-
this._subTitle && this._subTitle.setAttribute('maxLineWidth', width);
|
|
25988
26224
|
}
|
|
25989
26225
|
if (isValid(height)) {
|
|
25990
26226
|
titleHeight = height;
|
|
@@ -25993,10 +26229,6 @@ class Title extends AbstractComponent {
|
|
|
25993
26229
|
titleWidth = minWidth;
|
|
25994
26230
|
}
|
|
25995
26231
|
if (isValid(maxWidth)) {
|
|
25996
|
-
this._mainTitle && this._mainTitle.setAttribute('maxLineWidth', maxWidth);
|
|
25997
|
-
this._subTitle && this._subTitle.setAttribute('maxLineWidth', maxWidth);
|
|
25998
|
-
this._mainTitle && this._mainTitle.setAttribute('maxWidth', maxWidth);
|
|
25999
|
-
this._subTitle && this._subTitle.setAttribute('maxWidth', maxWidth);
|
|
26000
26232
|
if (titleWidth > maxWidth) {
|
|
26001
26233
|
titleWidth = maxWidth;
|
|
26002
26234
|
}
|
|
@@ -26005,8 +26237,6 @@ class Title extends AbstractComponent {
|
|
|
26005
26237
|
titleHeight = minHeight;
|
|
26006
26238
|
}
|
|
26007
26239
|
if (isValid(maxHeight)) {
|
|
26008
|
-
this._mainTitle && this._mainTitle.setAttribute('maxHeight', maxHeight);
|
|
26009
|
-
this._subTitle && this._subTitle.setAttribute('maxHeight', maxHeight - maintextHeight);
|
|
26010
26240
|
if (titleHeight > maxHeight) {
|
|
26011
26241
|
titleHeight = maxHeight;
|
|
26012
26242
|
}
|
|
@@ -26017,7 +26247,7 @@ class Title extends AbstractComponent {
|
|
|
26017
26247
|
if (this._mainTitle) {
|
|
26018
26248
|
if (isValid(align) || isValid(textStyle.align)) {
|
|
26019
26249
|
const mainTitleAlign = textStyle.align ? textStyle.align : align;
|
|
26020
|
-
const mainTitleWidth = (
|
|
26250
|
+
const mainTitleWidth = (_r = textStyle.width) !== null && _r !== void 0 ? _r : maintextWidth;
|
|
26021
26251
|
if (mainTitleAlign === 'left') {
|
|
26022
26252
|
this._mainTitle.setAttribute('x', 0);
|
|
26023
26253
|
this._mainTitle.setAttribute('textAlign', 'left');
|
|
@@ -26051,7 +26281,7 @@ class Title extends AbstractComponent {
|
|
|
26051
26281
|
if (this._subTitle) {
|
|
26052
26282
|
if (isValid(align) || isValid(subtextStyle.align)) {
|
|
26053
26283
|
const subTitleAlign = subtextStyle.align ? subtextStyle.align : align;
|
|
26054
|
-
const subTitleWidth = (
|
|
26284
|
+
const subTitleWidth = (_s = subtextStyle.width) !== null && _s !== void 0 ? _s : subtextWidth;
|
|
26055
26285
|
if (subTitleAlign === 'left') {
|
|
26056
26286
|
this._subTitle.setAttribute('x', 0);
|
|
26057
26287
|
this._subTitle.setAttribute('textAlign', 'left');
|
|
@@ -26068,7 +26298,7 @@ class Title extends AbstractComponent {
|
|
|
26068
26298
|
if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
|
|
26069
26299
|
const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;
|
|
26070
26300
|
const subTitleYStart = maintextHeight;
|
|
26071
|
-
const subTitleHeight = (
|
|
26301
|
+
const subTitleHeight = (_t = subtextStyle.height) !== null && _t !== void 0 ? _t : 0;
|
|
26072
26302
|
if (subTitleVerticalAlign === 'top') {
|
|
26073
26303
|
this._subTitle.setAttribute('y', subTitleYStart);
|
|
26074
26304
|
this._subTitle.setAttribute('textBaseline', 'top');
|
|
@@ -28589,6 +28819,6 @@ EmptyTip.defaultAttributes = {
|
|
|
28589
28819
|
}
|
|
28590
28820
|
};
|
|
28591
28821
|
|
|
28592
|
-
const version = "0.20.
|
|
28822
|
+
const version = "0.20.3";
|
|
28593
28823
|
|
|
28594
|
-
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, ticks, traverseGroup, version };
|
|
28824
|
+
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, ticks, traverseGroup, version };
|