@visactor/vrender-components 0.20.6-beta.0 → 0.20.7-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/axis/grid/base.d.ts +1 -0
- package/cjs/axis/grid/base.js +9 -3
- package/cjs/axis/grid/base.js.map +1 -1
- package/cjs/axis/grid/circle.d.ts +1 -0
- package/cjs/axis/grid/circle.js +4 -0
- package/cjs/axis/grid/circle.js.map +1 -1
- package/cjs/axis/grid/line.d.ts +2 -0
- package/cjs/axis/grid/line.js +9 -5
- package/cjs/axis/grid/line.js.map +1 -1
- package/cjs/axis/line.js +3 -2
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/overlap/auto-hide.d.ts +2 -1
- package/cjs/axis/overlap/auto-hide.js +29 -33
- package/cjs/axis/overlap/auto-hide.js.map +1 -1
- package/cjs/axis/overlap/util.js +11 -10
- package/cjs/axis/overlap/util.js.map +1 -1
- package/cjs/axis/tick-data/continuous.js +29 -5
- package/cjs/axis/tick-data/continuous.js.map +1 -1
- package/cjs/axis/tick-data/util.d.ts +1 -4
- package/cjs/axis/tick-data/util.js +2 -13
- package/cjs/axis/tick-data/util.js.map +1 -1
- package/cjs/axis/type.d.ts +3 -1
- package/cjs/axis/type.js.map +1 -1
- package/cjs/axis/util.d.ts +3 -1
- package/cjs/axis/util.js +15 -2
- package/cjs/axis/util.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.js +1 -1
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.js +18 -29
- package/cjs/label/base.js.map +1 -1
- package/cjs/legend/discrete/discrete.js +3 -3
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/dist/index.es.js +265 -148
- package/es/axis/grid/base.d.ts +1 -0
- package/es/axis/grid/base.js +8 -4
- package/es/axis/grid/base.js.map +1 -1
- package/es/axis/grid/circle.d.ts +1 -0
- package/es/axis/grid/circle.js +4 -0
- package/es/axis/grid/circle.js.map +1 -1
- package/es/axis/grid/line.d.ts +2 -0
- package/es/axis/grid/line.js +9 -5
- package/es/axis/grid/line.js.map +1 -1
- package/es/axis/line.js +3 -2
- package/es/axis/line.js.map +1 -1
- package/es/axis/overlap/auto-hide.d.ts +2 -1
- package/es/axis/overlap/auto-hide.js +25 -28
- package/es/axis/overlap/auto-hide.js.map +1 -1
- package/es/axis/overlap/util.js +10 -10
- package/es/axis/overlap/util.js.map +1 -1
- package/es/axis/tick-data/continuous.js +28 -5
- package/es/axis/tick-data/continuous.js.map +1 -1
- package/es/axis/tick-data/util.d.ts +1 -4
- package/es/axis/tick-data/util.js +0 -10
- package/es/axis/tick-data/util.js.map +1 -1
- package/es/axis/type.d.ts +3 -1
- package/es/axis/type.js.map +1 -1
- package/es/axis/util.d.ts +3 -1
- package/es/axis/util.js +12 -0
- package/es/axis/util.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.js +1 -1
- package/es/label/arc.js.map +1 -1
- package/es/label/base.js +18 -29
- package/es/label/base.js.map +1 -1
- package/es/legend/discrete/discrete.js +3 -3
- package/es/legend/discrete/discrete.js.map +1 -1
- package/package.json +8 -8
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, cos, sin, pi, isArray, pointAt, isNumber, getDecimalPlaces, isNil, Color, has, normalTransform, isValidUrl, isBase64, acos, sqrt, transformBoundsWithMatrix, arrayEqual, getContextFont, clampAngleByRadian, asin, Bounds, getRectIntersect, isRectIntersect, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isValid, isEmpty, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, array, isValidNumber, calculateAnchorOfBounds, computeQuadrant, isGreater, isLess, isNumberClose, normalizeAngle, flattenArray, cloneDeep, get,
|
|
1
|
+
import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, cos, sin, pi, isArray, pointAt, isNumber, getDecimalPlaces, isNil, Color, OBBBounds, has, normalTransform, isValidUrl, isBase64, acos, sqrt, transformBoundsWithMatrix, arrayEqual, getContextFont, rotatePoint, clampAngleByRadian, asin, Bounds, getRectIntersect, isRectIntersect, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isValid, isEmpty, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, array, isValidNumber, calculateAnchorOfBounds, computeQuadrant, isGreater, isLess, isNumberClose, normalizeAngle, flattenArray, cloneDeep, get, last, isRotateAABBIntersect, mixin, isEqual, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, polygonContainPoint } from '@visactor/vutils';
|
|
2
2
|
import { isContinuous, isDiscrete, LinearScale } from '@visactor/vscale';
|
|
3
3
|
|
|
4
4
|
class Generator {
|
|
@@ -4466,6 +4466,9 @@ class Graphic extends Node {
|
|
|
4466
4466
|
get AABBBounds() {
|
|
4467
4467
|
return this.tryUpdateAABBBounds("imprecise" === this.attribute.boundsMode);
|
|
4468
4468
|
}
|
|
4469
|
+
get OBBBounds() {
|
|
4470
|
+
return this.tryUpdateOBBBounds();
|
|
4471
|
+
}
|
|
4469
4472
|
get globalAABBBounds() {
|
|
4470
4473
|
return this.tryUpdateGlobalAABBBounds();
|
|
4471
4474
|
}
|
|
@@ -4478,7 +4481,7 @@ class Graphic extends Node {
|
|
|
4478
4481
|
constructor() {
|
|
4479
4482
|
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4480
4483
|
var _a;
|
|
4481
|
-
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
4484
|
+
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
4482
4485
|
}
|
|
4483
4486
|
setMode(mode) {
|
|
4484
4487
|
"3d" === mode ? this.set3dMode() : this.set2dMode();
|
|
@@ -4512,13 +4515,22 @@ class Graphic extends Node {
|
|
|
4512
4515
|
const bounds = this.doUpdateAABBBounds(full);
|
|
4513
4516
|
return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), bounds;
|
|
4514
4517
|
}
|
|
4518
|
+
tryUpdateOBBBounds() {
|
|
4519
|
+
if (this._OBBBounds || (this._OBBBounds = new OBBBounds()), this.tryUpdateAABBBounds(), this.updateOBBBoundsStamp === this.updateAABBBoundsStamp) return this._OBBBounds;
|
|
4520
|
+
if (this.updateOBBBoundsStamp = this.updateAABBBoundsStamp, !this.valid) return this._OBBBounds.clear(), this._OBBBounds;
|
|
4521
|
+
return this.doUpdateOBBBounds();
|
|
4522
|
+
}
|
|
4515
4523
|
combindShadowAABBBounds(bounds) {
|
|
4516
4524
|
if (this.shadowRoot) {
|
|
4517
4525
|
const b = this.shadowRoot.AABBBounds.clone();
|
|
4518
4526
|
bounds.union(b);
|
|
4519
4527
|
}
|
|
4520
4528
|
}
|
|
4529
|
+
doUpdateOBBBounds() {
|
|
4530
|
+
return this._OBBBounds;
|
|
4531
|
+
}
|
|
4521
4532
|
doUpdateAABBBounds(full) {
|
|
4533
|
+
this.updateAABBBoundsStamp++;
|
|
4522
4534
|
const graphicTheme = this.getGraphicTheme();
|
|
4523
4535
|
this._AABBBounds.clear();
|
|
4524
4536
|
const attribute = this.attribute,
|
|
@@ -5476,6 +5488,7 @@ class Group extends Graphic {
|
|
|
5476
5488
|
}), application.graphicService.updateTempAABBBounds(aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, this), originalAABBBounds.copy(aabbBounds), originalAABBBounds;
|
|
5477
5489
|
}
|
|
5478
5490
|
doUpdateAABBBounds() {
|
|
5491
|
+
this.updateAABBBoundsStamp++;
|
|
5479
5492
|
const bounds = super.doUpdateAABBBounds();
|
|
5480
5493
|
return this.parent && this.parent.addChildUpdateBoundTag(), this._emitCustomEvent("AAABBBoundsChange"), bounds;
|
|
5481
5494
|
}
|
|
@@ -5811,7 +5824,7 @@ function drawPathProxy(graphic, context, x, y, drawContext, params, fillCb, stro
|
|
|
5811
5824
|
const path = "function" == typeof graphic.pathProxy ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;
|
|
5812
5825
|
return renderCommandList(path.commandList, context, x, y), context.setShadowBlendStyle && context.setShadowBlendStyle(graphic, graphic.attribute, themeAttributes), doStroke && (strokeCb ? strokeCb(context, graphic.attribute, themeAttributes) : sVisible && (context.setStrokeStyle(graphic, graphic.attribute, x - originX, y - originY, themeAttributes), context.stroke())), doFill && (fillCb ? fillCb(context, graphic.attribute, themeAttributes) : fVisible && (context.setCommonStyle(graphic, graphic.attribute, x - originX, y - originY, themeAttributes), context.fill())), !0;
|
|
5813
5826
|
}
|
|
5814
|
-
function intersect
|
|
5827
|
+
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
|
5815
5828
|
const x10 = x1 - x0,
|
|
5816
5829
|
y10 = y1 - y0,
|
|
5817
5830
|
x32 = x3 - x2,
|
|
@@ -5880,7 +5893,7 @@ function calculateArcCornerRadius(arc, startAngle, endAngle, innerRadius, outerR
|
|
|
5880
5893
|
yire = innerRadius * sin(innerEndAngle);
|
|
5881
5894
|
let xore, yore, xirs, yirs;
|
|
5882
5895
|
if ((maxInnerCornerRadius > epsilon || maxOuterCornerRadius > epsilon) && (xore = outerRadius * cos(outerEndAngle), yore = outerRadius * sin(outerEndAngle), xirs = innerRadius * cos(innerStartAngle), yirs = innerRadius * sin(innerStartAngle), deltaAngle < pi)) {
|
|
5883
|
-
const oc = intersect
|
|
5896
|
+
const oc = intersect(xors, yors, xirs, yirs, xore, yore, xire, yire);
|
|
5884
5897
|
if (oc) {
|
|
5885
5898
|
const ax = xors - oc[0],
|
|
5886
5899
|
ay = yors - oc[1],
|
|
@@ -9152,7 +9165,10 @@ class InteractiveDrawItemInterceptorContribution {
|
|
|
9152
9165
|
}
|
|
9153
9166
|
beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) {
|
|
9154
9167
|
const baseGraphic = graphic.baseGraphic;
|
|
9155
|
-
|
|
9168
|
+
let intree = !!baseGraphic.stage,
|
|
9169
|
+
_g = baseGraphic.parent;
|
|
9170
|
+
for (; intree && _g && _g.stage !== _g;) intree = !!_g.stage, _g = _g.parent;
|
|
9171
|
+
if (!intree) {
|
|
9156
9172
|
const interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
|
|
9157
9173
|
if (interactiveLayer) {
|
|
9158
9174
|
this.getShadowRoot(interactiveLayer).removeChild(graphic);
|
|
@@ -9501,6 +9517,35 @@ class Text extends Graphic {
|
|
|
9501
9517
|
getGraphicTheme() {
|
|
9502
9518
|
return getTheme(this).text;
|
|
9503
9519
|
}
|
|
9520
|
+
doUpdateOBBBounds() {
|
|
9521
|
+
const graphicTheme = this.getGraphicTheme();
|
|
9522
|
+
this._OBBBounds.clear();
|
|
9523
|
+
const attribute = this.attribute,
|
|
9524
|
+
{
|
|
9525
|
+
angle = graphicTheme.angle
|
|
9526
|
+
} = attribute;
|
|
9527
|
+
if (!angle) {
|
|
9528
|
+
const b = this.AABBBounds;
|
|
9529
|
+
return this._OBBBounds.setValue(b.x1, b.y1, b.x2, b.y2), this._OBBBounds;
|
|
9530
|
+
}
|
|
9531
|
+
this.obbText || (this.obbText = new Text({})), this.obbText.setAttributes(Object.assign(Object.assign({}, attribute), {
|
|
9532
|
+
angle: 0
|
|
9533
|
+
}));
|
|
9534
|
+
const bounds1 = this.obbText.AABBBounds,
|
|
9535
|
+
{
|
|
9536
|
+
x: x,
|
|
9537
|
+
y: y
|
|
9538
|
+
} = attribute,
|
|
9539
|
+
boundsCenter = {
|
|
9540
|
+
x: (bounds1.x1 + bounds1.x2) / 2,
|
|
9541
|
+
y: (bounds1.y1 + bounds1.y2) / 2
|
|
9542
|
+
},
|
|
9543
|
+
center = rotatePoint(boundsCenter, angle, {
|
|
9544
|
+
x: x,
|
|
9545
|
+
y: y
|
|
9546
|
+
});
|
|
9547
|
+
return this._OBBBounds.copy(bounds1), this._OBBBounds.translate(center.x - boundsCenter.x, center.y - boundsCenter.y), this._OBBBounds.angle = angle, this._OBBBounds;
|
|
9548
|
+
}
|
|
9504
9549
|
updateAABBBounds(attribute, textTheme, aabbBounds) {
|
|
9505
9550
|
const {
|
|
9506
9551
|
text = textTheme.text
|
|
@@ -11933,13 +11978,14 @@ class Arc extends Graphic {
|
|
|
11933
11978
|
return super.needUpdateTag(key, ARC_UPDATE_TAG_KEY);
|
|
11934
11979
|
}
|
|
11935
11980
|
toCustomPath() {
|
|
11981
|
+
var _a, _b, _c, _d;
|
|
11936
11982
|
const attribute = this.attribute,
|
|
11937
11983
|
{
|
|
11938
11984
|
startAngle: startAngle,
|
|
11939
11985
|
endAngle: endAngle
|
|
11940
11986
|
} = this.getParsedAngle();
|
|
11941
|
-
let innerRadius = attribute.innerRadius - (attribute.innerPadding
|
|
11942
|
-
outerRadius = attribute.outerRadius - (attribute.outerPadding
|
|
11987
|
+
let innerRadius = (null !== (_a = attribute.innerRadius) && void 0 !== _a ? _a : 0) - (null !== (_b = attribute.innerPadding) && void 0 !== _b ? _b : 0),
|
|
11988
|
+
outerRadius = (null !== (_c = attribute.outerRadius) && void 0 !== _c ? _c : 0) - (null !== (_d = attribute.outerPadding) && void 0 !== _d ? _d : 0);
|
|
11943
11989
|
const deltaAngle = abs(endAngle - startAngle),
|
|
11944
11990
|
clockwise = endAngle > startAngle;
|
|
11945
11991
|
if (outerRadius < innerRadius) {
|
|
@@ -16802,44 +16848,31 @@ class LabelBase extends AbstractComponent {
|
|
|
16802
16848
|
const baseMark = this.getRelatedGraphic(label.attribute);
|
|
16803
16849
|
const backgroundColor = baseMark.attribute.fill;
|
|
16804
16850
|
const foregroundColor = label.attribute.fill;
|
|
16805
|
-
const baseColor = backgroundColor;
|
|
16806
16851
|
const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode);
|
|
16807
16852
|
const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
|
|
16808
|
-
if (outsideEnable) {
|
|
16809
|
-
const fill = smartInvertStrategy(fillStrategy,
|
|
16853
|
+
if (outsideEnable || this._canPlaceInside(label.AABBBounds, baseMark.AABBBounds)) {
|
|
16854
|
+
const fill = smartInvertStrategy(fillStrategy, backgroundColor, invertColor, similarColor);
|
|
16810
16855
|
fill && label.setAttributes({ fill });
|
|
16811
16856
|
if (label.attribute.lineWidth === 0) {
|
|
16812
16857
|
continue;
|
|
16813
16858
|
}
|
|
16814
|
-
const stroke = smartInvertStrategy(strokeStrategy,
|
|
16859
|
+
const stroke = smartInvertStrategy(strokeStrategy, backgroundColor, invertColor, similarColor);
|
|
16815
16860
|
stroke && label.setAttributes({ stroke });
|
|
16816
16861
|
}
|
|
16817
|
-
else {
|
|
16818
|
-
|
|
16819
|
-
|
|
16820
|
-
const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
|
|
16821
|
-
fill && label.setAttributes({ fill });
|
|
16822
|
-
if (label.attribute.lineWidth === 0) {
|
|
16823
|
-
continue;
|
|
16824
|
-
}
|
|
16825
|
-
const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
|
|
16826
|
-
stroke && label.setAttributes({ stroke });
|
|
16862
|
+
else if (label.AABBBounds && baseMark.AABBBounds && baseMark.AABBBounds.intersects(label.AABBBounds)) {
|
|
16863
|
+
if (label.attribute.lineWidth === 0) {
|
|
16864
|
+
continue;
|
|
16827
16865
|
}
|
|
16828
|
-
|
|
16829
|
-
|
|
16830
|
-
|
|
16831
|
-
}
|
|
16832
|
-
|
|
16833
|
-
label.setAttributes({
|
|
16834
|
-
fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors, mode)
|
|
16835
|
-
});
|
|
16836
|
-
continue;
|
|
16837
|
-
}
|
|
16838
|
-
const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
|
|
16839
|
-
fill && label.setAttributes({ fill });
|
|
16840
|
-
const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
|
|
16841
|
-
stroke && label.setAttributes({ stroke });
|
|
16866
|
+
if (label.attribute.stroke) {
|
|
16867
|
+
label.setAttributes({
|
|
16868
|
+
fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors, mode)
|
|
16869
|
+
});
|
|
16870
|
+
continue;
|
|
16842
16871
|
}
|
|
16872
|
+
const fill = smartInvertStrategy(fillStrategy, backgroundColor, invertColor, similarColor);
|
|
16873
|
+
fill && label.setAttributes({ fill });
|
|
16874
|
+
const stroke = smartInvertStrategy(strokeStrategy, backgroundColor, invertColor, similarColor);
|
|
16875
|
+
stroke && label.setAttributes({ stroke });
|
|
16843
16876
|
}
|
|
16844
16877
|
}
|
|
16845
16878
|
}
|
|
@@ -17315,7 +17348,9 @@ class ArcLabel extends LabelBase {
|
|
|
17315
17348
|
const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height);
|
|
17316
17349
|
const flag = isQuadrantLeft(quadrant) ? -1 : 1;
|
|
17317
17350
|
let cx = 0;
|
|
17318
|
-
let limit = (flag > 0 ? plotLayout.x2 - pointB.x : pointB.x - plotLayout.x1
|
|
17351
|
+
let limit = (flag > 0 ? plotLayout.x2 - pointB.x + this._alignOffset : pointB.x - plotLayout.x1 - this._alignOffset) -
|
|
17352
|
+
this._line2MinLength -
|
|
17353
|
+
spaceWidth;
|
|
17319
17354
|
if (labelLayoutAlign === 'labelLine') {
|
|
17320
17355
|
cx = (radius + line1MinLength + this._line2MinLength) * flag + center.x;
|
|
17321
17356
|
limit = (flag > 0 ? plotLayout.x2 - cx : cx - plotLayout.x1) - spaceWidth;
|
|
@@ -18351,6 +18386,25 @@ function getPolygonPath(points, closed) {
|
|
|
18351
18386
|
}
|
|
18352
18387
|
return path;
|
|
18353
18388
|
}
|
|
18389
|
+
function textIntersect(textA, textB, sep) {
|
|
18390
|
+
let a = textA.OBBBounds;
|
|
18391
|
+
let b = textB.OBBBounds;
|
|
18392
|
+
if (a && b && !a.empty() && !b.empty()) {
|
|
18393
|
+
return a.intersects(b);
|
|
18394
|
+
}
|
|
18395
|
+
a = textA.AABBBounds;
|
|
18396
|
+
b = textB.AABBBounds;
|
|
18397
|
+
return sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);
|
|
18398
|
+
}
|
|
18399
|
+
function hasOverlap(items, pad) {
|
|
18400
|
+
for (let i = 1, n = items.length, a = items[0], b; i < n; a = b, ++i) {
|
|
18401
|
+
b = items[i];
|
|
18402
|
+
if (textIntersect(a, b, pad)) {
|
|
18403
|
+
return true;
|
|
18404
|
+
}
|
|
18405
|
+
}
|
|
18406
|
+
return false;
|
|
18407
|
+
}
|
|
18354
18408
|
|
|
18355
18409
|
const dispatchHoverState = (e, container, lastHover) => {
|
|
18356
18410
|
const target = e.target;
|
|
@@ -18772,12 +18826,86 @@ class AxisBase extends AbstractComponent {
|
|
|
18772
18826
|
}
|
|
18773
18827
|
}
|
|
18774
18828
|
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
|
|
18829
|
+
const methods$1 = {
|
|
18830
|
+
parity: function (items) {
|
|
18831
|
+
return items.filter((item, i) => (i % 2 ? item.setAttribute('opacity', 0) : 1));
|
|
18832
|
+
},
|
|
18833
|
+
greedy: function (items, sep) {
|
|
18834
|
+
let a;
|
|
18835
|
+
return items.filter((b, i) => {
|
|
18836
|
+
if (!i || !textIntersect(a, b, sep)) {
|
|
18837
|
+
a = b;
|
|
18838
|
+
return 1;
|
|
18839
|
+
}
|
|
18840
|
+
return b.setAttribute('opacity', 0);
|
|
18841
|
+
});
|
|
18842
|
+
}
|
|
18843
|
+
};
|
|
18844
|
+
function hasBounds(item) {
|
|
18845
|
+
let bounds;
|
|
18846
|
+
if (!item.OBBBounds.empty()) {
|
|
18847
|
+
bounds = item.OBBBounds;
|
|
18848
|
+
}
|
|
18849
|
+
else {
|
|
18850
|
+
bounds = item.AABBBounds;
|
|
18851
|
+
}
|
|
18852
|
+
return bounds.width() > 1 && bounds.height() > 1;
|
|
18853
|
+
}
|
|
18854
|
+
function reset(items) {
|
|
18855
|
+
items.forEach(item => item.setAttribute('opacity', 1));
|
|
18856
|
+
return items;
|
|
18857
|
+
}
|
|
18858
|
+
function forceItemVisible$1(sourceItem, items, check, comparator, inverse = false) {
|
|
18859
|
+
if (check && !sourceItem.attribute.opacity) {
|
|
18860
|
+
const remainLength = items.length;
|
|
18861
|
+
if (remainLength > 1) {
|
|
18862
|
+
sourceItem.setAttribute('opacity', 1);
|
|
18863
|
+
for (let i = 0; i < remainLength; i++) {
|
|
18864
|
+
const item = inverse ? items[remainLength - 1 - i] : items[i];
|
|
18865
|
+
if (comparator(item)) {
|
|
18866
|
+
item.setAttribute('opacity', 0);
|
|
18867
|
+
}
|
|
18868
|
+
else {
|
|
18869
|
+
break;
|
|
18870
|
+
}
|
|
18871
|
+
}
|
|
18872
|
+
}
|
|
18873
|
+
}
|
|
18874
|
+
}
|
|
18875
|
+
function autoHide(labels, config) {
|
|
18876
|
+
if (isEmpty(labels)) {
|
|
18877
|
+
return;
|
|
18878
|
+
}
|
|
18879
|
+
const source = labels.filter(hasBounds);
|
|
18880
|
+
if (isEmpty(source)) {
|
|
18881
|
+
return;
|
|
18882
|
+
}
|
|
18883
|
+
let items;
|
|
18884
|
+
items = reset(source);
|
|
18885
|
+
const { method = 'parity', separation: sep = 0 } = config;
|
|
18886
|
+
const reduce = isFunction(method) ? method : methods$1[method] || methods$1.parity;
|
|
18887
|
+
if (items.length >= 3 && hasOverlap(items, sep)) {
|
|
18888
|
+
do {
|
|
18889
|
+
items = reduce(items, sep);
|
|
18890
|
+
} while (items.length >= 3 && hasOverlap(items, sep));
|
|
18891
|
+
const shouldCheck = (length, visibility) => length < 3 || visibility;
|
|
18892
|
+
const checkFirst = shouldCheck(items.length, config.firstVisible);
|
|
18893
|
+
let checkLast = shouldCheck(items.length, config.lastVisible);
|
|
18894
|
+
const firstSourceItem = source[0];
|
|
18895
|
+
const lastSourceItem = last(source);
|
|
18896
|
+
if (textIntersect(firstSourceItem, lastSourceItem, sep)) {
|
|
18897
|
+
lastSourceItem.setAttribute('opacity', 0);
|
|
18898
|
+
checkLast = false;
|
|
18899
|
+
}
|
|
18900
|
+
forceItemVisible$1(firstSourceItem, items, checkFirst, (item) => textIntersect(item, firstSourceItem, sep));
|
|
18901
|
+
forceItemVisible$1(lastSourceItem, items, checkLast, (item) => textIntersect(item, lastSourceItem, sep) ||
|
|
18902
|
+
(checkFirst && item !== firstSourceItem ? textIntersect(item, firstSourceItem, sep) : false), true);
|
|
18903
|
+
}
|
|
18904
|
+
source.forEach(item => {
|
|
18905
|
+
item.setAttribute('visible', !!item.attribute.opacity);
|
|
18906
|
+
});
|
|
18780
18907
|
}
|
|
18908
|
+
|
|
18781
18909
|
function genNormalBounds(item) {
|
|
18782
18910
|
const bounds = item.AABBBounds;
|
|
18783
18911
|
return {
|
|
@@ -18796,7 +18924,10 @@ function genRotateBounds(items) {
|
|
|
18796
18924
|
return;
|
|
18797
18925
|
}
|
|
18798
18926
|
const bounds = genNormalBounds(item);
|
|
18799
|
-
const rotatedCenter =
|
|
18927
|
+
const rotatedCenter = rotatePoint({ x: item.attribute.x, y: item.attribute.y }, bounds.angle, {
|
|
18928
|
+
x: bounds.centerX,
|
|
18929
|
+
y: bounds.centerY
|
|
18930
|
+
});
|
|
18800
18931
|
const deltaX = rotatedCenter.x - bounds.centerX;
|
|
18801
18932
|
const deltaY = rotatedCenter.y - bounds.centerY;
|
|
18802
18933
|
bounds.x1 += deltaX;
|
|
@@ -18809,6 +18940,10 @@ function genRotateBounds(items) {
|
|
|
18809
18940
|
});
|
|
18810
18941
|
}
|
|
18811
18942
|
function itemIntersect(item1, item2) {
|
|
18943
|
+
var _a, _b;
|
|
18944
|
+
if (!((_a = item1.OBBBounds) === null || _a === void 0 ? void 0 : _a.empty()) && !((_b = item2.OBBBounds) === null || _b === void 0 ? void 0 : _b.empty())) {
|
|
18945
|
+
return item1.OBBBounds.intersects(item2.OBBBounds);
|
|
18946
|
+
}
|
|
18812
18947
|
return (isRectIntersect(item1.AABBBounds, item2.AABBBounds, false) &&
|
|
18813
18948
|
(item1.rotatedBounds && item2.rotatedBounds
|
|
18814
18949
|
? isRotateAABBIntersect(item1.rotatedBounds, item2.rotatedBounds, true)
|
|
@@ -18826,86 +18961,6 @@ function isAngleHorizontal(angle) {
|
|
|
18826
18961
|
return !hasAngle || Math.abs(sin) <= DELTA_ANGLE;
|
|
18827
18962
|
}
|
|
18828
18963
|
|
|
18829
|
-
const methods$1 = {
|
|
18830
|
-
parity: function (items) {
|
|
18831
|
-
return items.filter((item, i) => (i % 2 ? item.setAttribute('opacity', 0) : 1));
|
|
18832
|
-
},
|
|
18833
|
-
greedy: function (items, sep) {
|
|
18834
|
-
let a;
|
|
18835
|
-
return items.filter((b, i) => {
|
|
18836
|
-
if (!i || !intersect$1(a, b, sep)) {
|
|
18837
|
-
a = b;
|
|
18838
|
-
return 1;
|
|
18839
|
-
}
|
|
18840
|
-
return b.setAttribute('opacity', 0);
|
|
18841
|
-
});
|
|
18842
|
-
}
|
|
18843
|
-
};
|
|
18844
|
-
function intersect$1(textA, textB, sep) {
|
|
18845
|
-
const a = textA.AABBBounds;
|
|
18846
|
-
const b = textB.AABBBounds;
|
|
18847
|
-
return (sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2) &&
|
|
18848
|
-
(textA.rotatedBounds && textB.rotatedBounds
|
|
18849
|
-
? sep >
|
|
18850
|
-
Math.max(textB.rotatedBounds.x1 - textA.rotatedBounds.x2, textA.rotatedBounds.x1 - textB.rotatedBounds.x2, textB.rotatedBounds.y1 - textA.rotatedBounds.y2, textA.rotatedBounds.y1 - textB.rotatedBounds.y2)
|
|
18851
|
-
: true));
|
|
18852
|
-
}
|
|
18853
|
-
function hasOverlap$1(items, pad) {
|
|
18854
|
-
for (let i = 1, n = items.length, a = items[0], b; i < n; a = b, ++i) {
|
|
18855
|
-
if (intersect$1(a, (b = items[i]), pad)) {
|
|
18856
|
-
return true;
|
|
18857
|
-
}
|
|
18858
|
-
}
|
|
18859
|
-
}
|
|
18860
|
-
function hasBounds(item) {
|
|
18861
|
-
const b = item.AABBBounds;
|
|
18862
|
-
return b.width() > 1 && b.height() > 1;
|
|
18863
|
-
}
|
|
18864
|
-
function reset(items) {
|
|
18865
|
-
items.forEach(item => item.setAttribute('opacity', 1));
|
|
18866
|
-
return items;
|
|
18867
|
-
}
|
|
18868
|
-
function autoHide(labels, config) {
|
|
18869
|
-
if (isEmpty(labels)) {
|
|
18870
|
-
return;
|
|
18871
|
-
}
|
|
18872
|
-
const source = labels.filter(hasBounds);
|
|
18873
|
-
if (isEmpty(source)) {
|
|
18874
|
-
return;
|
|
18875
|
-
}
|
|
18876
|
-
let items;
|
|
18877
|
-
items = reset(source);
|
|
18878
|
-
genRotateBounds(items);
|
|
18879
|
-
const { method = 'parity', separation: sep = 0 } = config;
|
|
18880
|
-
const reduce = isFunction(method) ? method : methods$1[method] || methods$1.parity;
|
|
18881
|
-
if (items.length >= 3 && hasOverlap$1(items, sep)) {
|
|
18882
|
-
do {
|
|
18883
|
-
items = reduce(items, sep);
|
|
18884
|
-
} while (items.length >= 3 && hasOverlap$1(items, sep));
|
|
18885
|
-
const checkLast = items.length < 3 || config.lastVisible;
|
|
18886
|
-
if (checkLast) {
|
|
18887
|
-
const lastSourceItem = last(source);
|
|
18888
|
-
if (!lastSourceItem.attribute.opacity) {
|
|
18889
|
-
const remainLength = items.length;
|
|
18890
|
-
if (remainLength > 1) {
|
|
18891
|
-
lastSourceItem.setAttribute('opacity', 1);
|
|
18892
|
-
for (let i = remainLength - 1; i >= 0; i--) {
|
|
18893
|
-
if (intersect$1(items[i], lastSourceItem, sep)) {
|
|
18894
|
-
items[i].setAttribute('opacity', 0);
|
|
18895
|
-
}
|
|
18896
|
-
else {
|
|
18897
|
-
break;
|
|
18898
|
-
}
|
|
18899
|
-
}
|
|
18900
|
-
}
|
|
18901
|
-
}
|
|
18902
|
-
}
|
|
18903
|
-
}
|
|
18904
|
-
source.forEach(item => {
|
|
18905
|
-
item.setAttribute('visible', !!item.attribute.opacity);
|
|
18906
|
-
});
|
|
18907
|
-
}
|
|
18908
|
-
|
|
18909
18964
|
function autoRotate(items, rotateConfig) {
|
|
18910
18965
|
if (isEmpty(items)) {
|
|
18911
18966
|
return;
|
|
@@ -19640,7 +19695,7 @@ class LineAxis extends AxisBase {
|
|
|
19640
19695
|
}
|
|
19641
19696
|
const { verticalLimitSize, label, orient } = this.attribute;
|
|
19642
19697
|
const limitLength = this._getAxisLabelLimitLength(verticalLimitSize, layerCount);
|
|
19643
|
-
const { layoutFunc, autoRotate: autoRotate$1, autoRotateAngle, autoLimit: autoLimit$1, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, lastVisible, autoWrap: autoWrap$1, overflowLimitLength } = label;
|
|
19698
|
+
const { layoutFunc, autoRotate: autoRotate$1, autoRotateAngle, autoLimit: autoLimit$1, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, lastVisible, firstVisible, autoWrap: autoWrap$1, overflowLimitLength } = label;
|
|
19644
19699
|
if (isFunction(layoutFunc)) {
|
|
19645
19700
|
layoutFunc(labelShapes, labelData, layer, this);
|
|
19646
19701
|
}
|
|
@@ -19682,7 +19737,8 @@ class LineAxis extends AxisBase {
|
|
|
19682
19737
|
orient,
|
|
19683
19738
|
method: autoHideMethod,
|
|
19684
19739
|
separation: autoHideSeparation,
|
|
19685
|
-
lastVisible
|
|
19740
|
+
lastVisible,
|
|
19741
|
+
firstVisible
|
|
19686
19742
|
});
|
|
19687
19743
|
}
|
|
19688
19744
|
}
|
|
@@ -20160,18 +20216,6 @@ const labelOverlap = (prevLabel, nextLabel, gap = 0) => {
|
|
|
20160
20216
|
const nextBounds = new AABBBounds(nextLabel).expand(gap / 2);
|
|
20161
20217
|
return prevBounds.intersects(nextBounds);
|
|
20162
20218
|
};
|
|
20163
|
-
function intersect(a, b, sep) {
|
|
20164
|
-
return sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);
|
|
20165
|
-
}
|
|
20166
|
-
function hasOverlap(items, pad) {
|
|
20167
|
-
for (let i = 1, n = items.length, a = items[0], b; i < n; a = b, ++i) {
|
|
20168
|
-
b = items[i];
|
|
20169
|
-
if (intersect(a.AABBBounds, b.AABBBounds, pad)) {
|
|
20170
|
-
return true;
|
|
20171
|
-
}
|
|
20172
|
-
}
|
|
20173
|
-
return false;
|
|
20174
|
-
}
|
|
20175
20219
|
const MIN_TICK_GAP = 12;
|
|
20176
20220
|
const calculateFlushPos = (basePosition, size, rangePosition, otherEnd) => {
|
|
20177
20221
|
return rangePosition < basePosition
|
|
@@ -20282,6 +20326,30 @@ function getScaleTicks(op, scale, count, getTicks) {
|
|
|
20282
20326
|
}
|
|
20283
20327
|
return scaleTicks;
|
|
20284
20328
|
}
|
|
20329
|
+
function forceItemVisible(sourceItem, items, check, comparator, inverse = false) {
|
|
20330
|
+
if (check && !items.includes(sourceItem)) {
|
|
20331
|
+
let remainLength = items.length;
|
|
20332
|
+
if (remainLength > 1) {
|
|
20333
|
+
if (inverse) {
|
|
20334
|
+
items.push(sourceItem);
|
|
20335
|
+
}
|
|
20336
|
+
else {
|
|
20337
|
+
items.unshift(sourceItem);
|
|
20338
|
+
}
|
|
20339
|
+
for (let i = 0; i < remainLength; i++) {
|
|
20340
|
+
const index = inverse ? remainLength - 1 - i : i;
|
|
20341
|
+
if (comparator(items[index])) {
|
|
20342
|
+
items.splice(index, 1);
|
|
20343
|
+
i--;
|
|
20344
|
+
remainLength--;
|
|
20345
|
+
}
|
|
20346
|
+
else {
|
|
20347
|
+
break;
|
|
20348
|
+
}
|
|
20349
|
+
}
|
|
20350
|
+
}
|
|
20351
|
+
}
|
|
20352
|
+
}
|
|
20285
20353
|
const DEFAULT_CONTINUOUS_TICK_COUNT = 5;
|
|
20286
20354
|
const continuousTicks = (scale, op) => {
|
|
20287
20355
|
var _a, _b;
|
|
@@ -20325,17 +20393,41 @@ const continuousTicks = (scale, op) => {
|
|
|
20325
20393
|
return scale.ticks(count, { noDecimals, customTicks });
|
|
20326
20394
|
});
|
|
20327
20395
|
}
|
|
20328
|
-
|
|
20396
|
+
const domain = scale.domain();
|
|
20397
|
+
if (op.labelFirstVisible && domain[0] !== scaleTicks[0] && !scaleTicks.includes(domain[0])) {
|
|
20398
|
+
scaleTicks.unshift(domain[0]);
|
|
20399
|
+
}
|
|
20400
|
+
if (op.labelLastVisible &&
|
|
20401
|
+
domain[domain.length - 1] !== scaleTicks[scaleTicks.length - 1] &&
|
|
20402
|
+
!scaleTicks.includes(domain[domain.length - 1])) {
|
|
20403
|
+
scaleTicks.push(domain[domain.length - 1]);
|
|
20404
|
+
}
|
|
20405
|
+
if (op.sampling && scaleTicks.length > 1) {
|
|
20329
20406
|
if (op.coordinateType === 'cartesian' || (op.coordinateType === 'polar' && op.axisOrientType === 'radius')) {
|
|
20330
20407
|
const { labelGap = 4, labelFlush } = op;
|
|
20331
20408
|
let items = getCartesianLabelBounds(scale, scaleTicks, op).map((bounds, i) => ({
|
|
20332
20409
|
AABBBounds: bounds,
|
|
20333
20410
|
value: scaleTicks[i]
|
|
20334
20411
|
}));
|
|
20412
|
+
const source = [...items];
|
|
20413
|
+
const firstSourceItem = source[0];
|
|
20414
|
+
const lastSourceItem = last(source);
|
|
20335
20415
|
const samplingMethod = breakData && breakData() ? methods.greedy : methods.parity;
|
|
20336
20416
|
while (items.length >= 3 && hasOverlap(items, labelGap)) {
|
|
20337
20417
|
items = samplingMethod(items, labelGap);
|
|
20338
20418
|
}
|
|
20419
|
+
const shouldCheck = (length, visibility) => length < 3 || visibility;
|
|
20420
|
+
const checkFirst = shouldCheck(items.length, op.labelFirstVisible);
|
|
20421
|
+
let checkLast = shouldCheck(items.length, op.labelLastVisible);
|
|
20422
|
+
if (textIntersect(firstSourceItem, lastSourceItem, labelGap)) {
|
|
20423
|
+
if (items.includes(lastSourceItem) && items.length > 1) {
|
|
20424
|
+
items.splice(items.indexOf(lastSourceItem), 1);
|
|
20425
|
+
checkLast = false;
|
|
20426
|
+
}
|
|
20427
|
+
}
|
|
20428
|
+
forceItemVisible(firstSourceItem, items, checkFirst, (item) => textIntersect(item, firstSourceItem, labelGap));
|
|
20429
|
+
forceItemVisible(lastSourceItem, items, checkLast, (item) => textIntersect(item, lastSourceItem, labelGap) ||
|
|
20430
|
+
(checkFirst && item !== firstSourceItem ? textIntersect(item, firstSourceItem, labelGap) : false), true);
|
|
20339
20431
|
const ticks = items.map(item => item.value);
|
|
20340
20432
|
if (ticks.length < 3 && labelFlush) {
|
|
20341
20433
|
if (ticks.length > 1) {
|
|
@@ -20357,7 +20449,7 @@ const methods = {
|
|
|
20357
20449
|
greedy: function (items, sep) {
|
|
20358
20450
|
let a;
|
|
20359
20451
|
return items.filter((b, i) => {
|
|
20360
|
-
if (!i || !
|
|
20452
|
+
if (!i || !textIntersect(a, b, sep)) {
|
|
20361
20453
|
a = b;
|
|
20362
20454
|
return true;
|
|
20363
20455
|
}
|
|
@@ -20854,8 +20946,25 @@ class BaseGrid extends AbstractComponent {
|
|
|
20854
20946
|
? alternateColor
|
|
20855
20947
|
: [alternateColor, 'transparent'];
|
|
20856
20948
|
const getColor = (index) => colors[index % colors.length];
|
|
20857
|
-
|
|
20858
|
-
|
|
20949
|
+
const originalItems = this.attribute.items;
|
|
20950
|
+
const firstItem = originalItems[0];
|
|
20951
|
+
const lastItem = originalItems[originalItems.length - 1];
|
|
20952
|
+
const noZero = !isNumberClose(firstItem.value, 0) && !isNumberClose(lastItem.value, 0);
|
|
20953
|
+
const noOne = !isNumberClose(firstItem.value, 1) && !isNumberClose(lastItem.value, 1);
|
|
20954
|
+
const allPoints = [];
|
|
20955
|
+
const isDesc = firstItem.value > lastItem.value;
|
|
20956
|
+
if ((isDesc && noOne) || (!isDesc && noZero)) {
|
|
20957
|
+
allPoints.push(this.getGridPointsByValue(isDesc ? 1 : 0));
|
|
20958
|
+
}
|
|
20959
|
+
items.forEach((item) => {
|
|
20960
|
+
allPoints.push(item.points);
|
|
20961
|
+
});
|
|
20962
|
+
if ((isDesc && noZero) || (!isDesc && noOne)) {
|
|
20963
|
+
allPoints.push(this.getGridPointsByValue(isDesc ? 0 : 1));
|
|
20964
|
+
}
|
|
20965
|
+
for (let index = 0; index < allPoints.length - 1; index++) {
|
|
20966
|
+
const prev = allPoints[index];
|
|
20967
|
+
const curr = allPoints[index + 1];
|
|
20859
20968
|
const path = getRegionPath(prev, curr, gridAttrs);
|
|
20860
20969
|
const shape = graphicCreator.path({
|
|
20861
20970
|
path,
|
|
@@ -20941,6 +21050,10 @@ class LineAxisGrid extends BaseGrid {
|
|
|
20941
21050
|
}
|
|
20942
21051
|
return gridPoints;
|
|
20943
21052
|
}
|
|
21053
|
+
getGridPointsByValue(value) {
|
|
21054
|
+
const basePoint = this.getTickCoord(value);
|
|
21055
|
+
return this._getGridPoint(this.attribute.type, basePoint);
|
|
21056
|
+
}
|
|
20944
21057
|
getGridAttribute(isSubGrid) {
|
|
20945
21058
|
const { type: gridType, alignWithLabel = true } = this.attribute;
|
|
20946
21059
|
const tickSegment = this._parseTickSegment();
|
|
@@ -20969,7 +21082,7 @@ class LineAxisGrid extends BaseGrid {
|
|
|
20969
21082
|
else {
|
|
20970
21083
|
gridAttribute = merge({}, this.attribute, this.attribute.subGrid);
|
|
20971
21084
|
const subGridItems = [];
|
|
20972
|
-
const { count: subCount = 4 } =
|
|
21085
|
+
const { count: subCount = 4 } = gridAttribute;
|
|
20973
21086
|
const tickLineCount = this.data.length;
|
|
20974
21087
|
if (tickLineCount >= 2) {
|
|
20975
21088
|
const points = this._getPointsOfSubGrid(tickSegment, alignWithLabel);
|
|
@@ -20978,23 +21091,22 @@ class LineAxisGrid extends BaseGrid {
|
|
|
20978
21091
|
const next = points[i + 1];
|
|
20979
21092
|
subGridItems.push({
|
|
20980
21093
|
id: `sub-${i}-0`,
|
|
20981
|
-
points: this.
|
|
21094
|
+
points: this.getGridPointsByValue(pre.value),
|
|
20982
21095
|
datum: {}
|
|
20983
21096
|
});
|
|
20984
21097
|
for (let j = 0; j < subCount; j++) {
|
|
20985
21098
|
const percent = (j + 1) / (subCount + 1);
|
|
20986
21099
|
const value = (1 - percent) * pre.value + percent * next.value;
|
|
20987
|
-
const point = this.getTickCoord(value);
|
|
20988
21100
|
subGridItems.push({
|
|
20989
21101
|
id: `sub-${i}-${j + 1}`,
|
|
20990
|
-
points: this.
|
|
21102
|
+
points: this.getGridPointsByValue(value),
|
|
20991
21103
|
datum: {}
|
|
20992
21104
|
});
|
|
20993
21105
|
}
|
|
20994
21106
|
if (i === points.length - 2) {
|
|
20995
21107
|
subGridItems.push({
|
|
20996
21108
|
id: `sub-${i}-${subCount + 1}`,
|
|
20997
|
-
points: this.
|
|
21109
|
+
points: this.getGridPointsByValue(next.value),
|
|
20998
21110
|
datum: {}
|
|
20999
21111
|
});
|
|
21000
21112
|
}
|
|
@@ -21012,6 +21124,11 @@ class CircleAxisGrid extends BaseGrid {
|
|
|
21012
21124
|
constructor(attributes, options) {
|
|
21013
21125
|
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, BaseGrid.defaultAttributes, attributes), options);
|
|
21014
21126
|
}
|
|
21127
|
+
getGridPointsByValue(value) {
|
|
21128
|
+
const basePoint = this.getTickCoord(value);
|
|
21129
|
+
const { radius, innerRadius = 0 } = this.attribute;
|
|
21130
|
+
return [basePoint, this.getVerticalCoord(basePoint, radius - innerRadius, true)];
|
|
21131
|
+
}
|
|
21015
21132
|
getGridAttribute(isSubGrid) {
|
|
21016
21133
|
let gridAttribute;
|
|
21017
21134
|
let items = [];
|
|
@@ -24517,7 +24634,7 @@ class DiscreteLegend extends LegendBase {
|
|
|
24517
24634
|
let focusSpace = 0;
|
|
24518
24635
|
if (focus) {
|
|
24519
24636
|
const focusSize = get(focusIconStyle, 'size', DEFAULT_SHAPE_SIZE);
|
|
24520
|
-
focusShape = graphicCreator.symbol(Object.assign(Object.assign({ x: 0, y: -focusSize / 2 - 1, strokeBoundsBuffer: 0 }, focusIconStyle), { visible: true, pickMode: 'imprecise'
|
|
24637
|
+
focusShape = graphicCreator.symbol(Object.assign(Object.assign({ x: 0, y: -focusSize / 2 - 1, strokeBoundsBuffer: 0, boundsPadding: parsedPadding }, focusIconStyle), { visible: true, pickMode: 'imprecise' }));
|
|
24521
24638
|
this._appendDataToShape(focusShape, LEGEND_ELEMENT_NAME.focus, item, itemGroup);
|
|
24522
24639
|
focusSpace = focusSize;
|
|
24523
24640
|
}
|
|
@@ -29002,6 +29119,6 @@ EmptyTip.defaultAttributes = {
|
|
|
29002
29119
|
}
|
|
29003
29120
|
};
|
|
29004
29121
|
|
|
29005
|
-
const version = "0.20.
|
|
29122
|
+
const version = "0.20.7-alpha.0";
|
|
29006
29123
|
|
|
29007
|
-
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, ticks, traverseGroup, version };
|
|
29124
|
+
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
|
package/es/axis/grid/base.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare abstract class BaseGrid<T extends GridBaseAttributes> extends Abs
|
|
|
19
19
|
abstract isInValidValue(value: number): boolean;
|
|
20
20
|
abstract getVerticalVector(offset: number, inside: boolean, point: Point): [number, number];
|
|
21
21
|
protected abstract getGridAttribute(isSubGrid: boolean): T;
|
|
22
|
+
protected abstract getGridPointsByValue(value: number): Point[];
|
|
22
23
|
protected render(): void;
|
|
23
24
|
protected getVerticalCoord(point: Point, offset: number, inside: boolean): Point;
|
|
24
25
|
private _transformItems;
|