@visactor/vrender-components 0.14.3-alpha.0 → 0.14.3-alpha.1
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/base.d.ts +4 -0
- package/cjs/axis/base.js +3 -5
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/circle.d.ts +5 -1
- package/cjs/axis/circle.js +6 -0
- package/cjs/axis/circle.js.map +1 -1
- package/cjs/axis/line.d.ts +5 -0
- package/cjs/axis/line.js +10 -3
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/overlap/auto-rotate.d.ts +9 -1
- package/cjs/axis/overlap/auto-rotate.js +41 -30
- package/cjs/axis/overlap/auto-rotate.js.map +1 -1
- 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 +2 -2
- package/cjs/label/arc.js +33 -26
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.d.ts +1 -1
- package/cjs/label/base.js +11 -23
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/type.d.ts +2 -0
- package/cjs/label/type.js.map +1 -1
- package/cjs/legend/constant.d.ts +2 -1
- package/cjs/legend/constant.js +1 -1
- package/cjs/legend/constant.js.map +1 -1
- package/cjs/legend/discrete/discrete.js +26 -13
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/marker/base.d.ts +3 -0
- package/cjs/marker/base.js +25 -6
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/type.d.ts +6 -0
- package/cjs/marker/type.js.map +1 -1
- package/dist/index.js +200 -120
- package/dist/index.min.js +1 -1
- package/es/axis/base.d.ts +4 -0
- package/es/axis/base.js +3 -5
- package/es/axis/base.js.map +1 -1
- package/es/axis/circle.d.ts +5 -1
- package/es/axis/circle.js +6 -0
- package/es/axis/circle.js.map +1 -1
- package/es/axis/line.d.ts +5 -0
- package/es/axis/line.js +11 -3
- package/es/axis/line.js.map +1 -1
- package/es/axis/overlap/auto-rotate.d.ts +9 -1
- package/es/axis/overlap/auto-rotate.js +38 -28
- package/es/axis/overlap/auto-rotate.js.map +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 +2 -2
- package/es/label/arc.js +32 -26
- package/es/label/arc.js.map +1 -1
- package/es/label/base.d.ts +1 -1
- package/es/label/base.js +11 -23
- package/es/label/base.js.map +1 -1
- package/es/label/type.d.ts +2 -0
- package/es/label/type.js.map +1 -1
- package/es/legend/constant.d.ts +2 -1
- package/es/legend/constant.js +1 -1
- package/es/legend/constant.js.map +1 -1
- package/es/legend/discrete/discrete.js +26 -13
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/marker/base.d.ts +3 -0
- package/es/marker/base.js +26 -5
- package/es/marker/base.js.map +1 -1
- package/es/marker/type.d.ts +6 -0
- package/es/marker/type.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1587,7 +1587,7 @@
|
|
|
1587
1587
|
setBitmapTool(bmpTool) {
|
|
1588
1588
|
this._bmpTool = bmpTool;
|
|
1589
1589
|
}
|
|
1590
|
-
layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray) {
|
|
1590
|
+
layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray, ellipsisWidth) {
|
|
1591
1591
|
const arcs = [];
|
|
1592
1592
|
return arcs;
|
|
1593
1593
|
}
|
|
@@ -1701,15 +1701,20 @@
|
|
|
1701
1701
|
labels.push(text);
|
|
1702
1702
|
}
|
|
1703
1703
|
if (this.attribute.type === 'arc') {
|
|
1704
|
-
const
|
|
1704
|
+
const ellipsisLabelAttribute = Object.assign(Object.assign({}, this.attribute.textStyle), { text: '...' });
|
|
1705
|
+
const ellipsisText = this._createLabelText(ellipsisLabelAttribute);
|
|
1706
|
+
const ellipsisTextBounds = this.getGraphicBounds(ellipsisText);
|
|
1707
|
+
const ellipsisWidth = ellipsisTextBounds.x2 - ellipsisTextBounds.x1;
|
|
1708
|
+
const arcs = this.layoutArcLabels(position, this.attribute, Array.from(this._idToGraphic.values()), data, textBoundsArray, ellipsisWidth);
|
|
1705
1709
|
for (let i = 0; i < data.length; i++) {
|
|
1706
1710
|
const textData = data[i];
|
|
1707
|
-
const basedArc = arcs.find(arc => arc.
|
|
1711
|
+
const basedArc = arcs.find(arc => arc.refDatum.id === textData.id);
|
|
1708
1712
|
const labelAttribute = {
|
|
1709
1713
|
visible: basedArc.labelVisible,
|
|
1710
1714
|
x: basedArc.labelPosition.x,
|
|
1711
1715
|
y: basedArc.labelPosition.y,
|
|
1712
1716
|
angle: basedArc.angle,
|
|
1717
|
+
maxLineWidth: basedArc.labelLimit,
|
|
1713
1718
|
points: (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointA) && (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointB) && (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointC)
|
|
1714
1719
|
? [basedArc.pointA, basedArc.pointB, basedArc.pointC]
|
|
1715
1720
|
: undefined
|
|
@@ -1774,20 +1779,6 @@
|
|
|
1774
1779
|
continue;
|
|
1775
1780
|
}
|
|
1776
1781
|
}
|
|
1777
|
-
if (clampForce) {
|
|
1778
|
-
const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);
|
|
1779
|
-
if (!(dx === 0 && dy === 0) &&
|
|
1780
|
-
canPlace(bmpTool, bitmap, {
|
|
1781
|
-
x1: text.AABBBounds.x1 + dx,
|
|
1782
|
-
x2: text.AABBBounds.x2 + dx,
|
|
1783
|
-
y1: text.AABBBounds.y1 + dy,
|
|
1784
|
-
y2: text.AABBBounds.y2 + dy
|
|
1785
|
-
})) {
|
|
1786
|
-
text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
|
|
1787
|
-
result.push(text);
|
|
1788
|
-
continue;
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
1782
|
let hasPlace = false;
|
|
1792
1783
|
for (let j = 0; j < strategy.length; j++) {
|
|
1793
1784
|
hasPlace = place(bmpTool, bitmap, strategy[j], this.attribute, text, this.getGraphicBounds(baseMark, labels[i]), this.labeling);
|
|
@@ -1847,13 +1838,13 @@
|
|
|
1847
1838
|
const prevTextMap = this._graphicToText || new Map();
|
|
1848
1839
|
const texts = [];
|
|
1849
1840
|
labels.forEach((text, index) => {
|
|
1850
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1841
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
1851
1842
|
const labelLine = ((_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points)
|
|
1852
1843
|
? vrender.createLine({
|
|
1853
1844
|
visible: (_c = (_b = text.attribute) === null || _b === void 0 ? void 0 : _b.visible) !== null && _c !== void 0 ? _c : true,
|
|
1854
1845
|
stroke: (_f = (_e = (_d = text.attribute) === null || _d === void 0 ? void 0 : _d.line) === null || _e === void 0 ? void 0 : _e.stroke) !== null && _f !== void 0 ? _f : (_g = text.attribute) === null || _g === void 0 ? void 0 : _g.fill,
|
|
1855
|
-
lineWidth: 1,
|
|
1856
|
-
points: (
|
|
1846
|
+
lineWidth: (_k = (_j = (_h = text.attribute) === null || _h === void 0 ? void 0 : _h.line) === null || _j === void 0 ? void 0 : _j.lineWidth) !== null && _k !== void 0 ? _k : 1,
|
|
1847
|
+
points: (_l = text.attribute) === null || _l === void 0 ? void 0 : _l.points
|
|
1857
1848
|
})
|
|
1858
1849
|
: undefined;
|
|
1859
1850
|
const relatedGraphic = this._idToGraphic.get(text.attribute.id);
|
|
@@ -1895,7 +1886,7 @@
|
|
|
1895
1886
|
prevText.animate().to(text.attribute, duration, easing);
|
|
1896
1887
|
if (prevLabel.labelLine) {
|
|
1897
1888
|
prevLabel.labelLine.animate().to(vutils.merge({}, prevLabel.labelLine.attribute, {
|
|
1898
|
-
points: (
|
|
1889
|
+
points: (_m = text.attribute) === null || _m === void 0 ? void 0 : _m.points
|
|
1899
1890
|
}), duration, easing);
|
|
1900
1891
|
}
|
|
1901
1892
|
if (animationConfig.increaseEffect !== false &&
|
|
@@ -1909,7 +1900,7 @@
|
|
|
1909
1900
|
else {
|
|
1910
1901
|
prevLabel.text.setAttributes(text.attribute);
|
|
1911
1902
|
if (prevLabel === null || prevLabel === void 0 ? void 0 : prevLabel.labelLine) {
|
|
1912
|
-
prevLabel.labelLine.setAttributes({ points: (
|
|
1903
|
+
prevLabel.labelLine.setAttributes({ points: (_o = text.attribute) === null || _o === void 0 ? void 0 : _o.points });
|
|
1913
1904
|
}
|
|
1914
1905
|
}
|
|
1915
1906
|
}
|
|
@@ -2386,15 +2377,18 @@
|
|
|
2386
2377
|
}
|
|
2387
2378
|
return { x: 0, y: 0 };
|
|
2388
2379
|
}
|
|
2389
|
-
layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray) {
|
|
2380
|
+
layoutArcLabels(position, attribute, currentMarks, data, textBoundsArray, ellipsisWidth) {
|
|
2381
|
+
var _a;
|
|
2390
2382
|
this._arcLeft.clear();
|
|
2391
2383
|
this._arcRight.clear();
|
|
2384
|
+
this._ellipsisWidth = ellipsisWidth;
|
|
2392
2385
|
const { width, height } = attribute;
|
|
2386
|
+
const centerOffset = (_a = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _a !== void 0 ? _a : 0;
|
|
2393
2387
|
currentMarks.forEach((currentMark, index) => {
|
|
2394
2388
|
var _a, _b;
|
|
2395
2389
|
const graphicAttribute = currentMark.attribute;
|
|
2396
2390
|
const radiusRatio = this.computeLayoutOuterRadius(graphicAttribute.outerRadius, width, height);
|
|
2397
|
-
const radius = this.computeRadius(radiusRatio, width, height);
|
|
2391
|
+
const radius = this.computeRadius(radiusRatio, width, height, centerOffset);
|
|
2398
2392
|
const center = { x: (_a = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.x) !== null && _a !== void 0 ? _a : 0, y: (_b = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.y) !== null && _b !== void 0 ? _b : 0 };
|
|
2399
2393
|
const item = data[index];
|
|
2400
2394
|
const textBounds = textBoundsArray[index];
|
|
@@ -2404,7 +2398,7 @@
|
|
|
2404
2398
|
const arcMiddle = circlePoint(center.x, center.y, graphicAttribute.outerRadius, arcMiddleAngle);
|
|
2405
2399
|
const outerArcMiddle = circlePoint(center.x, center.y, radius + attribute.line.line1MinLength, arcMiddleAngle);
|
|
2406
2400
|
const arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle);
|
|
2407
|
-
arc.pointA = circlePoint(center.x, center.y, this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttribute.outerRadius), arc.middleAngle);
|
|
2401
|
+
arc.pointA = circlePoint(center.x, center.y, this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttribute.outerRadius, centerOffset), arc.middleAngle);
|
|
2408
2402
|
arc.labelSize = {
|
|
2409
2403
|
width: textBounds.x2 - textBounds.x1,
|
|
2410
2404
|
height: textBounds.y2 - textBounds.y1
|
|
@@ -2430,8 +2424,9 @@
|
|
|
2430
2424
|
return arcs;
|
|
2431
2425
|
}
|
|
2432
2426
|
_layoutInsideLabels(arcs, attribute, currentMarks) {
|
|
2433
|
-
var _a, _b, _c, _d;
|
|
2427
|
+
var _a, _b, _c, _d, _e;
|
|
2434
2428
|
const center = { x: (_b = (_a = currentMarks[0].attribute) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0, y: (_d = (_c = currentMarks[0].attribute) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0 };
|
|
2429
|
+
const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
|
|
2435
2430
|
const innerRadiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.innerRadius, attribute.width, attribute.height);
|
|
2436
2431
|
const outerRadiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
|
|
2437
2432
|
const labelConfig = attribute;
|
|
@@ -2439,8 +2434,8 @@
|
|
|
2439
2434
|
arcs.forEach((arc) => {
|
|
2440
2435
|
var _a, _b;
|
|
2441
2436
|
const { labelSize, radian } = arc;
|
|
2442
|
-
const innerRadius = this.computeRadius(innerRadiusRatio, attribute.width, attribute.height, 1);
|
|
2443
|
-
const outerRadius = this.computeRadius(outerRadiusRatio, attribute.width, attribute.height, 1);
|
|
2437
|
+
const innerRadius = this.computeRadius(innerRadiusRatio, attribute.width, attribute.height, centerOffset, 1);
|
|
2438
|
+
const outerRadius = this.computeRadius(outerRadiusRatio, attribute.width, attribute.height, centerOffset, 1);
|
|
2444
2439
|
const minRadian = connectLineRadian(outerRadius, labelSize.height);
|
|
2445
2440
|
let limit;
|
|
2446
2441
|
if (radian < minRadian) {
|
|
@@ -2539,13 +2534,14 @@
|
|
|
2539
2534
|
return arcs;
|
|
2540
2535
|
}
|
|
2541
2536
|
_computeX(arc, attribute, currentMarks) {
|
|
2542
|
-
var _a, _b, _c, _d, _e;
|
|
2537
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2543
2538
|
const center = { x: (_b = (_a = currentMarks[0].attribute) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0, y: (_d = (_c = currentMarks[0].attribute) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0 };
|
|
2539
|
+
const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
|
|
2544
2540
|
const plotLayout = { width: center.x * 2, height: center.y * 2 };
|
|
2545
2541
|
const radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
|
|
2546
2542
|
const line1MinLength = attribute.line.line1MinLength;
|
|
2547
2543
|
const line2MinLength = attribute.line.line2MinLength;
|
|
2548
|
-
const labelLayoutAlign = (
|
|
2544
|
+
const labelLayoutAlign = (_f = attribute.layout) === null || _f === void 0 ? void 0 : _f.align;
|
|
2549
2545
|
const spaceWidth = attribute.spaceWidth;
|
|
2550
2546
|
const { labelPosition, quadrant, pointB } = arc;
|
|
2551
2547
|
if (!vutils.isValidNumber(pointB.x * pointB.y)) {
|
|
@@ -2553,7 +2549,7 @@
|
|
|
2553
2549
|
labelPosition.x = NaN;
|
|
2554
2550
|
arc.labelLimit = 0;
|
|
2555
2551
|
}
|
|
2556
|
-
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);
|
|
2552
|
+
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset);
|
|
2557
2553
|
const flag = isQuadrantLeft(quadrant) ? -1 : 1;
|
|
2558
2554
|
let cx = 0;
|
|
2559
2555
|
const restWidth = flag > 0 ? plotLayout.width - pointB.x : pointB.x;
|
|
@@ -2577,16 +2573,17 @@
|
|
|
2577
2573
|
break;
|
|
2578
2574
|
}
|
|
2579
2575
|
labelWidth = Math.max(this._ellipsisWidth, labelWidth);
|
|
2576
|
+
arc.labelLimit = labelWidth;
|
|
2580
2577
|
arc.pointC = { x: cx, y: labelPosition.y };
|
|
2578
|
+
const targetCenterOffset = 0.5 * (arc.labelLimit < arc.labelSize.width ? arc.labelLimit : arc.labelSize.width);
|
|
2581
2579
|
if (labelLayoutAlign === 'edge') {
|
|
2582
2580
|
const alignOffset = 0;
|
|
2583
|
-
labelPosition.x = flag > 0 ? plotLayout.width + alignOffset : alignOffset;
|
|
2581
|
+
labelPosition.x = (flag > 0 ? plotLayout.width + alignOffset : alignOffset) - flag * targetCenterOffset;
|
|
2584
2582
|
}
|
|
2585
2583
|
else {
|
|
2586
2584
|
const alignOffset = 0;
|
|
2587
|
-
labelPosition.x = cx + alignOffset + flag * (spaceWidth + 0.5 *
|
|
2585
|
+
labelPosition.x = cx + alignOffset + flag * (spaceWidth + 0.5 * targetCenterOffset);
|
|
2588
2586
|
}
|
|
2589
|
-
arc.labelLimit = labelWidth;
|
|
2590
2587
|
}
|
|
2591
2588
|
_computeAlignOffset(align, labelWidth, alignFlag) {
|
|
2592
2589
|
switch (align) {
|
|
@@ -2770,7 +2767,7 @@
|
|
|
2770
2767
|
return -1;
|
|
2771
2768
|
}
|
|
2772
2769
|
_computePointB(arc, r, attribute, currentMarks) {
|
|
2773
|
-
var _a, _b, _c, _d;
|
|
2770
|
+
var _a, _b, _c, _d, _e;
|
|
2774
2771
|
const labelConfig = attribute;
|
|
2775
2772
|
const radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
|
|
2776
2773
|
const line1MinLength = labelConfig.line.line1MinLength;
|
|
@@ -2783,7 +2780,8 @@
|
|
|
2783
2780
|
}
|
|
2784
2781
|
else {
|
|
2785
2782
|
const center = { x: (_b = (_a = currentMarks[0].attribute) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0, y: (_d = (_c = currentMarks[0].attribute) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0 };
|
|
2786
|
-
const
|
|
2783
|
+
const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
|
|
2784
|
+
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset);
|
|
2787
2785
|
const { labelPosition, quadrant } = arc;
|
|
2788
2786
|
const outerR = Math.max(radius + line1MinLength, currentMarks[0].attribute.outerRadius);
|
|
2789
2787
|
const rd = r - outerR;
|
|
@@ -2807,13 +2805,14 @@
|
|
|
2807
2805
|
}
|
|
2808
2806
|
}
|
|
2809
2807
|
_computeYRange(arc, attribute, currentMarks) {
|
|
2810
|
-
var _a, _b, _c, _d;
|
|
2808
|
+
var _a, _b, _c, _d, _e;
|
|
2811
2809
|
const center = { x: (_b = (_a = currentMarks[0].attribute) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0, y: (_d = (_c = currentMarks[0].attribute) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0 };
|
|
2812
2810
|
const plotRect = { width: center.x * 2, height: center.y * 2 };
|
|
2813
2811
|
const radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
|
|
2814
2812
|
const line1MinLength = attribute.line.line1MinLength;
|
|
2815
2813
|
const { width, height } = plotRect;
|
|
2816
|
-
const
|
|
2814
|
+
const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
|
|
2815
|
+
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset);
|
|
2817
2816
|
const r = this._computeLayoutRadius(height / 2, attribute, currentMarks);
|
|
2818
2817
|
const cx = Math.abs(arc.center.x - width / 2);
|
|
2819
2818
|
const cy = arc.center.y - height / 2;
|
|
@@ -2872,11 +2871,13 @@
|
|
|
2872
2871
|
arc.labelYRange = [min, max];
|
|
2873
2872
|
}
|
|
2874
2873
|
_computeLayoutRadius(halfYLength, attribute, currentMarks) {
|
|
2874
|
+
var _a;
|
|
2875
2875
|
const labelConfig = attribute;
|
|
2876
2876
|
const layoutArcGap = labelConfig.layoutArcGap;
|
|
2877
2877
|
const line1MinLength = labelConfig.line.line1MinLength;
|
|
2878
2878
|
const radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
|
|
2879
|
-
const
|
|
2879
|
+
const centerOffset = (_a = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _a !== void 0 ? _a : 0;
|
|
2880
|
+
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset);
|
|
2880
2881
|
const outerR = radius + line1MinLength;
|
|
2881
2882
|
const a = outerR - layoutArcGap;
|
|
2882
2883
|
return Math.max((a ** 2 + halfYLength ** 2) / (2 * a), outerR);
|
|
@@ -2942,8 +2943,9 @@
|
|
|
2942
2943
|
}
|
|
2943
2944
|
}
|
|
2944
2945
|
}
|
|
2945
|
-
computeRadius(r, width, height, k) {
|
|
2946
|
-
|
|
2946
|
+
computeRadius(r, width, height, centerOffset, k) {
|
|
2947
|
+
var _a;
|
|
2948
|
+
return ((_a = this.computeLayoutRadius(width ? width : 0, height ? height : 0) * r * (vutils.isNil(k) ? 1 : k) + centerOffset) !== null && _a !== void 0 ? _a : 0);
|
|
2947
2949
|
}
|
|
2948
2950
|
computeLayoutRadius(width, height) {
|
|
2949
2951
|
return Math.min(width / 2, height / 2);
|
|
@@ -2951,9 +2953,10 @@
|
|
|
2951
2953
|
computeLayoutOuterRadius(r, width, height) {
|
|
2952
2954
|
return r / (Math.min(width, height) / 2);
|
|
2953
2955
|
}
|
|
2954
|
-
computeDatumRadius(width, height, outerRadius) {
|
|
2956
|
+
computeDatumRadius(width, height, outerRadius, centerOffset) {
|
|
2957
|
+
var _a;
|
|
2955
2958
|
const outerRadiusRatio = this.computeLayoutOuterRadius(outerRadius, width, height);
|
|
2956
|
-
return this.computeLayoutRadius(width ? width : 0, height ? height : 0) * outerRadiusRatio;
|
|
2959
|
+
return (_a = this.computeLayoutRadius(width ? width : 0, height ? height : 0) * outerRadiusRatio + centerOffset) !== null && _a !== void 0 ? _a : 0;
|
|
2957
2960
|
}
|
|
2958
2961
|
}
|
|
2959
2962
|
ArcLabel.defaultAttributes = {
|
|
@@ -3838,10 +3841,8 @@
|
|
|
3838
3841
|
textStyle = vutils.isFunction(textStyle)
|
|
3839
3842
|
? vutils.merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer))
|
|
3840
3843
|
: textStyle;
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
textBaseline: this.getTextBaseline(vector, inside)
|
|
3844
|
-
}, textStyle);
|
|
3844
|
+
const labelAlign = this.getLabelAlign(vector, inside, textStyle.angle);
|
|
3845
|
+
textStyle = vutils.merge(labelAlign, textStyle);
|
|
3845
3846
|
if (vutils.isFunction(textStyle.text)) {
|
|
3846
3847
|
textStyle.text = textStyle.text({
|
|
3847
3848
|
label: tickDatum.label,
|
|
@@ -4007,73 +4008,70 @@
|
|
|
4007
4008
|
item.rotatedBounds = bounds;
|
|
4008
4009
|
});
|
|
4009
4010
|
}
|
|
4010
|
-
function
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
align = ['left', 'right', 'right', 'right', 'left', 'left', 'left', 'left', 'right'];
|
|
4015
|
-
baseline = ['middle', 'bottom', 'middle', 'top', 'top', 'top', 'middle', 'bottom', 'bottom'];
|
|
4016
|
-
}
|
|
4017
|
-
items.forEach((item, i) => {
|
|
4018
|
-
let angle = item.attribute.angle || 0;
|
|
4019
|
-
if (angle < 0) {
|
|
4020
|
-
while (angle < 0) {
|
|
4021
|
-
angle += Math.PI * 2;
|
|
4022
|
-
}
|
|
4023
|
-
}
|
|
4024
|
-
if (angle > 0) {
|
|
4025
|
-
while (angle >= Math.PI * 2) {
|
|
4026
|
-
angle -= Math.PI * 2;
|
|
4027
|
-
}
|
|
4028
|
-
}
|
|
4029
|
-
const step = angle / (Math.PI * 0.5);
|
|
4030
|
-
let index;
|
|
4031
|
-
if (step === Math.floor(step)) {
|
|
4032
|
-
index = Math.floor(step) * 2;
|
|
4011
|
+
function clampAngle(angle = 0) {
|
|
4012
|
+
if (angle < 0) {
|
|
4013
|
+
while (angle < 0) {
|
|
4014
|
+
angle += Math.PI * 2;
|
|
4033
4015
|
}
|
|
4034
|
-
|
|
4035
|
-
|
|
4016
|
+
}
|
|
4017
|
+
if (angle > 0) {
|
|
4018
|
+
while (angle >= Math.PI * 2) {
|
|
4019
|
+
angle -= Math.PI * 2;
|
|
4036
4020
|
}
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4021
|
+
}
|
|
4022
|
+
return angle;
|
|
4023
|
+
}
|
|
4024
|
+
function rotateYAxis(orient, items) {
|
|
4025
|
+
items.forEach((item, i) => {
|
|
4026
|
+
item.setAttributes(Object.assign(Object.assign({}, getYAxisLabelAlign(orient, item.attribute.angle)), { angle: clampAngle(item.attribute.angle) }));
|
|
4042
4027
|
});
|
|
4043
4028
|
}
|
|
4044
4029
|
function rotateXAxis(orient, items) {
|
|
4030
|
+
items.forEach(item => {
|
|
4031
|
+
item.setAttributes(Object.assign(Object.assign({}, getXAxisLabelAlign(orient, item.attribute.angle)), { angle: clampAngle(item.attribute.angle) }));
|
|
4032
|
+
});
|
|
4033
|
+
}
|
|
4034
|
+
function getXAxisLabelAlign(orient, angle = 0) {
|
|
4045
4035
|
let align = ['center', 'left', 'left', 'left', 'center', 'right', 'right', 'right', 'left'];
|
|
4046
4036
|
let baseline = ['top', 'top', 'middle', 'bottom', 'bottom', 'bottom', 'middle', 'top', 'top'];
|
|
4047
4037
|
if (orient === 'top') {
|
|
4048
4038
|
align = ['center', 'right', 'right', 'right', 'center', 'left', 'left', 'left', 'right'];
|
|
4049
4039
|
baseline = ['bottom', 'bottom', 'middle', 'top', 'top', 'top', 'middle', 'bottom', 'bottom'];
|
|
4050
4040
|
}
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4041
|
+
angle = clampAngle(angle);
|
|
4042
|
+
const step = angle / (Math.PI * 0.5);
|
|
4043
|
+
let index;
|
|
4044
|
+
if (step === Math.floor(step)) {
|
|
4045
|
+
index = Math.floor(step) * 2;
|
|
4046
|
+
}
|
|
4047
|
+
else {
|
|
4048
|
+
index = Math.floor(step) * 2 + 1;
|
|
4049
|
+
}
|
|
4050
|
+
return {
|
|
4051
|
+
textAlign: align[index],
|
|
4052
|
+
textBaseline: baseline[index]
|
|
4053
|
+
};
|
|
4054
|
+
}
|
|
4055
|
+
function getYAxisLabelAlign(orient, angle = 0) {
|
|
4056
|
+
let align = ['right', 'right', 'center', 'left', 'center', 'left', 'center', 'right', 'right'];
|
|
4057
|
+
let baseline = ['middle', 'middle', 'top', 'top', 'middle', 'middle', 'bottom', 'bottom', 'middle'];
|
|
4058
|
+
if (orient === 'right') {
|
|
4059
|
+
align = ['left', 'right', 'right', 'right', 'left', 'left', 'left', 'left', 'right'];
|
|
4060
|
+
baseline = ['middle', 'bottom', 'middle', 'top', 'top', 'top', 'middle', 'bottom', 'bottom'];
|
|
4061
|
+
}
|
|
4062
|
+
angle = clampAngle(angle);
|
|
4063
|
+
const step = angle / (Math.PI * 0.5);
|
|
4064
|
+
let index;
|
|
4065
|
+
if (step === Math.floor(step)) {
|
|
4066
|
+
index = Math.floor(step) * 2;
|
|
4067
|
+
}
|
|
4068
|
+
else {
|
|
4069
|
+
index = Math.floor(step) * 2 + 1;
|
|
4070
|
+
}
|
|
4071
|
+
return {
|
|
4072
|
+
textAlign: align[index],
|
|
4073
|
+
textBaseline: baseline[index]
|
|
4074
|
+
};
|
|
4077
4075
|
}
|
|
4078
4076
|
|
|
4079
4077
|
function autoLimit(labels, config) {
|
|
@@ -4480,14 +4478,23 @@
|
|
|
4480
4478
|
}
|
|
4481
4479
|
return base;
|
|
4482
4480
|
}
|
|
4483
|
-
|
|
4481
|
+
getLabelAlign(vector, inside, angle) {
|
|
4484
4482
|
const orient = this.attribute.orient;
|
|
4485
|
-
if (
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4483
|
+
if (vutils.isValidNumber(angle)) {
|
|
4484
|
+
if (orient === 'top' || orient === 'bottom') {
|
|
4485
|
+
return getXAxisLabelAlign(orient, angle);
|
|
4486
|
+
}
|
|
4487
|
+
if (orient === 'left' || orient === 'right') {
|
|
4488
|
+
return getYAxisLabelAlign(orient, angle);
|
|
4489
|
+
}
|
|
4490
4490
|
}
|
|
4491
|
+
return {
|
|
4492
|
+
textAlign: this.getTextAlign(vector),
|
|
4493
|
+
textBaseline: this.getTextBaseline(vector, inside)
|
|
4494
|
+
};
|
|
4495
|
+
}
|
|
4496
|
+
beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4497
|
+
return;
|
|
4491
4498
|
}
|
|
4492
4499
|
handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4493
4500
|
if (vutils.isEmpty(labelShapes)) {
|
|
@@ -4835,6 +4842,12 @@
|
|
|
4835
4842
|
afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4836
4843
|
return;
|
|
4837
4844
|
}
|
|
4845
|
+
getLabelAlign(vector, inside, angle) {
|
|
4846
|
+
return {
|
|
4847
|
+
textAlign: this.getTextAlign(vector),
|
|
4848
|
+
textBaseline: this.getTextBaseline(vector)
|
|
4849
|
+
};
|
|
4850
|
+
}
|
|
4838
4851
|
}
|
|
4839
4852
|
CircleAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
4840
4853
|
|
|
@@ -5725,6 +5738,27 @@
|
|
|
5725
5738
|
})(exports.IMarkPointItemPosition || (exports.IMarkPointItemPosition = {}));
|
|
5726
5739
|
|
|
5727
5740
|
class Marker extends AbstractComponent {
|
|
5741
|
+
_initContainer() {
|
|
5742
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
5743
|
+
const groupClip = vrender.createGroup(Object.assign(Object.assign({}, (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.clipRange), { clip: (_c = vutils.isValid((_b = this.attribute) === null || _b === void 0 ? void 0 : _b.clipRange)) !== null && _c !== void 0 ? _c : false }));
|
|
5744
|
+
groupClip.name = 'marker-container';
|
|
5745
|
+
const group = vrender.createGroup({
|
|
5746
|
+
x: -((_f = (_e = (_d = this.attribute) === null || _d === void 0 ? void 0 : _d.clipRange) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0),
|
|
5747
|
+
y: -((_j = (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.clipRange) === null || _h === void 0 ? void 0 : _h.y) !== null && _j !== void 0 ? _j : 0)
|
|
5748
|
+
});
|
|
5749
|
+
groupClip.add(group);
|
|
5750
|
+
this._containerClip = groupClip;
|
|
5751
|
+
this.add(groupClip);
|
|
5752
|
+
this._container = group;
|
|
5753
|
+
}
|
|
5754
|
+
_updateContainer() {
|
|
5755
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
5756
|
+
this._containerClip.setAttributes(Object.assign(Object.assign({}, (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.clipRange), { clip: (_c = vutils.isValid((_b = this.attribute) === null || _b === void 0 ? void 0 : _b.clipRange)) !== null && _c !== void 0 ? _c : false }));
|
|
5757
|
+
this._container.setAttributes({
|
|
5758
|
+
x: -((_f = (_e = (_d = this.attribute) === null || _d === void 0 ? void 0 : _d.clipRange) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0),
|
|
5759
|
+
y: -((_j = (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.clipRange) === null || _h === void 0 ? void 0 : _h.y) !== null && _j !== void 0 ? _j : 0)
|
|
5760
|
+
});
|
|
5761
|
+
}
|
|
5728
5762
|
render() {
|
|
5729
5763
|
var _a, _b;
|
|
5730
5764
|
const markerVisible = (_a = this.attribute.visible) !== null && _a !== void 0 ? _a : true;
|
|
@@ -5734,14 +5768,12 @@
|
|
|
5734
5768
|
this.setAttribute('childrenPickable', false);
|
|
5735
5769
|
}
|
|
5736
5770
|
if (markerVisible) {
|
|
5737
|
-
if (!this.
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
this.add(group);
|
|
5741
|
-
this._container = group;
|
|
5742
|
-
this.initMarker(group);
|
|
5771
|
+
if (!this._containerClip) {
|
|
5772
|
+
this._initContainer();
|
|
5773
|
+
this.initMarker(this._container);
|
|
5743
5774
|
}
|
|
5744
5775
|
else {
|
|
5776
|
+
this._updateContainer();
|
|
5745
5777
|
this.updateMarker();
|
|
5746
5778
|
}
|
|
5747
5779
|
}
|
|
@@ -6502,6 +6534,7 @@
|
|
|
6502
6534
|
LegendEvent["legendItemHover"] = "legendItemHover";
|
|
6503
6535
|
LegendEvent["legendItemUnHover"] = "legendItemUnHover";
|
|
6504
6536
|
LegendEvent["legendItemClick"] = "legendItemClick";
|
|
6537
|
+
LegendEvent["legendItemAttributeUpdate"] = "legendItemAttributeUpdate";
|
|
6505
6538
|
})(exports.LegendEvent || (exports.LegendEvent = {}));
|
|
6506
6539
|
exports.LEGEND_ELEMENT_NAME = void 0;
|
|
6507
6540
|
(function (LEGEND_ELEMENT_NAME) {
|
|
@@ -6625,12 +6658,21 @@
|
|
|
6625
6658
|
const target = e.target;
|
|
6626
6659
|
if ((_a = target === null || target === void 0 ? void 0 : target.name) === null || _a === void 0 ? void 0 : _a.startsWith(exports.LEGEND_ELEMENT_NAME.item)) {
|
|
6627
6660
|
const legendItem = target.delegate;
|
|
6661
|
+
let attributeUpdate = false;
|
|
6662
|
+
if (legendItem.hasState(exports.LegendStateValue.unSelectedHover) ||
|
|
6663
|
+
legendItem.hasState(exports.LegendStateValue.selectedHover)) {
|
|
6664
|
+
attributeUpdate = true;
|
|
6665
|
+
}
|
|
6628
6666
|
legendItem.removeState(exports.LegendStateValue.unSelectedHover);
|
|
6629
6667
|
legendItem.removeState(exports.LegendStateValue.selectedHover);
|
|
6630
6668
|
legendItem
|
|
6631
6669
|
.getChildren()[0]
|
|
6632
6670
|
.getChildren()
|
|
6633
6671
|
.forEach((child) => {
|
|
6672
|
+
if (!attributeUpdate &&
|
|
6673
|
+
(child.hasState(exports.LegendStateValue.unSelectedHover) || child.hasState(exports.LegendStateValue.selectedHover))) {
|
|
6674
|
+
attributeUpdate = true;
|
|
6675
|
+
}
|
|
6634
6676
|
child.removeState(exports.LegendStateValue.unSelectedHover);
|
|
6635
6677
|
child.removeState(exports.LegendStateValue.selectedHover);
|
|
6636
6678
|
});
|
|
@@ -6638,6 +6680,9 @@
|
|
|
6638
6680
|
if (focusButton) {
|
|
6639
6681
|
focusButton.setAttribute('visible', false);
|
|
6640
6682
|
}
|
|
6683
|
+
if (attributeUpdate) {
|
|
6684
|
+
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem);
|
|
6685
|
+
}
|
|
6641
6686
|
this._dispatchEvent(exports.LegendEvent.legendItemUnHover, legendItem);
|
|
6642
6687
|
}
|
|
6643
6688
|
};
|
|
@@ -6908,15 +6953,30 @@
|
|
|
6908
6953
|
this._appendDataToShape(valueShape, exports.LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueAttr === null || valueAttr === void 0 ? void 0 : valueAttr.state);
|
|
6909
6954
|
valueShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
|
|
6910
6955
|
if (this._itemWidthByUser) {
|
|
6911
|
-
|
|
6956
|
+
const layoutWidth = this._itemWidthByUser -
|
|
6912
6957
|
parsedPadding[1] -
|
|
6913
6958
|
parsedPadding[3] -
|
|
6914
6959
|
shapeSize -
|
|
6915
6960
|
shapeSpace -
|
|
6916
|
-
labelShape.AABBBounds.width() -
|
|
6917
6961
|
labelSpace -
|
|
6918
6962
|
focusSpace -
|
|
6919
|
-
valueSpace
|
|
6963
|
+
valueSpace;
|
|
6964
|
+
const valueBounds = valueShape.AABBBounds;
|
|
6965
|
+
const labelBounds = labelShape.AABBBounds;
|
|
6966
|
+
const valueWidth = valueBounds.width();
|
|
6967
|
+
const labelWidth = labelBounds.width();
|
|
6968
|
+
if (valueWidth + labelWidth > layoutWidth) {
|
|
6969
|
+
if ((layoutWidth - valueWidth) / labelWidth > 0.4) {
|
|
6970
|
+
labelShape.setAttribute('maxLineWidth', layoutWidth - valueWidth);
|
|
6971
|
+
}
|
|
6972
|
+
else {
|
|
6973
|
+
valueShape.setAttribute('maxLineWidth', layoutWidth * 0.5);
|
|
6974
|
+
labelShape.setAttribute('maxLineWidth', layoutWidth * 0.5);
|
|
6975
|
+
}
|
|
6976
|
+
}
|
|
6977
|
+
else {
|
|
6978
|
+
valueShape.setAttribute('maxLineWidth', layoutWidth - labelWidth);
|
|
6979
|
+
}
|
|
6920
6980
|
if (valueAttr.alignRight) {
|
|
6921
6981
|
valueShape.setAttributes({
|
|
6922
6982
|
textAlign: 'right',
|
|
@@ -7066,18 +7126,32 @@
|
|
|
7066
7126
|
return true;
|
|
7067
7127
|
}
|
|
7068
7128
|
_setLegendItemState(legendItem, stateName, keepCurrentStates = true) {
|
|
7129
|
+
let attributeUpdate = false;
|
|
7130
|
+
if (!legendItem.hasState(stateName)) {
|
|
7131
|
+
attributeUpdate = true;
|
|
7132
|
+
}
|
|
7069
7133
|
legendItem.addState(stateName, keepCurrentStates);
|
|
7070
7134
|
legendItem
|
|
7071
7135
|
.getChildren()[0]
|
|
7072
7136
|
.getChildren()
|
|
7073
|
-
.forEach(child => {
|
|
7137
|
+
.forEach((child) => {
|
|
7074
7138
|
if (child.name !== exports.LEGEND_ELEMENT_NAME.focus) {
|
|
7139
|
+
if (!attributeUpdate && !child.hasState(stateName)) {
|
|
7140
|
+
attributeUpdate = true;
|
|
7141
|
+
}
|
|
7075
7142
|
child.addState(stateName, keepCurrentStates);
|
|
7076
7143
|
}
|
|
7077
7144
|
});
|
|
7145
|
+
if (attributeUpdate) {
|
|
7146
|
+
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem);
|
|
7147
|
+
}
|
|
7078
7148
|
}
|
|
7079
7149
|
_removeLegendItemState(legendItem, stateNames) {
|
|
7150
|
+
let attributeUpdate = false;
|
|
7080
7151
|
stateNames.forEach(name => {
|
|
7152
|
+
if (!attributeUpdate && legendItem.hasState(name)) {
|
|
7153
|
+
attributeUpdate = true;
|
|
7154
|
+
}
|
|
7081
7155
|
legendItem.removeState(name);
|
|
7082
7156
|
});
|
|
7083
7157
|
legendItem
|
|
@@ -7086,10 +7160,16 @@
|
|
|
7086
7160
|
.forEach(child => {
|
|
7087
7161
|
if (child.name !== exports.LEGEND_ELEMENT_NAME.focus) {
|
|
7088
7162
|
stateNames.forEach(name => {
|
|
7163
|
+
if (!attributeUpdate && child.hasState(name)) {
|
|
7164
|
+
attributeUpdate = true;
|
|
7165
|
+
}
|
|
7089
7166
|
child.removeState(name);
|
|
7090
7167
|
});
|
|
7091
7168
|
}
|
|
7092
7169
|
});
|
|
7170
|
+
if (attributeUpdate) {
|
|
7171
|
+
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem);
|
|
7172
|
+
}
|
|
7093
7173
|
}
|
|
7094
7174
|
_getSelectedLegends() {
|
|
7095
7175
|
var _a;
|
|
@@ -9963,7 +10043,7 @@
|
|
|
9963
10043
|
}
|
|
9964
10044
|
Tooltip.defaultAttributes = defaultAttributes;
|
|
9965
10045
|
|
|
9966
|
-
const version = "0.14.3-alpha.
|
|
10046
|
+
const version = "0.14.3-alpha.1";
|
|
9967
10047
|
|
|
9968
10048
|
exports.AbstractComponent = AbstractComponent;
|
|
9969
10049
|
exports.ArcInfo = ArcInfo;
|