@visactor/vrender-components 0.13.8 → 0.13.9-alpha.5
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/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/arc.d.ts +69 -0
- package/cjs/label/arc.js +397 -0
- package/cjs/label/arc.js.map +1 -0
- package/cjs/label/base.d.ts +2 -1
- package/cjs/label/base.js +61 -22
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.js +3 -2
- package/cjs/label/dataLabel.js.map +1 -1
- package/cjs/label/index.d.ts +1 -0
- package/cjs/label/index.js +2 -1
- package/cjs/label/index.js.map +1 -1
- package/cjs/label/type.d.ts +41 -1
- package/cjs/label/type.js.map +1 -1
- package/cjs/label/util.d.ts +12 -0
- package/cjs/label/util.js +113 -0
- package/cjs/label/util.js.map +1 -0
- package/cjs/link-path/type.js +1 -2
- package/cjs/marker/base.js +2 -1
- package/cjs/pager/index.js +1 -1
- package/cjs/pager/pager.js +1 -1
- package/dist/index.js +843 -26
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/arc.d.ts +69 -0
- package/es/label/arc.js +387 -0
- package/es/label/arc.js.map +1 -0
- package/es/label/base.d.ts +2 -1
- package/es/label/base.js +61 -22
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.js +4 -1
- package/es/label/dataLabel.js.map +1 -1
- package/es/label/index.d.ts +1 -0
- package/es/label/index.js +2 -0
- package/es/label/index.js.map +1 -1
- package/es/label/type.d.ts +41 -1
- package/es/label/type.js.map +1 -1
- package/es/label/util.d.ts +12 -0
- package/es/label/util.js +99 -0
- package/es/label/util.js.map +1 -0
- package/es/link-path/type.js +1 -2
- package/es/marker/base.js +2 -1
- package/es/pager/index.js +1 -1
- package/es/pager/pager.js +1 -1
- package/package.json +4 -4
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
|
-
}), exports.version = void 0, exports.version = "0.13.
|
|
20
|
+
}), exports.version = void 0, exports.version = "0.13.9-alpha.5", __exportStar(require("./core/base"), exports),
|
|
21
21
|
__exportStar(require("./scrollbar"), exports), __exportStar(require("./tag"), exports),
|
|
22
22
|
__exportStar(require("./poptip"), exports), __exportStar(require("./crosshair"), exports),
|
|
23
23
|
__exportStar(require("./label"), exports), __exportStar(require("./axis"), exports),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.13.9-alpha.5\";\n\nexport * from './core/base';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './interface';\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { IBoundsLike } from '@visactor/vutils';
|
|
2
|
+
import { LabelBase } from './base';
|
|
3
|
+
import type { ArcLabelAttrs, IPoint, Quadrant } from './type';
|
|
4
|
+
import type { BaseLabelAttrs } from './type';
|
|
5
|
+
import type { TextAlignType, TextBaselineType } from '@visactor/vrender';
|
|
6
|
+
import type { IGraphic } from '@visactor/vrender';
|
|
7
|
+
export declare class ArcInfo {
|
|
8
|
+
key: string;
|
|
9
|
+
refDatum: any;
|
|
10
|
+
center: IPoint;
|
|
11
|
+
outerCenter: IPoint;
|
|
12
|
+
labelSize: {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
labelPosition: IPoint;
|
|
17
|
+
labelLimit: number;
|
|
18
|
+
labelVisible: boolean;
|
|
19
|
+
lastLabelY: number;
|
|
20
|
+
labelYRange: [number, number];
|
|
21
|
+
labelText: string | string[];
|
|
22
|
+
pointA: IPoint;
|
|
23
|
+
pointB: IPoint;
|
|
24
|
+
pointC: IPoint;
|
|
25
|
+
quadrant: Quadrant;
|
|
26
|
+
radian: number;
|
|
27
|
+
middleAngle: number;
|
|
28
|
+
k: number;
|
|
29
|
+
textAlign: TextAlignType;
|
|
30
|
+
textBaseline: TextBaselineType;
|
|
31
|
+
angle: number;
|
|
32
|
+
constructor(refDatum: any, center: IPoint, outerCenter: IPoint, quadrant: Quadrant, radian: number, middleAngle: number);
|
|
33
|
+
getLabelBounds(): IBoundsLike;
|
|
34
|
+
}
|
|
35
|
+
export declare class ArcLabel extends LabelBase<ArcLabelAttrs> {
|
|
36
|
+
name: string;
|
|
37
|
+
static defaultAttributes: Partial<ArcLabelAttrs>;
|
|
38
|
+
private _ellipsisWidth;
|
|
39
|
+
private _arcLeft;
|
|
40
|
+
private _arcRight;
|
|
41
|
+
constructor(attributes: ArcLabelAttrs);
|
|
42
|
+
protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position: string, offset: number, graphicAttributes: any, textData: any, width: number, height: number, attribute: any): {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
} | undefined;
|
|
46
|
+
protected layoutArcLabels(position: BaseLabelAttrs['position'], attribute: any, currentMarks?: IGraphic[]): ArcInfo[];
|
|
47
|
+
private _layoutInsideLabels;
|
|
48
|
+
private _layoutOutsideLabels;
|
|
49
|
+
private _computeX;
|
|
50
|
+
private _computeAlignOffset;
|
|
51
|
+
private _computeAlign;
|
|
52
|
+
private _getFormatLabelText;
|
|
53
|
+
private _adjustY;
|
|
54
|
+
private _shiftY;
|
|
55
|
+
private _findNextVisibleIndex;
|
|
56
|
+
private _computePointB;
|
|
57
|
+
private _storeY;
|
|
58
|
+
private _computeYRange;
|
|
59
|
+
private _computeLayoutRadius;
|
|
60
|
+
private _findNeighborIndex;
|
|
61
|
+
private _twoWayShift;
|
|
62
|
+
private _restoreY;
|
|
63
|
+
private _checkYRange;
|
|
64
|
+
private _coverLabels;
|
|
65
|
+
protected computeRadius(r: number, width?: number, height?: number, k?: number): number;
|
|
66
|
+
protected computeLayoutRadius(width: number, height: number): number;
|
|
67
|
+
private computeLayoutOuterRadius;
|
|
68
|
+
private computeDatumRadius;
|
|
69
|
+
}
|
package/cjs/label/arc.js
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.ArcLabel = exports.ArcInfo = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), base_1 = require("./base"), vutils_2 = require("@visactor/vutils"), util_1 = require("./util");
|
|
8
|
+
|
|
9
|
+
class ArcInfo {
|
|
10
|
+
constructor(refDatum, center, outerCenter, quadrant, radian, middleAngle) {
|
|
11
|
+
this.refDatum = refDatum, this.center = center, this.outerCenter = outerCenter,
|
|
12
|
+
this.quadrant = quadrant, this.radian = radian, this.middleAngle = middleAngle,
|
|
13
|
+
this.labelVisible = !0, this.labelLimit = 0;
|
|
14
|
+
}
|
|
15
|
+
getLabelBounds() {
|
|
16
|
+
return this.labelPosition && this.labelSize ? {
|
|
17
|
+
x1: this.labelPosition.x - this.labelSize.width / 2,
|
|
18
|
+
y1: this.labelPosition.y - this.labelSize.height / 2,
|
|
19
|
+
x2: this.labelPosition.x + this.labelSize.width / 2,
|
|
20
|
+
y2: this.labelPosition.y + this.labelSize.height / 2
|
|
21
|
+
} : {
|
|
22
|
+
x1: 0,
|
|
23
|
+
x2: 0,
|
|
24
|
+
y1: 0,
|
|
25
|
+
y2: 0
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.ArcInfo = ArcInfo;
|
|
31
|
+
|
|
32
|
+
class ArcLabel extends base_1.LabelBase {
|
|
33
|
+
constructor(attributes) {
|
|
34
|
+
super((0, vutils_1.merge)({}, ArcLabel.defaultAttributes, attributes)), this.name = "arc-label",
|
|
35
|
+
this._ellipsisWidth = 0, this._arcLeft = new Map, this._arcRight = new Map;
|
|
36
|
+
}
|
|
37
|
+
labeling(textBounds, graphicBounds, position = "outside", offset = 0, graphicAttributes, textData, width, height, attribute) {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
if (!textBounds || !graphicBounds) return;
|
|
40
|
+
const radiusRatio = this.computeLayoutOuterRadius(graphicAttributes.outerRadius, width, height), radius = this.computeRadius(radiusRatio, width, height), center = {
|
|
41
|
+
x: null !== (_a = null == graphicAttributes ? void 0 : graphicAttributes.x) && void 0 !== _a ? _a : 0,
|
|
42
|
+
y: null !== (_b = null == graphicAttributes ? void 0 : graphicAttributes.y) && void 0 !== _b ? _b : 0
|
|
43
|
+
}, item = textData, arcMiddleAngle = (graphicAttributes.startAngle + graphicAttributes.endAngle) / 2, intervalAngle = graphicAttributes.endAngle - graphicAttributes.startAngle, arcQuadrant = (0,
|
|
44
|
+
util_1.computeQuadrant)(graphicAttributes.endAngle - intervalAngle / 2), arcMiddle = (0,
|
|
45
|
+
util_1.circlePoint)(center.x, center.y, graphicAttributes.outerRadius, arcMiddleAngle), outerArcMiddle = (0,
|
|
46
|
+
util_1.circlePoint)(center.x, center.y, radius + attribute.line.line1MinLength, arcMiddleAngle), arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle);
|
|
47
|
+
arc.pointA = (0, util_1.circlePoint)(center.x, center.y, this.computeDatumRadius(2 * center.x, 2 * center.y, graphicAttributes.outerRadius), arc.middleAngle),
|
|
48
|
+
arc.labelSize = {
|
|
49
|
+
width: textBounds.x2 - textBounds.x1,
|
|
50
|
+
height: textBounds.y2 - textBounds.y1
|
|
51
|
+
}, (0, util_1.isQuadrantRight)(arc.quadrant) ? (arc.textAlign = "left", arc.textBaseline = "middle",
|
|
52
|
+
this._arcRight.set(arc.refDatum, arc)) : (0, util_1.isQuadrantLeft)(arc.quadrant) && (arc.textAlign = "right",
|
|
53
|
+
arc.textBaseline = "middle", this._arcLeft.set(arc.refDatum, arc));
|
|
54
|
+
}
|
|
55
|
+
layoutArcLabels(position, attribute, currentMarks) {
|
|
56
|
+
const leftArcs = Array.from(this._arcLeft.values()), rightArcs = Array.from(this._arcRight.values()), arcs = [];
|
|
57
|
+
return "inside" === position ? (arcs.push(...this._layoutInsideLabels(rightArcs, attribute, currentMarks)),
|
|
58
|
+
arcs.push(...this._layoutInsideLabels(leftArcs, attribute, currentMarks))) : (arcs.push(...this._layoutOutsideLabels(rightArcs, attribute, currentMarks)),
|
|
59
|
+
arcs.push(...this._layoutOutsideLabels(leftArcs, attribute, currentMarks))), arcs;
|
|
60
|
+
}
|
|
61
|
+
_layoutInsideLabels(arcs, attribute, currentMarks) {
|
|
62
|
+
var _a, _b, _c, _d;
|
|
63
|
+
const center = {
|
|
64
|
+
x: null !== (_b = null === (_a = currentMarks[0].attribute) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : 0,
|
|
65
|
+
y: null !== (_d = null === (_c = currentMarks[0].attribute) || void 0 === _c ? void 0 : _c.y) && void 0 !== _d ? _d : 0
|
|
66
|
+
}, innerRadiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.innerRadius, attribute.width, attribute.height), outerRadiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height), labelConfig = attribute, spaceWidth = labelConfig.spaceWidth;
|
|
67
|
+
return arcs.forEach((arc => {
|
|
68
|
+
const {labelSize: labelSize, radian: radian} = arc, innerRadius = this.computeRadius(innerRadiusRatio, attribute.width, attribute.height, 1), outerRadius = this.computeRadius(outerRadiusRatio, attribute.width, attribute.height, 1);
|
|
69
|
+
let limit;
|
|
70
|
+
if (radian < (0, util_1.connectLineRadian)(outerRadius, labelSize.height)) limit = 0; else {
|
|
71
|
+
let minRadius;
|
|
72
|
+
minRadius = radian >= Math.PI ? innerRadius : Math.max(innerRadius, labelSize.height / 2 / Math.tan(radian / 2)),
|
|
73
|
+
limit = outerRadius - minRadius - spaceWidth;
|
|
74
|
+
}
|
|
75
|
+
!0 !== (null == labelConfig ? void 0 : labelConfig.rotate) && (limit = outerRadius - spaceWidth);
|
|
76
|
+
const text = this._getFormatLabelText(arc.refDatum, limit);
|
|
77
|
+
arc.labelText = text;
|
|
78
|
+
const labelWidth = Math.min(limit, arc.labelSize.width), align = this._computeAlign(arc, attribute), labelRadius = outerRadius - spaceWidth - ("left" === align ? labelWidth : "right" === align ? 0 : labelWidth / 2);
|
|
79
|
+
arc.labelPosition = (0, util_1.circlePoint)(center.x, center.y, labelRadius, arc.middleAngle),
|
|
80
|
+
arc.labelLimit = labelWidth, (0, vutils_2.isGreater)(labelWidth, 0) || (arc.labelVisible = !1),
|
|
81
|
+
arc.textAlign = "center", arc.textBaseline = "middle", arc.angle = arc.middleAngle;
|
|
82
|
+
})), arcs;
|
|
83
|
+
}
|
|
84
|
+
_layoutOutsideLabels(arcs, attribute, currentMarks) {
|
|
85
|
+
var _a, _b, _c, _d, _e;
|
|
86
|
+
const center_x = null !== (_b = null === (_a = currentMarks[0].attribute) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : 0, height = 2 * (null !== (_d = null === (_c = currentMarks[0].attribute) || void 0 === _c ? void 0 : _c.y) && void 0 !== _d ? _d : 0), line2MinLength = attribute.line.line2MinLength, labelLayout = attribute.layout, spaceWidth = attribute.spaceWidth;
|
|
87
|
+
if (arcs.forEach((arc => {
|
|
88
|
+
const direction = (0, util_1.isQuadrantLeft)(arc.quadrant) ? -1 : 1;
|
|
89
|
+
arc.labelPosition = {
|
|
90
|
+
x: arc.outerCenter.x + direction * (arc.labelSize.width / 2 + line2MinLength + spaceWidth),
|
|
91
|
+
y: arc.outerCenter.y
|
|
92
|
+
};
|
|
93
|
+
})), arcs.sort(((a, b) => a.labelPosition.y - b.labelPosition.y)), !1 !== attribute.coverEnable || "none" === labelLayout.strategy) {
|
|
94
|
+
for (const arc of arcs) {
|
|
95
|
+
const {labelPosition: labelPosition, labelSize: labelSize} = arc;
|
|
96
|
+
arc.labelLimit = labelSize.width, arc.pointB = (0, util_1.isQuadrantLeft)(arc.quadrant) ? {
|
|
97
|
+
x: labelPosition.x + labelSize.width / 2 + line2MinLength + spaceWidth,
|
|
98
|
+
y: labelPosition.y
|
|
99
|
+
} : {
|
|
100
|
+
x: labelPosition.x - labelSize.width / 2 - line2MinLength - spaceWidth,
|
|
101
|
+
y: labelPosition.y
|
|
102
|
+
}, this._computeX(arc, attribute, currentMarks);
|
|
103
|
+
}
|
|
104
|
+
!1 === attribute.coverEnable && "none" === labelLayout.strategy && this._coverLabels(arcs);
|
|
105
|
+
} else {
|
|
106
|
+
const maxLabels = height / ((null === (_e = attribute.textStyle) || void 0 === _e ? void 0 : _e.fontSize) || 16);
|
|
107
|
+
this._adjustY(arcs, maxLabels, attribute, currentMarks);
|
|
108
|
+
const {minY: minY, maxY: maxY} = arcs.reduce(((yInfo, arc) => {
|
|
109
|
+
const {y1: y1, y2: y2} = arc.getLabelBounds();
|
|
110
|
+
return yInfo.minY = Math.max(0, Math.min(y1, yInfo.minY)), yInfo.maxY = Math.min(height, Math.max(y2, yInfo.maxY)),
|
|
111
|
+
yInfo;
|
|
112
|
+
}), {
|
|
113
|
+
minY: 1 / 0,
|
|
114
|
+
maxY: -1 / 0
|
|
115
|
+
}), halfY = Math.max(Math.abs(height / 2 - minY), Math.abs(maxY - height / 2)), r = this._computeLayoutRadius(halfY, attribute, currentMarks);
|
|
116
|
+
for (const arc of arcs) this._computePointB(arc, r, attribute, currentMarks), this._computeX(arc, attribute, currentMarks);
|
|
117
|
+
}
|
|
118
|
+
const width = 2 * center_x;
|
|
119
|
+
return arcs.forEach((arc => {
|
|
120
|
+
arc.labelVisible && ((0, vutils_2.isLess)(arc.pointB.x, line2MinLength + spaceWidth) || (0,
|
|
121
|
+
vutils_2.isGreater)(arc.pointB.x, width - line2MinLength - spaceWidth)) && (arc.labelVisible = !1),
|
|
122
|
+
arc.angle = 0;
|
|
123
|
+
})), arcs;
|
|
124
|
+
}
|
|
125
|
+
_computeX(arc, attribute, currentMarks) {
|
|
126
|
+
var _a, _b, _c, _d, _e;
|
|
127
|
+
const center_x = null !== (_b = null === (_a = currentMarks[0].attribute) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : 0, plotLayout_width = 2 * center_x, radiusRatio = (_d = null === (_c = currentMarks[0].attribute) || void 0 === _c ? void 0 : _c.y,
|
|
128
|
+
this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height)), line1MinLength = attribute.line.line1MinLength, line2MinLength = attribute.line.line2MinLength, labelLayoutAlign = null === (_e = attribute.layout) || void 0 === _e ? void 0 : _e.align, spaceWidth = attribute.spaceWidth, align = this._computeAlign(arc, attribute), {labelPosition: labelPosition, quadrant: quadrant, pointB: pointB} = arc;
|
|
129
|
+
(0, vutils_2.isValidNumber)(pointB.x * pointB.y) || (arc.pointC = {
|
|
130
|
+
x: NaN,
|
|
131
|
+
y: NaN
|
|
132
|
+
}, labelPosition.x = NaN, arc.labelLimit = 0);
|
|
133
|
+
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height), flag = (0,
|
|
134
|
+
util_1.isQuadrantLeft)(quadrant) ? -1 : 1;
|
|
135
|
+
let cx = 0;
|
|
136
|
+
let limit = (flag > 0 ? plotLayout_width - pointB.x : pointB.x) - line2MinLength - spaceWidth;
|
|
137
|
+
"labelLine" === labelLayoutAlign && (cx = (radius + line1MinLength + line2MinLength) * flag + center_x,
|
|
138
|
+
limit = (flag > 0 ? plotLayout_width - cx : cx) - spaceWidth);
|
|
139
|
+
const text = this._getFormatLabelText(arc.refDatum, limit);
|
|
140
|
+
arc.labelText = text;
|
|
141
|
+
let labelWidth = Math.min(limit, arc.labelSize.width);
|
|
142
|
+
switch (labelLayoutAlign) {
|
|
143
|
+
case "labelLine":
|
|
144
|
+
break;
|
|
145
|
+
|
|
146
|
+
case "edge":
|
|
147
|
+
cx = flag > 0 ? plotLayout_width - labelWidth - spaceWidth : labelWidth + spaceWidth;
|
|
148
|
+
break;
|
|
149
|
+
|
|
150
|
+
default:
|
|
151
|
+
cx = pointB.x + flag * line2MinLength;
|
|
152
|
+
}
|
|
153
|
+
if (labelWidth = Math.max(this._ellipsisWidth, labelWidth), arc.pointC = {
|
|
154
|
+
x: cx,
|
|
155
|
+
y: labelPosition.y
|
|
156
|
+
}, "edge" === labelLayoutAlign) {
|
|
157
|
+
const alignOffset = this._computeAlignOffset(align, labelWidth, -flag);
|
|
158
|
+
labelPosition.x = flag > 0 ? plotLayout_width + alignOffset : alignOffset;
|
|
159
|
+
} else {
|
|
160
|
+
const alignOffset = this._computeAlignOffset(align, labelWidth, flag);
|
|
161
|
+
labelPosition.x = cx + alignOffset + flag * spaceWidth;
|
|
162
|
+
}
|
|
163
|
+
arc.labelLimit = labelWidth;
|
|
164
|
+
}
|
|
165
|
+
_computeAlignOffset(align, labelWidth, alignFlag) {
|
|
166
|
+
switch (align) {
|
|
167
|
+
case "left":
|
|
168
|
+
return alignFlag < 0 ? -labelWidth : 0;
|
|
169
|
+
|
|
170
|
+
case "right":
|
|
171
|
+
return alignFlag < 0 ? 0 : labelWidth;
|
|
172
|
+
|
|
173
|
+
default:
|
|
174
|
+
return labelWidth / 2 * alignFlag;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
_computeAlign(arc, attribute) {
|
|
178
|
+
var _a, _b, _c, _d, _e, _f;
|
|
179
|
+
const labelConfig = attribute, textAlign = null !== (_b = null === (_a = labelConfig.textStyle) || void 0 === _a ? void 0 : _a.textAlign) && void 0 !== _b ? _b : null === (_c = labelConfig.textStyle) || void 0 === _c ? void 0 : _c.align, layoutAlign = null !== (_e = null === (_d = labelConfig.layout) || void 0 === _d ? void 0 : _d.textAlign) && void 0 !== _e ? _e : null === (_f = labelConfig.layout) || void 0 === _f ? void 0 : _f.align;
|
|
180
|
+
return "inside" !== labelConfig.position ? (0, vutils_2.isNil)(textAlign) || "auto" === textAlign ? "edge" === layoutAlign ? (0,
|
|
181
|
+
util_1.isQuadrantLeft)(arc.quadrant) ? "left" : "right" : (0, util_1.isQuadrantLeft)(arc.quadrant) ? "right" : "left" : textAlign : (0,
|
|
182
|
+
vutils_2.isNil)(textAlign) || "auto" === textAlign ? "center" : textAlign;
|
|
183
|
+
}
|
|
184
|
+
_getFormatLabelText(value, limit) {
|
|
185
|
+
return value.text;
|
|
186
|
+
}
|
|
187
|
+
_adjustY(arcs, maxLabels, attribute, currentMarks) {
|
|
188
|
+
var _a, _b, _c, _d;
|
|
189
|
+
_b = null === (_a = currentMarks[0].attribute) || void 0 === _a ? void 0 : _a.x;
|
|
190
|
+
const plotRect_height = 2 * (null !== (_d = null === (_c = currentMarks[0].attribute) || void 0 === _c ? void 0 : _c.y) && void 0 !== _d ? _d : 0), labelLayout = attribute.layout;
|
|
191
|
+
if ("vertical" === labelLayout.strategy) {
|
|
192
|
+
let delta, lastY = 0;
|
|
193
|
+
const len = arcs.length;
|
|
194
|
+
if (len <= 0) return;
|
|
195
|
+
for (let i = 0; i < len; i++) {
|
|
196
|
+
const {y1: y1} = arcs[i].getLabelBounds();
|
|
197
|
+
if (delta = y1 - lastY, (0, vutils_2.isLess)(delta, 0)) {
|
|
198
|
+
const index = this._shiftY(arcs, i, len - 1, -delta);
|
|
199
|
+
this._shiftY(arcs, index, 0, delta / 2);
|
|
200
|
+
}
|
|
201
|
+
const {y2: y2} = arcs[i].getLabelBounds();
|
|
202
|
+
lastY = y2;
|
|
203
|
+
}
|
|
204
|
+
const {y1: firstY1} = arcs[0].getLabelBounds();
|
|
205
|
+
delta = firstY1 - 0, (0, vutils_2.isLess)(delta, 0) && this._shiftY(arcs, 0, len - 1, -delta);
|
|
206
|
+
for (let i = arcs.length - 1; i >= 0 && arcs[i].getLabelBounds().y2 > plotRect_height; i--) arcs[i].labelVisible = !1;
|
|
207
|
+
} else if ("none" !== labelLayout.strategy) {
|
|
208
|
+
const priorityArcs = arcs.map(((arc, i) => ({
|
|
209
|
+
arc: arc,
|
|
210
|
+
originIndex: i,
|
|
211
|
+
priorityIndex: 0
|
|
212
|
+
})));
|
|
213
|
+
priorityArcs.sort(((a, b) => b.arc.radian - a.arc.radian)), priorityArcs.forEach(((priorityArc, i) => {
|
|
214
|
+
priorityArc.priorityIndex = i, priorityArc.arc.labelVisible = !1;
|
|
215
|
+
}));
|
|
216
|
+
let topLabelIndex = 1 / 0, bottomLabelIndex = -1 / 0;
|
|
217
|
+
for (let i = 0; i < maxLabels && i < arcs.length; i++) {
|
|
218
|
+
this._storeY(arcs);
|
|
219
|
+
const arc = priorityArcs[i].arc;
|
|
220
|
+
this._computeYRange(arc, attribute, currentMarks), arc.labelVisible = !0;
|
|
221
|
+
const curY = arc.labelPosition.y, {lastIndex: lastIndex, nextIndex: nextIndex} = this._findNeighborIndex(arcs, priorityArcs[i]), lastArc = arcs[lastIndex], nextArc = arcs[nextIndex];
|
|
222
|
+
if (-1 === lastIndex && -1 !== nextIndex) {
|
|
223
|
+
const nextY = nextArc.labelPosition.y;
|
|
224
|
+
curY > nextY ? arc.labelPosition.y = nextY - nextArc.labelSize.height / 2 - arc.labelSize.height / 2 : this._twoWayShift(arcs, arc, nextArc, nextIndex);
|
|
225
|
+
} else if (-1 !== lastIndex && -1 === nextIndex) {
|
|
226
|
+
const lastY = lastArc.labelPosition.y;
|
|
227
|
+
curY < lastY ? arc.labelPosition.y = lastY + lastArc.labelSize.height / 2 + arc.labelSize.height / 2 : this._twoWayShift(arcs, lastArc, arc, priorityArcs[i].originIndex);
|
|
228
|
+
} else if (-1 !== lastIndex && -1 !== nextIndex) {
|
|
229
|
+
const lastY = lastArc.labelPosition.y, nextY = nextArc.labelPosition.y;
|
|
230
|
+
curY > nextY ? (arc.labelPosition.y = nextY - nextArc.labelSize.height / 2 - arc.labelSize.height / 2,
|
|
231
|
+
this._twoWayShift(arcs, lastArc, arc, priorityArcs[i].originIndex)) : curY < lastY ? (arc.labelPosition.y = lastY + lastArc.labelSize.height / 2 + arc.labelSize.height / 2,
|
|
232
|
+
this._twoWayShift(arcs, arc, nextArc, nextIndex)) : (this._twoWayShift(arcs, lastArc, arc, priorityArcs[i].originIndex),
|
|
233
|
+
this._twoWayShift(arcs, arc, nextArc, nextIndex));
|
|
234
|
+
}
|
|
235
|
+
const nextTopIndex = Math.min(topLabelIndex, priorityArcs[i].originIndex), nextBottomIndex = Math.max(bottomLabelIndex, priorityArcs[i].originIndex);
|
|
236
|
+
let delta;
|
|
237
|
+
if (delta = arcs[nextBottomIndex].getLabelBounds().y2 - plotRect_height, (0, vutils_2.isGreater)(delta, 0) && this._shiftY(arcs, nextBottomIndex, 0, -delta),
|
|
238
|
+
delta = arcs[nextTopIndex].getLabelBounds().y1 - 0, (0, vutils_2.isLess)(delta, 0) && this._shiftY(arcs, nextTopIndex, arcs.length - 1, -delta),
|
|
239
|
+
delta = arcs[nextBottomIndex].getLabelBounds().y2 - plotRect_height, (0, vutils_2.isGreater)(delta, 0)) {
|
|
240
|
+
arc.labelVisible = !1, this._restoreY(arcs);
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
labelLayout.tangentConstraint && !this._checkYRange(arcs) ? (arc.labelVisible = !1,
|
|
244
|
+
this._restoreY(arcs)) : (topLabelIndex = nextTopIndex, bottomLabelIndex = nextBottomIndex);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
_shiftY(arcs, start, end, delta) {
|
|
249
|
+
const direction = start < end ? 1 : -1;
|
|
250
|
+
let index = start;
|
|
251
|
+
for (;-1 !== index; ) {
|
|
252
|
+
arcs[index].labelPosition.y += delta;
|
|
253
|
+
const nextIndex = this._findNextVisibleIndex(arcs, index, end, direction);
|
|
254
|
+
if (nextIndex >= 0 && nextIndex < arcs.length) {
|
|
255
|
+
const {y1: curY1, y2: curY2} = arcs[index].getLabelBounds(), {y1: nextY1, y2: nextY2} = arcs[nextIndex].getLabelBounds();
|
|
256
|
+
if (direction > 0 && curY2 < nextY1 || direction < 0 && curY1 > nextY2) return index;
|
|
257
|
+
}
|
|
258
|
+
index = nextIndex;
|
|
259
|
+
}
|
|
260
|
+
return end;
|
|
261
|
+
}
|
|
262
|
+
_findNextVisibleIndex(arcs, start, end, direction) {
|
|
263
|
+
const diff = (end - start) * direction;
|
|
264
|
+
for (let i = 1; i <= diff; i++) {
|
|
265
|
+
const index = start + i * direction;
|
|
266
|
+
if (arcs[index].labelVisible) return index;
|
|
267
|
+
}
|
|
268
|
+
return -1;
|
|
269
|
+
}
|
|
270
|
+
_computePointB(arc, r, attribute, currentMarks) {
|
|
271
|
+
var _a, _b, _c, _d;
|
|
272
|
+
const labelConfig = attribute, radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height), line1MinLength = labelConfig.line.line1MinLength;
|
|
273
|
+
if ("none" === labelConfig.layout.strategy) arc.pointB = {
|
|
274
|
+
x: arc.outerCenter.x,
|
|
275
|
+
y: arc.outerCenter.y
|
|
276
|
+
}; else {
|
|
277
|
+
const center = {
|
|
278
|
+
x: null !== (_b = null === (_a = currentMarks[0].attribute) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : 0,
|
|
279
|
+
y: null !== (_d = null === (_c = currentMarks[0].attribute) || void 0 === _c ? void 0 : _c.y) && void 0 !== _d ? _d : 0
|
|
280
|
+
}, radius = this.computeRadius(radiusRatio, attribute.width, attribute.height), {labelPosition: labelPosition, quadrant: quadrant} = arc, rd = r - Math.max(radius + line1MinLength, currentMarks[0].attribute.outerRadius), x = Math.sqrt(r ** 2 - Math.abs(center.y - labelPosition.y) ** 2) - rd;
|
|
281
|
+
(0, vutils_2.isValidNumber)(x) ? arc.pointB = {
|
|
282
|
+
x: center.x + x * ((0, util_1.isQuadrantLeft)(quadrant) ? -1 : 1),
|
|
283
|
+
y: labelPosition.y
|
|
284
|
+
} : arc.pointB = {
|
|
285
|
+
x: NaN,
|
|
286
|
+
y: NaN
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
_storeY(arcs) {
|
|
291
|
+
for (const arc of arcs) arc.labelVisible && (arc.lastLabelY = arc.labelPosition.y);
|
|
292
|
+
}
|
|
293
|
+
_computeYRange(arc, attribute, currentMarks) {
|
|
294
|
+
var _a, _b, _c, _d;
|
|
295
|
+
const plotRect = {
|
|
296
|
+
width: 2 * (null !== (_b = null === (_a = currentMarks[0].attribute) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : 0),
|
|
297
|
+
height: 2 * (null !== (_d = null === (_c = currentMarks[0].attribute) || void 0 === _c ? void 0 : _c.y) && void 0 !== _d ? _d : 0)
|
|
298
|
+
}, radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height), line1MinLength = attribute.line.line1MinLength, {width: width, height: height} = plotRect, radius = this.computeRadius(radiusRatio, attribute.width, attribute.height), r = this._computeLayoutRadius(height / 2, attribute, currentMarks), cx = Math.abs(arc.center.x - width / 2), cy = arc.center.y - height / 2;
|
|
299
|
+
let a, b, c;
|
|
300
|
+
if ((0, vutils_2.isNumberClose)(width / 2, cx)) a = 0, b = 1, c = -cy; else if ((0,
|
|
301
|
+
vutils_2.isNumberClose)(height / 2, cy)) a = 1, b = 0, c = -cx; else {
|
|
302
|
+
const k = -1 / (cy / cx);
|
|
303
|
+
a = k, b = -1, c = cy - k * cx;
|
|
304
|
+
}
|
|
305
|
+
const points = (0, util_1.lineCirclePoints)(a, b, c, line1MinLength + radius - r, 0, r);
|
|
306
|
+
if (points.length < 2) return;
|
|
307
|
+
let min, max;
|
|
308
|
+
points[0].x > points[1].x && points.reverse(), points[0].x < 0 ? (0, vutils_2.isNumberClose)(points[0].y, points[1].y) ? Math.abs(arc.middleAngle) < Math.PI / 2 ? (min = 0,
|
|
309
|
+
max = points[1].y + height / 2) : (min = points[1].y + height / 2, max = height) : points[0].y < points[1].y ? (min = 0,
|
|
310
|
+
max = points[1].y + height / 2) : (min = points[1].y + height / 2, max = plotRect.height) : (min = Math.min(points[0].y, points[1].y) + height / 2,
|
|
311
|
+
max = Math.max(points[0].y, points[1].y) + height / 2), arc.labelYRange = [ min, max ];
|
|
312
|
+
}
|
|
313
|
+
_computeLayoutRadius(halfYLength, attribute, currentMarks) {
|
|
314
|
+
const labelConfig = attribute, layoutArcGap = labelConfig.layoutArcGap, line1MinLength = labelConfig.line.line1MinLength, radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height), outerR = this.computeRadius(radiusRatio, attribute.width, attribute.height) + line1MinLength, a = outerR - layoutArcGap;
|
|
315
|
+
return Math.max((a ** 2 + halfYLength ** 2) / (2 * a), outerR);
|
|
316
|
+
}
|
|
317
|
+
_findNeighborIndex(arcs, priorityArc) {
|
|
318
|
+
const index = priorityArc.originIndex;
|
|
319
|
+
let lastIndex = -1, nextIndex = -1;
|
|
320
|
+
for (let i = index - 1; i >= 0; i--) if (arcs[i].labelVisible) {
|
|
321
|
+
lastIndex = i;
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
for (let i = index + 1; i < arcs.length; i++) if (arcs[i].labelVisible) {
|
|
325
|
+
nextIndex = i;
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
lastIndex: lastIndex,
|
|
330
|
+
nextIndex: nextIndex
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
_twoWayShift(arcs, lastArc, nextArc, nextIndex) {
|
|
334
|
+
const delta = nextArc.getLabelBounds().y1 - lastArc.getLabelBounds().y2;
|
|
335
|
+
if ((0, vutils_2.isLess)(delta, 0)) {
|
|
336
|
+
const i = this._shiftY(arcs, nextIndex, arcs.length - 1, -delta);
|
|
337
|
+
this._shiftY(arcs, i, 0, delta / 2);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
_restoreY(arcs) {
|
|
341
|
+
for (const arc of arcs) arc.labelVisible && (arc.labelPosition.y = arc.lastLabelY);
|
|
342
|
+
}
|
|
343
|
+
_checkYRange(arcs) {
|
|
344
|
+
for (const arc of arcs) {
|
|
345
|
+
const {labelYRange: labelYRange, labelPosition: labelPosition} = arc;
|
|
346
|
+
if (arc.labelVisible && labelYRange && ((0, vutils_2.isLess)(labelPosition.y, labelYRange[0]) || (0,
|
|
347
|
+
vutils_2.isGreater)(labelPosition.y, labelYRange[1]))) return !1;
|
|
348
|
+
}
|
|
349
|
+
return !0;
|
|
350
|
+
}
|
|
351
|
+
_coverLabels(arcs) {
|
|
352
|
+
if (arcs.length <= 1) return;
|
|
353
|
+
let lastBounds = arcs[0].getLabelBounds();
|
|
354
|
+
for (let i = 1; i < arcs.length; i++) {
|
|
355
|
+
const bounds = arcs[i].getLabelBounds();
|
|
356
|
+
(0, util_1.checkBoundsOverlap)(lastBounds, bounds) ? arcs[i].labelVisible = !1 : lastBounds = bounds;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
computeRadius(r, width, height, k) {
|
|
360
|
+
return this.computeLayoutRadius(width || 0, height || 0) * r * ((0, vutils_2.isNil)(k) ? 1 : k);
|
|
361
|
+
}
|
|
362
|
+
computeLayoutRadius(width, height) {
|
|
363
|
+
return Math.min(width / 2, height / 2);
|
|
364
|
+
}
|
|
365
|
+
computeLayoutOuterRadius(r, width, height) {
|
|
366
|
+
return r / (Math.min(width, height) / 2);
|
|
367
|
+
}
|
|
368
|
+
computeDatumRadius(width, height, outerRadius) {
|
|
369
|
+
const outerRadiusRatio = this.computeLayoutOuterRadius(outerRadius, width, height);
|
|
370
|
+
return this.computeLayoutRadius(width || 0, height || 0) * outerRadiusRatio;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
exports.ArcLabel = ArcLabel, ArcLabel.defaultAttributes = {
|
|
375
|
+
coverEnable: !1,
|
|
376
|
+
spaceWidth: 5,
|
|
377
|
+
layoutArcGap: 6,
|
|
378
|
+
textStyle: {
|
|
379
|
+
visible: !0,
|
|
380
|
+
fontSize: 14,
|
|
381
|
+
fontWeight: "normal",
|
|
382
|
+
fillOpacity: 1
|
|
383
|
+
},
|
|
384
|
+
position: "outside",
|
|
385
|
+
offset: 0,
|
|
386
|
+
line: {
|
|
387
|
+
visible: !0,
|
|
388
|
+
line1MinLength: 20,
|
|
389
|
+
line2MinLength: 10
|
|
390
|
+
},
|
|
391
|
+
layout: {
|
|
392
|
+
align: "arc",
|
|
393
|
+
strategy: "priority",
|
|
394
|
+
tangentConstraint: !0
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
//# sourceMappingURL=arc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["label/arc.ts"],"names":[],"mappings":";;;AACA,6CAAyC;AACzC,iCAAmC;AAInC,6CAAqG;AACrG,iCAQgB;AAGhB,MAAa,OAAO;IAgClB,YACE,QAAa,EACb,MAAc,EACd,WAAmB,EACnB,QAAkB,EAClB,MAAc,EACd,WAAmB;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K,EAAE,KAAK;QACZ,QAAQ,EAAE,UAAU;QACpB,iBAAiB,EAAE,IAAI;KACxB;CACF,CAAC","file":"arc.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport { merge } from '@visactor/vutils';\nimport { LabelBase } from './base';\nimport type { ArcLabelAttrs, IPoint, Quadrant, TextAlign } from './type';\nimport type { BaseLabelAttrs } from './type';\nimport type { TextAlignType, TextBaselineType } from '@visactor/vrender';\nimport { isValidNumber, isNil, isLess, isGreater, isNumberClose as isClose } from '@visactor/vutils';\nimport {\n circlePoint,\n isQuadrantRight,\n isQuadrantLeft,\n lineCirclePoints,\n connectLineRadian,\n checkBoundsOverlap,\n computeQuadrant\n} from './util';\nimport type { IGraphic } from '@visactor/vrender';\n\nexport class ArcInfo {\n key!: string;\n refDatum!: any;\n /**\n * 绘图区圆弧中点\n */\n center!: IPoint;\n /**\n * label起始区圆弧中点\n */\n outerCenter!: IPoint;\n labelSize!: { width: number; height: number };\n labelPosition!: IPoint;\n labelLimit: number;\n labelVisible: boolean;\n lastLabelY!: number;\n labelYRange!: [number, number];\n labelText!: string | string[];\n pointA!: IPoint;\n pointB!: IPoint;\n pointC!: IPoint;\n /**\n * 象限\n */\n quadrant: Quadrant;\n radian: number;\n middleAngle: number;\n k: number;\n textAlign: TextAlignType;\n textBaseline: TextBaselineType;\n angle: number;\n\n constructor(\n refDatum: any,\n center: IPoint,\n outerCenter: IPoint,\n quadrant: Quadrant,\n radian: number,\n middleAngle: number\n ) {\n this.refDatum = refDatum;\n this.center = center;\n this.outerCenter = outerCenter;\n this.quadrant = quadrant;\n this.radian = radian;\n this.middleAngle = middleAngle;\n this.labelVisible = true;\n this.labelLimit = 0;\n }\n\n getLabelBounds(): IBoundsLike {\n if (!this.labelPosition || !this.labelSize) {\n return { x1: 0, x2: 0, y1: 0, y2: 0 };\n }\n return {\n x1: this.labelPosition.x - this.labelSize.width / 2,\n y1: this.labelPosition.y - this.labelSize.height / 2,\n x2: this.labelPosition.x + this.labelSize.width / 2,\n y2: this.labelPosition.y + this.labelSize.height / 2\n };\n }\n}\n\ntype PriorityArc = {\n arc: ArcInfo;\n /**\n * 在初始 arc 数组中的索引\n */\n originIndex: number;\n priorityIndex: number;\n};\n\nexport class ArcLabel extends LabelBase<ArcLabelAttrs> {\n name = 'arc-label';\n\n static defaultAttributes: Partial<ArcLabelAttrs> = {\n // visible: true,\n // showRule: 'all',\n // rotate: true,\n coverEnable: false,\n spaceWidth: 5,\n layoutArcGap: 6,\n textStyle: {\n visible: true,\n fontSize: 14,\n fontWeight: 'normal',\n fillOpacity: 1\n },\n position: 'outside',\n offset: 0,\n line: {\n visible: true,\n line1MinLength: 20,\n line2MinLength: 10\n },\n layout: {\n align: 'arc',\n strategy: 'priority',\n tangentConstraint: true\n }\n };\n\n private _ellipsisWidth: number = 0;\n\n private _arcLeft: Map<any, ArcInfo> = new Map();\n private _arcRight: Map<any, ArcInfo> = new Map();\n\n constructor(attributes: ArcLabelAttrs) {\n super(merge({}, ArcLabel.defaultAttributes, attributes));\n }\n\n protected labeling(\n textBounds: IBoundsLike,\n graphicBounds: IBoundsLike,\n position = 'outside',\n offset = 0,\n graphicAttributes: any,\n textData: any,\n width: number,\n height: number,\n attribute: any\n ): { x: number; y: number } | undefined {\n if (!textBounds || !graphicBounds) {\n return;\n }\n\n // setArcs : 根据 arc 设置 datum 中对应的标签数据\n const radiusRatio = this.computeLayoutOuterRadius(graphicAttributes.outerRadius, width, height);\n const radius = this.computeRadius(radiusRatio, width, height);\n const center = { x: graphicAttributes?.x ?? 0, y: graphicAttributes?.y ?? 0 };\n\n const item = textData;\n\n const arcMiddleAngle = (graphicAttributes.startAngle + graphicAttributes.endAngle) / 2;\n const intervalAngle = graphicAttributes.endAngle - graphicAttributes.startAngle;\n const arcQuadrant = computeQuadrant(graphicAttributes.endAngle - intervalAngle / 2);\n\n const arcMiddle = circlePoint(center.x, center.y, graphicAttributes.outerRadius, arcMiddleAngle);\n const outerArcMiddle = circlePoint(center.x, center.y, radius + attribute.line.line1MinLength, arcMiddleAngle);\n const arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle);\n\n // refDatum: any,\n // center: IPoint,\n // outerCenter: IPoint,\n // quadrant: Quadrant,\n // radian: number,\n // middleAngle: number,\n // k: number\n\n arc.pointA = circlePoint(\n (center as IPoint).x,\n (center as IPoint).y,\n this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttributes.outerRadius),\n arc.middleAngle\n );\n\n arc.labelSize = {\n width: textBounds.x2 - textBounds.x1,\n height: textBounds.y2 - textBounds.y1\n };\n if (isQuadrantRight(arc.quadrant)) {\n arc.textAlign = 'left';\n arc.textBaseline = 'middle';\n this._arcRight.set(arc.refDatum, arc);\n } else if (isQuadrantLeft(arc.quadrant)) {\n arc.textAlign = 'right';\n arc.textBaseline = 'middle';\n this._arcLeft.set(arc.refDatum, arc);\n }\n\n // return { arcRight: this._arcRight, arcLeft: this._arcLeft };\n }\n\n // layoutLabels : 执行内部/外部标签的布局计算\n protected layoutArcLabels(position: BaseLabelAttrs['position'], attribute: any, currentMarks?: IGraphic[]) {\n const leftArcs = Array.from(this._arcLeft.values());\n const rightArcs = Array.from(this._arcRight.values());\n const arcs: ArcInfo[] = [];\n if (position === 'inside') {\n arcs.push(...this._layoutInsideLabels(rightArcs, attribute, currentMarks));\n arcs.push(...this._layoutInsideLabels(leftArcs, attribute, currentMarks));\n } else {\n arcs.push(...this._layoutOutsideLabels(rightArcs, attribute, currentMarks));\n arcs.push(...this._layoutOutsideLabels(leftArcs, attribute, currentMarks));\n }\n return arcs;\n }\n\n /**\n * 布局内部标签\n */\n private _layoutInsideLabels(arcs: ArcInfo[], attribute: any, currentMarks: any[]) {\n const center = { x: currentMarks[0].attribute?.x ?? 0, y: currentMarks[0].attribute?.y ?? 0 };\n const innerRadiusRatio = this.computeLayoutOuterRadius(\n currentMarks[0].attribute.innerRadius,\n attribute.width,\n attribute.height\n );\n const outerRadiusRatio = this.computeLayoutOuterRadius(\n currentMarks[0].attribute.outerRadius,\n attribute.width,\n attribute.height\n );\n const labelConfig = attribute;\n const spaceWidth = labelConfig.spaceWidth as number;\n\n arcs.forEach((arc: ArcInfo) => {\n const { labelSize, radian } = arc;\n const innerRadius = this.computeRadius(innerRadiusRatio, attribute.width, attribute.height, 1);\n const outerRadius = this.computeRadius(outerRadiusRatio, attribute.width, attribute.height, 1);\n const minRadian = connectLineRadian(outerRadius, labelSize.height);\n let limit;\n if (radian < minRadian) {\n limit = 0;\n } else {\n let minRadius;\n if (radian >= Math.PI) {\n minRadius = innerRadius;\n } else {\n minRadius = Math.max(innerRadius, labelSize.height / 2 / Math.tan(radian / 2));\n }\n limit = outerRadius - minRadius - spaceWidth;\n }\n // TODO: 对于不旋转的内部标签设置 limit 为 outerRadius\n if (labelConfig?.rotate !== true) {\n limit = outerRadius - spaceWidth;\n }\n const text = this._getFormatLabelText(arc.refDatum, limit);\n arc.labelText = text;\n const labelWidth = Math.min(limit, arc.labelSize.width);\n const align = this._computeAlign(arc, attribute);\n const alignOffset = align === 'left' ? labelWidth : align === 'right' ? 0 : labelWidth / 2;\n const labelRadius = outerRadius - spaceWidth - alignOffset;\n arc.labelPosition = circlePoint((center as IPoint).x, (center as IPoint).y, labelRadius, arc.middleAngle);\n arc.labelLimit = labelWidth;\n if (!isGreater(labelWidth, 0)) {\n arc.labelVisible = false;\n }\n (arc.textAlign = 'center'), (arc.textBaseline = 'middle');\n\n // arc.angle = degrees(arc.middleAngle);\n arc.angle = arc.middleAngle;\n });\n return arcs;\n }\n\n /**\n * 布局外部标签\n */\n private _layoutOutsideLabels(arcs: ArcInfo[], attribute: any, currentMarks: any[]) {\n const center = { x: currentMarks[0].attribute?.x ?? 0, y: currentMarks[0].attribute?.y ?? 0 };\n const height = center.y * 2;\n const line2MinLength = attribute.line.line2MinLength as number;\n const labelLayout = attribute.layout;\n const spaceWidth = attribute.spaceWidth as number;\n\n arcs.forEach(arc => {\n const direction = isQuadrantLeft(arc.quadrant) ? -1 : 1;\n arc.labelPosition = {\n x: arc.outerCenter.x + direction * (arc.labelSize.width / 2 + line2MinLength + spaceWidth),\n y: arc.outerCenter.y\n };\n });\n arcs.sort((a, b) => {\n return a.labelPosition.y - b.labelPosition.y;\n });\n\n if (attribute.coverEnable !== false || labelLayout.strategy === 'none') {\n for (const arc of arcs) {\n const { labelPosition, labelSize } = arc;\n arc.labelLimit = labelSize.width;\n arc.pointB = isQuadrantLeft(arc.quadrant)\n ? {\n x: labelPosition.x + labelSize.width / 2 + line2MinLength + spaceWidth,\n y: labelPosition.y\n }\n : {\n x: labelPosition.x - labelSize.width / 2 - line2MinLength - spaceWidth,\n y: labelPosition.y\n };\n this._computeX(arc, attribute, currentMarks);\n }\n if (attribute.coverEnable === false && labelLayout.strategy === 'none') {\n this._coverLabels(arcs);\n }\n } else {\n // 由于可能存在多行标签,这里仅仅估计一个最大标签数量用于避免冗余计算\n const maxLabels = height / ((attribute.textStyle?.fontSize as number) || 16);\n // 布局圆弧半径\n this._adjustY(arcs, maxLabels, attribute, currentMarks);\n\n const { minY, maxY } = arcs.reduce(\n (yInfo, arc) => {\n const { y1, y2 } = arc.getLabelBounds();\n yInfo.minY = Math.max(0, Math.min(y1, yInfo.minY));\n yInfo.maxY = Math.min(height, Math.max(y2, yInfo.maxY));\n return yInfo;\n },\n { minY: Infinity, maxY: -Infinity }\n );\n const halfY = Math.max(Math.abs(height / 2 - minY), Math.abs(maxY - height / 2));\n // pointB 与 label 的 y 值相同,但是 label 的 x 值依赖于 pointB 的 x 值\n const r = this._computeLayoutRadius(halfY, attribute, currentMarks);\n for (const arc of arcs) {\n this._computePointB(arc, r, attribute, currentMarks);\n this._computeX(arc, attribute, currentMarks);\n }\n }\n const width = center.x * 2;\n arcs.forEach(arc => {\n if (\n arc.labelVisible &&\n (isLess(arc.pointB.x, line2MinLength + spaceWidth) ||\n isGreater(arc.pointB.x, width - line2MinLength - spaceWidth))\n ) {\n arc.labelVisible = false;\n }\n arc.angle = 0;\n });\n return arcs;\n }\n\n /**\n * 计算 pointC 以及 label limit 与 position\n */\n private _computeX(arc: ArcInfo, attribute: any, currentMarks: any[]) {\n const center = { x: currentMarks[0].attribute?.x ?? 0, y: currentMarks[0].attribute?.y ?? 0 };\n const plotLayout = { width: center.x * 2, height: center.y * 2 };\n const radiusRatio = this.computeLayoutOuterRadius(\n currentMarks[0].attribute.outerRadius,\n attribute.width,\n attribute.height\n );\n\n const line1MinLength = attribute.line.line1MinLength as number;\n const line2MinLength = attribute.line.line2MinLength as number;\n const labelLayoutAlign = attribute.layout?.align;\n const spaceWidth = attribute.spaceWidth as number;\n const align = this._computeAlign(arc, attribute) as TextAlign;\n\n const { labelPosition, quadrant, pointB } = arc;\n if (!isValidNumber(pointB.x * pointB.y)) {\n arc.pointC = { x: NaN, y: NaN };\n labelPosition.x = NaN;\n arc.labelLimit = 0;\n }\n const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);\n const flag = isQuadrantLeft(quadrant) ? -1 : 1;\n let cx: number = 0;\n const restWidth = flag > 0 ? plotLayout.width - pointB.x : pointB.x;\n let limit = restWidth - line2MinLength - spaceWidth;\n if (labelLayoutAlign === 'labelLine') {\n cx = (radius + line1MinLength + line2MinLength) * flag + (center as IPoint).x;\n limit = (flag > 0 ? plotLayout.width - cx : cx) - spaceWidth;\n }\n const text = this._getFormatLabelText(arc.refDatum, limit);\n arc.labelText = text;\n let labelWidth = Math.min(limit, arc.labelSize.width);\n switch (labelLayoutAlign) {\n case 'labelLine':\n break;\n case 'edge':\n cx = flag > 0 ? plotLayout.width - labelWidth - spaceWidth : labelWidth + spaceWidth;\n break;\n case 'arc':\n default:\n cx = pointB.x + flag * line2MinLength;\n break;\n }\n labelWidth = Math.max(this._ellipsisWidth, labelWidth);\n arc.pointC = { x: cx, y: labelPosition.y };\n\n if (labelLayoutAlign === 'edge') {\n // edge 模式下的多行文本对齐方向与其他模式相反\n const alignOffset = this._computeAlignOffset(align, labelWidth, -flag);\n // 贴近画布边缘的布局结果可能会由于 cx 的小数 pixel 导致被部分裁剪,因此额外做计算\n labelPosition.x = flag > 0 ? plotLayout.width + alignOffset : alignOffset;\n } else {\n const alignOffset = this._computeAlignOffset(align, labelWidth, flag);\n labelPosition.x = cx + alignOffset + flag * spaceWidth;\n }\n\n arc.labelLimit = labelWidth;\n }\n\n private _computeAlignOffset(align: TextAlign, labelWidth: number, alignFlag: number): number {\n switch (align) {\n case 'left':\n return alignFlag < 0 ? -labelWidth : 0;\n case 'right':\n return alignFlag < 0 ? 0 : labelWidth;\n case 'center':\n default:\n return (labelWidth / 2) * alignFlag;\n }\n }\n\n private _computeAlign(arc: ArcInfo, attribute: any) {\n const labelConfig = attribute;\n // 暂时兼容两种配置方式\n const textAlign = labelConfig.textStyle?.textAlign ?? labelConfig.textStyle?.align;\n const layoutAlign = labelConfig.layout?.textAlign ?? labelConfig.layout?.align;\n if (labelConfig.position !== 'inside') {\n if (isNil(textAlign) || textAlign === 'auto') {\n // edge 模式下沿着画布对齐,与 labelLine & edge 模式相反\n if (layoutAlign === 'edge') {\n return isQuadrantLeft(arc.quadrant) ? 'left' : 'right';\n }\n return isQuadrantLeft(arc.quadrant) ? 'right' : 'left';\n }\n return textAlign;\n }\n return isNil(textAlign) || textAlign === 'auto' ? 'center' : textAlign;\n }\n\n private _getFormatLabelText(value: any, limit?: number) {\n return value.text;\n }\n\n /**\n * 调整标签位置的 Y 值\n */\n private _adjustY(arcs: ArcInfo[], maxLabels: number, attribute: any, currentMarks: any[]) {\n const center = { x: currentMarks[0].attribute?.x ?? 0, y: currentMarks[0].attribute?.y ?? 0 };\n const plotRect = { width: center.x * 2, height: center.y * 2 };\n const labelLayout = attribute.layout;\n if (labelLayout.strategy === 'vertical') {\n // vertical 策略类似 echarts 方案,没有切线限制策略,没有优先级,执行整体调整没有标签数量限制\n let lastY = 0;\n let delta;\n const len = arcs.length;\n if (len <= 0) {\n return;\n }\n // 偏移 y 值以避免遮挡\n for (let i = 0; i < len; i++) {\n const { y1 } = arcs[i].getLabelBounds();\n delta = y1 - lastY;\n if (isLess(delta, 0)) {\n const index = this._shiftY(arcs, i, len - 1, -delta);\n this._shiftY(arcs, index, 0, delta / 2);\n }\n const { y2 } = arcs[i].getLabelBounds();\n lastY = y2;\n }\n // 将超出上界的标签下移\n const { y1: firstY1 } = arcs[0].getLabelBounds();\n delta = firstY1 - 0;\n if (isLess(delta, 0)) {\n this._shiftY(arcs, 0, len - 1, -delta);\n }\n for (let i = arcs.length - 1; i >= 0; i--) {\n if (arcs[i].getLabelBounds().y2 > plotRect.height) {\n arcs[i].labelVisible = false;\n } else {\n break;\n }\n }\n } else if (labelLayout.strategy !== 'none') {\n const priorityArcs: PriorityArc[] = arcs.map((arc, i) => {\n return {\n arc,\n originIndex: i,\n priorityIndex: 0\n };\n });\n priorityArcs.sort((a, b) => {\n return b.arc.radian - a.arc.radian;\n });\n priorityArcs.forEach((priorityArc, i) => {\n priorityArc.priorityIndex = i;\n // 首先隐藏所有标签\n priorityArc.arc.labelVisible = false;\n });\n\n let topLabelIndex = Infinity;\n let bottomLabelIndex = -Infinity;\n // 按照优先级依次布局标签\n for (let i = 0; i < maxLabels && i < arcs.length; i++) {\n this._storeY(arcs);\n const arc = priorityArcs[i].arc;\n this._computeYRange(arc, attribute, currentMarks);\n arc.labelVisible = true;\n const curY = arc.labelPosition.y;\n // 寻找标签在布局前垂直方向上的上下邻居,也就是饼图上的邻居关系\n const { lastIndex, nextIndex } = this._findNeighborIndex(arcs, priorityArcs[i]);\n const lastArc = arcs[lastIndex];\n const nextArc = arcs[nextIndex];\n if (lastIndex === -1 && nextIndex !== -1) {\n const nextY = nextArc.labelPosition.y;\n if (curY > nextY) {\n arc.labelPosition.y = nextY - nextArc.labelSize.height / 2 - arc.labelSize.height / 2;\n } else {\n this._twoWayShift(arcs, arc, nextArc, nextIndex);\n }\n } else if (lastIndex !== -1 && nextIndex === -1) {\n const lastY = lastArc.labelPosition.y;\n if (curY < lastY) {\n arc.labelPosition.y = lastY + lastArc.labelSize.height / 2 + arc.labelSize.height / 2;\n } else {\n this._twoWayShift(arcs, lastArc, arc, priorityArcs[i].originIndex);\n }\n } else if (lastIndex !== -1 && nextIndex !== -1) {\n const lastY = lastArc.labelPosition.y;\n const nextY = nextArc.labelPosition.y;\n if (curY > nextY) {\n arc.labelPosition.y = nextY - nextArc.labelSize.height / 2 - arc.labelSize.height / 2;\n this._twoWayShift(arcs, lastArc, arc, priorityArcs[i].originIndex);\n } else if (curY < lastY) {\n arc.labelPosition.y = lastY + lastArc.labelSize.height / 2 + arc.labelSize.height / 2;\n this._twoWayShift(arcs, arc, nextArc, nextIndex);\n } else {\n this._twoWayShift(arcs, lastArc, arc, priorityArcs[i].originIndex);\n this._twoWayShift(arcs, arc, nextArc, nextIndex);\n }\n }\n\n const nextTopIndex = Math.min(topLabelIndex, priorityArcs[i].originIndex);\n const nextBottomIndex = Math.max(bottomLabelIndex, priorityArcs[i].originIndex);\n let delta;\n // 将超出下界的标签上移\n delta = arcs[nextBottomIndex].getLabelBounds().y2 - plotRect.height;\n if (isGreater(delta, 0)) {\n this._shiftY(arcs, nextBottomIndex, 0, -delta);\n }\n // 将超出上界的标签下移\n delta = arcs[nextTopIndex].getLabelBounds().y1 - 0;\n if (isLess(delta, 0)) {\n this._shiftY(arcs, nextTopIndex, arcs.length - 1, -delta);\n }\n delta = arcs[nextBottomIndex].getLabelBounds().y2 - plotRect.height;\n // 当整体上下移一次之后仍然无法容纳所有标签,则当前标签应当舍去\n if (isGreater(delta, 0)) {\n arc.labelVisible = false;\n this._restoreY(arcs);\n break;\n } else if (labelLayout.tangentConstraint && !this._checkYRange(arcs)) {\n // 当标签由于 Y 方向调节范围过大而舍弃时不应当终止布局过程\n arc.labelVisible = false;\n this._restoreY(arcs);\n } else {\n topLabelIndex = nextTopIndex;\n bottomLabelIndex = nextBottomIndex;\n }\n }\n }\n }\n\n /**\n * 向某一方向调整局部标签的 Y 值\n */\n private _shiftY(arcs: ArcInfo[], start: number, end: number, delta: number) {\n const direction = start < end ? 1 : -1;\n let index = start;\n while (index !== -1) {\n arcs[index].labelPosition.y += delta;\n const nextIndex = this._findNextVisibleIndex(arcs, index, end, direction);\n if (nextIndex >= 0 && nextIndex < arcs.length) {\n const { y1: curY1, y2: curY2 } = arcs[index].getLabelBounds();\n const { y1: nextY1, y2: nextY2 } = arcs[nextIndex].getLabelBounds();\n if ((direction > 0 && curY2 < nextY1) || (direction < 0 && curY1 > nextY2)) {\n return index;\n }\n }\n index = nextIndex;\n }\n return end;\n }\n\n /**\n * 寻找下一个显示标签索引\n */\n private _findNextVisibleIndex(arcs: ArcInfo[], start: number, end: number, direction: number) {\n const diff = (end - start) * direction;\n for (let i = 1; i <= diff; i++) {\n const index = start + i * direction;\n if (arcs[index].labelVisible) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * 计算 pointB,其 y 值在 adjustY 中确定,也即是 label 的 y 值\n */\n private _computePointB(arc: ArcInfo, r: number, attribute: any, currentMarks: any[]) {\n const labelConfig = attribute;\n const radiusRatio = this.computeLayoutOuterRadius(\n currentMarks[0].attribute.outerRadius,\n attribute.width,\n attribute.height\n );\n const line1MinLength = labelConfig.line.line1MinLength as number;\n const labelLayout = labelConfig.layout;\n\n if (labelLayout.strategy === 'none') {\n // 不执行躲避策略或者不显示引导线时紧挨着圆弧布局\n arc.pointB = {\n x: arc.outerCenter.x,\n y: arc.outerCenter.y\n };\n } else {\n const center = { x: currentMarks[0].attribute?.x ?? 0, y: currentMarks[0].attribute?.y ?? 0 };\n const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);\n const { labelPosition, quadrant } = arc;\n const outerR = Math.max(radius + line1MinLength, currentMarks[0].attribute.outerRadius);\n const rd = r - outerR;\n // x 为 pointB.x 与圆心的差值\n const x = Math.sqrt(r ** 2 - Math.abs((center as IPoint).y - labelPosition.y) ** 2) - rd;\n if (isValidNumber(x)) {\n arc.pointB = {\n x: (center as IPoint).x + x * (isQuadrantLeft(quadrant) ? -1 : 1),\n y: labelPosition.y\n };\n } else {\n arc.pointB = { x: NaN, y: NaN };\n }\n }\n }\n\n /**\n * 存储当前所有显示标签的 Y 值\n */\n private _storeY(arcs: ArcInfo[]) {\n for (const arc of arcs) {\n if (arc.labelVisible) {\n arc.lastLabelY = arc.labelPosition.y;\n }\n }\n }\n\n /**\n * 计算圆弧切线所限制的标签 Y 值范围\n */\n private _computeYRange(arc: ArcInfo, attribute: any, currentMarks: any[]) {\n const center = { x: currentMarks[0].attribute?.x ?? 0, y: currentMarks[0].attribute?.y ?? 0 };\n const plotRect = { width: center.x * 2, height: center.y * 2 };\n\n const radiusRatio = this.computeLayoutOuterRadius(\n currentMarks[0].attribute.outerRadius,\n attribute.width,\n attribute.height\n );\n const line1MinLength = attribute.line.line1MinLength as number;\n\n const { width, height } = plotRect;\n\n const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);\n // 出现 y 方向挤压过度必然是由于画布上下某一端被占满,此时半径是确定的\n const r = this._computeLayoutRadius(height / 2, attribute, currentMarks);\n // 所有坐标转化到以圆心为原点的坐标系计算\n // 在饼图上左右计算对称,可以全都转化到右侧计算\n const cx = Math.abs(arc.center.x - width / 2);\n const cy = arc.center.y - height / 2;\n let a;\n let b;\n let c;\n if (isClose(width / 2, cx)) {\n a = 0;\n b = 1;\n c = -cy;\n } else if (isClose(height / 2, cy)) {\n a = 1;\n b = 0;\n c = -cx;\n } else {\n // 斜截式转为一般式\n const k = -1 / (cy / cx);\n a = k;\n b = -1;\n c = cy - k * cx;\n }\n const points = lineCirclePoints(a, b, c, line1MinLength + radius - r, 0, r);\n // 由于饼图上切点在布局圆内部,交点必然有两个\n if (points.length < 2) {\n return;\n }\n let min;\n let max;\n if (points[0].x > points[1].x) {\n points.reverse();\n }\n if (points[0].x < 0) {\n if (isClose(points[0].y, points[1].y)) {\n if (Math.abs(arc.middleAngle) < Math.PI / 2) {\n min = 0;\n max = points[1].y + height / 2;\n } else {\n min = points[1].y + height / 2;\n max = height;\n }\n } else if (points[0].y < points[1].y) {\n min = 0;\n max = points[1].y + height / 2;\n } else {\n min = points[1].y + height / 2;\n max = plotRect.height;\n }\n } else {\n min = Math.min(points[0].y, points[1].y) + height / 2;\n max = Math.max(points[0].y, points[1].y) + height / 2;\n }\n arc.labelYRange = [min, max];\n }\n\n /**\n * 计算标签布局圆弧半径,即 pointB 所落在的圆弧\n */\n private _computeLayoutRadius(halfYLength: number, attribute: any, currentMarks: any[]) {\n const labelConfig = attribute;\n const layoutArcGap = labelConfig.layoutArcGap as number;\n const line1MinLength = labelConfig.line.line1MinLength as number;\n const radiusRatio = this.computeLayoutOuterRadius(\n currentMarks[0].attribute.outerRadius,\n attribute.width,\n attribute.height\n );\n const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);\n const outerR = radius + line1MinLength;\n\n const a = outerR - layoutArcGap;\n\n return Math.max((a ** 2 + halfYLength ** 2) / (2 * a), outerR);\n }\n\n /**\n * 依据初始的标签排序,寻找某一标签上下最近的显示标签索引\n */\n private _findNeighborIndex(arcs: ArcInfo[], priorityArc: PriorityArc) {\n const index = priorityArc.originIndex;\n let lastIndex = -1;\n let nextIndex = -1;\n for (let i = index - 1; i >= 0; i--) {\n if (arcs[i].labelVisible) {\n lastIndex = i;\n break;\n }\n }\n for (let i = index + 1; i < arcs.length; i++) {\n if (arcs[i].labelVisible) {\n nextIndex = i;\n break;\n }\n }\n return {\n lastIndex,\n nextIndex\n };\n }\n\n /**\n * 执行给定标签 Y 值的 shiftDown 以及 shiftUp\n */\n private _twoWayShift(arcs: ArcInfo[], lastArc: ArcInfo, nextArc: ArcInfo, nextIndex: number) {\n const delta = nextArc.getLabelBounds().y1 - lastArc.getLabelBounds().y2;\n if (isLess(delta, 0)) {\n const i = this._shiftY(arcs, nextIndex, arcs.length - 1, -delta);\n this._shiftY(arcs, i, 0, delta / 2);\n }\n }\n\n /**\n * 恢复所有显示标签在之前存储的 Y 值\n */\n private _restoreY(arcs: ArcInfo[]) {\n for (const arc of arcs) {\n if (arc.labelVisible) {\n arc.labelPosition.y = arc.lastLabelY;\n }\n }\n }\n\n /**\n * 检查每个显示的标签的 Y 值是否在切线限制范围内\n */\n private _checkYRange(arcs: ArcInfo[]) {\n for (const arc of arcs) {\n const { labelYRange, labelPosition } = arc;\n if (\n arc.labelVisible &&\n labelYRange &&\n (isLess(labelPosition.y, labelYRange[0]) || isGreater(labelPosition.y, labelYRange[1]))\n ) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * 自上至下计算被遮盖的标签\n */\n private _coverLabels(arcs: ArcInfo[]) {\n if (arcs.length <= 1) {\n return;\n }\n let lastBounds = arcs[0].getLabelBounds();\n for (let i = 1; i < arcs.length; i++) {\n const bounds = arcs[i].getLabelBounds();\n if (!checkBoundsOverlap(lastBounds, bounds)) {\n lastBounds = bounds;\n } else {\n arcs[i].labelVisible = false;\n }\n }\n }\n\n protected computeRadius(r: number, width?: number, height?: number, k?: number): number {\n return this.computeLayoutRadius(width ? width : 0, height ? height : 0) * r * (isNil(k) ? 1 : k);\n }\n\n protected computeLayoutRadius(width: number, height: number) {\n return Math.min(width / 2, height / 2);\n }\n\n private computeLayoutOuterRadius(r: number, width: number, height: number) {\n return r / (Math.min(width, height) / 2);\n }\n\n private computeDatumRadius(width?: number, height?: number, outerRadius?: any): number {\n const outerRadiusRatio = this.computeLayoutOuterRadius(outerRadius, width, height); //this.getRadius(state)\n return this.computeLayoutRadius(width ? width : 0, height ? height : 0) * outerRadiusRatio;\n }\n}\n"]}
|