@visactor/vrender-components 0.14.9-alpha.1 → 0.14.9-alpha.4
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/animate/group-transition.d.ts +2 -1
- package/cjs/axis/animate/group-transition.js +3 -3
- package/cjs/axis/animate/group-transition.js.map +1 -1
- package/cjs/axis/base.d.ts +5 -8
- package/cjs/axis/base.js +16 -32
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/circle.d.ts +3 -23
- package/cjs/axis/circle.js +3 -84
- package/cjs/axis/circle.js.map +1 -1
- package/cjs/axis/config.d.ts +0 -17
- package/cjs/axis/config.js +0 -17
- package/cjs/axis/config.js.map +1 -1
- package/cjs/axis/grid/base.d.ts +24 -0
- package/cjs/axis/{grid.js → grid/base.js} +67 -20
- package/cjs/axis/grid/base.js.map +1 -0
- package/cjs/axis/grid/circle.d.ts +9 -0
- package/cjs/axis/grid/circle.js +92 -0
- package/cjs/axis/grid/circle.js.map +1 -0
- package/cjs/axis/grid/index.d.ts +3 -0
- package/cjs/axis/grid/index.js +22 -0
- package/cjs/axis/grid/index.js.map +1 -0
- package/cjs/axis/grid/line.d.ts +10 -0
- package/cjs/axis/grid/line.js +103 -0
- package/cjs/axis/grid/line.js.map +1 -0
- package/cjs/axis/grid/type.d.ts +63 -0
- package/cjs/axis/grid/type.js +6 -0
- package/cjs/axis/grid/type.js.map +1 -0
- package/cjs/axis/index.d.ts +0 -1
- package/cjs/axis/index.js +3 -3
- package/cjs/axis/index.js.map +1 -1
- package/cjs/axis/line.d.ts +3 -24
- package/cjs/axis/line.js +17 -118
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/mixin/circle.d.ts +17 -0
- package/cjs/axis/mixin/circle.js +30 -0
- package/cjs/axis/mixin/circle.js.map +1 -0
- package/cjs/axis/mixin/line.d.ts +14 -0
- package/cjs/axis/mixin/line.js +32 -0
- package/cjs/axis/mixin/line.js.map +1 -0
- package/cjs/axis/type.d.ts +0 -55
- package/cjs/axis/type.js.map +1 -1
- package/cjs/core/base.d.ts +2 -1
- package/cjs/core/base.js +4 -2
- package/cjs/core/base.js.map +1 -1
- package/cjs/core/type.js +2 -1
- package/cjs/crosshair/base.js +1 -2
- package/cjs/index.d.ts +3 -1
- package/cjs/index.js +9 -8
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/type.js +2 -1
- package/cjs/jsx/component-type.d.ts +4 -0
- package/cjs/jsx/component-type.js +13 -0
- package/cjs/jsx/component-type.js.map +1 -0
- package/cjs/jsx/index.d.ts +1 -0
- package/cjs/jsx/index.js +21 -0
- package/cjs/jsx/index.js.map +1 -0
- package/cjs/label/arc.js +5 -4
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.js +4 -2
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/type.d.ts +4 -3
- package/cjs/label/type.js.map +1 -1
- package/cjs/legend/discrete/discrete.js +28 -27
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/link-path/index.js +1 -2
- package/cjs/link-path/link-path.js +2 -1
- package/cjs/marker/point.js +1 -1
- package/cjs/pager/pager.js +4 -2
- package/cjs/pager/pager.js.map +1 -1
- package/cjs/poptip/register.d.ts +1 -1
- package/cjs/poptip/register.js +8 -6
- package/cjs/poptip/register.js.map +1 -1
- package/cjs/util/matrix.d.ts +1 -1
- package/cjs/util/matrix.js.map +1 -1
- package/cjs/util/text.js +3 -3
- package/cjs/util/text.js.map +1 -1
- package/dist/index.js +684 -634
- package/dist/index.min.js +1 -1
- package/es/axis/animate/group-transition.d.ts +2 -1
- package/es/axis/animate/group-transition.js +3 -3
- package/es/axis/animate/group-transition.js.map +1 -1
- package/es/axis/base.d.ts +5 -8
- package/es/axis/base.js +15 -33
- package/es/axis/base.js.map +1 -1
- package/es/axis/circle.d.ts +3 -23
- package/es/axis/circle.js +4 -85
- package/es/axis/circle.js.map +1 -1
- package/es/axis/config.d.ts +0 -17
- package/es/axis/config.js +0 -17
- package/es/axis/config.js.map +1 -1
- package/es/axis/grid/base.d.ts +24 -0
- package/es/axis/{grid.js → grid/base.js} +69 -21
- package/es/axis/grid/base.js.map +1 -0
- package/es/axis/grid/circle.d.ts +9 -0
- package/es/axis/grid/circle.js +92 -0
- package/es/axis/grid/circle.js.map +1 -0
- package/es/axis/grid/index.d.ts +3 -0
- package/es/axis/grid/index.js +6 -0
- package/es/axis/grid/index.js.map +1 -0
- package/es/axis/grid/line.d.ts +10 -0
- package/es/axis/grid/line.js +102 -0
- package/es/axis/grid/line.js.map +1 -0
- package/es/axis/grid/type.d.ts +63 -0
- package/es/axis/grid/type.js +2 -0
- package/es/axis/grid/type.js.map +1 -0
- package/es/axis/index.d.ts +0 -1
- package/es/axis/index.js +0 -2
- package/es/axis/index.js.map +1 -1
- package/es/axis/line.d.ts +3 -24
- package/es/axis/line.js +9 -110
- package/es/axis/line.js.map +1 -1
- package/es/axis/mixin/circle.d.ts +17 -0
- package/es/axis/mixin/circle.js +25 -0
- package/es/axis/mixin/circle.js.map +1 -0
- package/es/axis/mixin/line.d.ts +14 -0
- package/es/axis/mixin/line.js +23 -0
- package/es/axis/mixin/line.js.map +1 -0
- package/es/axis/type.d.ts +0 -55
- package/es/axis/type.js.map +1 -1
- package/es/core/base.d.ts +2 -1
- package/es/core/base.js +3 -3
- package/es/core/base.js.map +1 -1
- package/es/core/type.js +2 -1
- package/es/crosshair/base.js +1 -2
- package/es/index.d.ts +3 -1
- package/es/index.js +5 -1
- package/es/index.js.map +1 -1
- package/es/indicator/type.js +2 -1
- package/es/jsx/component-type.d.ts +4 -0
- package/es/jsx/component-type.js +5 -0
- package/es/jsx/component-type.js.map +1 -0
- package/es/jsx/index.d.ts +1 -0
- package/es/jsx/index.js +2 -0
- package/es/jsx/index.js.map +1 -0
- package/es/label/arc.js +5 -4
- package/es/label/arc.js.map +1 -1
- package/es/label/base.js +4 -2
- package/es/label/base.js.map +1 -1
- package/es/label/type.d.ts +4 -3
- package/es/label/type.js.map +1 -1
- package/es/legend/discrete/discrete.js +26 -25
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/link-path/index.js +1 -2
- package/es/link-path/link-path.js +2 -1
- package/es/marker/point.js +1 -1
- package/es/pager/pager.js +4 -2
- package/es/pager/pager.js.map +1 -1
- package/es/poptip/register.d.ts +1 -1
- package/es/poptip/register.js +7 -6
- package/es/poptip/register.js.map +1 -1
- package/es/util/matrix.d.ts +1 -1
- package/es/util/matrix.js.map +1 -1
- package/es/util/text.js +3 -3
- package/es/util/text.js.map +1 -1
- package/package.json +2 -2
- package/cjs/axis/grid.d.ts +0 -9
- package/cjs/axis/grid.js.map +0 -1
- package/es/axis/grid.d.ts +0 -9
- package/es/axis/grid.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
setAttribute(key, value, forceUpdateTag) {
|
|
39
|
-
if (vutils.isPlainObject(this.attribute[key])) {
|
|
39
|
+
if (vutils.isPlainObject(this.attribute[key]) && !vutils.isFunction(this.attribute[key]) && !vutils.isFunction(value)) {
|
|
40
40
|
vutils.merge(this.attribute[key], value);
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
for (let i = 0; i < keys.length; i++) {
|
|
79
79
|
const key = keys[i];
|
|
80
|
-
if (vutils.isPlainObject(this.attribute[key])) {
|
|
80
|
+
if (vutils.isPlainObject(this.attribute[key]) && !vutils.isFunction(this.attribute[key]) && !vutils.isFunction(params[key])) {
|
|
81
81
|
vutils.merge(this.attribute[key], params[key]);
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
@@ -575,16 +575,16 @@
|
|
|
575
575
|
}, getTextBounds: useNaiveCanvas ? undefined : vrender.getTextBounds, specialCharSet: '-/: .,@%\'"~' + vutils.TextMeasure.ALPHABET_CHAR_SET + vutils.TextMeasure.ALPHABET_CHAR_SET.toUpperCase() }, (option !== null && option !== void 0 ? option : {})), textSpec);
|
|
576
576
|
};
|
|
577
577
|
function measureTextSize(text, textSpec) {
|
|
578
|
-
var _a
|
|
578
|
+
var _a;
|
|
579
579
|
if (!text) {
|
|
580
580
|
return { width: 0, height: 0 };
|
|
581
581
|
}
|
|
582
582
|
const bounds = vrender.getTextBounds({
|
|
583
583
|
text,
|
|
584
|
-
fontFamily:
|
|
584
|
+
fontFamily: textSpec.fontFamily,
|
|
585
585
|
fontSize: textSpec.fontSize || 12,
|
|
586
586
|
fontWeight: textSpec.fontWeight,
|
|
587
|
-
textAlign: (
|
|
587
|
+
textAlign: (_a = textSpec.textAlign) !== null && _a !== void 0 ? _a : 'center',
|
|
588
588
|
textBaseline: textSpec.textBaseline,
|
|
589
589
|
ellipsis: !!textSpec.ellipsis,
|
|
590
590
|
maxLineWidth: textSpec.maxLineWidth || Infinity,
|
|
@@ -1103,16 +1103,21 @@
|
|
|
1103
1103
|
injectable()
|
|
1104
1104
|
], PopTipForClipedTextPlugin);
|
|
1105
1105
|
|
|
1106
|
-
const popTipModule = new ContainerModule(bind => {
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1106
|
+
const popTipModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
1107
|
+
if (!isBound(PopTipRenderContribution)) {
|
|
1108
|
+
bind(PopTipRenderContribution).toSelf().inSingletonScope();
|
|
1109
|
+
bind(vrender.InteractiveSubRenderContribution).toService(PopTipRenderContribution);
|
|
1110
|
+
}
|
|
1111
|
+
if (!isBound(PopTipPlugin)) {
|
|
1112
|
+
bind(PopTipPlugin).toSelf();
|
|
1113
|
+
bind(vrender.AutoEnablePlugins).toService(PopTipPlugin);
|
|
1114
|
+
}
|
|
1115
|
+
if (!isBound(PopTipForClipedTextPlugin)) {
|
|
1116
|
+
bind(PopTipForClipedTextPlugin).toSelf();
|
|
1117
|
+
bind(vrender.AutoEnablePlugins).toService(PopTipForClipedTextPlugin);
|
|
1118
|
+
}
|
|
1113
1119
|
});
|
|
1114
|
-
function loadPoptip(
|
|
1115
|
-
vutils.merge(theme.poptip, defaultPoptipTheme);
|
|
1120
|
+
function loadPoptip() {
|
|
1116
1121
|
vrender.container.load(popTipModule);
|
|
1117
1122
|
}
|
|
1118
1123
|
function setPoptipTheme(defaultPoptipTheme) {
|
|
@@ -1706,8 +1711,14 @@
|
|
|
1706
1711
|
}
|
|
1707
1712
|
_prepare() {
|
|
1708
1713
|
var _a;
|
|
1709
|
-
const baseMarks = getMarksByName(this.getRootNode(), this.attribute.baseMarkGroupName);
|
|
1710
1714
|
const currentBaseMarks = [];
|
|
1715
|
+
let baseMarks;
|
|
1716
|
+
if (vutils.isFunction(this.attribute.getBaseMarks)) {
|
|
1717
|
+
baseMarks = this.attribute.getBaseMarks();
|
|
1718
|
+
}
|
|
1719
|
+
else {
|
|
1720
|
+
baseMarks = getMarksByName(this.getRootNode(), this.attribute.baseMarkGroupName);
|
|
1721
|
+
}
|
|
1711
1722
|
baseMarks.forEach(mark => {
|
|
1712
1723
|
if (mark.releaseStatus !== 'willRelease') {
|
|
1713
1724
|
currentBaseMarks.push(mark);
|
|
@@ -3069,13 +3080,14 @@
|
|
|
3069
3080
|
}
|
|
3070
3081
|
}
|
|
3071
3082
|
_labelLine(text) {
|
|
3072
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
3083
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
3073
3084
|
const labelLine = ((_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points)
|
|
3074
3085
|
? vrender.createLine({
|
|
3075
3086
|
visible: (_g = (_e = (((_c = (_b = text.attribute) === null || _b === void 0 ? void 0 : _b.line) === null || _c === void 0 ? void 0 : _c.visible) && ((_d = text.attribute) === null || _d === void 0 ? void 0 : _d.visible))) !== null && _e !== void 0 ? _e : (_f = text.attribute) === null || _f === void 0 ? void 0 : _f.visible) !== null && _g !== void 0 ? _g : true,
|
|
3076
|
-
stroke: (_k = (_j = (_h = text.attribute) === null || _h === void 0 ? void 0 : _h.line) === null || _j === void 0 ? void 0 : _j.stroke) !== null &&
|
|
3077
|
-
lineWidth: (
|
|
3078
|
-
points: (
|
|
3087
|
+
stroke: (_l = (_k = (_j = (_h = text.attribute) === null || _h === void 0 ? void 0 : _h.line) === null || _j === void 0 ? void 0 : _j.style) === null || _k === void 0 ? void 0 : _k.stroke) !== null && _l !== void 0 ? _l : (_m = text.attribute) === null || _m === void 0 ? void 0 : _m.fill,
|
|
3088
|
+
lineWidth: (_r = (_q = (_p = (_o = text.attribute) === null || _o === void 0 ? void 0 : _o.line) === null || _p === void 0 ? void 0 : _p.style) === null || _q === void 0 ? void 0 : _q.lineWidth) !== null && _r !== void 0 ? _r : 1,
|
|
3089
|
+
points: (_s = text.attribute) === null || _s === void 0 ? void 0 : _s.points,
|
|
3090
|
+
curveType: ((_u = (_t = text.attribute) === null || _t === void 0 ? void 0 : _t.line) === null || _u === void 0 ? void 0 : _u.smooth) ? 'basis' : null
|
|
3079
3091
|
})
|
|
3080
3092
|
: undefined;
|
|
3081
3093
|
return labelLine;
|
|
@@ -3198,156 +3210,6 @@
|
|
|
3198
3210
|
pickable: false
|
|
3199
3211
|
};
|
|
3200
3212
|
|
|
3201
|
-
function getLinePath(points, closed) {
|
|
3202
|
-
let path = '';
|
|
3203
|
-
if (points.length === 0) {
|
|
3204
|
-
return path;
|
|
3205
|
-
}
|
|
3206
|
-
points.forEach((point, index) => {
|
|
3207
|
-
if (index === 0) {
|
|
3208
|
-
path = `M${point.x},${point.y}`;
|
|
3209
|
-
}
|
|
3210
|
-
else {
|
|
3211
|
-
path += `L${point.x},${point.y}`;
|
|
3212
|
-
}
|
|
3213
|
-
});
|
|
3214
|
-
if (closed) {
|
|
3215
|
-
path += 'Z';
|
|
3216
|
-
}
|
|
3217
|
-
return path;
|
|
3218
|
-
}
|
|
3219
|
-
function getArcPath(center, points, reverse, closed) {
|
|
3220
|
-
let path = '';
|
|
3221
|
-
if (!center || points.length === 0) {
|
|
3222
|
-
return path;
|
|
3223
|
-
}
|
|
3224
|
-
const firstPoint = points[0];
|
|
3225
|
-
const radius = vutils.PointService.distancePP(center, firstPoint);
|
|
3226
|
-
const sweepFlag = reverse ? 0 : 1;
|
|
3227
|
-
if (closed) {
|
|
3228
|
-
path += `M${center.x},${center.y - radius}A${radius},${radius},0,0,${sweepFlag},${center.x},${center.y + radius}A${radius},${radius},0,0,${sweepFlag},${center.x},${center.y - radius}Z`;
|
|
3229
|
-
}
|
|
3230
|
-
else {
|
|
3231
|
-
points.forEach((point, index) => {
|
|
3232
|
-
if (index === 0) {
|
|
3233
|
-
path = `M${point.x},${point.y}`;
|
|
3234
|
-
}
|
|
3235
|
-
else {
|
|
3236
|
-
path += `A${radius},${radius},0,0,${sweepFlag},${point.x},${point.y}`;
|
|
3237
|
-
}
|
|
3238
|
-
});
|
|
3239
|
-
}
|
|
3240
|
-
return path;
|
|
3241
|
-
}
|
|
3242
|
-
function getRegionPath(from, to, attribute) {
|
|
3243
|
-
const { type, closed } = attribute;
|
|
3244
|
-
const reversePoints = to.slice(0).reverse();
|
|
3245
|
-
let regionPath = '';
|
|
3246
|
-
let nextPath = '';
|
|
3247
|
-
if (type === 'line' && attribute.smoothLink && attribute.center) {
|
|
3248
|
-
const fromStart = from[0];
|
|
3249
|
-
const toEnd = reversePoints[0];
|
|
3250
|
-
const center = attribute.center;
|
|
3251
|
-
regionPath = getLinePath(from, !!closed);
|
|
3252
|
-
nextPath = getLinePath(reversePoints, !!closed);
|
|
3253
|
-
const toEndRadius = vutils.PointService.distancePP(toEnd, center);
|
|
3254
|
-
const fromStartRadius = vutils.PointService.distancePP(fromStart, center);
|
|
3255
|
-
regionPath += `A${toEndRadius},${toEndRadius},0,0,1,${toEnd.x},${toEnd.y}L${toEnd.x},${toEnd.y}`;
|
|
3256
|
-
nextPath += `A${fromStartRadius},${fromStartRadius},0,0,0,${fromStart.x},${fromStart.y}`;
|
|
3257
|
-
}
|
|
3258
|
-
else if (type === 'circle') {
|
|
3259
|
-
const { center } = attribute;
|
|
3260
|
-
regionPath = getArcPath(center, from, false, !!closed);
|
|
3261
|
-
nextPath = getArcPath(center, reversePoints, true, !!closed);
|
|
3262
|
-
}
|
|
3263
|
-
else if (type === 'line' || type === 'polygon') {
|
|
3264
|
-
regionPath = getLinePath(from, !!closed);
|
|
3265
|
-
nextPath = getLinePath(reversePoints, !!closed);
|
|
3266
|
-
}
|
|
3267
|
-
if (closed) {
|
|
3268
|
-
regionPath += nextPath;
|
|
3269
|
-
}
|
|
3270
|
-
else {
|
|
3271
|
-
nextPath = 'L' + nextPath.substring(1);
|
|
3272
|
-
regionPath += nextPath;
|
|
3273
|
-
regionPath += 'Z';
|
|
3274
|
-
}
|
|
3275
|
-
return regionPath;
|
|
3276
|
-
}
|
|
3277
|
-
class Grid extends AbstractComponent {
|
|
3278
|
-
constructor(attributes) {
|
|
3279
|
-
super(vutils.merge({}, Grid.defaultAttributes, attributes));
|
|
3280
|
-
this.name = 'grid';
|
|
3281
|
-
}
|
|
3282
|
-
render() {
|
|
3283
|
-
this.removeAllChild();
|
|
3284
|
-
const { type, items, style, closed, alternateColor, depth = 0 } = this.attribute;
|
|
3285
|
-
if (vutils.isEmpty(items)) {
|
|
3286
|
-
return;
|
|
3287
|
-
}
|
|
3288
|
-
items.forEach((item, index) => {
|
|
3289
|
-
const { id, points } = item;
|
|
3290
|
-
let path = '';
|
|
3291
|
-
if (type === 'line' || type === 'polygon') {
|
|
3292
|
-
path = getLinePath(points, !!closed);
|
|
3293
|
-
}
|
|
3294
|
-
else if (type === 'circle') {
|
|
3295
|
-
const { center } = this.attribute;
|
|
3296
|
-
path = getArcPath(center, points, false, !!closed);
|
|
3297
|
-
}
|
|
3298
|
-
const shape = vrender.createPath(Object.assign({ path, z: depth }, (vutils.isFunction(style) ? vutils.merge({}, Grid.defaultAttributes.style, style(item, index)) : style)));
|
|
3299
|
-
shape.name = `${this.name}-line`;
|
|
3300
|
-
shape.id = this._getNodeId(`path-${id}`);
|
|
3301
|
-
this.add(shape);
|
|
3302
|
-
});
|
|
3303
|
-
if (depth && type === 'line') {
|
|
3304
|
-
items.forEach((item, index) => {
|
|
3305
|
-
const { id, points } = item;
|
|
3306
|
-
const nextPoints = [];
|
|
3307
|
-
nextPoints.push(points[0]);
|
|
3308
|
-
const dir = { x: points[1].x - points[0].x, y: points[1].y - points[0].y };
|
|
3309
|
-
const dirLen = Math.sqrt(dir.x * dir.x + dir.y * dir.y);
|
|
3310
|
-
const ratio = depth / dirLen;
|
|
3311
|
-
nextPoints.push({ x: points[0].x + dir.x * ratio, y: points[0].y + dir.y * ratio });
|
|
3312
|
-
const path = getLinePath(nextPoints, !!closed);
|
|
3313
|
-
const deltaX = vutils.abs(nextPoints[0].x - nextPoints[1].x);
|
|
3314
|
-
const deltaY = vutils.abs(nextPoints[0].y - nextPoints[1].y);
|
|
3315
|
-
const shape = vrender.createPath(Object.assign({ path, z: 0, alpha: deltaX > deltaY ? ((points[1].x - points[0].x > 0 ? -1 : 1) * vutils.pi) / 2 : 0, beta: deltaX < deltaY ? -vutils.pi / 2 : 0, anchor3d: deltaX > deltaY ? [nextPoints[0].x, 0] : [0, nextPoints[0].y] }, (vutils.isFunction(style) ? vutils.merge({}, Grid.defaultAttributes.style, style(item, index)) : style)));
|
|
3316
|
-
shape.name = `${this.name}-line`;
|
|
3317
|
-
shape.id = this._getNodeId(`path-${id}`);
|
|
3318
|
-
this.add(shape);
|
|
3319
|
-
});
|
|
3320
|
-
}
|
|
3321
|
-
if (items.length > 1 && alternateColor) {
|
|
3322
|
-
const colors = vutils.isArray(alternateColor)
|
|
3323
|
-
? alternateColor
|
|
3324
|
-
: [alternateColor, 'transparent'];
|
|
3325
|
-
const getColor = (index) => colors[index % colors.length];
|
|
3326
|
-
for (let index = 0; index < items.length - 1; index++) {
|
|
3327
|
-
const [prev, curr] = [items[index].points, items[index + 1].points];
|
|
3328
|
-
const path = getRegionPath(prev, curr, this.attribute);
|
|
3329
|
-
const shape = vrender.createPath({
|
|
3330
|
-
path,
|
|
3331
|
-
fill: getColor(index)
|
|
3332
|
-
});
|
|
3333
|
-
shape.name = `${this.name}-region`;
|
|
3334
|
-
shape.id = this._getNodeId(`region-${index}`);
|
|
3335
|
-
this.add(shape);
|
|
3336
|
-
}
|
|
3337
|
-
}
|
|
3338
|
-
}
|
|
3339
|
-
_getNodeId(id) {
|
|
3340
|
-
return `${this.id}-${id}`;
|
|
3341
|
-
}
|
|
3342
|
-
}
|
|
3343
|
-
Grid.defaultAttributes = {
|
|
3344
|
-
style: {
|
|
3345
|
-
lineWidth: 1,
|
|
3346
|
-
stroke: '#416180'
|
|
3347
|
-
},
|
|
3348
|
-
zIndex: 0
|
|
3349
|
-
};
|
|
3350
|
-
|
|
3351
3213
|
class Segment extends AbstractComponent {
|
|
3352
3214
|
constructor(attributes) {
|
|
3353
3215
|
super(vutils.merge({}, Segment.defaultAttributes, attributes));
|
|
@@ -3565,23 +3427,6 @@
|
|
|
3565
3427
|
stroke: '#000',
|
|
3566
3428
|
strokeOpacity: 1
|
|
3567
3429
|
}
|
|
3568
|
-
},
|
|
3569
|
-
grid: {
|
|
3570
|
-
style: {
|
|
3571
|
-
lineWidth: 1,
|
|
3572
|
-
stroke: '#999',
|
|
3573
|
-
strokeOpacity: 1,
|
|
3574
|
-
lineDash: [4, 4]
|
|
3575
|
-
}
|
|
3576
|
-
},
|
|
3577
|
-
subGrid: {
|
|
3578
|
-
visible: false,
|
|
3579
|
-
style: {
|
|
3580
|
-
lineWidth: 1,
|
|
3581
|
-
stroke: '#999',
|
|
3582
|
-
strokeOpacity: 1,
|
|
3583
|
-
lineDash: [4, 4]
|
|
3584
|
-
}
|
|
3585
3430
|
}
|
|
3586
3431
|
};
|
|
3587
3432
|
|
|
@@ -3678,7 +3523,7 @@
|
|
|
3678
3523
|
}
|
|
3679
3524
|
}
|
|
3680
3525
|
_renderInner(container) {
|
|
3681
|
-
const { title, label, tick, line,
|
|
3526
|
+
const { title, label, tick, line, items } = this.attribute;
|
|
3682
3527
|
const axisContainer = vrender.createGroup({ x: 0, y: 0, zIndex: 1 });
|
|
3683
3528
|
axisContainer.name = exports.AXIS_ELEMENT_NAME.axisContainer;
|
|
3684
3529
|
axisContainer.id = this._getNodeId('container');
|
|
@@ -3707,9 +3552,6 @@
|
|
|
3707
3552
|
this.afterLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);
|
|
3708
3553
|
});
|
|
3709
3554
|
}
|
|
3710
|
-
if (grid === null || grid === void 0 ? void 0 : grid.visible) {
|
|
3711
|
-
this.renderGrid(container);
|
|
3712
|
-
}
|
|
3713
3555
|
}
|
|
3714
3556
|
if (title === null || title === void 0 ? void 0 : title.visible) {
|
|
3715
3557
|
this.renderTitle(axisContainer);
|
|
@@ -3826,13 +3668,6 @@
|
|
|
3826
3668
|
axisTitle.id = this._getNodeId('title');
|
|
3827
3669
|
container.add(axisTitle);
|
|
3828
3670
|
}
|
|
3829
|
-
renderGrid(container) {
|
|
3830
|
-
const { visible } = this.attribute.subGrid || {};
|
|
3831
|
-
if (visible) {
|
|
3832
|
-
this._renderGridByType('subGrid', container);
|
|
3833
|
-
}
|
|
3834
|
-
this._renderGridByType('grid', container);
|
|
3835
|
-
}
|
|
3836
3671
|
getVerticalCoord(point, offset, inside) {
|
|
3837
3672
|
const vector = this.getVerticalVector(offset, inside, point);
|
|
3838
3673
|
return {
|
|
@@ -4003,13 +3838,6 @@
|
|
|
4003
3838
|
});
|
|
4004
3839
|
return data;
|
|
4005
3840
|
}
|
|
4006
|
-
_renderGridByType(type, container) {
|
|
4007
|
-
const gridAttrs = this.getGridAttribute(type);
|
|
4008
|
-
const gridGroup = new Grid(Object.assign(Object.assign({ pickable: false }, gridAttrs), { zIndex: 0 }));
|
|
4009
|
-
gridGroup.name = type === 'subGrid' ? `${exports.AXIS_ELEMENT_NAME.grid}-sub` : `${exports.AXIS_ELEMENT_NAME.grid}`;
|
|
4010
|
-
gridGroup.id = this._getNodeId(type);
|
|
4011
|
-
container.add(gridGroup);
|
|
4012
|
-
}
|
|
4013
3841
|
}
|
|
4014
3842
|
|
|
4015
3843
|
const methods = {
|
|
@@ -4308,15 +4136,31 @@
|
|
|
4308
4136
|
}
|
|
4309
4137
|
}
|
|
4310
4138
|
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4139
|
+
class LineAxisMixin {
|
|
4140
|
+
isInValidValue(value) {
|
|
4141
|
+
return value < 0 || value > 1;
|
|
4142
|
+
}
|
|
4143
|
+
getTickCoord(tickValue) {
|
|
4144
|
+
const { start } = this.attribute;
|
|
4145
|
+
const axisVector = this.getRelativeVector();
|
|
4146
|
+
return {
|
|
4147
|
+
x: start.x + axisVector[0] * tickValue,
|
|
4148
|
+
y: start.y + axisVector[1] * tickValue
|
|
4149
|
+
};
|
|
4150
|
+
}
|
|
4151
|
+
getRelativeVector(point) {
|
|
4152
|
+
const { start, end } = this.attribute;
|
|
4153
|
+
return [end.x - start.x, end.y - start.y];
|
|
4154
|
+
}
|
|
4155
|
+
getVerticalVector(offset, inside = false, point) {
|
|
4156
|
+
const { verticalFactor = 1 } = this.attribute;
|
|
4157
|
+
const axisVector = this.getRelativeVector();
|
|
4158
|
+
const normalizedAxisVector = normalize(axisVector);
|
|
4159
|
+
const verticalVector = [normalizedAxisVector[1], normalizedAxisVector[0] * -1];
|
|
4160
|
+
return scale(verticalVector, offset * (inside ? 1 : -1) * verticalFactor);
|
|
4317
4161
|
}
|
|
4318
|
-
return points;
|
|
4319
4162
|
}
|
|
4163
|
+
|
|
4320
4164
|
class LineAxis extends AxisBase {
|
|
4321
4165
|
constructor(attributes, mode) {
|
|
4322
4166
|
super(vutils.merge({}, LineAxis.defaultAttributes, attributes), mode);
|
|
@@ -4354,28 +4198,6 @@
|
|
|
4354
4198
|
axisLineGroup.id = this._getNodeId('line');
|
|
4355
4199
|
container.add(axisLineGroup);
|
|
4356
4200
|
}
|
|
4357
|
-
isInValidValue(value) {
|
|
4358
|
-
return value < 0 || value > 1;
|
|
4359
|
-
}
|
|
4360
|
-
getTickCoord(tickValue) {
|
|
4361
|
-
const { start } = this.attribute;
|
|
4362
|
-
const axisVector = this.getRelativeVector();
|
|
4363
|
-
return {
|
|
4364
|
-
x: start.x + axisVector[0] * tickValue,
|
|
4365
|
-
y: start.y + axisVector[1] * tickValue
|
|
4366
|
-
};
|
|
4367
|
-
}
|
|
4368
|
-
getRelativeVector() {
|
|
4369
|
-
const { start, end } = this.attribute;
|
|
4370
|
-
return [end.x - start.x, end.y - start.y];
|
|
4371
|
-
}
|
|
4372
|
-
getVerticalVector(offset, inside = false) {
|
|
4373
|
-
const { verticalFactor = 1 } = this.attribute;
|
|
4374
|
-
const axisVector = this.getRelativeVector();
|
|
4375
|
-
const normalizedAxisVector = normalize(axisVector);
|
|
4376
|
-
const verticalVector = [normalizedAxisVector[1], normalizedAxisVector[0] * -1];
|
|
4377
|
-
return scale(verticalVector, offset * (inside ? 1 : -1) * verticalFactor);
|
|
4378
|
-
}
|
|
4379
4201
|
getTitleAttribute() {
|
|
4380
4202
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4381
4203
|
const _j = this.attribute.title, { position = 'middle', space = 4, textStyle = {}, autoRotate = true, shape, background, state } = _j, restAttrs = __rest(_j, ["position", "space", "textStyle", "autoRotate", "shape", "background", "state"]);
|
|
@@ -4460,7 +4282,7 @@
|
|
|
4460
4282
|
}
|
|
4461
4283
|
const offset = tickLength + labelLength + space;
|
|
4462
4284
|
const titlePoint = this.getVerticalCoord(point, offset, false);
|
|
4463
|
-
const vector = this.getVerticalVector(offset, false);
|
|
4285
|
+
const vector = this.getVerticalVector(offset, false, { x: 0, y: 0 });
|
|
4464
4286
|
let { angle } = restAttrs;
|
|
4465
4287
|
let textAlign;
|
|
4466
4288
|
if (position === 'start') {
|
|
@@ -4508,129 +4330,35 @@
|
|
|
4508
4330
|
}
|
|
4509
4331
|
return attrs;
|
|
4510
4332
|
}
|
|
4511
|
-
|
|
4512
|
-
let
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4333
|
+
getTextBaseline(vector, inside) {
|
|
4334
|
+
let base = 'middle';
|
|
4335
|
+
const { verticalFactor = 1 } = this.attribute;
|
|
4336
|
+
const factor = (inside ? 1 : -1) * verticalFactor;
|
|
4337
|
+
if (vutils.isNumberClose(vector[1], 0)) {
|
|
4338
|
+
if (vutils.isNumberClose(vector[0], 0) && !Object.is(vector[0], -0) && !Object.is(vector[1], -0)) {
|
|
4339
|
+
base = factor === 1 ? 'bottom' : 'top';
|
|
4340
|
+
}
|
|
4341
|
+
else {
|
|
4342
|
+
base = 'middle';
|
|
4343
|
+
}
|
|
4517
4344
|
}
|
|
4518
|
-
else if (
|
|
4519
|
-
|
|
4520
|
-
const distance = vutils.PointService.distancePP(center, point);
|
|
4521
|
-
gridPoints = getCirclePoints(center, sides, distance, startAngle, endAngle);
|
|
4345
|
+
else if (vector[1] > 0) {
|
|
4346
|
+
base = 'top';
|
|
4522
4347
|
}
|
|
4523
|
-
|
|
4348
|
+
else if (vector[1] < 0) {
|
|
4349
|
+
base = 'bottom';
|
|
4350
|
+
}
|
|
4351
|
+
return base;
|
|
4524
4352
|
}
|
|
4525
|
-
|
|
4526
|
-
const
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
if (type === 'grid') {
|
|
4535
|
-
gridAttribute = this.attribute.grid;
|
|
4536
|
-
const gridItems = [];
|
|
4537
|
-
this.data.forEach(item => {
|
|
4538
|
-
let { point } = item;
|
|
4539
|
-
if (!alignWithLabel) {
|
|
4540
|
-
const value = item.value - tickSegment / 2;
|
|
4541
|
-
if (this.isInValidValue(value)) {
|
|
4542
|
-
return;
|
|
4543
|
-
}
|
|
4544
|
-
point = this.getTickCoord(value);
|
|
4545
|
-
}
|
|
4546
|
-
gridItems.push({
|
|
4547
|
-
id: item.label,
|
|
4548
|
-
datum: item,
|
|
4549
|
-
points: this._getGridPoint(gridType, point)
|
|
4550
|
-
});
|
|
4551
|
-
});
|
|
4552
|
-
items = gridItems;
|
|
4553
|
-
}
|
|
4554
|
-
else {
|
|
4555
|
-
gridAttribute = vutils.merge({}, this.attribute.grid, this.attribute.subGrid);
|
|
4556
|
-
const subGridItems = [];
|
|
4557
|
-
const { count: subCount = 4 } = this.attribute.subTick || {};
|
|
4558
|
-
const tickLineCount = this.data.length;
|
|
4559
|
-
if (tickLineCount >= 2) {
|
|
4560
|
-
const points = [];
|
|
4561
|
-
this.data.forEach((item) => {
|
|
4562
|
-
let tickValue = item.value;
|
|
4563
|
-
if (!alignWithLabel) {
|
|
4564
|
-
const value = item.value - tickSegment / 2;
|
|
4565
|
-
if (this.isInValidValue(value)) {
|
|
4566
|
-
return;
|
|
4567
|
-
}
|
|
4568
|
-
tickValue = value;
|
|
4569
|
-
}
|
|
4570
|
-
points.push({
|
|
4571
|
-
value: tickValue
|
|
4572
|
-
});
|
|
4573
|
-
});
|
|
4574
|
-
for (let i = 0; i < points.length - 1; i++) {
|
|
4575
|
-
const pre = points[i];
|
|
4576
|
-
const next = points[i + 1];
|
|
4577
|
-
subGridItems.push({
|
|
4578
|
-
id: `sub-${i}-0`,
|
|
4579
|
-
points: this._getGridPoint(gridType, this.getTickCoord(pre.value)),
|
|
4580
|
-
datum: {}
|
|
4581
|
-
});
|
|
4582
|
-
for (let j = 0; j < subCount; j++) {
|
|
4583
|
-
const percent = (j + 1) / (subCount + 1);
|
|
4584
|
-
const value = (1 - percent) * pre.value + percent * next.value;
|
|
4585
|
-
const point = this.getTickCoord(value);
|
|
4586
|
-
subGridItems.push({
|
|
4587
|
-
id: `sub-${i}-${j + 1}`,
|
|
4588
|
-
points: this._getGridPoint(gridType, point),
|
|
4589
|
-
datum: {}
|
|
4590
|
-
});
|
|
4591
|
-
}
|
|
4592
|
-
if (i === points.length - 2) {
|
|
4593
|
-
subGridItems.push({
|
|
4594
|
-
id: `sub-${i}-${subCount + 1}`,
|
|
4595
|
-
points: this._getGridPoint(gridType, this.getTickCoord(next.value)),
|
|
4596
|
-
datum: {}
|
|
4597
|
-
});
|
|
4598
|
-
}
|
|
4599
|
-
}
|
|
4600
|
-
items = subGridItems;
|
|
4601
|
-
}
|
|
4602
|
-
}
|
|
4603
|
-
return Object.assign(Object.assign({}, gridAttribute), { items });
|
|
4604
|
-
}
|
|
4605
|
-
getTextBaseline(vector, inside) {
|
|
4606
|
-
let base = 'middle';
|
|
4607
|
-
const { verticalFactor = 1 } = this.attribute;
|
|
4608
|
-
const factor = (inside ? 1 : -1) * verticalFactor;
|
|
4609
|
-
if (vutils.isNumberClose(vector[1], 0)) {
|
|
4610
|
-
if (vutils.isNumberClose(vector[0], 0) && !Object.is(vector[0], -0) && !Object.is(vector[1], -0)) {
|
|
4611
|
-
base = factor === 1 ? 'bottom' : 'top';
|
|
4612
|
-
}
|
|
4613
|
-
else {
|
|
4614
|
-
base = 'middle';
|
|
4615
|
-
}
|
|
4616
|
-
}
|
|
4617
|
-
else if (vector[1] > 0) {
|
|
4618
|
-
base = 'top';
|
|
4619
|
-
}
|
|
4620
|
-
else if (vector[1] < 0) {
|
|
4621
|
-
base = 'bottom';
|
|
4622
|
-
}
|
|
4623
|
-
return base;
|
|
4624
|
-
}
|
|
4625
|
-
getLabelAlign(vector, inside, angle) {
|
|
4626
|
-
const orient = this.attribute.orient;
|
|
4627
|
-
if (vutils.isValidNumber(angle)) {
|
|
4628
|
-
if (orient === 'top' || orient === 'bottom') {
|
|
4629
|
-
return getXAxisLabelAlign(orient, angle);
|
|
4630
|
-
}
|
|
4631
|
-
if (orient === 'left' || orient === 'right') {
|
|
4632
|
-
return getYAxisLabelAlign(orient, angle);
|
|
4633
|
-
}
|
|
4353
|
+
getLabelAlign(vector, inside, angle) {
|
|
4354
|
+
const orient = this.attribute.orient;
|
|
4355
|
+
if (vutils.isValidNumber(angle)) {
|
|
4356
|
+
if (orient === 'top' || orient === 'bottom') {
|
|
4357
|
+
return getXAxisLabelAlign(orient, angle);
|
|
4358
|
+
}
|
|
4359
|
+
if (orient === 'left' || orient === 'right') {
|
|
4360
|
+
return getYAxisLabelAlign(orient, angle);
|
|
4361
|
+
}
|
|
4634
4362
|
}
|
|
4635
4363
|
return {
|
|
4636
4364
|
textAlign: this.getTextAlign(vector),
|
|
@@ -4639,7 +4367,7 @@
|
|
|
4639
4367
|
}
|
|
4640
4368
|
beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4641
4369
|
const { flush = false } = this.attribute.label || {};
|
|
4642
|
-
if (flush) {
|
|
4370
|
+
if (flush && labelShapes.length) {
|
|
4643
4371
|
const { orient, start, end } = this.attribute;
|
|
4644
4372
|
const isX = orient === 'bottom' || orient === 'top';
|
|
4645
4373
|
const first = labelShapes[0];
|
|
@@ -4835,29 +4563,9 @@
|
|
|
4835
4563
|
}
|
|
4836
4564
|
}
|
|
4837
4565
|
LineAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
4566
|
+
vutils.mixin(LineAxis, LineAxisMixin);
|
|
4838
4567
|
|
|
4839
|
-
class
|
|
4840
|
-
constructor(attributes) {
|
|
4841
|
-
super(vutils.merge({}, CircleAxis.defaultAttributes, attributes));
|
|
4842
|
-
}
|
|
4843
|
-
renderLine(container) {
|
|
4844
|
-
const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, radius, center, innerRadius = 0, line, inside = false } = this.attribute;
|
|
4845
|
-
let arcRadius = radius;
|
|
4846
|
-
let arcInnerRadius = innerRadius;
|
|
4847
|
-
if (inside && innerRadius > 0) {
|
|
4848
|
-
arcRadius = innerRadius;
|
|
4849
|
-
arcInnerRadius = 0;
|
|
4850
|
-
}
|
|
4851
|
-
const arcAttrs = Object.assign(Object.assign(Object.assign({}, center), { startAngle,
|
|
4852
|
-
endAngle, radius: arcRadius, innerRadius: arcInnerRadius }), line === null || line === void 0 ? void 0 : line.style);
|
|
4853
|
-
const axisLine = vrender.createCircle(arcAttrs);
|
|
4854
|
-
axisLine.name = exports.AXIS_ELEMENT_NAME.line;
|
|
4855
|
-
axisLine.id = this._getNodeId('line');
|
|
4856
|
-
if (!vutils.isEmpty(line === null || line === void 0 ? void 0 : line.state)) {
|
|
4857
|
-
axisLine.states = vutils.merge({}, DEFAULT_STATES$1, line.state);
|
|
4858
|
-
}
|
|
4859
|
-
container.add(axisLine);
|
|
4860
|
-
}
|
|
4568
|
+
class CircleAxisMixin {
|
|
4861
4569
|
isInValidValue(value) {
|
|
4862
4570
|
const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE } = this.attribute;
|
|
4863
4571
|
if (Math.abs(endAngle - startAngle) % (Math.PI * 2) === 0) {
|
|
@@ -4880,6 +4588,30 @@
|
|
|
4880
4588
|
const { center } = this.attribute;
|
|
4881
4589
|
return [point.y - center.y, -1 * (point.x - center.x)];
|
|
4882
4590
|
}
|
|
4591
|
+
}
|
|
4592
|
+
|
|
4593
|
+
class CircleAxis extends AxisBase {
|
|
4594
|
+
constructor(attributes) {
|
|
4595
|
+
super(vutils.merge({}, CircleAxis.defaultAttributes, attributes));
|
|
4596
|
+
}
|
|
4597
|
+
renderLine(container) {
|
|
4598
|
+
const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, radius, center, innerRadius = 0, line, inside = false } = this.attribute;
|
|
4599
|
+
let arcRadius = radius;
|
|
4600
|
+
let arcInnerRadius = innerRadius;
|
|
4601
|
+
if (inside && innerRadius > 0) {
|
|
4602
|
+
arcRadius = innerRadius;
|
|
4603
|
+
arcInnerRadius = 0;
|
|
4604
|
+
}
|
|
4605
|
+
const arcAttrs = Object.assign(Object.assign(Object.assign({}, center), { startAngle,
|
|
4606
|
+
endAngle, radius: arcRadius, innerRadius: arcInnerRadius }), line === null || line === void 0 ? void 0 : line.style);
|
|
4607
|
+
const axisLine = vrender.createCircle(arcAttrs);
|
|
4608
|
+
axisLine.name = exports.AXIS_ELEMENT_NAME.line;
|
|
4609
|
+
axisLine.id = this._getNodeId('line');
|
|
4610
|
+
if (!vutils.isEmpty(line === null || line === void 0 ? void 0 : line.state)) {
|
|
4611
|
+
axisLine.states = vutils.merge({}, DEFAULT_STATES$1, line.state);
|
|
4612
|
+
}
|
|
4613
|
+
container.add(axisLine);
|
|
4614
|
+
}
|
|
4883
4615
|
getTitleAttribute() {
|
|
4884
4616
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4885
4617
|
const { center, radius, innerRadius = 0 } = this.attribute;
|
|
@@ -4932,40 +4664,541 @@
|
|
|
4932
4664
|
if (background && background.visible) {
|
|
4933
4665
|
attrs.panel = Object.assign({ visible: true }, background.style);
|
|
4934
4666
|
}
|
|
4935
|
-
return attrs;
|
|
4936
|
-
}
|
|
4937
|
-
getSubTickLineItems() {
|
|
4938
|
-
var _a, _b;
|
|
4939
|
-
const { subTick } = this.attribute;
|
|
4940
|
-
const subTickLineItems = [];
|
|
4941
|
-
const { count: subCount = 4, inside = false, length = 2 } = subTick;
|
|
4942
|
-
const tickLineItems = this.tickLineItems;
|
|
4943
|
-
const tickLineCount = tickLineItems.length;
|
|
4944
|
-
if (tickLineCount >= 2) {
|
|
4945
|
-
const tickSegment = this.data[1].value - this.data[0].value;
|
|
4946
|
-
const isAlignWithLable = (_b = (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.tick) === null || _b === void 0 ? void 0 : _b.alignWithLabel;
|
|
4947
|
-
for (let i = 0; i < tickLineCount; i++) {
|
|
4948
|
-
const pre = tickLineItems[i];
|
|
4949
|
-
const next = tickLineItems[i + 1];
|
|
4950
|
-
for (let j = 0; j < subCount; j++) {
|
|
4951
|
-
const percent = (j + 1) / (subCount + 1);
|
|
4952
|
-
const value = (1 - percent) * pre.value + percent * (next ? next.value : isAlignWithLable ? 1 : pre.value + tickSegment);
|
|
4953
|
-
const point = this.getTickCoord(value);
|
|
4954
|
-
const endPoint = this.getVerticalCoord(point, length, inside);
|
|
4955
|
-
subTickLineItems.push({
|
|
4956
|
-
start: point,
|
|
4957
|
-
end: endPoint,
|
|
4958
|
-
value
|
|
4667
|
+
return attrs;
|
|
4668
|
+
}
|
|
4669
|
+
getSubTickLineItems() {
|
|
4670
|
+
var _a, _b;
|
|
4671
|
+
const { subTick } = this.attribute;
|
|
4672
|
+
const subTickLineItems = [];
|
|
4673
|
+
const { count: subCount = 4, inside = false, length = 2 } = subTick;
|
|
4674
|
+
const tickLineItems = this.tickLineItems;
|
|
4675
|
+
const tickLineCount = tickLineItems.length;
|
|
4676
|
+
if (tickLineCount >= 2) {
|
|
4677
|
+
const tickSegment = this.data[1].value - this.data[0].value;
|
|
4678
|
+
const isAlignWithLable = (_b = (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.tick) === null || _b === void 0 ? void 0 : _b.alignWithLabel;
|
|
4679
|
+
for (let i = 0; i < tickLineCount; i++) {
|
|
4680
|
+
const pre = tickLineItems[i];
|
|
4681
|
+
const next = tickLineItems[i + 1];
|
|
4682
|
+
for (let j = 0; j < subCount; j++) {
|
|
4683
|
+
const percent = (j + 1) / (subCount + 1);
|
|
4684
|
+
const value = (1 - percent) * pre.value + percent * (next ? next.value : isAlignWithLable ? 1 : pre.value + tickSegment);
|
|
4685
|
+
const point = this.getTickCoord(value);
|
|
4686
|
+
const endPoint = this.getVerticalCoord(point, length, inside);
|
|
4687
|
+
subTickLineItems.push({
|
|
4688
|
+
start: point,
|
|
4689
|
+
end: endPoint,
|
|
4690
|
+
value
|
|
4691
|
+
});
|
|
4692
|
+
}
|
|
4693
|
+
}
|
|
4694
|
+
}
|
|
4695
|
+
return subTickLineItems;
|
|
4696
|
+
}
|
|
4697
|
+
getTextBaseline(vector) {
|
|
4698
|
+
let base = 'middle';
|
|
4699
|
+
if (vutils.isNumberClose(vector[1], 0)) {
|
|
4700
|
+
base = 'middle';
|
|
4701
|
+
}
|
|
4702
|
+
else if (vector[1] > 0 && vector[1] > Math.abs(vector[0])) {
|
|
4703
|
+
base = 'top';
|
|
4704
|
+
}
|
|
4705
|
+
else if (vector[1] < 0 && Math.abs(vector[1]) > Math.abs(vector[0])) {
|
|
4706
|
+
base = 'bottom';
|
|
4707
|
+
}
|
|
4708
|
+
return base;
|
|
4709
|
+
}
|
|
4710
|
+
beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4711
|
+
return;
|
|
4712
|
+
}
|
|
4713
|
+
handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4714
|
+
return;
|
|
4715
|
+
}
|
|
4716
|
+
afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4717
|
+
return;
|
|
4718
|
+
}
|
|
4719
|
+
getLabelAlign(vector, inside, angle) {
|
|
4720
|
+
return {
|
|
4721
|
+
textAlign: this.getTextAlign(vector),
|
|
4722
|
+
textBaseline: this.getTextBaseline(vector)
|
|
4723
|
+
};
|
|
4724
|
+
}
|
|
4725
|
+
}
|
|
4726
|
+
CircleAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
4727
|
+
vutils.mixin(CircleAxis, CircleAxisMixin);
|
|
4728
|
+
|
|
4729
|
+
function getElMap(g) {
|
|
4730
|
+
const elMap = {};
|
|
4731
|
+
traverseGroup(g, (el) => {
|
|
4732
|
+
if (el.type !== 'group' && el.id) {
|
|
4733
|
+
elMap[el.id] = el;
|
|
4734
|
+
}
|
|
4735
|
+
});
|
|
4736
|
+
return elMap;
|
|
4737
|
+
}
|
|
4738
|
+
class GroupTransition extends vrender.ACustomAnimate {
|
|
4739
|
+
constructor() {
|
|
4740
|
+
super(...arguments);
|
|
4741
|
+
this.mode = vrender.AnimateMode.NORMAL;
|
|
4742
|
+
}
|
|
4743
|
+
onBind() {
|
|
4744
|
+
const currentInnerView = this.target.getInnerView();
|
|
4745
|
+
const prevInnerView = this.target.getPrevInnerView();
|
|
4746
|
+
if (!prevInnerView) {
|
|
4747
|
+
return;
|
|
4748
|
+
}
|
|
4749
|
+
this._oldElementMap = getElMap(prevInnerView);
|
|
4750
|
+
this._newElementAttrMap = {};
|
|
4751
|
+
traverseGroup(currentInnerView, (el) => {
|
|
4752
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4753
|
+
if (el.type !== 'group' && el.id) {
|
|
4754
|
+
const oldEl = this._oldElementMap[el.id];
|
|
4755
|
+
if (oldEl) {
|
|
4756
|
+
if (!vutils.isEqual(el.attribute, oldEl.attribute)) {
|
|
4757
|
+
const newProps = vutils.cloneDeep(el.attribute);
|
|
4758
|
+
this._newElementAttrMap[el.id] = {
|
|
4759
|
+
state: 'update',
|
|
4760
|
+
node: el,
|
|
4761
|
+
attrs: Object.assign(Object.assign({}, newProps), { opacity: (_a = newProps.opacity) !== null && _a !== void 0 ? _a : 1, fillOpacity: (_b = newProps.fillOpacity) !== null && _b !== void 0 ? _b : 1, strokeOpacity: (_c = newProps.strokeOpacity) !== null && _c !== void 0 ? _c : 1 })
|
|
4762
|
+
};
|
|
4763
|
+
el.setAttributes(oldEl.attribute);
|
|
4764
|
+
}
|
|
4765
|
+
}
|
|
4766
|
+
else {
|
|
4767
|
+
const finalOpacityAttrs = {
|
|
4768
|
+
opacity: (_d = el.attribute.opacity) !== null && _d !== void 0 ? _d : 1,
|
|
4769
|
+
fillOpacity: (_e = el.attribute.fillOpacity) !== null && _e !== void 0 ? _e : 1,
|
|
4770
|
+
strokeOpacity: (_f = el.attribute.strokeOpacity) !== null && _f !== void 0 ? _f : 1
|
|
4771
|
+
};
|
|
4772
|
+
this._newElementAttrMap[el.id] = {
|
|
4773
|
+
state: 'enter',
|
|
4774
|
+
node: el,
|
|
4775
|
+
attrs: finalOpacityAttrs
|
|
4776
|
+
};
|
|
4777
|
+
el.setAttributes({
|
|
4778
|
+
opacity: 0,
|
|
4779
|
+
fillOpacity: 0,
|
|
4780
|
+
strokeOpacity: 0
|
|
4781
|
+
});
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
});
|
|
4785
|
+
}
|
|
4786
|
+
onStart() {
|
|
4787
|
+
let duration = this.duration;
|
|
4788
|
+
let easing = this.easing;
|
|
4789
|
+
Object.keys(this._newElementAttrMap).forEach(id => {
|
|
4790
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4791
|
+
const { node, attrs, state } = this._newElementAttrMap[id];
|
|
4792
|
+
if (state === 'enter') {
|
|
4793
|
+
duration = vutils.isValidNumber((_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.enter) === null || _b === void 0 ? void 0 : _b.duration) ? (_c = this.params) === null || _c === void 0 ? void 0 : _c.enter.duration : duration;
|
|
4794
|
+
easing = ((_e = (_d = this.params) === null || _d === void 0 ? void 0 : _d.enter) === null || _e === void 0 ? void 0 : _e.easing) ? (_g = (_f = this.params) === null || _f === void 0 ? void 0 : _f.enter) === null || _g === void 0 ? void 0 : _g.easing : easing;
|
|
4795
|
+
}
|
|
4796
|
+
if (node.type === 'path') {
|
|
4797
|
+
node
|
|
4798
|
+
.animate({
|
|
4799
|
+
interpolate(key, ratio, from, to, nextAttributes) {
|
|
4800
|
+
if (key === 'path') {
|
|
4801
|
+
nextAttributes.path = vutils.interpolateString(from, to)(ratio);
|
|
4802
|
+
return true;
|
|
4803
|
+
}
|
|
4804
|
+
return false;
|
|
4805
|
+
}
|
|
4806
|
+
})
|
|
4807
|
+
.to(attrs, duration, easing);
|
|
4808
|
+
}
|
|
4809
|
+
else {
|
|
4810
|
+
node
|
|
4811
|
+
.animate()
|
|
4812
|
+
.to(attrs, duration, easing);
|
|
4813
|
+
}
|
|
4814
|
+
});
|
|
4815
|
+
}
|
|
4816
|
+
onUpdate(end, ratio, out) {
|
|
4817
|
+
}
|
|
4818
|
+
}
|
|
4819
|
+
|
|
4820
|
+
class GroupFadeIn extends vrender.ACustomAnimate {
|
|
4821
|
+
constructor(from, to, duration, easing) {
|
|
4822
|
+
super(null, null, duration, easing);
|
|
4823
|
+
}
|
|
4824
|
+
getEndProps() {
|
|
4825
|
+
return {};
|
|
4826
|
+
}
|
|
4827
|
+
onBind() {
|
|
4828
|
+
this.target.setTheme({
|
|
4829
|
+
common: {
|
|
4830
|
+
opacity: 0
|
|
4831
|
+
}
|
|
4832
|
+
});
|
|
4833
|
+
return;
|
|
4834
|
+
}
|
|
4835
|
+
onEnd() {
|
|
4836
|
+
this.target.setTheme({
|
|
4837
|
+
common: {
|
|
4838
|
+
opacity: 1
|
|
4839
|
+
}
|
|
4840
|
+
});
|
|
4841
|
+
return;
|
|
4842
|
+
}
|
|
4843
|
+
onUpdate(end, ratio, out) {
|
|
4844
|
+
this.target.setTheme({
|
|
4845
|
+
common: {
|
|
4846
|
+
opacity: ratio
|
|
4847
|
+
}
|
|
4848
|
+
});
|
|
4849
|
+
}
|
|
4850
|
+
}
|
|
4851
|
+
class GroupFadeOut extends vrender.ACustomAnimate {
|
|
4852
|
+
constructor(from, to, duration, easing) {
|
|
4853
|
+
super(null, null, duration, easing);
|
|
4854
|
+
}
|
|
4855
|
+
getEndProps() {
|
|
4856
|
+
return {};
|
|
4857
|
+
}
|
|
4858
|
+
onBind() {
|
|
4859
|
+
this.target.setTheme({
|
|
4860
|
+
common: {
|
|
4861
|
+
opacity: 1
|
|
4862
|
+
}
|
|
4863
|
+
});
|
|
4864
|
+
return;
|
|
4865
|
+
}
|
|
4866
|
+
onEnd() {
|
|
4867
|
+
this.target.setTheme({
|
|
4868
|
+
common: {
|
|
4869
|
+
opacity: 0
|
|
4870
|
+
}
|
|
4871
|
+
});
|
|
4872
|
+
return;
|
|
4873
|
+
}
|
|
4874
|
+
onUpdate(end, ratio, out) {
|
|
4875
|
+
this.target.setTheme({
|
|
4876
|
+
common: {
|
|
4877
|
+
opacity: 1 - ratio
|
|
4878
|
+
}
|
|
4879
|
+
});
|
|
4880
|
+
}
|
|
4881
|
+
}
|
|
4882
|
+
|
|
4883
|
+
function getLinePath(points, closed) {
|
|
4884
|
+
let path = '';
|
|
4885
|
+
if (points.length === 0) {
|
|
4886
|
+
return path;
|
|
4887
|
+
}
|
|
4888
|
+
points.forEach((point, index) => {
|
|
4889
|
+
if (index === 0) {
|
|
4890
|
+
path = `M${point.x},${point.y}`;
|
|
4891
|
+
}
|
|
4892
|
+
else {
|
|
4893
|
+
path += `L${point.x},${point.y}`;
|
|
4894
|
+
}
|
|
4895
|
+
});
|
|
4896
|
+
if (closed) {
|
|
4897
|
+
path += 'Z';
|
|
4898
|
+
}
|
|
4899
|
+
return path;
|
|
4900
|
+
}
|
|
4901
|
+
function getArcPath(center, points, reverse, closed) {
|
|
4902
|
+
let path = '';
|
|
4903
|
+
if (!center || points.length === 0) {
|
|
4904
|
+
return path;
|
|
4905
|
+
}
|
|
4906
|
+
const firstPoint = points[0];
|
|
4907
|
+
const radius = vutils.PointService.distancePP(center, firstPoint);
|
|
4908
|
+
const sweepFlag = reverse ? 0 : 1;
|
|
4909
|
+
if (closed) {
|
|
4910
|
+
path += `M${center.x},${center.y - radius}A${radius},${radius},0,0,${sweepFlag},${center.x},${center.y + radius}A${radius},${radius},0,0,${sweepFlag},${center.x},${center.y - radius}Z`;
|
|
4911
|
+
}
|
|
4912
|
+
else {
|
|
4913
|
+
points.forEach((point, index) => {
|
|
4914
|
+
if (index === 0) {
|
|
4915
|
+
path = `M${point.x},${point.y}`;
|
|
4916
|
+
}
|
|
4917
|
+
else {
|
|
4918
|
+
path += `A${radius},${radius},0,0,${sweepFlag},${point.x},${point.y}`;
|
|
4919
|
+
}
|
|
4920
|
+
});
|
|
4921
|
+
}
|
|
4922
|
+
return path;
|
|
4923
|
+
}
|
|
4924
|
+
function getRegionPath(from, to, attribute) {
|
|
4925
|
+
const { type, closed } = attribute;
|
|
4926
|
+
const reversePoints = to.slice(0).reverse();
|
|
4927
|
+
let regionPath = '';
|
|
4928
|
+
let nextPath = '';
|
|
4929
|
+
if (type === 'line' && attribute.smoothLink && attribute.center) {
|
|
4930
|
+
const fromStart = from[0];
|
|
4931
|
+
const toEnd = reversePoints[0];
|
|
4932
|
+
const center = attribute.center;
|
|
4933
|
+
regionPath = getLinePath(from, !!closed);
|
|
4934
|
+
nextPath = getLinePath(reversePoints, !!closed);
|
|
4935
|
+
const toEndRadius = vutils.PointService.distancePP(toEnd, center);
|
|
4936
|
+
const fromStartRadius = vutils.PointService.distancePP(fromStart, center);
|
|
4937
|
+
regionPath += `A${toEndRadius},${toEndRadius},0,0,1,${toEnd.x},${toEnd.y}L${toEnd.x},${toEnd.y}`;
|
|
4938
|
+
nextPath += `A${fromStartRadius},${fromStartRadius},0,0,0,${fromStart.x},${fromStart.y}`;
|
|
4939
|
+
}
|
|
4940
|
+
else if (type === 'circle') {
|
|
4941
|
+
const { center } = attribute;
|
|
4942
|
+
regionPath = getArcPath(center, from, false, !!closed);
|
|
4943
|
+
nextPath = getArcPath(center, reversePoints, true, !!closed);
|
|
4944
|
+
}
|
|
4945
|
+
else if (type === 'line' || type === 'polygon') {
|
|
4946
|
+
regionPath = getLinePath(from, !!closed);
|
|
4947
|
+
nextPath = getLinePath(reversePoints, !!closed);
|
|
4948
|
+
}
|
|
4949
|
+
if (closed) {
|
|
4950
|
+
regionPath += nextPath;
|
|
4951
|
+
}
|
|
4952
|
+
else {
|
|
4953
|
+
nextPath = 'L' + nextPath.substring(1);
|
|
4954
|
+
regionPath += nextPath;
|
|
4955
|
+
regionPath += 'Z';
|
|
4956
|
+
}
|
|
4957
|
+
return regionPath;
|
|
4958
|
+
}
|
|
4959
|
+
class BaseGrid extends AbstractComponent {
|
|
4960
|
+
constructor() {
|
|
4961
|
+
super(...arguments);
|
|
4962
|
+
this.name = 'axis-grid';
|
|
4963
|
+
this.data = [];
|
|
4964
|
+
}
|
|
4965
|
+
getInnerView() {
|
|
4966
|
+
return this._innerView;
|
|
4967
|
+
}
|
|
4968
|
+
getPrevInnerView() {
|
|
4969
|
+
return this._prevInnerView;
|
|
4970
|
+
}
|
|
4971
|
+
render() {
|
|
4972
|
+
this.removeAllChild();
|
|
4973
|
+
this._prevInnerView = this._innerView;
|
|
4974
|
+
this._innerView = vrender.createGroup({ x: 0, y: 0, pickable: false });
|
|
4975
|
+
this.add(this._innerView);
|
|
4976
|
+
const { items, visible } = this.attribute;
|
|
4977
|
+
if (items && items.length && visible !== false) {
|
|
4978
|
+
this.data = this._transformItems(items);
|
|
4979
|
+
this._renderGrid(this._innerView);
|
|
4980
|
+
}
|
|
4981
|
+
}
|
|
4982
|
+
getVerticalCoord(point, offset, inside) {
|
|
4983
|
+
const vector = this.getVerticalVector(offset, inside, point);
|
|
4984
|
+
return {
|
|
4985
|
+
x: point.x + vector[0],
|
|
4986
|
+
y: point.y + vector[1]
|
|
4987
|
+
};
|
|
4988
|
+
}
|
|
4989
|
+
_transformItems(items) {
|
|
4990
|
+
const data = [];
|
|
4991
|
+
items.forEach((item) => {
|
|
4992
|
+
var _a;
|
|
4993
|
+
data.push(Object.assign(Object.assign({}, item), { point: this.getTickCoord(item.value), id: (_a = item.id) !== null && _a !== void 0 ? _a : item.label }));
|
|
4994
|
+
});
|
|
4995
|
+
return data;
|
|
4996
|
+
}
|
|
4997
|
+
_renderGrid(container) {
|
|
4998
|
+
const { visible } = this.attribute.subGrid || {};
|
|
4999
|
+
if (visible) {
|
|
5000
|
+
this._renderGridByType(true, container);
|
|
5001
|
+
}
|
|
5002
|
+
this._renderGridByType(false, container);
|
|
5003
|
+
}
|
|
5004
|
+
_renderGridByType(isSubGrid, container) {
|
|
5005
|
+
const gridAttrs = vutils.merge({}, this.attribute, this.getGridAttribute(isSubGrid));
|
|
5006
|
+
const { type, items, style, closed, alternateColor, depth = 0 } = gridAttrs;
|
|
5007
|
+
const name = isSubGrid ? `${exports.AXIS_ELEMENT_NAME.grid}-sub` : `${exports.AXIS_ELEMENT_NAME.grid}`;
|
|
5008
|
+
items.forEach((item, index) => {
|
|
5009
|
+
const { id, points } = item;
|
|
5010
|
+
let path = '';
|
|
5011
|
+
if (type === 'line' || type === 'polygon') {
|
|
5012
|
+
path = getLinePath(points, !!closed);
|
|
5013
|
+
}
|
|
5014
|
+
else if (type === 'circle') {
|
|
5015
|
+
const { center } = this.attribute;
|
|
5016
|
+
path = getArcPath(center, points, false, !!closed);
|
|
5017
|
+
}
|
|
5018
|
+
const shape = vrender.createPath(Object.assign({ path, z: depth }, (vutils.isFunction(style) ? vutils.merge({}, BaseGrid.defaultAttributes.style, style(item, index)) : style)));
|
|
5019
|
+
shape.name = `${name}-line`;
|
|
5020
|
+
shape.id = this._getNodeId(`${name}-path-${id}`);
|
|
5021
|
+
container.add(shape);
|
|
5022
|
+
});
|
|
5023
|
+
if (depth && type === 'line') {
|
|
5024
|
+
items.forEach((item, index) => {
|
|
5025
|
+
const { id, points } = item;
|
|
5026
|
+
const nextPoints = [];
|
|
5027
|
+
nextPoints.push(points[0]);
|
|
5028
|
+
const dir = { x: points[1].x - points[0].x, y: points[1].y - points[0].y };
|
|
5029
|
+
const dirLen = Math.sqrt(dir.x * dir.x + dir.y * dir.y);
|
|
5030
|
+
const ratio = depth / dirLen;
|
|
5031
|
+
nextPoints.push({ x: points[0].x + dir.x * ratio, y: points[0].y + dir.y * ratio });
|
|
5032
|
+
const path = getLinePath(nextPoints, !!closed);
|
|
5033
|
+
const deltaX = vutils.abs(nextPoints[0].x - nextPoints[1].x);
|
|
5034
|
+
const deltaY = vutils.abs(nextPoints[0].y - nextPoints[1].y);
|
|
5035
|
+
const shape = vrender.createPath(Object.assign({ path, z: 0, alpha: deltaX > deltaY ? ((points[1].x - points[0].x > 0 ? -1 : 1) * vutils.pi) / 2 : 0, beta: deltaX < deltaY ? -vutils.pi / 2 : 0, anchor3d: deltaX > deltaY ? [nextPoints[0].x, 0] : [0, nextPoints[0].y] }, (vutils.isFunction(style) ? vutils.merge({}, BaseGrid.defaultAttributes.style, style(item, index)) : style)));
|
|
5036
|
+
shape.name = `${name}-line`;
|
|
5037
|
+
shape.id = this._getNodeId(`${name}-path-${id}`);
|
|
5038
|
+
container.add(shape);
|
|
5039
|
+
});
|
|
5040
|
+
}
|
|
5041
|
+
if (items.length > 1 && alternateColor) {
|
|
5042
|
+
const colors = vutils.isArray(alternateColor)
|
|
5043
|
+
? alternateColor
|
|
5044
|
+
: [alternateColor, 'transparent'];
|
|
5045
|
+
const getColor = (index) => colors[index % colors.length];
|
|
5046
|
+
for (let index = 0; index < items.length - 1; index++) {
|
|
5047
|
+
const [prev, curr] = [items[index].points, items[index + 1].points];
|
|
5048
|
+
const path = getRegionPath(prev, curr, gridAttrs);
|
|
5049
|
+
const shape = vrender.createPath({
|
|
5050
|
+
path,
|
|
5051
|
+
fill: getColor(index)
|
|
5052
|
+
});
|
|
5053
|
+
shape.name = `${name}-region`;
|
|
5054
|
+
shape.id = this._getNodeId(`${name}-region-${index}`);
|
|
5055
|
+
container.add(shape);
|
|
5056
|
+
}
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
5059
|
+
_getNodeId(id) {
|
|
5060
|
+
return `${this.id}-${id}`;
|
|
5061
|
+
}
|
|
5062
|
+
}
|
|
5063
|
+
BaseGrid.defaultAttributes = {
|
|
5064
|
+
style: {
|
|
5065
|
+
lineWidth: 1,
|
|
5066
|
+
stroke: '#999',
|
|
5067
|
+
strokeOpacity: 1,
|
|
5068
|
+
lineDash: [4, 4]
|
|
5069
|
+
},
|
|
5070
|
+
subGrid: {
|
|
5071
|
+
visible: false,
|
|
5072
|
+
style: {
|
|
5073
|
+
lineWidth: 1,
|
|
5074
|
+
stroke: '#999',
|
|
5075
|
+
strokeOpacity: 1,
|
|
5076
|
+
lineDash: [4, 4]
|
|
5077
|
+
}
|
|
5078
|
+
}
|
|
5079
|
+
};
|
|
5080
|
+
|
|
5081
|
+
function getCirclePoints(center, count, radius, startAngle, endAngle) {
|
|
5082
|
+
const points = [];
|
|
5083
|
+
const range = endAngle - startAngle;
|
|
5084
|
+
for (let i = 0; i < count; i++) {
|
|
5085
|
+
const angle = startAngle + (i * range) / count;
|
|
5086
|
+
points.push(vutils.polarToCartesian(center, radius, angle));
|
|
5087
|
+
}
|
|
5088
|
+
return points;
|
|
5089
|
+
}
|
|
5090
|
+
class LineAxisGrid extends BaseGrid {
|
|
5091
|
+
constructor(attributes, mode) {
|
|
5092
|
+
super(vutils.merge({}, BaseGrid.defaultAttributes, attributes), mode);
|
|
5093
|
+
if (mode === '3d') {
|
|
5094
|
+
this.setMode(mode);
|
|
5095
|
+
}
|
|
5096
|
+
}
|
|
5097
|
+
_getGridPoint(gridType, point) {
|
|
5098
|
+
let gridPoints;
|
|
5099
|
+
if (gridType === 'line') {
|
|
5100
|
+
const { length } = this.attribute;
|
|
5101
|
+
const endPoint = this.getVerticalCoord(point, length, true);
|
|
5102
|
+
gridPoints = [point, endPoint];
|
|
5103
|
+
}
|
|
5104
|
+
else if (gridType === 'circle' || gridType === 'polygon') {
|
|
5105
|
+
const { center, sides = 6, startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE } = this.attribute;
|
|
5106
|
+
const distance = vutils.PointService.distancePP(center, point);
|
|
5107
|
+
gridPoints = getCirclePoints(center, sides, distance, startAngle, endAngle);
|
|
5108
|
+
}
|
|
5109
|
+
return gridPoints;
|
|
5110
|
+
}
|
|
5111
|
+
getGridAttribute(isSubGrid) {
|
|
5112
|
+
const { type: gridType, alignWithLabel = true } = this.attribute;
|
|
5113
|
+
let tickSegment = 1;
|
|
5114
|
+
const count = this.data.length;
|
|
5115
|
+
if (count >= 2) {
|
|
5116
|
+
tickSegment = this.data[1].value - this.data[0].value;
|
|
5117
|
+
}
|
|
5118
|
+
let gridAttribute;
|
|
5119
|
+
let items = [];
|
|
5120
|
+
if (!isSubGrid) {
|
|
5121
|
+
gridAttribute = this.attribute;
|
|
5122
|
+
const gridItems = [];
|
|
5123
|
+
this.data.forEach(item => {
|
|
5124
|
+
let { point } = item;
|
|
5125
|
+
if (!alignWithLabel) {
|
|
5126
|
+
const value = item.value - tickSegment / 2;
|
|
5127
|
+
if (this.isInValidValue(value)) {
|
|
5128
|
+
return;
|
|
5129
|
+
}
|
|
5130
|
+
point = this.getTickCoord(value);
|
|
5131
|
+
}
|
|
5132
|
+
gridItems.push({
|
|
5133
|
+
id: item.label,
|
|
5134
|
+
datum: item,
|
|
5135
|
+
points: this._getGridPoint(gridType, point)
|
|
5136
|
+
});
|
|
5137
|
+
});
|
|
5138
|
+
items = gridItems;
|
|
5139
|
+
}
|
|
5140
|
+
else {
|
|
5141
|
+
gridAttribute = vutils.merge({}, this.attribute, this.attribute.subGrid);
|
|
5142
|
+
const subGridItems = [];
|
|
5143
|
+
const { count: subCount = 4 } = this.attribute.subGrid || {};
|
|
5144
|
+
const tickLineCount = this.data.length;
|
|
5145
|
+
if (tickLineCount >= 2) {
|
|
5146
|
+
const points = [];
|
|
5147
|
+
this.data.forEach((item) => {
|
|
5148
|
+
let tickValue = item.value;
|
|
5149
|
+
if (!alignWithLabel) {
|
|
5150
|
+
const value = item.value - tickSegment / 2;
|
|
5151
|
+
if (this.isInValidValue(value)) {
|
|
5152
|
+
return;
|
|
5153
|
+
}
|
|
5154
|
+
tickValue = value;
|
|
5155
|
+
}
|
|
5156
|
+
points.push({
|
|
5157
|
+
value: tickValue
|
|
5158
|
+
});
|
|
5159
|
+
});
|
|
5160
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
5161
|
+
const pre = points[i];
|
|
5162
|
+
const next = points[i + 1];
|
|
5163
|
+
subGridItems.push({
|
|
5164
|
+
id: `sub-${i}-0`,
|
|
5165
|
+
points: this._getGridPoint(gridType, this.getTickCoord(pre.value)),
|
|
5166
|
+
datum: {}
|
|
4959
5167
|
});
|
|
5168
|
+
for (let j = 0; j < subCount; j++) {
|
|
5169
|
+
const percent = (j + 1) / (subCount + 1);
|
|
5170
|
+
const value = (1 - percent) * pre.value + percent * next.value;
|
|
5171
|
+
const point = this.getTickCoord(value);
|
|
5172
|
+
subGridItems.push({
|
|
5173
|
+
id: `sub-${i}-${j + 1}`,
|
|
5174
|
+
points: this._getGridPoint(gridType, point),
|
|
5175
|
+
datum: {}
|
|
5176
|
+
});
|
|
5177
|
+
}
|
|
5178
|
+
if (i === points.length - 2) {
|
|
5179
|
+
subGridItems.push({
|
|
5180
|
+
id: `sub-${i}-${subCount + 1}`,
|
|
5181
|
+
points: this._getGridPoint(gridType, this.getTickCoord(next.value)),
|
|
5182
|
+
datum: {}
|
|
5183
|
+
});
|
|
5184
|
+
}
|
|
4960
5185
|
}
|
|
5186
|
+
items = subGridItems;
|
|
4961
5187
|
}
|
|
4962
5188
|
}
|
|
4963
|
-
return
|
|
5189
|
+
return Object.assign(Object.assign({}, gridAttribute), { items });
|
|
5190
|
+
}
|
|
5191
|
+
}
|
|
5192
|
+
vutils.mixin(LineAxisGrid, LineAxisMixin);
|
|
5193
|
+
|
|
5194
|
+
class CircleAxisGrid extends BaseGrid {
|
|
5195
|
+
constructor(attributes) {
|
|
5196
|
+
super(vutils.merge({}, BaseGrid.defaultAttributes, attributes));
|
|
4964
5197
|
}
|
|
4965
|
-
getGridAttribute(
|
|
5198
|
+
getGridAttribute(isSubGrid) {
|
|
4966
5199
|
let gridAttribute;
|
|
4967
5200
|
let items = [];
|
|
4968
|
-
const { radius, innerRadius = 0, startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, center,
|
|
5201
|
+
const _a = this.attribute, { radius, innerRadius = 0, startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, center, subGrid } = _a, grid = __rest(_a, ["radius", "innerRadius", "startAngle", "endAngle", "center", "subGrid"]);
|
|
4969
5202
|
const { alignWithLabel = true } = grid || {};
|
|
4970
5203
|
const length = radius - innerRadius;
|
|
4971
5204
|
let tickSegment = 1;
|
|
@@ -4973,8 +5206,8 @@
|
|
|
4973
5206
|
if (count >= 2) {
|
|
4974
5207
|
tickSegment = this.data[1].value - this.data[0].value;
|
|
4975
5208
|
}
|
|
4976
|
-
if (
|
|
4977
|
-
gridAttribute =
|
|
5209
|
+
if (!isSubGrid) {
|
|
5210
|
+
gridAttribute = grid;
|
|
4978
5211
|
const gridItems = [];
|
|
4979
5212
|
let data;
|
|
4980
5213
|
if (Math.abs(endAngle - startAngle) % (Math.PI * 2) === 0) {
|
|
@@ -5002,9 +5235,9 @@
|
|
|
5002
5235
|
items = gridItems;
|
|
5003
5236
|
}
|
|
5004
5237
|
else {
|
|
5005
|
-
gridAttribute = vutils.merge({},
|
|
5238
|
+
gridAttribute = vutils.merge({}, grid, subGrid);
|
|
5006
5239
|
const subGridItems = [];
|
|
5007
|
-
const { count: subCount = 4 } =
|
|
5240
|
+
const { count: subCount = 4 } = subGrid || {};
|
|
5008
5241
|
const tickLineCount = this.data.length;
|
|
5009
5242
|
if (tickLineCount >= 2) {
|
|
5010
5243
|
const points = [];
|
|
@@ -5048,192 +5281,10 @@
|
|
|
5048
5281
|
}
|
|
5049
5282
|
}
|
|
5050
5283
|
return Object.assign(Object.assign({}, gridAttribute), { items,
|
|
5051
|
-
center });
|
|
5052
|
-
}
|
|
5053
|
-
getTextBaseline(vector) {
|
|
5054
|
-
let base = 'middle';
|
|
5055
|
-
if (vutils.isNumberClose(vector[1], 0)) {
|
|
5056
|
-
base = 'middle';
|
|
5057
|
-
}
|
|
5058
|
-
else if (vector[1] > 0 && vector[1] > Math.abs(vector[0])) {
|
|
5059
|
-
base = 'top';
|
|
5060
|
-
}
|
|
5061
|
-
else if (vector[1] < 0 && Math.abs(vector[1]) > Math.abs(vector[0])) {
|
|
5062
|
-
base = 'bottom';
|
|
5063
|
-
}
|
|
5064
|
-
return base;
|
|
5065
|
-
}
|
|
5066
|
-
beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
5067
|
-
return;
|
|
5068
|
-
}
|
|
5069
|
-
handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
5070
|
-
return;
|
|
5071
|
-
}
|
|
5072
|
-
afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
5073
|
-
return;
|
|
5074
|
-
}
|
|
5075
|
-
getLabelAlign(vector, inside, angle) {
|
|
5076
|
-
return {
|
|
5077
|
-
textAlign: this.getTextAlign(vector),
|
|
5078
|
-
textBaseline: this.getTextBaseline(vector)
|
|
5079
|
-
};
|
|
5080
|
-
}
|
|
5081
|
-
}
|
|
5082
|
-
CircleAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
5083
|
-
|
|
5084
|
-
function getElMap(g) {
|
|
5085
|
-
const elMap = {};
|
|
5086
|
-
traverseGroup(g, (el) => {
|
|
5087
|
-
if (el.type !== 'group' && el.id) {
|
|
5088
|
-
elMap[el.id] = el;
|
|
5089
|
-
}
|
|
5090
|
-
});
|
|
5091
|
-
return elMap;
|
|
5092
|
-
}
|
|
5093
|
-
class GroupTransition extends vrender.ACustomAnimate {
|
|
5094
|
-
constructor() {
|
|
5095
|
-
super(...arguments);
|
|
5096
|
-
this.mode = vrender.AnimateMode.NORMAL;
|
|
5097
|
-
}
|
|
5098
|
-
onBind() {
|
|
5099
|
-
const currentInnerView = this.target.getInnerView();
|
|
5100
|
-
const prevInnerView = this.target.getPrevInnerView();
|
|
5101
|
-
if (!prevInnerView) {
|
|
5102
|
-
return;
|
|
5103
|
-
}
|
|
5104
|
-
this._oldElementMap = getElMap(prevInnerView);
|
|
5105
|
-
this._newElementAttrMap = {};
|
|
5106
|
-
traverseGroup(currentInnerView, (el) => {
|
|
5107
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5108
|
-
if (el.type !== 'group' && el.id) {
|
|
5109
|
-
const oldEl = this._oldElementMap[el.id];
|
|
5110
|
-
if (oldEl) {
|
|
5111
|
-
if (!vutils.isEqual(el.attribute, oldEl.attribute)) {
|
|
5112
|
-
const newProps = vutils.cloneDeep(el.attribute);
|
|
5113
|
-
this._newElementAttrMap[el.id] = {
|
|
5114
|
-
state: 'update',
|
|
5115
|
-
node: el,
|
|
5116
|
-
attrs: Object.assign(Object.assign({}, newProps), { opacity: (_a = newProps.opacity) !== null && _a !== void 0 ? _a : 1, fillOpacity: (_b = newProps.fillOpacity) !== null && _b !== void 0 ? _b : 1, strokeOpacity: (_c = newProps.strokeOpacity) !== null && _c !== void 0 ? _c : 1 })
|
|
5117
|
-
};
|
|
5118
|
-
el.setAttributes(oldEl.attribute);
|
|
5119
|
-
}
|
|
5120
|
-
}
|
|
5121
|
-
else {
|
|
5122
|
-
const finalOpacityAttrs = {
|
|
5123
|
-
opacity: (_d = el.attribute.opacity) !== null && _d !== void 0 ? _d : 1,
|
|
5124
|
-
fillOpacity: (_e = el.attribute.fillOpacity) !== null && _e !== void 0 ? _e : 1,
|
|
5125
|
-
strokeOpacity: (_f = el.attribute.strokeOpacity) !== null && _f !== void 0 ? _f : 1
|
|
5126
|
-
};
|
|
5127
|
-
this._newElementAttrMap[el.id] = {
|
|
5128
|
-
state: 'enter',
|
|
5129
|
-
node: el,
|
|
5130
|
-
attrs: finalOpacityAttrs
|
|
5131
|
-
};
|
|
5132
|
-
el.setAttributes({
|
|
5133
|
-
opacity: 0,
|
|
5134
|
-
fillOpacity: 0,
|
|
5135
|
-
strokeOpacity: 0
|
|
5136
|
-
});
|
|
5137
|
-
}
|
|
5138
|
-
}
|
|
5139
|
-
});
|
|
5140
|
-
}
|
|
5141
|
-
onStart() {
|
|
5142
|
-
let duration = this.duration;
|
|
5143
|
-
let easing = this.easing;
|
|
5144
|
-
Object.keys(this._newElementAttrMap).forEach(id => {
|
|
5145
|
-
var _a, _b, _c;
|
|
5146
|
-
const { node, attrs, state } = this._newElementAttrMap[id];
|
|
5147
|
-
if (state === 'enter') {
|
|
5148
|
-
duration = vutils.isValidNumber((_a = this.params.enter) === null || _a === void 0 ? void 0 : _a.duration) ? this.params.enter.duration : duration;
|
|
5149
|
-
easing = ((_b = this.params.enter) === null || _b === void 0 ? void 0 : _b.easing) ? (_c = this.params.enter) === null || _c === void 0 ? void 0 : _c.easing : easing;
|
|
5150
|
-
}
|
|
5151
|
-
if (node.type === 'path') {
|
|
5152
|
-
node
|
|
5153
|
-
.animate({
|
|
5154
|
-
interpolate(key, ratio, from, to, nextAttributes) {
|
|
5155
|
-
if (key === 'path') {
|
|
5156
|
-
nextAttributes.path = vutils.interpolateString(from, to)(ratio);
|
|
5157
|
-
return true;
|
|
5158
|
-
}
|
|
5159
|
-
return false;
|
|
5160
|
-
}
|
|
5161
|
-
})
|
|
5162
|
-
.to(attrs, duration, easing);
|
|
5163
|
-
}
|
|
5164
|
-
else {
|
|
5165
|
-
node
|
|
5166
|
-
.animate()
|
|
5167
|
-
.to(attrs, duration, easing);
|
|
5168
|
-
}
|
|
5169
|
-
});
|
|
5170
|
-
}
|
|
5171
|
-
onUpdate(end, ratio, out) {
|
|
5172
|
-
}
|
|
5173
|
-
}
|
|
5174
|
-
|
|
5175
|
-
class GroupFadeIn extends vrender.ACustomAnimate {
|
|
5176
|
-
constructor(from, to, duration, easing) {
|
|
5177
|
-
super(null, null, duration, easing);
|
|
5178
|
-
}
|
|
5179
|
-
getEndProps() {
|
|
5180
|
-
return {};
|
|
5181
|
-
}
|
|
5182
|
-
onBind() {
|
|
5183
|
-
this.target.setTheme({
|
|
5184
|
-
common: {
|
|
5185
|
-
opacity: 0
|
|
5186
|
-
}
|
|
5187
|
-
});
|
|
5188
|
-
return;
|
|
5189
|
-
}
|
|
5190
|
-
onEnd() {
|
|
5191
|
-
this.target.setTheme({
|
|
5192
|
-
common: {
|
|
5193
|
-
opacity: 1
|
|
5194
|
-
}
|
|
5195
|
-
});
|
|
5196
|
-
return;
|
|
5197
|
-
}
|
|
5198
|
-
onUpdate(end, ratio, out) {
|
|
5199
|
-
this.target.setTheme({
|
|
5200
|
-
common: {
|
|
5201
|
-
opacity: ratio
|
|
5202
|
-
}
|
|
5203
|
-
});
|
|
5204
|
-
}
|
|
5205
|
-
}
|
|
5206
|
-
class GroupFadeOut extends vrender.ACustomAnimate {
|
|
5207
|
-
constructor(from, to, duration, easing) {
|
|
5208
|
-
super(null, null, duration, easing);
|
|
5209
|
-
}
|
|
5210
|
-
getEndProps() {
|
|
5211
|
-
return {};
|
|
5212
|
-
}
|
|
5213
|
-
onBind() {
|
|
5214
|
-
this.target.setTheme({
|
|
5215
|
-
common: {
|
|
5216
|
-
opacity: 1
|
|
5217
|
-
}
|
|
5218
|
-
});
|
|
5219
|
-
return;
|
|
5220
|
-
}
|
|
5221
|
-
onEnd() {
|
|
5222
|
-
this.target.setTheme({
|
|
5223
|
-
common: {
|
|
5224
|
-
opacity: 0
|
|
5225
|
-
}
|
|
5226
|
-
});
|
|
5227
|
-
return;
|
|
5228
|
-
}
|
|
5229
|
-
onUpdate(end, ratio, out) {
|
|
5230
|
-
this.target.setTheme({
|
|
5231
|
-
common: {
|
|
5232
|
-
opacity: 1 - ratio
|
|
5233
|
-
}
|
|
5234
|
-
});
|
|
5284
|
+
center, type: 'line' });
|
|
5235
5285
|
}
|
|
5236
5286
|
}
|
|
5287
|
+
vutils.mixin(CircleAxisGrid, CircleAxisMixin);
|
|
5237
5288
|
|
|
5238
5289
|
var DataZoomActiveTag;
|
|
5239
5290
|
(function (DataZoomActiveTag) {
|
|
@@ -6626,7 +6677,8 @@
|
|
|
6626
6677
|
const changeEvent = new vrender.CustomEvent('toPrev', {
|
|
6627
6678
|
current: this._current,
|
|
6628
6679
|
total: this._total,
|
|
6629
|
-
direction: 'pre'
|
|
6680
|
+
direction: 'pre',
|
|
6681
|
+
event: e
|
|
6630
6682
|
});
|
|
6631
6683
|
changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
|
|
6632
6684
|
this.dispatchEvent(changeEvent);
|
|
@@ -6645,7 +6697,8 @@
|
|
|
6645
6697
|
const changeEvent = new vrender.CustomEvent('toNext', {
|
|
6646
6698
|
current: this._current,
|
|
6647
6699
|
total: this._total,
|
|
6648
|
-
direction: 'next'
|
|
6700
|
+
direction: 'next',
|
|
6701
|
+
event: e
|
|
6649
6702
|
});
|
|
6650
6703
|
changeEvent.manager = (_b = this.stage) === null || _b === void 0 ? void 0 : _b.eventSystem.manager;
|
|
6651
6704
|
this.dispatchEvent(changeEvent);
|
|
@@ -6871,16 +6924,16 @@
|
|
|
6871
6924
|
const legendItem = target.delegate;
|
|
6872
6925
|
const selected = legendItem.hasState(exports.LegendStateValue.selected);
|
|
6873
6926
|
if (selected) {
|
|
6874
|
-
this._setLegendItemState(legendItem, exports.LegendStateValue.selectedHover);
|
|
6927
|
+
this._setLegendItemState(legendItem, exports.LegendStateValue.selectedHover, e);
|
|
6875
6928
|
}
|
|
6876
6929
|
else {
|
|
6877
|
-
this._setLegendItemState(legendItem, exports.LegendStateValue.unSelectedHover);
|
|
6930
|
+
this._setLegendItemState(legendItem, exports.LegendStateValue.unSelectedHover, e);
|
|
6878
6931
|
}
|
|
6879
6932
|
const focusButton = legendItem.getChildren()[0].find(node => node.name === exports.LEGEND_ELEMENT_NAME.focus, false);
|
|
6880
6933
|
if (focusButton) {
|
|
6881
6934
|
focusButton.setAttribute('visible', true);
|
|
6882
6935
|
}
|
|
6883
|
-
this._dispatchEvent(exports.LegendEvent.legendItemHover, legendItem);
|
|
6936
|
+
this._dispatchEvent(exports.LegendEvent.legendItemHover, legendItem, e);
|
|
6884
6937
|
}
|
|
6885
6938
|
};
|
|
6886
6939
|
this._onUnHover = (e) => {
|
|
@@ -6911,9 +6964,9 @@
|
|
|
6911
6964
|
focusButton.setAttribute('visible', false);
|
|
6912
6965
|
}
|
|
6913
6966
|
if (attributeUpdate) {
|
|
6914
|
-
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem);
|
|
6967
|
+
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
|
|
6915
6968
|
}
|
|
6916
|
-
this._dispatchEvent(exports.LegendEvent.legendItemUnHover, legendItem);
|
|
6969
|
+
this._dispatchEvent(exports.LegendEvent.legendItemUnHover, legendItem, e);
|
|
6917
6970
|
}
|
|
6918
6971
|
};
|
|
6919
6972
|
this._onClick = (e) => {
|
|
@@ -6926,25 +6979,17 @@
|
|
|
6926
6979
|
legendItem.toggleState(exports.LegendStateValue.focus);
|
|
6927
6980
|
if (isFocusSelected) {
|
|
6928
6981
|
(_b = this._itemsContainer) === null || _b === void 0 ? void 0 : _b.getChildren().forEach(item => {
|
|
6929
|
-
this._removeLegendItemState(item, [
|
|
6930
|
-
|
|
6931
|
-
exports.LegendStateValue.unSelectedHover,
|
|
6932
|
-
exports.LegendStateValue.focus
|
|
6933
|
-
]);
|
|
6934
|
-
this._setLegendItemState(item, exports.LegendStateValue.selected);
|
|
6982
|
+
this._removeLegendItemState(item, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover, exports.LegendStateValue.focus], e);
|
|
6983
|
+
this._setLegendItemState(item, exports.LegendStateValue.selected, e);
|
|
6935
6984
|
});
|
|
6936
6985
|
}
|
|
6937
6986
|
else {
|
|
6938
|
-
this._setLegendItemState(legendItem, exports.LegendStateValue.selected);
|
|
6939
|
-
this._removeLegendItemState(legendItem, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover]);
|
|
6987
|
+
this._setLegendItemState(legendItem, exports.LegendStateValue.selected, e);
|
|
6988
|
+
this._removeLegendItemState(legendItem, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover], e);
|
|
6940
6989
|
(_c = this._itemsContainer) === null || _c === void 0 ? void 0 : _c.getChildren().forEach(item => {
|
|
6941
6990
|
if (legendItem !== item) {
|
|
6942
|
-
this._removeLegendItemState(item, [
|
|
6943
|
-
|
|
6944
|
-
exports.LegendStateValue.selectedHover,
|
|
6945
|
-
exports.LegendStateValue.focus
|
|
6946
|
-
]);
|
|
6947
|
-
this._setLegendItemState(item, exports.LegendStateValue.unSelected);
|
|
6991
|
+
this._removeLegendItemState(item, [exports.LegendStateValue.selected, exports.LegendStateValue.selectedHover, exports.LegendStateValue.focus], e);
|
|
6992
|
+
this._setLegendItemState(item, exports.LegendStateValue.unSelected, e);
|
|
6948
6993
|
}
|
|
6949
6994
|
});
|
|
6950
6995
|
}
|
|
@@ -6958,33 +7003,30 @@
|
|
|
6958
7003
|
const currentSelectedItems = this._getSelectedLegends();
|
|
6959
7004
|
if (selectMode === 'multiple') {
|
|
6960
7005
|
if (allowAllCanceled === false && isSelected && currentSelectedItems.length === 1) {
|
|
6961
|
-
this._dispatchEvent(exports.LegendEvent.legendItemClick, legendItem);
|
|
7006
|
+
this._dispatchEvent(exports.LegendEvent.legendItemClick, legendItem, e);
|
|
6962
7007
|
return;
|
|
6963
7008
|
}
|
|
6964
7009
|
if (isSelected) {
|
|
6965
|
-
this._removeLegendItemState(legendItem, [exports.LegendStateValue.selected, exports.LegendStateValue.selectedHover]);
|
|
6966
|
-
this._setLegendItemState(legendItem, exports.LegendStateValue.unSelected);
|
|
7010
|
+
this._removeLegendItemState(legendItem, [exports.LegendStateValue.selected, exports.LegendStateValue.selectedHover], e);
|
|
7011
|
+
this._setLegendItemState(legendItem, exports.LegendStateValue.unSelected, e);
|
|
6967
7012
|
}
|
|
6968
7013
|
else {
|
|
6969
|
-
this._setLegendItemState(legendItem, exports.LegendStateValue.selected);
|
|
6970
|
-
this._removeLegendItemState(legendItem, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover]);
|
|
7014
|
+
this._setLegendItemState(legendItem, exports.LegendStateValue.selected, e);
|
|
7015
|
+
this._removeLegendItemState(legendItem, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover], e);
|
|
6971
7016
|
}
|
|
6972
7017
|
}
|
|
6973
7018
|
else {
|
|
6974
|
-
this._setLegendItemState(legendItem, exports.LegendStateValue.selected);
|
|
6975
|
-
this._removeLegendItemState(legendItem, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover]);
|
|
7019
|
+
this._setLegendItemState(legendItem, exports.LegendStateValue.selected, e);
|
|
7020
|
+
this._removeLegendItemState(legendItem, [exports.LegendStateValue.unSelected, exports.LegendStateValue.unSelectedHover], e);
|
|
6976
7021
|
(_e = this._itemsContainer) === null || _e === void 0 ? void 0 : _e.getChildren().forEach(item => {
|
|
6977
7022
|
if (legendItem !== item) {
|
|
6978
|
-
this._removeLegendItemState(item, [
|
|
6979
|
-
|
|
6980
|
-
exports.LegendStateValue.selectedHover
|
|
6981
|
-
]);
|
|
6982
|
-
this._setLegendItemState(item, exports.LegendStateValue.unSelected);
|
|
7023
|
+
this._removeLegendItemState(item, [exports.LegendStateValue.selected, exports.LegendStateValue.selectedHover], e);
|
|
7024
|
+
this._setLegendItemState(item, exports.LegendStateValue.unSelected, e);
|
|
6983
7025
|
}
|
|
6984
7026
|
});
|
|
6985
7027
|
}
|
|
6986
7028
|
}
|
|
6987
|
-
this._dispatchEvent(exports.LegendEvent.legendItemClick, legendItem);
|
|
7029
|
+
this._dispatchEvent(exports.LegendEvent.legendItemClick, legendItem, e);
|
|
6988
7030
|
}
|
|
6989
7031
|
};
|
|
6990
7032
|
}
|
|
@@ -7355,7 +7397,8 @@
|
|
|
7355
7397
|
this._pager.addEventListener('toNext', onPaging);
|
|
7356
7398
|
return true;
|
|
7357
7399
|
}
|
|
7358
|
-
_setLegendItemState(legendItem, stateName,
|
|
7400
|
+
_setLegendItemState(legendItem, stateName, e) {
|
|
7401
|
+
const keepCurrentStates = true;
|
|
7359
7402
|
let attributeUpdate = false;
|
|
7360
7403
|
if (!legendItem.hasState(stateName)) {
|
|
7361
7404
|
attributeUpdate = true;
|
|
@@ -7373,10 +7416,10 @@
|
|
|
7373
7416
|
}
|
|
7374
7417
|
});
|
|
7375
7418
|
if (attributeUpdate) {
|
|
7376
|
-
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem);
|
|
7419
|
+
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
|
|
7377
7420
|
}
|
|
7378
7421
|
}
|
|
7379
|
-
_removeLegendItemState(legendItem, stateNames) {
|
|
7422
|
+
_removeLegendItemState(legendItem, stateNames, e) {
|
|
7380
7423
|
let attributeUpdate = false;
|
|
7381
7424
|
stateNames.forEach(name => {
|
|
7382
7425
|
if (!attributeUpdate && legendItem.hasState(name)) {
|
|
@@ -7398,7 +7441,7 @@
|
|
|
7398
7441
|
}
|
|
7399
7442
|
});
|
|
7400
7443
|
if (attributeUpdate) {
|
|
7401
|
-
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem);
|
|
7444
|
+
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem, e);
|
|
7402
7445
|
}
|
|
7403
7446
|
}
|
|
7404
7447
|
_getSelectedLegends() {
|
|
@@ -7417,7 +7460,7 @@
|
|
|
7417
7460
|
shape.delegate = delegateShape;
|
|
7418
7461
|
shape.states = vutils.merge({}, DEFAULT_STATES, states);
|
|
7419
7462
|
}
|
|
7420
|
-
_dispatchEvent(eventName, legendItem) {
|
|
7463
|
+
_dispatchEvent(eventName, legendItem, event) {
|
|
7421
7464
|
var _a;
|
|
7422
7465
|
const currentSelectedItems = this._getSelectedLegends();
|
|
7423
7466
|
currentSelectedItems.sort((pre, next) => pre.index - next.index);
|
|
@@ -7427,7 +7470,8 @@
|
|
|
7427
7470
|
data: legendItem.data,
|
|
7428
7471
|
selected: legendItem.hasState(exports.LegendStateValue.selected),
|
|
7429
7472
|
currentSelectedItems,
|
|
7430
|
-
currentSelected
|
|
7473
|
+
currentSelected,
|
|
7474
|
+
event
|
|
7431
7475
|
});
|
|
7432
7476
|
changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
|
|
7433
7477
|
this.dispatchEvent(changeEvent);
|
|
@@ -10310,7 +10354,11 @@
|
|
|
10310
10354
|
}
|
|
10311
10355
|
Tooltip.defaultAttributes = defaultAttributes;
|
|
10312
10356
|
|
|
10313
|
-
|
|
10357
|
+
function VTag(params) {
|
|
10358
|
+
return new Tag(params ? params.attribute : {});
|
|
10359
|
+
}
|
|
10360
|
+
|
|
10361
|
+
const version = "0.14.9-alpha.4";
|
|
10314
10362
|
|
|
10315
10363
|
exports.AbstractComponent = AbstractComponent;
|
|
10316
10364
|
exports.ArcInfo = ArcInfo;
|
|
@@ -10318,6 +10366,7 @@
|
|
|
10318
10366
|
exports.BasePlayer = BasePlayer;
|
|
10319
10367
|
exports.Brush = Brush;
|
|
10320
10368
|
exports.CircleAxis = CircleAxis;
|
|
10369
|
+
exports.CircleAxisGrid = CircleAxisGrid;
|
|
10321
10370
|
exports.CircleCrosshair = CircleCrosshair;
|
|
10322
10371
|
exports.ColorContinuousLegend = ColorContinuousLegend;
|
|
10323
10372
|
exports.ContinuousPlayer = ContinuousPlayer;
|
|
@@ -10334,13 +10383,13 @@
|
|
|
10334
10383
|
exports.DataZoom = DataZoom;
|
|
10335
10384
|
exports.DiscreteLegend = DiscreteLegend;
|
|
10336
10385
|
exports.DiscretePlayer = DiscretePlayer;
|
|
10337
|
-
exports.Grid = Grid;
|
|
10338
10386
|
exports.GroupFadeIn = GroupFadeIn;
|
|
10339
10387
|
exports.GroupFadeOut = GroupFadeOut;
|
|
10340
10388
|
exports.GroupTransition = GroupTransition;
|
|
10341
10389
|
exports.Indicator = Indicator;
|
|
10342
10390
|
exports.LabelBase = LabelBase;
|
|
10343
10391
|
exports.LineAxis = LineAxis;
|
|
10392
|
+
exports.LineAxisGrid = LineAxisGrid;
|
|
10344
10393
|
exports.LineCrosshair = LineCrosshair;
|
|
10345
10394
|
exports.LineLabel = LineLabel;
|
|
10346
10395
|
exports.LinkPath = LinkPath;
|
|
@@ -10361,6 +10410,7 @@
|
|
|
10361
10410
|
exports.Tag = Tag;
|
|
10362
10411
|
exports.Title = Title;
|
|
10363
10412
|
exports.Tooltip = Tooltip;
|
|
10413
|
+
exports.VTag = VTag;
|
|
10364
10414
|
exports.getHorizontalPath = getHorizontalPath;
|
|
10365
10415
|
exports.getSizeHandlerPath = getSizeHandlerPath;
|
|
10366
10416
|
exports.getVerticalPath = getVerticalPath;
|