@visactor/vrender-components 0.20.2-alpha.3 → 0.20.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +60 -7
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/overlap/auto-limit.js +4 -3
- 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 +24 -4
- package/cjs/axis/type.js.map +1 -1
- package/cjs/axis/util.d.ts +2 -0
- package/cjs/axis/util.js +14 -3
- package/cjs/axis/util.js.map +1 -1
- package/cjs/brush/brush.js +1 -2
- 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/base.d.ts +6 -5
- package/cjs/label/base.js +60 -58
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/type.d.ts +3 -3
- package/cjs/label/type.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 +330 -133
- 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 +64 -7
- package/es/axis/line.js.map +1 -1
- package/es/axis/overlap/auto-limit.js +4 -2
- 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 +24 -4
- package/es/axis/type.js.map +1 -1
- package/es/axis/util.d.ts +2 -0
- package/es/axis/util.js +12 -1
- package/es/axis/util.js.map +1 -1
- package/es/brush/brush.js +1 -2
- 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/base.d.ts +6 -5
- package/es/label/base.js +57 -57
- package/es/label/base.js.map +1 -1
- package/es/label/type.d.ts +3 -3
- package/es/label/type.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 +8 -8
package/dist/index.es.js
CHANGED
|
@@ -3719,7 +3719,8 @@ class Animate {
|
|
|
3719
3719
|
constructor() {
|
|
3720
3720
|
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Generator.GenAutoIncrementId();
|
|
3721
3721
|
let timeline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTimeline;
|
|
3722
|
-
|
|
3722
|
+
let slience = arguments.length > 2 ? arguments[2] : undefined;
|
|
3723
|
+
this.id = id, this.timeline = timeline, this.status = AnimateStatus.INITIAL, this.tailAnimate = new SubAnimate(this), this.subAnimates = [this.tailAnimate], this.timeScale = 1, this.rawPosition = -1, this._startTime = 0, this._duringTime = 0, this.timeline.addAnimate(this), this.slience = slience;
|
|
3723
3724
|
}
|
|
3724
3725
|
setTimeline(timeline) {
|
|
3725
3726
|
timeline !== this.timeline && (this.timeline.removeAnimate(this, !1), timeline.addAnimate(this));
|
|
@@ -3847,7 +3848,7 @@ class Animate {
|
|
|
3847
3848
|
return !this._preventAttrs || !this._preventAttrs.has(key);
|
|
3848
3849
|
}
|
|
3849
3850
|
bind(target) {
|
|
3850
|
-
return this.target = target, this.target.onAnimateBind && this.target.onAnimateBind(this), this.subAnimates.forEach(sa => {
|
|
3851
|
+
return this.target = target, this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.subAnimates.forEach(sa => {
|
|
3851
3852
|
sa.bind(target);
|
|
3852
3853
|
}), this;
|
|
3853
3854
|
}
|
|
@@ -4719,8 +4720,8 @@ class Graphic extends Node {
|
|
|
4719
4720
|
}
|
|
4720
4721
|
animate(params) {
|
|
4721
4722
|
this.animates || (this.animates = new Map());
|
|
4722
|
-
const animate = new Animate(null == params ? void 0 : params.id, this.stage && this.stage.getTimeline()
|
|
4723
|
-
if (params) {
|
|
4723
|
+
const animate = new Animate(null == params ? void 0 : params.id, this.stage && this.stage.getTimeline(), null == params ? void 0 : params.slience);
|
|
4724
|
+
if (animate.bind(this), params) {
|
|
4724
4725
|
const {
|
|
4725
4726
|
onStart: onStart,
|
|
4726
4727
|
onFrame: onFrame,
|
|
@@ -4756,7 +4757,9 @@ class Graphic extends Node {
|
|
|
4756
4757
|
keys.forEach(key => {
|
|
4757
4758
|
noWorkAttrs[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = isClear && void 0 === attrs[key] ? this.getDefaultAttribute(key) : attrs[key];
|
|
4758
4759
|
});
|
|
4759
|
-
const animate = this.animate(
|
|
4760
|
+
const animate = this.animate({
|
|
4761
|
+
slience: !0
|
|
4762
|
+
});
|
|
4760
4763
|
animate.stateNames = stateNames, animate.to(animateAttrs, null !== (_b = null === (_a = this.stateAnimateConfig) || void 0 === _a ? void 0 : _a.duration) && void 0 !== _b ? _b : DefaultStateAnimateConfig.duration, null !== (_d = null === (_c = this.stateAnimateConfig) || void 0 === _c ? void 0 : _c.easing) && void 0 !== _d ? _d : DefaultStateAnimateConfig.easing), noAnimateAttrs && this.setAttributes(noAnimateAttrs, !1, {
|
|
4761
4764
|
type: AttributeUpdateType.STATE
|
|
4762
4765
|
});
|
|
@@ -4973,7 +4976,7 @@ class Graphic extends Node {
|
|
|
4973
4976
|
if (!animate.validAttr(key)) return;
|
|
4974
4977
|
const nextStepVal = nextProps[key],
|
|
4975
4978
|
lastStepVal = null !== (_a = lastProps && lastProps[key]) && void 0 !== _a ? _a : subAnimate.getLastPropByName(key, step);
|
|
4976
|
-
if (null == nextStepVal || null == lastStepVal) return void (nextAttributes[key] = nextStepVal);
|
|
4979
|
+
if (null == nextStepVal || null == lastStepVal || nextStepVal === lastStepVal) return void (nextAttributes[key] = nextStepVal);
|
|
4977
4980
|
let match;
|
|
4978
4981
|
match = animate.interpolateFunc && animate.interpolateFunc(key, ratio, lastStepVal, nextStepVal, nextAttributes), match || (match = animate.customInterpolate(key, ratio, lastStepVal, nextStepVal, this, nextAttributes), match || this.defaultInterpolate(nextStepVal, lastStepVal, key, nextAttributes, nextParsedProps, ratio) || this._interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes));
|
|
4979
4982
|
}), step.parsedProps = nextParsedProps;
|
|
@@ -14771,7 +14774,7 @@ class Tag extends AbstractComponent {
|
|
|
14771
14774
|
textShape = group.createOrUpdateChild('tag-text', richTextAttrs, 'richtext');
|
|
14772
14775
|
const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
|
|
14773
14776
|
if (visible && isBoolean(bgVisible)) {
|
|
14774
|
-
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');
|
|
14777
|
+
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');
|
|
14775
14778
|
if (!isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
14776
14779
|
bgRect.states = state.panel;
|
|
14777
14780
|
}
|
|
@@ -15873,16 +15876,18 @@ function updateAnimation(prev, next, animationConfig) {
|
|
|
15873
15876
|
if (!isArray(animationConfig)) {
|
|
15874
15877
|
const { duration, easing, increaseEffect = true } = animationConfig;
|
|
15875
15878
|
prev.animate().to(next.attribute, duration, easing);
|
|
15876
|
-
increaseEffect &&
|
|
15879
|
+
if (increaseEffect && prev.type === 'text' && next.type === 'text') {
|
|
15880
|
+
playIncreaseCount(prev, next, duration, easing);
|
|
15881
|
+
}
|
|
15877
15882
|
return;
|
|
15878
15883
|
}
|
|
15879
|
-
animationConfig.forEach(
|
|
15884
|
+
animationConfig.forEach(cfg => {
|
|
15880
15885
|
const { duration, easing, increaseEffect = true, channel } = cfg;
|
|
15881
|
-
const {
|
|
15886
|
+
const { to } = update(prev, next, channel, cfg.options);
|
|
15882
15887
|
if (!isEmpty(to)) {
|
|
15883
15888
|
prev.animate().to(to, duration, easing);
|
|
15884
15889
|
}
|
|
15885
|
-
if (
|
|
15890
|
+
if (increaseEffect && prev.type === 'text' && next.type === 'text') {
|
|
15886
15891
|
playIncreaseCount(prev, next, duration, easing);
|
|
15887
15892
|
}
|
|
15888
15893
|
});
|
|
@@ -16294,7 +16299,7 @@ class LabelBase extends AbstractComponent {
|
|
|
16294
16299
|
return createTextGraphicByType(textAttrs, 'textType');
|
|
16295
16300
|
}
|
|
16296
16301
|
_prepare() {
|
|
16297
|
-
var _a, _b
|
|
16302
|
+
var _a, _b;
|
|
16298
16303
|
const currentBaseMarks = [];
|
|
16299
16304
|
let baseMarks;
|
|
16300
16305
|
if (isFunction(this.attribute.getBaseMarks)) {
|
|
@@ -16358,13 +16363,23 @@ class LabelBase extends AbstractComponent {
|
|
|
16358
16363
|
}
|
|
16359
16364
|
}
|
|
16360
16365
|
if (this.attribute.animation !== false) {
|
|
16361
|
-
const animation
|
|
16366
|
+
const { animation, animationEnter, animationExit, animationUpdate } = this.attribute;
|
|
16367
|
+
const animationCfg = isObject(animation) ? animation : {};
|
|
16368
|
+
this._animationConfig = {
|
|
16369
|
+
enter: animationEnter !== false ? merge({}, DefaultLabelAnimation, animationCfg, animationEnter !== null && animationEnter !== void 0 ? animationEnter : {}) : false,
|
|
16370
|
+
exit: animationExit !== false ? merge({}, DefaultLabelAnimation, animationCfg, animationExit !== null && animationExit !== void 0 ? animationExit : {}) : false,
|
|
16371
|
+
update: animationUpdate !== false
|
|
16372
|
+
? isArray(animationUpdate)
|
|
16373
|
+
? animationUpdate
|
|
16374
|
+
: merge({}, DefaultLabelAnimation, animationCfg, animationUpdate !== null && animationUpdate !== void 0 ? animationUpdate : {})
|
|
16375
|
+
: false
|
|
16376
|
+
};
|
|
16377
|
+
}
|
|
16378
|
+
else {
|
|
16362
16379
|
this._animationConfig = {
|
|
16363
|
-
enter:
|
|
16364
|
-
exit:
|
|
16365
|
-
update:
|
|
16366
|
-
? this.attribute.animationUpdate
|
|
16367
|
-
: merge({}, DefaultLabelAnimation, animation, (_e = this.attribute.animationUpdate) !== null && _e !== void 0 ? _e : {})
|
|
16380
|
+
enter: false,
|
|
16381
|
+
exit: false,
|
|
16382
|
+
update: false
|
|
16368
16383
|
};
|
|
16369
16384
|
}
|
|
16370
16385
|
}
|
|
@@ -16532,15 +16547,6 @@ class LabelBase extends AbstractComponent {
|
|
|
16532
16547
|
return { x1: x, x2: x, y1: y, y2: y };
|
|
16533
16548
|
}
|
|
16534
16549
|
_renderLabels(labels) {
|
|
16535
|
-
const disableAnimation = this._enableAnimation === false || this.attribute.animation === false;
|
|
16536
|
-
if (disableAnimation) {
|
|
16537
|
-
this._renderWithOutAnimation(labels);
|
|
16538
|
-
}
|
|
16539
|
-
else {
|
|
16540
|
-
this._renderWithAnimation(labels);
|
|
16541
|
-
}
|
|
16542
|
-
}
|
|
16543
|
-
_renderWithAnimation(labels) {
|
|
16544
16550
|
var _a;
|
|
16545
16551
|
const { syncState } = this.attribute;
|
|
16546
16552
|
const currentTextMap = new Map();
|
|
@@ -16552,8 +16558,7 @@ class LabelBase extends AbstractComponent {
|
|
|
16552
16558
|
labels.forEach((text, index) => {
|
|
16553
16559
|
var _a;
|
|
16554
16560
|
const relatedGraphic = this.getRelatedGraphic(text.attribute);
|
|
16555
|
-
const
|
|
16556
|
-
const textKey = this._isCollectionBase ? textId : relatedGraphic;
|
|
16561
|
+
const textKey = this._isCollectionBase ? text.attribute.id : relatedGraphic;
|
|
16557
16562
|
const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(textKey)) ? 'update' : 'enter';
|
|
16558
16563
|
let labelLine;
|
|
16559
16564
|
if (showLabelLine) {
|
|
@@ -16565,90 +16570,88 @@ class LabelBase extends AbstractComponent {
|
|
|
16565
16570
|
if (state === 'enter') {
|
|
16566
16571
|
texts.push(text);
|
|
16567
16572
|
currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });
|
|
16568
|
-
|
|
16569
|
-
const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');
|
|
16570
|
-
this.add(text);
|
|
16571
|
-
if (labelLine) {
|
|
16572
|
-
labelLines.push(labelLine);
|
|
16573
|
-
this.add(labelLine);
|
|
16574
|
-
}
|
|
16575
|
-
this._syncStateWithRelatedGraphic(relatedGraphic);
|
|
16576
|
-
this._animationConfig.enter.duration > 0 &&
|
|
16577
|
-
relatedGraphic.once('animate-bind', a => {
|
|
16578
|
-
text.setAttributes(from);
|
|
16579
|
-
labelLine && labelLine.setAttributes(from);
|
|
16580
|
-
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, labelLine, labelLines, index, relatedGraphic, to, this._animationConfig.enter);
|
|
16581
|
-
relatedGraphic.on('afterAttributeUpdate', listener);
|
|
16582
|
-
});
|
|
16583
|
-
}
|
|
16573
|
+
this._addLabel({ text, labelLine }, texts, labelLines, index);
|
|
16584
16574
|
}
|
|
16585
16575
|
else if (state === 'update') {
|
|
16586
16576
|
const prevLabel = prevTextMap.get(textKey);
|
|
16587
16577
|
prevTextMap.delete(textKey);
|
|
16588
16578
|
currentTextMap.set(textKey, prevLabel);
|
|
16589
|
-
|
|
16590
|
-
const { duration, easing } = this._animationConfig.update;
|
|
16591
|
-
updateAnimation(prevText, text, this._animationConfig.update);
|
|
16592
|
-
if (prevLabel.labelLine && labelLine) {
|
|
16593
|
-
prevLabel.labelLine.animate().to(labelLine.attribute, duration, easing);
|
|
16594
|
-
}
|
|
16579
|
+
this._updateLabel(prevLabel, { text, labelLine });
|
|
16595
16580
|
}
|
|
16596
16581
|
});
|
|
16597
|
-
|
|
16598
|
-
var _a;
|
|
16599
|
-
(_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(() => {
|
|
16600
|
-
this.removeChild(label.text);
|
|
16601
|
-
if (label.labelLine) {
|
|
16602
|
-
this.removeChild(label.labelLine);
|
|
16603
|
-
}
|
|
16604
|
-
});
|
|
16605
|
-
});
|
|
16582
|
+
this._removeLabel(prevTextMap);
|
|
16606
16583
|
this._graphicToText = currentTextMap;
|
|
16607
16584
|
}
|
|
16608
|
-
|
|
16609
|
-
|
|
16610
|
-
const
|
|
16611
|
-
|
|
16612
|
-
|
|
16613
|
-
|
|
16614
|
-
|
|
16615
|
-
|
|
16616
|
-
var _a;
|
|
16617
|
-
const relatedGraphic = this.getRelatedGraphic(text.attribute);
|
|
16618
|
-
const state = (prevTextMap === null || prevTextMap === void 0 ? void 0 : prevTextMap.get(relatedGraphic)) ? 'update' : 'enter';
|
|
16619
|
-
const textKey = this._isCollectionBase ? text.attribute.id : relatedGraphic;
|
|
16620
|
-
let labelLine;
|
|
16621
|
-
if (showLabelLine) {
|
|
16622
|
-
labelLine = this._createLabelLine(text, relatedGraphic);
|
|
16623
|
-
}
|
|
16624
|
-
if (syncState) {
|
|
16625
|
-
this.updateStatesOfLabels([labelLine ? { text, labelLine } : { text }], (_a = relatedGraphic.currentStates) !== null && _a !== void 0 ? _a : []);
|
|
16626
|
-
}
|
|
16627
|
-
if (state === 'enter') {
|
|
16628
|
-
currentTextMap.set(textKey, labelLine ? { text, labelLine } : { text });
|
|
16585
|
+
_addLabel(label, texts, labelLines, index) {
|
|
16586
|
+
const { text, labelLine } = label;
|
|
16587
|
+
const relatedGraphic = this.getRelatedGraphic(text.attribute);
|
|
16588
|
+
this._syncStateWithRelatedGraphic(relatedGraphic);
|
|
16589
|
+
if (this._enableAnimation !== false && this._animationConfig.enter !== false) {
|
|
16590
|
+
if (relatedGraphic) {
|
|
16591
|
+
const { from, to } = getAnimationAttributes(text.attribute, 'fadeIn');
|
|
16592
|
+
if (text) {
|
|
16629
16593
|
this.add(text);
|
|
16630
|
-
if (labelLine) {
|
|
16631
|
-
this.add(labelLine);
|
|
16632
|
-
}
|
|
16633
|
-
this._syncStateWithRelatedGraphic(relatedGraphic);
|
|
16634
16594
|
}
|
|
16635
|
-
|
|
16636
|
-
|
|
16637
|
-
|
|
16638
|
-
currentTextMap.set(textKey, prevLabel);
|
|
16639
|
-
prevLabel.text.setAttributes(text.attribute);
|
|
16640
|
-
if (prevLabel.labelLine && labelLine) {
|
|
16641
|
-
prevLabel.labelLine.setAttributes(labelLine.attribute);
|
|
16642
|
-
}
|
|
16595
|
+
if (labelLine) {
|
|
16596
|
+
labelLines.push(labelLine);
|
|
16597
|
+
this.add(labelLine);
|
|
16643
16598
|
}
|
|
16644
|
-
|
|
16645
|
-
|
|
16599
|
+
this._animationConfig.enter.duration > 0 &&
|
|
16600
|
+
relatedGraphic.once('animate-bind', a => {
|
|
16601
|
+
text.setAttributes(from);
|
|
16602
|
+
labelLine && labelLine.setAttributes(from);
|
|
16603
|
+
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, labelLine, labelLines, index, relatedGraphic, to, this._animationConfig.enter);
|
|
16604
|
+
relatedGraphic.on('afterAttributeUpdate', listener);
|
|
16605
|
+
});
|
|
16606
|
+
}
|
|
16607
|
+
}
|
|
16608
|
+
else {
|
|
16609
|
+
if (text) {
|
|
16610
|
+
this.add(text);
|
|
16611
|
+
}
|
|
16612
|
+
if (labelLine) {
|
|
16613
|
+
this.add(labelLine);
|
|
16614
|
+
}
|
|
16615
|
+
}
|
|
16616
|
+
}
|
|
16617
|
+
_updateLabel(prevLabel, currentLabel) {
|
|
16618
|
+
const { text: prevText, labelLine: prevLabelLine } = prevLabel;
|
|
16619
|
+
const { text: curText, labelLine: curLabelLine } = currentLabel;
|
|
16620
|
+
if (this._enableAnimation !== false && this._animationConfig.update !== false) {
|
|
16621
|
+
const { duration, easing } = this._animationConfig.update;
|
|
16622
|
+
updateAnimation(prevText, curText, this._animationConfig.update);
|
|
16623
|
+
if (prevLabelLine && curLabelLine) {
|
|
16624
|
+
prevLabel.labelLine.animate().to(curLabelLine.attribute, duration, easing);
|
|
16625
|
+
}
|
|
16626
|
+
}
|
|
16627
|
+
else {
|
|
16628
|
+
prevLabel.text.setAttributes(curText.attribute);
|
|
16629
|
+
if (prevLabelLine && curLabelLine) {
|
|
16630
|
+
prevLabel.labelLine.setAttributes(curLabelLine.attribute);
|
|
16631
|
+
}
|
|
16632
|
+
}
|
|
16633
|
+
}
|
|
16634
|
+
_removeLabel(textMap) {
|
|
16635
|
+
const removeLabelAndLine = (label) => {
|
|
16646
16636
|
this.removeChild(label.text);
|
|
16647
16637
|
if (label.labelLine) {
|
|
16648
16638
|
this.removeChild(label.labelLine);
|
|
16649
16639
|
}
|
|
16650
|
-
}
|
|
16651
|
-
this.
|
|
16640
|
+
};
|
|
16641
|
+
if (this._enableAnimation !== false && this._animationConfig.exit !== false) {
|
|
16642
|
+
const { duration, easing } = this._animationConfig.exit;
|
|
16643
|
+
textMap.forEach(label => {
|
|
16644
|
+
var _a;
|
|
16645
|
+
(_a = label.text) === null || _a === void 0 ? void 0 : _a.animate().to(getAnimationAttributes(label.text.attribute, 'fadeOut').to, duration, easing).onEnd(() => {
|
|
16646
|
+
removeLabelAndLine(label);
|
|
16647
|
+
});
|
|
16648
|
+
});
|
|
16649
|
+
}
|
|
16650
|
+
else {
|
|
16651
|
+
textMap.forEach(label => {
|
|
16652
|
+
removeLabelAndLine(label);
|
|
16653
|
+
});
|
|
16654
|
+
}
|
|
16652
16655
|
}
|
|
16653
16656
|
updateStatesOfLabels(labels, currentStates) {
|
|
16654
16657
|
labels.forEach(label => {
|
|
@@ -16663,7 +16666,7 @@ class LabelBase extends AbstractComponent {
|
|
|
16663
16666
|
});
|
|
16664
16667
|
}
|
|
16665
16668
|
_syncStateWithRelatedGraphic(relatedGraphic) {
|
|
16666
|
-
if (this.attribute.syncState) {
|
|
16669
|
+
if (this.attribute.syncState && relatedGraphic) {
|
|
16667
16670
|
relatedGraphic.on('afterAttributeUpdate', this._handleRelatedGraphicSetState);
|
|
16668
16671
|
}
|
|
16669
16672
|
}
|
|
@@ -18087,6 +18090,8 @@ var AXIS_ELEMENT_NAME;
|
|
|
18087
18090
|
AXIS_ELEMENT_NAME["line"] = "axis-line";
|
|
18088
18091
|
AXIS_ELEMENT_NAME["background"] = "axis-background";
|
|
18089
18092
|
AXIS_ELEMENT_NAME["axisLabelBackground"] = "axis-label-background";
|
|
18093
|
+
AXIS_ELEMENT_NAME["axisBreak"] = "axis-break";
|
|
18094
|
+
AXIS_ELEMENT_NAME["axisBreakSymbol"] = "axis-break-symbol";
|
|
18090
18095
|
})(AXIS_ELEMENT_NAME || (AXIS_ELEMENT_NAME = {}));
|
|
18091
18096
|
var AxisStateValue;
|
|
18092
18097
|
(function (AxisStateValue) {
|
|
@@ -18101,6 +18106,7 @@ const DEFAULT_STATES$1 = {
|
|
|
18101
18106
|
[AxisStateValue.hover]: {},
|
|
18102
18107
|
[AxisStateValue.hoverReverse]: {}
|
|
18103
18108
|
};
|
|
18109
|
+
const TopZIndex = 999;
|
|
18104
18110
|
|
|
18105
18111
|
const DEFAULT_AXIS_THEME = {
|
|
18106
18112
|
title: {
|
|
@@ -18156,6 +18162,12 @@ const DEFAULT_AXIS_THEME = {
|
|
|
18156
18162
|
}
|
|
18157
18163
|
}
|
|
18158
18164
|
};
|
|
18165
|
+
const DEFAULT_AXIS_BREAK_SYMBOL_STYLE = {
|
|
18166
|
+
size: 8,
|
|
18167
|
+
stroke: '#000',
|
|
18168
|
+
lineWidth: 1,
|
|
18169
|
+
zIndex: 1
|
|
18170
|
+
};
|
|
18159
18171
|
|
|
18160
18172
|
const clampRadian = (angle = 0) => {
|
|
18161
18173
|
if (angle < 0) {
|
|
@@ -18213,6 +18225,13 @@ function getCircleLabelPosition(tickPosition, tickVector, text, style) {
|
|
|
18213
18225
|
const y = baseY - dy;
|
|
18214
18226
|
return { x, y };
|
|
18215
18227
|
}
|
|
18228
|
+
function getAxisBreakSymbolAttrs(props = {}) {
|
|
18229
|
+
var _a, _b;
|
|
18230
|
+
const { style = {}, angle = Math.PI * 0.5 } = props;
|
|
18231
|
+
const symbolStyle = merge({}, DEFAULT_AXIS_BREAK_SYMBOL_STYLE, style);
|
|
18232
|
+
const symbolSize = (_a = symbolStyle.size) !== null && _a !== void 0 ? _a : DEFAULT_AXIS_BREAK_SYMBOL_STYLE.size;
|
|
18233
|
+
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 });
|
|
18234
|
+
}
|
|
18216
18235
|
function getElMap(g) {
|
|
18217
18236
|
const elMap = {};
|
|
18218
18237
|
traverseGroup(g, (el) => {
|
|
@@ -18775,6 +18794,17 @@ function itemIntersect(item1, item2) {
|
|
|
18775
18794
|
? isRotateAABBIntersect(item1.rotatedBounds, item2.rotatedBounds, true)
|
|
18776
18795
|
: true));
|
|
18777
18796
|
}
|
|
18797
|
+
const DELTA_ANGLE = Math.sin(Math.PI / 10);
|
|
18798
|
+
function isAngleVertical(angle) {
|
|
18799
|
+
const hasAngle = !isNil(angle) && angle !== 0;
|
|
18800
|
+
const cos = hasAngle ? Math.cos(angle) : 1;
|
|
18801
|
+
return hasAngle && Math.abs(cos) <= DELTA_ANGLE;
|
|
18802
|
+
}
|
|
18803
|
+
function isAngleHorizontal(angle) {
|
|
18804
|
+
const hasAngle = !isNil(angle) && angle !== 0;
|
|
18805
|
+
const sin = hasAngle ? Math.sin(angle) : 0;
|
|
18806
|
+
return !hasAngle || Math.abs(sin) <= DELTA_ANGLE;
|
|
18807
|
+
}
|
|
18778
18808
|
|
|
18779
18809
|
const methods$1 = {
|
|
18780
18810
|
parity: function (items) {
|
|
@@ -18970,15 +19000,14 @@ function autoLimit(labels, config) {
|
|
|
18970
19000
|
if (isEmpty(labels) || !isValidNumber(limitLength)) {
|
|
18971
19001
|
return;
|
|
18972
19002
|
}
|
|
18973
|
-
const DELTA = Math.sin(Math.PI / 10);
|
|
18974
19003
|
labels.forEach(label => {
|
|
18975
19004
|
var _a;
|
|
18976
19005
|
const angle = label.attribute.angle;
|
|
18977
19006
|
const hasAngle = !isNil(angle);
|
|
18978
19007
|
const cos = hasAngle ? Math.cos(angle) : 1;
|
|
18979
19008
|
const sin = hasAngle ? Math.sin(angle) : 0;
|
|
18980
|
-
const isHorizontal =
|
|
18981
|
-
const isVertical =
|
|
19009
|
+
const isHorizontal = isAngleHorizontal(angle);
|
|
19010
|
+
const isVertical = isAngleVertical(angle);
|
|
18982
19011
|
const isX = orient === 'top' || orient === 'bottom';
|
|
18983
19012
|
if (isX) {
|
|
18984
19013
|
if (isVertical && Math.floor(label.AABBBounds.height()) <= limitLength) {
|
|
@@ -19039,6 +19068,65 @@ function autoLimit(labels, config) {
|
|
|
19039
19068
|
});
|
|
19040
19069
|
}
|
|
19041
19070
|
|
|
19071
|
+
function autoWrap(labels, config) {
|
|
19072
|
+
const { limitLength, axisLength, ellipsis = '...', orient } = config;
|
|
19073
|
+
if (isEmpty(labels) || !isValidNumber(limitLength)) {
|
|
19074
|
+
return;
|
|
19075
|
+
}
|
|
19076
|
+
const verticalLimitLength = axisLength / labels.length;
|
|
19077
|
+
labels.forEach(label => {
|
|
19078
|
+
var _a;
|
|
19079
|
+
const angle = label.attribute.angle;
|
|
19080
|
+
const isHorizontal = isAngleHorizontal(angle);
|
|
19081
|
+
const isVertical = isAngleVertical(angle);
|
|
19082
|
+
const isX = orient === 'top' || orient === 'bottom';
|
|
19083
|
+
if (isX) {
|
|
19084
|
+
if (isVertical && Math.floor(label.AABBBounds.height()) <= limitLength) {
|
|
19085
|
+
return;
|
|
19086
|
+
}
|
|
19087
|
+
if (isHorizontal && Math.floor(label.AABBBounds.width()) <= verticalLimitLength) {
|
|
19088
|
+
return;
|
|
19089
|
+
}
|
|
19090
|
+
}
|
|
19091
|
+
else {
|
|
19092
|
+
if (isVertical && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) {
|
|
19093
|
+
return;
|
|
19094
|
+
}
|
|
19095
|
+
if (isHorizontal && Math.floor(label.AABBBounds.width()) <= limitLength) {
|
|
19096
|
+
return;
|
|
19097
|
+
}
|
|
19098
|
+
}
|
|
19099
|
+
let limitLabelLength = null;
|
|
19100
|
+
let heightLimit = null;
|
|
19101
|
+
if (isX) {
|
|
19102
|
+
if (isVertical) {
|
|
19103
|
+
limitLabelLength = limitLength;
|
|
19104
|
+
heightLimit = verticalLimitLength;
|
|
19105
|
+
}
|
|
19106
|
+
else {
|
|
19107
|
+
limitLabelLength = verticalLimitLength;
|
|
19108
|
+
heightLimit = limitLength;
|
|
19109
|
+
}
|
|
19110
|
+
}
|
|
19111
|
+
else {
|
|
19112
|
+
if (isVertical) {
|
|
19113
|
+
limitLabelLength = verticalLimitLength;
|
|
19114
|
+
heightLimit = limitLength;
|
|
19115
|
+
}
|
|
19116
|
+
else {
|
|
19117
|
+
limitLabelLength = limitLength;
|
|
19118
|
+
heightLimit = verticalLimitLength;
|
|
19119
|
+
}
|
|
19120
|
+
}
|
|
19121
|
+
label.setAttributes({
|
|
19122
|
+
maxLineWidth: limitLabelLength,
|
|
19123
|
+
ellipsis: (_a = label.attribute.ellipsis) !== null && _a !== void 0 ? _a : ellipsis,
|
|
19124
|
+
whiteSpace: 'normal',
|
|
19125
|
+
heightLimit
|
|
19126
|
+
});
|
|
19127
|
+
});
|
|
19128
|
+
}
|
|
19129
|
+
|
|
19042
19130
|
function alignAxisLabels(labels, start, containerSize, orient, align) {
|
|
19043
19131
|
if (orient === 'left' || orient === 'right') {
|
|
19044
19132
|
if (align === 'left') {
|
|
@@ -19149,7 +19237,44 @@ class LineAxis extends AxisBase {
|
|
|
19149
19237
|
}
|
|
19150
19238
|
_renderInner(container) {
|
|
19151
19239
|
var _a;
|
|
19240
|
+
this._breaks = null;
|
|
19241
|
+
if (this.attribute.breaks && this.attribute.breaks.length) {
|
|
19242
|
+
const transformedBreaks = [];
|
|
19243
|
+
for (let index = 0; index < this.attribute.breaks.length; index++) {
|
|
19244
|
+
const aBreak = this.attribute.breaks[index];
|
|
19245
|
+
const { range, breakSymbol, rawRange } = aBreak;
|
|
19246
|
+
transformedBreaks.push({
|
|
19247
|
+
startPoint: this.getTickCoord(range[0]),
|
|
19248
|
+
endPoint: this.getTickCoord(range[1]),
|
|
19249
|
+
range,
|
|
19250
|
+
breakSymbol,
|
|
19251
|
+
rawRange
|
|
19252
|
+
});
|
|
19253
|
+
}
|
|
19254
|
+
this._breaks = transformedBreaks;
|
|
19255
|
+
}
|
|
19152
19256
|
super._renderInner(container);
|
|
19257
|
+
if (this._breaks && this._breaks.length) {
|
|
19258
|
+
this._breaks.forEach((b, index) => {
|
|
19259
|
+
const { startPoint, endPoint, breakSymbol, rawRange } = b;
|
|
19260
|
+
if ((breakSymbol === null || breakSymbol === void 0 ? void 0 : breakSymbol.visible) !== false) {
|
|
19261
|
+
const axisBreakGroup = graphicCreator.group({
|
|
19262
|
+
zIndex: TopZIndex
|
|
19263
|
+
});
|
|
19264
|
+
axisBreakGroup.name = AXIS_ELEMENT_NAME.axisBreak;
|
|
19265
|
+
axisBreakGroup.id = this._getNodeId(`${AXIS_ELEMENT_NAME.axisBreak}-${index}`);
|
|
19266
|
+
axisBreakGroup.data = rawRange;
|
|
19267
|
+
const symbolStyle = getAxisBreakSymbolAttrs(breakSymbol);
|
|
19268
|
+
const shape1 = graphicCreator.symbol(Object.assign({ x: startPoint.x, y: startPoint.y }, symbolStyle));
|
|
19269
|
+
shape1.name = AXIS_ELEMENT_NAME.axisBreakSymbol;
|
|
19270
|
+
const shape2 = graphicCreator.symbol(Object.assign({ x: endPoint.x, y: endPoint.y }, symbolStyle));
|
|
19271
|
+
shape2.name = AXIS_ELEMENT_NAME.axisBreakSymbol;
|
|
19272
|
+
axisBreakGroup.add(shape1);
|
|
19273
|
+
axisBreakGroup.add(shape2);
|
|
19274
|
+
container.add(axisBreakGroup);
|
|
19275
|
+
}
|
|
19276
|
+
});
|
|
19277
|
+
}
|
|
19153
19278
|
const { panel } = this.attribute;
|
|
19154
19279
|
if (panel && panel.visible) {
|
|
19155
19280
|
const axisContainer = this.axisContainer;
|
|
@@ -19163,9 +19288,24 @@ class LineAxis extends AxisBase {
|
|
|
19163
19288
|
}
|
|
19164
19289
|
renderLine(container) {
|
|
19165
19290
|
const { start, end, line } = this.attribute;
|
|
19166
|
-
const _a = line, { startSymbol, endSymbol, style,
|
|
19167
|
-
const lineAttrs = Object.assign({
|
|
19291
|
+
const _a = line, { startSymbol, endSymbol, style, state } = _a, restLineAttrs = __rest(_a, ["startSymbol", "endSymbol", "style", "state"]);
|
|
19292
|
+
const lineAttrs = Object.assign({ startSymbol,
|
|
19168
19293
|
endSymbol, lineStyle: style }, restLineAttrs);
|
|
19294
|
+
if (this._breaks && this._breaks.length) {
|
|
19295
|
+
const linePoints = [];
|
|
19296
|
+
let lastStartPoint = start;
|
|
19297
|
+
this._breaks.forEach(b => {
|
|
19298
|
+
const { startPoint, endPoint } = b;
|
|
19299
|
+
linePoints.push([lastStartPoint, startPoint]);
|
|
19300
|
+
lastStartPoint = endPoint;
|
|
19301
|
+
});
|
|
19302
|
+
linePoints.push([lastStartPoint, end]);
|
|
19303
|
+
lineAttrs.points = linePoints;
|
|
19304
|
+
lineAttrs.multiSegment = true;
|
|
19305
|
+
}
|
|
19306
|
+
else {
|
|
19307
|
+
lineAttrs.points = [start, end];
|
|
19308
|
+
}
|
|
19169
19309
|
if (!isEmpty(state)) {
|
|
19170
19310
|
lineAttrs.state = {
|
|
19171
19311
|
line: merge({}, DEFAULT_STATES$1, state),
|
|
@@ -19438,7 +19578,7 @@ class LineAxis extends AxisBase {
|
|
|
19438
19578
|
}
|
|
19439
19579
|
const { verticalLimitSize, label, orient } = this.attribute;
|
|
19440
19580
|
const limitLength = this._getAxisLabelLimitLength(verticalLimitSize, layerCount);
|
|
19441
|
-
const { layoutFunc, autoRotate: autoRotate$1, autoRotateAngle, autoLimit: autoLimit$1, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, lastVisible } = label;
|
|
19581
|
+
const { layoutFunc, autoRotate: autoRotate$1, autoRotateAngle, autoLimit: autoLimit$1, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, lastVisible, autoWrap: autoWrap$1 } = label;
|
|
19442
19582
|
if (isFunction(layoutFunc)) {
|
|
19443
19583
|
layoutFunc(labelShapes, labelData, layer, this);
|
|
19444
19584
|
}
|
|
@@ -19449,7 +19589,14 @@ class LineAxis extends AxisBase {
|
|
|
19449
19589
|
orient
|
|
19450
19590
|
});
|
|
19451
19591
|
}
|
|
19452
|
-
if (
|
|
19592
|
+
else if (autoWrap$1) {
|
|
19593
|
+
const isVertical = orient === 'left' || orient === 'right';
|
|
19594
|
+
const axisLength = isVertical
|
|
19595
|
+
? Math.abs(this.attribute.start.y - this.attribute.end.y)
|
|
19596
|
+
: Math.abs(this.attribute.start.x - this.attribute.end.x);
|
|
19597
|
+
autoWrap(labelShapes, { orient, limitLength, axisLength, ellipsis: limitEllipsis });
|
|
19598
|
+
}
|
|
19599
|
+
if (!autoWrap$1 && autoLimit$1 && isValidNumber(limitLength) && limitLength > 0) {
|
|
19453
19600
|
const isVertical = orient === 'left' || orient === 'right';
|
|
19454
19601
|
const axisLength = isVertical
|
|
19455
19602
|
? Math.abs(this.attribute.start.y - this.attribute.end.y)
|
|
@@ -19551,6 +19698,10 @@ class LineAxis extends AxisBase {
|
|
|
19551
19698
|
}
|
|
19552
19699
|
return limitLength;
|
|
19553
19700
|
}
|
|
19701
|
+
release() {
|
|
19702
|
+
super.release();
|
|
19703
|
+
this._breaks = null;
|
|
19704
|
+
}
|
|
19554
19705
|
}
|
|
19555
19706
|
LineAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
19556
19707
|
mixin(LineAxis, LineAxisMixin);
|
|
@@ -19920,8 +20071,32 @@ const isAxisHorizontal = (axisOrientType) => {
|
|
|
19920
20071
|
return ['bottom', 'top', 'z'].includes(axisOrientType);
|
|
19921
20072
|
};
|
|
19922
20073
|
|
|
20074
|
+
function getScaleTicks(op, scale, count, getTicks) {
|
|
20075
|
+
let scaleTicks;
|
|
20076
|
+
const { breakData } = op;
|
|
20077
|
+
if (breakData && breakData()) {
|
|
20078
|
+
const { breakDomains } = breakData();
|
|
20079
|
+
const domain = scale.domain();
|
|
20080
|
+
scaleTicks = [];
|
|
20081
|
+
for (let i = 0; i < domain.length - 1; i++) {
|
|
20082
|
+
const subDomain = [domain[i], domain[i + 1]];
|
|
20083
|
+
const ticks = getTicks(count, subDomain);
|
|
20084
|
+
ticks.forEach(tick => {
|
|
20085
|
+
if (!breakDomains.some(breakDomain => tick >= breakDomain[0] && tick <= breakDomain[1])) {
|
|
20086
|
+
scaleTicks.push(tick);
|
|
20087
|
+
}
|
|
20088
|
+
});
|
|
20089
|
+
}
|
|
20090
|
+
scale.domain(domain);
|
|
20091
|
+
}
|
|
20092
|
+
else {
|
|
20093
|
+
scaleTicks = getTicks(count);
|
|
20094
|
+
}
|
|
20095
|
+
return scaleTicks;
|
|
20096
|
+
}
|
|
19923
20097
|
const DEFAULT_CONTINUOUS_TICK_COUNT = 5;
|
|
19924
20098
|
const continuousTicks = (scale, op) => {
|
|
20099
|
+
var _a, _b;
|
|
19925
20100
|
if (!isContinuous(scale.type)) {
|
|
19926
20101
|
return convertDomainToTickData(scale.domain());
|
|
19927
20102
|
}
|
|
@@ -19930,22 +20105,37 @@ const continuousTicks = (scale, op) => {
|
|
|
19930
20105
|
if (rangeSize < 2) {
|
|
19931
20106
|
return convertDomainToTickData([scale.domain()[0]]);
|
|
19932
20107
|
}
|
|
19933
|
-
const { tickCount, forceTickCount, tickStep, noDecimals = false, labelStyle } = op;
|
|
20108
|
+
const { tickCount, forceTickCount, tickStep, noDecimals = false, labelStyle, breakData } = op;
|
|
19934
20109
|
let scaleTicks;
|
|
19935
20110
|
if (isValid(tickStep)) {
|
|
19936
20111
|
scaleTicks = scale.stepTicks(tickStep);
|
|
19937
20112
|
}
|
|
19938
20113
|
else if (isValid(forceTickCount)) {
|
|
19939
|
-
scaleTicks = scale
|
|
20114
|
+
scaleTicks = getScaleTicks(op, scale, forceTickCount, (count, subDomain) => {
|
|
20115
|
+
if (subDomain && subDomain.length) {
|
|
20116
|
+
return scale.domain(subDomain, true).forceTicks(count);
|
|
20117
|
+
}
|
|
20118
|
+
return scale.forceTicks(count);
|
|
20119
|
+
});
|
|
19940
20120
|
}
|
|
19941
20121
|
else if (op.tickMode === 'd3') {
|
|
19942
|
-
const count = isFunction(tickCount) ? tickCount({ axisLength: rangeSize, labelStyle }) : tickCount;
|
|
19943
|
-
scaleTicks =
|
|
20122
|
+
const count = (_a = (isFunction(tickCount) ? tickCount({ axisLength: rangeSize, labelStyle }) : tickCount)) !== null && _a !== void 0 ? _a : DEFAULT_CONTINUOUS_TICK_COUNT;
|
|
20123
|
+
scaleTicks = getScaleTicks(op, scale, count, (count, subDomain) => {
|
|
20124
|
+
if (subDomain && subDomain.length) {
|
|
20125
|
+
return scale.domain(subDomain, true).d3Ticks(count, { noDecimals });
|
|
20126
|
+
}
|
|
20127
|
+
return scale.d3Ticks(count, { noDecimals });
|
|
20128
|
+
});
|
|
19944
20129
|
}
|
|
19945
20130
|
else {
|
|
19946
|
-
const count = isFunction(tickCount) ? tickCount({ axisLength: rangeSize, labelStyle }) : tickCount;
|
|
20131
|
+
const count = (_b = (isFunction(tickCount) ? tickCount({ axisLength: rangeSize, labelStyle }) : tickCount)) !== null && _b !== void 0 ? _b : DEFAULT_CONTINUOUS_TICK_COUNT;
|
|
19947
20132
|
const customTicks = isFunction(op.tickMode) ? op.tickMode : undefined;
|
|
19948
|
-
scaleTicks =
|
|
20133
|
+
scaleTicks = getScaleTicks(op, scale, count, (count, subDomain) => {
|
|
20134
|
+
if (subDomain && subDomain.length) {
|
|
20135
|
+
return scale.domain(subDomain, true).ticks(count, { noDecimals, customTicks });
|
|
20136
|
+
}
|
|
20137
|
+
return scale.ticks(count, { noDecimals, customTicks });
|
|
20138
|
+
});
|
|
19949
20139
|
}
|
|
19950
20140
|
if (op.sampling) {
|
|
19951
20141
|
if (op.coordinateType === 'cartesian' || (op.coordinateType === 'polar' && op.axisOrientType === 'radius')) {
|
|
@@ -19954,8 +20144,9 @@ const continuousTicks = (scale, op) => {
|
|
|
19954
20144
|
AABBBounds: bounds,
|
|
19955
20145
|
value: scaleTicks[i]
|
|
19956
20146
|
}));
|
|
20147
|
+
const samplingMethod = breakData && breakData() ? methods.greedy : methods.parity;
|
|
19957
20148
|
while (items.length >= 3 && hasOverlap(items, labelGap)) {
|
|
19958
|
-
items =
|
|
20149
|
+
items = samplingMethod(items, labelGap);
|
|
19959
20150
|
}
|
|
19960
20151
|
const ticks = items.map(item => item.value);
|
|
19961
20152
|
if (ticks.length < 3 && labelFlush) {
|
|
@@ -25942,46 +26133,58 @@ class Title extends AbstractComponent {
|
|
|
25942
26133
|
this.name = 'title';
|
|
25943
26134
|
}
|
|
25944
26135
|
render() {
|
|
25945
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t
|
|
26136
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
25946
26137
|
const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
|
|
25947
26138
|
const parsedPadding = normalizePadding(padding);
|
|
25948
26139
|
const group = this.createOrUpdateChild('title-container', { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 }, 'group');
|
|
25949
26140
|
if (this.attribute.visible !== false && textStyle.visible !== false) {
|
|
26141
|
+
const { width: mainTitleWidth, height: mainTitleHeight, maxHeight: mainTitleMaxHeight, maxWidth: mainTitleMaxWidth, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', maxWidth, lineClamp } = textStyle;
|
|
25950
26142
|
if (textType === 'rich' || isValid(textStyle.character)) {
|
|
25951
|
-
const attr = Object.assign({ x
|
|
26143
|
+
const attr = Object.assign({ x,
|
|
26144
|
+
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);
|
|
25952
26145
|
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
25953
26146
|
}
|
|
25954
26147
|
else if (textType === 'html') {
|
|
25955
|
-
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: text }, DEFAULT_HTML_TEXT_SPEC), textStyle), x
|
|
26148
|
+
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: text }, DEFAULT_HTML_TEXT_SPEC), textStyle), x,
|
|
26149
|
+
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,
|
|
26150
|
+
wordBreak, maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: [] }, textStyle);
|
|
25956
26151
|
this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
|
|
25957
26152
|
}
|
|
25958
26153
|
else if (isValid(text)) {
|
|
25959
|
-
this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: isArray(text) ? text : [text],
|
|
26154
|
+
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,
|
|
26155
|
+
ellipsis,
|
|
26156
|
+
x,
|
|
26157
|
+
y }), 'text');
|
|
25960
26158
|
}
|
|
25961
26159
|
}
|
|
25962
26160
|
const maintextHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;
|
|
25963
26161
|
const maintextWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;
|
|
25964
26162
|
if (this.attribute.visible !== false && subtextStyle.visible !== false) {
|
|
26163
|
+
const { width: subTitleWidth, height: subTitleHeight, maxWidth: subTitleMaxWidth, maxHeight: subTitleMaxHeight, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', lineClamp } = subtextStyle;
|
|
26164
|
+
const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - maintextHeight);
|
|
25965
26165
|
if (subtextType === 'rich' || isValid(subtextStyle.character)) {
|
|
25966
|
-
const attr = Object.assign({ x
|
|
26166
|
+
const attr = Object.assign({ x,
|
|
26167
|
+
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,
|
|
26168
|
+
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);
|
|
25967
26169
|
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
25968
26170
|
}
|
|
25969
26171
|
else if (subtextType === 'html') {
|
|
25970
|
-
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: subtext }, DEFAULT_HTML_TEXT_SPEC), subtextStyle), x
|
|
26172
|
+
const attr = Object.assign({ html: Object.assign(Object.assign({ dom: subtext }, DEFAULT_HTML_TEXT_SPEC), subtextStyle), x,
|
|
26173
|
+
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,
|
|
26174
|
+
wordBreak, maxHeight: subTitleMaxHeight !== null && subTitleMaxHeight !== void 0 ? subTitleMaxHeight : maxSubTextHeight, maxWidth: subTitleMaxWidth !== null && subTitleMaxWidth !== void 0 ? subTitleMaxWidth : maxWidth, textConfig: [] }, subtextStyle);
|
|
25971
26175
|
this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
|
|
25972
26176
|
}
|
|
25973
26177
|
else if (isValid(subtext)) {
|
|
25974
|
-
this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: isArray(subtext) ? subtext : [subtext],
|
|
26178
|
+
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,
|
|
26179
|
+
ellipsis, x: 0, y: maintextHeight }), 'text');
|
|
25975
26180
|
}
|
|
25976
26181
|
}
|
|
25977
26182
|
const subtextHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;
|
|
25978
26183
|
const subtextWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
|
|
25979
26184
|
let titleWidth = Math.max(maintextWidth, subtextWidth);
|
|
25980
|
-
let titleHeight = maintextHeight + ((
|
|
26185
|
+
let titleHeight = maintextHeight + ((_q = subtextStyle.height) !== null && _q !== void 0 ? _q : subtextHeight);
|
|
25981
26186
|
if (isValid(width)) {
|
|
25982
26187
|
titleWidth = width;
|
|
25983
|
-
this._mainTitle && this._mainTitle.setAttribute('maxLineWidth', width);
|
|
25984
|
-
this._subTitle && this._subTitle.setAttribute('maxLineWidth', width);
|
|
25985
26188
|
}
|
|
25986
26189
|
if (isValid(height)) {
|
|
25987
26190
|
titleHeight = height;
|
|
@@ -25990,10 +26193,6 @@ class Title extends AbstractComponent {
|
|
|
25990
26193
|
titleWidth = minWidth;
|
|
25991
26194
|
}
|
|
25992
26195
|
if (isValid(maxWidth)) {
|
|
25993
|
-
this._mainTitle && this._mainTitle.setAttribute('maxLineWidth', maxWidth);
|
|
25994
|
-
this._subTitle && this._subTitle.setAttribute('maxLineWidth', maxWidth);
|
|
25995
|
-
this._mainTitle && this._mainTitle.setAttribute('maxWidth', maxWidth);
|
|
25996
|
-
this._subTitle && this._subTitle.setAttribute('maxWidth', maxWidth);
|
|
25997
26196
|
if (titleWidth > maxWidth) {
|
|
25998
26197
|
titleWidth = maxWidth;
|
|
25999
26198
|
}
|
|
@@ -26002,8 +26201,6 @@ class Title extends AbstractComponent {
|
|
|
26002
26201
|
titleHeight = minHeight;
|
|
26003
26202
|
}
|
|
26004
26203
|
if (isValid(maxHeight)) {
|
|
26005
|
-
this._mainTitle && this._mainTitle.setAttribute('maxHeight', maxHeight);
|
|
26006
|
-
this._subTitle && this._subTitle.setAttribute('maxHeight', maxHeight - maintextHeight);
|
|
26007
26204
|
if (titleHeight > maxHeight) {
|
|
26008
26205
|
titleHeight = maxHeight;
|
|
26009
26206
|
}
|
|
@@ -26014,7 +26211,7 @@ class Title extends AbstractComponent {
|
|
|
26014
26211
|
if (this._mainTitle) {
|
|
26015
26212
|
if (isValid(align) || isValid(textStyle.align)) {
|
|
26016
26213
|
const mainTitleAlign = textStyle.align ? textStyle.align : align;
|
|
26017
|
-
const mainTitleWidth = (
|
|
26214
|
+
const mainTitleWidth = (_r = textStyle.width) !== null && _r !== void 0 ? _r : maintextWidth;
|
|
26018
26215
|
if (mainTitleAlign === 'left') {
|
|
26019
26216
|
this._mainTitle.setAttribute('x', 0);
|
|
26020
26217
|
this._mainTitle.setAttribute('textAlign', 'left');
|
|
@@ -26048,7 +26245,7 @@ class Title extends AbstractComponent {
|
|
|
26048
26245
|
if (this._subTitle) {
|
|
26049
26246
|
if (isValid(align) || isValid(subtextStyle.align)) {
|
|
26050
26247
|
const subTitleAlign = subtextStyle.align ? subtextStyle.align : align;
|
|
26051
|
-
const subTitleWidth = (
|
|
26248
|
+
const subTitleWidth = (_s = subtextStyle.width) !== null && _s !== void 0 ? _s : subtextWidth;
|
|
26052
26249
|
if (subTitleAlign === 'left') {
|
|
26053
26250
|
this._subTitle.setAttribute('x', 0);
|
|
26054
26251
|
this._subTitle.setAttribute('textAlign', 'left');
|
|
@@ -26065,7 +26262,7 @@ class Title extends AbstractComponent {
|
|
|
26065
26262
|
if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
|
|
26066
26263
|
const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;
|
|
26067
26264
|
const subTitleYStart = maintextHeight;
|
|
26068
|
-
const subTitleHeight = (
|
|
26265
|
+
const subTitleHeight = (_t = subtextStyle.height) !== null && _t !== void 0 ? _t : 0;
|
|
26069
26266
|
if (subTitleVerticalAlign === 'top') {
|
|
26070
26267
|
this._subTitle.setAttribute('y', subTitleYStart);
|
|
26071
26268
|
this._subTitle.setAttribute('textBaseline', 'top');
|
|
@@ -28586,6 +28783,6 @@ EmptyTip.defaultAttributes = {
|
|
|
28586
28783
|
}
|
|
28587
28784
|
};
|
|
28588
28785
|
|
|
28589
|
-
const version = "0.20.
|
|
28786
|
+
const version = "0.20.3-alpha.0";
|
|
28590
28787
|
|
|
28591
|
-
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 };
|
|
28788
|
+
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 };
|