@visactor/vrender-components 0.14.7 → 0.15.0-alpha.11
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 +16 -117
- 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/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/link-path/index.js +1 -2
- package/cjs/link-path/link-path.js +2 -1
- package/cjs/marker/point.js +1 -1
- package/cjs/poptip/register.js +6 -4
- 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 +636 -584
- 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 +8 -109
- 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/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/link-path/index.js +1 -2
- package/es/link-path/link-path.js +2 -1
- package/es/marker/point.js +1 -1
- package/es/poptip/register.js +6 -4
- 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
|
@@ -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,
|
|
@@ -1095,13 +1095,20 @@
|
|
|
1095
1095
|
injectable()
|
|
1096
1096
|
], PopTipForClipedTextPlugin);
|
|
1097
1097
|
|
|
1098
|
-
const popTipModule = new ContainerModule(bind => {
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1098
|
+
const popTipModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
1099
|
+
if (!isBound(PopTipRenderContribution) || !isBound(PopTipPlugin) || !isBound(PopTipForClipedTextPlugin)) {
|
|
1100
|
+
bind(PopTipRenderContribution).toSelf().inSingletonScope();
|
|
1101
|
+
bind(vrender.InteractiveSubRenderContribution).toService(PopTipRenderContribution);
|
|
1102
|
+
bind(PopTipPlugin).toSelf();
|
|
1103
|
+
bind(vrender.AutoEnablePlugins).toService(PopTipPlugin);
|
|
1104
|
+
bind(PopTipForClipedTextPlugin).toSelf();
|
|
1105
|
+
bind(vrender.AutoEnablePlugins).toService(PopTipForClipedTextPlugin);
|
|
1106
|
+
}
|
|
1107
|
+
else {
|
|
1108
|
+
rebind(PopTipRenderContribution).toSelf().inSingletonScope();
|
|
1109
|
+
rebind(PopTipPlugin).toSelf();
|
|
1110
|
+
rebind(PopTipForClipedTextPlugin).toSelf();
|
|
1111
|
+
}
|
|
1105
1112
|
});
|
|
1106
1113
|
function loadPoptip(defaultPoptipTheme) {
|
|
1107
1114
|
vutils.merge(theme.poptip, defaultPoptipTheme);
|
|
@@ -3163,156 +3170,6 @@
|
|
|
3163
3170
|
pickable: false
|
|
3164
3171
|
};
|
|
3165
3172
|
|
|
3166
|
-
function getLinePath(points, closed) {
|
|
3167
|
-
let path = '';
|
|
3168
|
-
if (points.length === 0) {
|
|
3169
|
-
return path;
|
|
3170
|
-
}
|
|
3171
|
-
points.forEach((point, index) => {
|
|
3172
|
-
if (index === 0) {
|
|
3173
|
-
path = `M${point.x},${point.y}`;
|
|
3174
|
-
}
|
|
3175
|
-
else {
|
|
3176
|
-
path += `L${point.x},${point.y}`;
|
|
3177
|
-
}
|
|
3178
|
-
});
|
|
3179
|
-
if (closed) {
|
|
3180
|
-
path += 'Z';
|
|
3181
|
-
}
|
|
3182
|
-
return path;
|
|
3183
|
-
}
|
|
3184
|
-
function getArcPath(center, points, reverse, closed) {
|
|
3185
|
-
let path = '';
|
|
3186
|
-
if (!center || points.length === 0) {
|
|
3187
|
-
return path;
|
|
3188
|
-
}
|
|
3189
|
-
const firstPoint = points[0];
|
|
3190
|
-
const radius = vutils.PointService.distancePP(center, firstPoint);
|
|
3191
|
-
const sweepFlag = reverse ? 0 : 1;
|
|
3192
|
-
if (closed) {
|
|
3193
|
-
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`;
|
|
3194
|
-
}
|
|
3195
|
-
else {
|
|
3196
|
-
points.forEach((point, index) => {
|
|
3197
|
-
if (index === 0) {
|
|
3198
|
-
path = `M${point.x},${point.y}`;
|
|
3199
|
-
}
|
|
3200
|
-
else {
|
|
3201
|
-
path += `A${radius},${radius},0,0,${sweepFlag},${point.x},${point.y}`;
|
|
3202
|
-
}
|
|
3203
|
-
});
|
|
3204
|
-
}
|
|
3205
|
-
return path;
|
|
3206
|
-
}
|
|
3207
|
-
function getRegionPath(from, to, attribute) {
|
|
3208
|
-
const { type, closed } = attribute;
|
|
3209
|
-
const reversePoints = to.slice(0).reverse();
|
|
3210
|
-
let regionPath = '';
|
|
3211
|
-
let nextPath = '';
|
|
3212
|
-
if (type === 'line' && attribute.smoothLink && attribute.center) {
|
|
3213
|
-
const fromStart = from[0];
|
|
3214
|
-
const toEnd = reversePoints[0];
|
|
3215
|
-
const center = attribute.center;
|
|
3216
|
-
regionPath = getLinePath(from, !!closed);
|
|
3217
|
-
nextPath = getLinePath(reversePoints, !!closed);
|
|
3218
|
-
const toEndRadius = vutils.PointService.distancePP(toEnd, center);
|
|
3219
|
-
const fromStartRadius = vutils.PointService.distancePP(fromStart, center);
|
|
3220
|
-
regionPath += `A${toEndRadius},${toEndRadius},0,0,1,${toEnd.x},${toEnd.y}L${toEnd.x},${toEnd.y}`;
|
|
3221
|
-
nextPath += `A${fromStartRadius},${fromStartRadius},0,0,0,${fromStart.x},${fromStart.y}`;
|
|
3222
|
-
}
|
|
3223
|
-
else if (type === 'circle') {
|
|
3224
|
-
const { center } = attribute;
|
|
3225
|
-
regionPath = getArcPath(center, from, false, !!closed);
|
|
3226
|
-
nextPath = getArcPath(center, reversePoints, true, !!closed);
|
|
3227
|
-
}
|
|
3228
|
-
else if (type === 'line' || type === 'polygon') {
|
|
3229
|
-
regionPath = getLinePath(from, !!closed);
|
|
3230
|
-
nextPath = getLinePath(reversePoints, !!closed);
|
|
3231
|
-
}
|
|
3232
|
-
if (closed) {
|
|
3233
|
-
regionPath += nextPath;
|
|
3234
|
-
}
|
|
3235
|
-
else {
|
|
3236
|
-
nextPath = 'L' + nextPath.substring(1);
|
|
3237
|
-
regionPath += nextPath;
|
|
3238
|
-
regionPath += 'Z';
|
|
3239
|
-
}
|
|
3240
|
-
return regionPath;
|
|
3241
|
-
}
|
|
3242
|
-
class Grid extends AbstractComponent {
|
|
3243
|
-
constructor(attributes) {
|
|
3244
|
-
super(vutils.merge({}, Grid.defaultAttributes, attributes));
|
|
3245
|
-
this.name = 'grid';
|
|
3246
|
-
}
|
|
3247
|
-
render() {
|
|
3248
|
-
this.removeAllChild();
|
|
3249
|
-
const { type, items, style, closed, alternateColor, depth = 0 } = this.attribute;
|
|
3250
|
-
if (vutils.isEmpty(items)) {
|
|
3251
|
-
return;
|
|
3252
|
-
}
|
|
3253
|
-
items.forEach((item, index) => {
|
|
3254
|
-
const { id, points } = item;
|
|
3255
|
-
let path = '';
|
|
3256
|
-
if (type === 'line' || type === 'polygon') {
|
|
3257
|
-
path = getLinePath(points, !!closed);
|
|
3258
|
-
}
|
|
3259
|
-
else if (type === 'circle') {
|
|
3260
|
-
const { center } = this.attribute;
|
|
3261
|
-
path = getArcPath(center, points, false, !!closed);
|
|
3262
|
-
}
|
|
3263
|
-
const shape = vrender.createPath(Object.assign({ path, z: depth }, (vutils.isFunction(style) ? vutils.merge({}, Grid.defaultAttributes.style, style(item, index)) : style)));
|
|
3264
|
-
shape.name = `${this.name}-line`;
|
|
3265
|
-
shape.id = this._getNodeId(`path-${id}`);
|
|
3266
|
-
this.add(shape);
|
|
3267
|
-
});
|
|
3268
|
-
if (depth && type === 'line') {
|
|
3269
|
-
items.forEach((item, index) => {
|
|
3270
|
-
const { id, points } = item;
|
|
3271
|
-
const nextPoints = [];
|
|
3272
|
-
nextPoints.push(points[0]);
|
|
3273
|
-
const dir = { x: points[1].x - points[0].x, y: points[1].y - points[0].y };
|
|
3274
|
-
const dirLen = Math.sqrt(dir.x * dir.x + dir.y * dir.y);
|
|
3275
|
-
const ratio = depth / dirLen;
|
|
3276
|
-
nextPoints.push({ x: points[0].x + dir.x * ratio, y: points[0].y + dir.y * ratio });
|
|
3277
|
-
const path = getLinePath(nextPoints, !!closed);
|
|
3278
|
-
const deltaX = vutils.abs(nextPoints[0].x - nextPoints[1].x);
|
|
3279
|
-
const deltaY = vutils.abs(nextPoints[0].y - nextPoints[1].y);
|
|
3280
|
-
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)));
|
|
3281
|
-
shape.name = `${this.name}-line`;
|
|
3282
|
-
shape.id = this._getNodeId(`path-${id}`);
|
|
3283
|
-
this.add(shape);
|
|
3284
|
-
});
|
|
3285
|
-
}
|
|
3286
|
-
if (items.length > 1 && alternateColor) {
|
|
3287
|
-
const colors = vutils.isArray(alternateColor)
|
|
3288
|
-
? alternateColor
|
|
3289
|
-
: [alternateColor, 'transparent'];
|
|
3290
|
-
const getColor = (index) => colors[index % colors.length];
|
|
3291
|
-
for (let index = 0; index < items.length - 1; index++) {
|
|
3292
|
-
const [prev, curr] = [items[index].points, items[index + 1].points];
|
|
3293
|
-
const path = getRegionPath(prev, curr, this.attribute);
|
|
3294
|
-
const shape = vrender.createPath({
|
|
3295
|
-
path,
|
|
3296
|
-
fill: getColor(index)
|
|
3297
|
-
});
|
|
3298
|
-
shape.name = `${this.name}-region`;
|
|
3299
|
-
shape.id = this._getNodeId(`region-${index}`);
|
|
3300
|
-
this.add(shape);
|
|
3301
|
-
}
|
|
3302
|
-
}
|
|
3303
|
-
}
|
|
3304
|
-
_getNodeId(id) {
|
|
3305
|
-
return `${this.id}-${id}`;
|
|
3306
|
-
}
|
|
3307
|
-
}
|
|
3308
|
-
Grid.defaultAttributes = {
|
|
3309
|
-
style: {
|
|
3310
|
-
lineWidth: 1,
|
|
3311
|
-
stroke: '#416180'
|
|
3312
|
-
},
|
|
3313
|
-
zIndex: 0
|
|
3314
|
-
};
|
|
3315
|
-
|
|
3316
3173
|
class Segment extends AbstractComponent {
|
|
3317
3174
|
constructor(attributes) {
|
|
3318
3175
|
super(vutils.merge({}, Segment.defaultAttributes, attributes));
|
|
@@ -3530,23 +3387,6 @@
|
|
|
3530
3387
|
stroke: '#000',
|
|
3531
3388
|
strokeOpacity: 1
|
|
3532
3389
|
}
|
|
3533
|
-
},
|
|
3534
|
-
grid: {
|
|
3535
|
-
style: {
|
|
3536
|
-
lineWidth: 1,
|
|
3537
|
-
stroke: '#999',
|
|
3538
|
-
strokeOpacity: 1,
|
|
3539
|
-
lineDash: [4, 4]
|
|
3540
|
-
}
|
|
3541
|
-
},
|
|
3542
|
-
subGrid: {
|
|
3543
|
-
visible: false,
|
|
3544
|
-
style: {
|
|
3545
|
-
lineWidth: 1,
|
|
3546
|
-
stroke: '#999',
|
|
3547
|
-
strokeOpacity: 1,
|
|
3548
|
-
lineDash: [4, 4]
|
|
3549
|
-
}
|
|
3550
3390
|
}
|
|
3551
3391
|
};
|
|
3552
3392
|
|
|
@@ -3643,7 +3483,7 @@
|
|
|
3643
3483
|
}
|
|
3644
3484
|
}
|
|
3645
3485
|
_renderInner(container) {
|
|
3646
|
-
const { title, label, tick, line,
|
|
3486
|
+
const { title, label, tick, line, items } = this.attribute;
|
|
3647
3487
|
const axisContainer = vrender.createGroup({ x: 0, y: 0, zIndex: 1 });
|
|
3648
3488
|
axisContainer.name = exports.AXIS_ELEMENT_NAME.axisContainer;
|
|
3649
3489
|
axisContainer.id = this._getNodeId('container');
|
|
@@ -3672,9 +3512,6 @@
|
|
|
3672
3512
|
this.afterLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);
|
|
3673
3513
|
});
|
|
3674
3514
|
}
|
|
3675
|
-
if (grid === null || grid === void 0 ? void 0 : grid.visible) {
|
|
3676
|
-
this.renderGrid(container);
|
|
3677
|
-
}
|
|
3678
3515
|
}
|
|
3679
3516
|
if (title === null || title === void 0 ? void 0 : title.visible) {
|
|
3680
3517
|
this.renderTitle(axisContainer);
|
|
@@ -3791,13 +3628,6 @@
|
|
|
3791
3628
|
axisTitle.id = this._getNodeId('title');
|
|
3792
3629
|
container.add(axisTitle);
|
|
3793
3630
|
}
|
|
3794
|
-
renderGrid(container) {
|
|
3795
|
-
const { visible } = this.attribute.subGrid || {};
|
|
3796
|
-
if (visible) {
|
|
3797
|
-
this._renderGridByType('subGrid', container);
|
|
3798
|
-
}
|
|
3799
|
-
this._renderGridByType('grid', container);
|
|
3800
|
-
}
|
|
3801
3631
|
getVerticalCoord(point, offset, inside) {
|
|
3802
3632
|
const vector = this.getVerticalVector(offset, inside, point);
|
|
3803
3633
|
return {
|
|
@@ -3968,13 +3798,6 @@
|
|
|
3968
3798
|
});
|
|
3969
3799
|
return data;
|
|
3970
3800
|
}
|
|
3971
|
-
_renderGridByType(type, container) {
|
|
3972
|
-
const gridAttrs = this.getGridAttribute(type);
|
|
3973
|
-
const gridGroup = new Grid(Object.assign(Object.assign({ pickable: false }, gridAttrs), { zIndex: 0 }));
|
|
3974
|
-
gridGroup.name = type === 'subGrid' ? `${exports.AXIS_ELEMENT_NAME.grid}-sub` : `${exports.AXIS_ELEMENT_NAME.grid}`;
|
|
3975
|
-
gridGroup.id = this._getNodeId(type);
|
|
3976
|
-
container.add(gridGroup);
|
|
3977
|
-
}
|
|
3978
3801
|
}
|
|
3979
3802
|
|
|
3980
3803
|
const methods = {
|
|
@@ -4273,15 +4096,31 @@
|
|
|
4273
4096
|
}
|
|
4274
4097
|
}
|
|
4275
4098
|
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4099
|
+
class LineAxisMixin {
|
|
4100
|
+
isInValidValue(value) {
|
|
4101
|
+
return value < 0 || value > 1;
|
|
4102
|
+
}
|
|
4103
|
+
getTickCoord(tickValue) {
|
|
4104
|
+
const { start } = this.attribute;
|
|
4105
|
+
const axisVector = this.getRelativeVector();
|
|
4106
|
+
return {
|
|
4107
|
+
x: start.x + axisVector[0] * tickValue,
|
|
4108
|
+
y: start.y + axisVector[1] * tickValue
|
|
4109
|
+
};
|
|
4110
|
+
}
|
|
4111
|
+
getRelativeVector(point) {
|
|
4112
|
+
const { start, end } = this.attribute;
|
|
4113
|
+
return [end.x - start.x, end.y - start.y];
|
|
4114
|
+
}
|
|
4115
|
+
getVerticalVector(offset, inside = false, point) {
|
|
4116
|
+
const { verticalFactor = 1 } = this.attribute;
|
|
4117
|
+
const axisVector = this.getRelativeVector();
|
|
4118
|
+
const normalizedAxisVector = normalize(axisVector);
|
|
4119
|
+
const verticalVector = [normalizedAxisVector[1], normalizedAxisVector[0] * -1];
|
|
4120
|
+
return scale(verticalVector, offset * (inside ? 1 : -1) * verticalFactor);
|
|
4282
4121
|
}
|
|
4283
|
-
return points;
|
|
4284
4122
|
}
|
|
4123
|
+
|
|
4285
4124
|
class LineAxis extends AxisBase {
|
|
4286
4125
|
constructor(attributes, mode) {
|
|
4287
4126
|
super(vutils.merge({}, LineAxis.defaultAttributes, attributes), mode);
|
|
@@ -4319,28 +4158,6 @@
|
|
|
4319
4158
|
axisLineGroup.id = this._getNodeId('line');
|
|
4320
4159
|
container.add(axisLineGroup);
|
|
4321
4160
|
}
|
|
4322
|
-
isInValidValue(value) {
|
|
4323
|
-
return value < 0 || value > 1;
|
|
4324
|
-
}
|
|
4325
|
-
getTickCoord(tickValue) {
|
|
4326
|
-
const { start } = this.attribute;
|
|
4327
|
-
const axisVector = this.getRelativeVector();
|
|
4328
|
-
return {
|
|
4329
|
-
x: start.x + axisVector[0] * tickValue,
|
|
4330
|
-
y: start.y + axisVector[1] * tickValue
|
|
4331
|
-
};
|
|
4332
|
-
}
|
|
4333
|
-
getRelativeVector() {
|
|
4334
|
-
const { start, end } = this.attribute;
|
|
4335
|
-
return [end.x - start.x, end.y - start.y];
|
|
4336
|
-
}
|
|
4337
|
-
getVerticalVector(offset, inside = false) {
|
|
4338
|
-
const { verticalFactor = 1 } = this.attribute;
|
|
4339
|
-
const axisVector = this.getRelativeVector();
|
|
4340
|
-
const normalizedAxisVector = normalize(axisVector);
|
|
4341
|
-
const verticalVector = [normalizedAxisVector[1], normalizedAxisVector[0] * -1];
|
|
4342
|
-
return scale(verticalVector, offset * (inside ? 1 : -1) * verticalFactor);
|
|
4343
|
-
}
|
|
4344
4161
|
getTitleAttribute() {
|
|
4345
4162
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4346
4163
|
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"]);
|
|
@@ -4425,7 +4242,7 @@
|
|
|
4425
4242
|
}
|
|
4426
4243
|
const offset = tickLength + labelLength + space;
|
|
4427
4244
|
const titlePoint = this.getVerticalCoord(point, offset, false);
|
|
4428
|
-
const vector = this.getVerticalVector(offset, false);
|
|
4245
|
+
const vector = this.getVerticalVector(offset, false, { x: 0, y: 0 });
|
|
4429
4246
|
let { angle } = restAttrs;
|
|
4430
4247
|
let textAlign;
|
|
4431
4248
|
if (position === 'start') {
|
|
@@ -4473,129 +4290,35 @@
|
|
|
4473
4290
|
}
|
|
4474
4291
|
return attrs;
|
|
4475
4292
|
}
|
|
4476
|
-
|
|
4477
|
-
let
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4293
|
+
getTextBaseline(vector, inside) {
|
|
4294
|
+
let base = 'middle';
|
|
4295
|
+
const { verticalFactor = 1 } = this.attribute;
|
|
4296
|
+
const factor = (inside ? 1 : -1) * verticalFactor;
|
|
4297
|
+
if (vutils.isNumberClose(vector[1], 0)) {
|
|
4298
|
+
if (vutils.isNumberClose(vector[0], 0) && !Object.is(vector[0], -0) && !Object.is(vector[1], -0)) {
|
|
4299
|
+
base = factor === 1 ? 'bottom' : 'top';
|
|
4300
|
+
}
|
|
4301
|
+
else {
|
|
4302
|
+
base = 'middle';
|
|
4303
|
+
}
|
|
4482
4304
|
}
|
|
4483
|
-
else if (
|
|
4484
|
-
|
|
4485
|
-
const distance = vutils.PointService.distancePP(center, point);
|
|
4486
|
-
gridPoints = getCirclePoints(center, sides, distance, startAngle, endAngle);
|
|
4305
|
+
else if (vector[1] > 0) {
|
|
4306
|
+
base = 'top';
|
|
4487
4307
|
}
|
|
4488
|
-
|
|
4308
|
+
else if (vector[1] < 0) {
|
|
4309
|
+
base = 'bottom';
|
|
4310
|
+
}
|
|
4311
|
+
return base;
|
|
4489
4312
|
}
|
|
4490
|
-
|
|
4491
|
-
const
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
if (type === 'grid') {
|
|
4500
|
-
gridAttribute = this.attribute.grid;
|
|
4501
|
-
const gridItems = [];
|
|
4502
|
-
this.data.forEach(item => {
|
|
4503
|
-
let { point } = item;
|
|
4504
|
-
if (!alignWithLabel) {
|
|
4505
|
-
const value = item.value - tickSegment / 2;
|
|
4506
|
-
if (this.isInValidValue(value)) {
|
|
4507
|
-
return;
|
|
4508
|
-
}
|
|
4509
|
-
point = this.getTickCoord(value);
|
|
4510
|
-
}
|
|
4511
|
-
gridItems.push({
|
|
4512
|
-
id: item.label,
|
|
4513
|
-
datum: item,
|
|
4514
|
-
points: this._getGridPoint(gridType, point)
|
|
4515
|
-
});
|
|
4516
|
-
});
|
|
4517
|
-
items = gridItems;
|
|
4518
|
-
}
|
|
4519
|
-
else {
|
|
4520
|
-
gridAttribute = vutils.merge({}, this.attribute.grid, this.attribute.subGrid);
|
|
4521
|
-
const subGridItems = [];
|
|
4522
|
-
const { count: subCount = 4 } = this.attribute.subTick || {};
|
|
4523
|
-
const tickLineCount = this.data.length;
|
|
4524
|
-
if (tickLineCount >= 2) {
|
|
4525
|
-
const points = [];
|
|
4526
|
-
this.data.forEach((item) => {
|
|
4527
|
-
let tickValue = item.value;
|
|
4528
|
-
if (!alignWithLabel) {
|
|
4529
|
-
const value = item.value - tickSegment / 2;
|
|
4530
|
-
if (this.isInValidValue(value)) {
|
|
4531
|
-
return;
|
|
4532
|
-
}
|
|
4533
|
-
tickValue = value;
|
|
4534
|
-
}
|
|
4535
|
-
points.push({
|
|
4536
|
-
value: tickValue
|
|
4537
|
-
});
|
|
4538
|
-
});
|
|
4539
|
-
for (let i = 0; i < points.length - 1; i++) {
|
|
4540
|
-
const pre = points[i];
|
|
4541
|
-
const next = points[i + 1];
|
|
4542
|
-
subGridItems.push({
|
|
4543
|
-
id: `sub-${i}-0`,
|
|
4544
|
-
points: this._getGridPoint(gridType, this.getTickCoord(pre.value)),
|
|
4545
|
-
datum: {}
|
|
4546
|
-
});
|
|
4547
|
-
for (let j = 0; j < subCount; j++) {
|
|
4548
|
-
const percent = (j + 1) / (subCount + 1);
|
|
4549
|
-
const value = (1 - percent) * pre.value + percent * next.value;
|
|
4550
|
-
const point = this.getTickCoord(value);
|
|
4551
|
-
subGridItems.push({
|
|
4552
|
-
id: `sub-${i}-${j + 1}`,
|
|
4553
|
-
points: this._getGridPoint(gridType, point),
|
|
4554
|
-
datum: {}
|
|
4555
|
-
});
|
|
4556
|
-
}
|
|
4557
|
-
if (i === points.length - 2) {
|
|
4558
|
-
subGridItems.push({
|
|
4559
|
-
id: `sub-${i}-${subCount + 1}`,
|
|
4560
|
-
points: this._getGridPoint(gridType, this.getTickCoord(next.value)),
|
|
4561
|
-
datum: {}
|
|
4562
|
-
});
|
|
4563
|
-
}
|
|
4564
|
-
}
|
|
4565
|
-
items = subGridItems;
|
|
4566
|
-
}
|
|
4567
|
-
}
|
|
4568
|
-
return Object.assign(Object.assign({}, gridAttribute), { items });
|
|
4569
|
-
}
|
|
4570
|
-
getTextBaseline(vector, inside) {
|
|
4571
|
-
let base = 'middle';
|
|
4572
|
-
const { verticalFactor = 1 } = this.attribute;
|
|
4573
|
-
const factor = (inside ? 1 : -1) * verticalFactor;
|
|
4574
|
-
if (vutils.isNumberClose(vector[1], 0)) {
|
|
4575
|
-
if (vutils.isNumberClose(vector[0], 0) && !Object.is(vector[0], -0) && !Object.is(vector[1], -0)) {
|
|
4576
|
-
base = factor === 1 ? 'bottom' : 'top';
|
|
4577
|
-
}
|
|
4578
|
-
else {
|
|
4579
|
-
base = 'middle';
|
|
4580
|
-
}
|
|
4581
|
-
}
|
|
4582
|
-
else if (vector[1] > 0) {
|
|
4583
|
-
base = 'top';
|
|
4584
|
-
}
|
|
4585
|
-
else if (vector[1] < 0) {
|
|
4586
|
-
base = 'bottom';
|
|
4587
|
-
}
|
|
4588
|
-
return base;
|
|
4589
|
-
}
|
|
4590
|
-
getLabelAlign(vector, inside, angle) {
|
|
4591
|
-
const orient = this.attribute.orient;
|
|
4592
|
-
if (vutils.isValidNumber(angle)) {
|
|
4593
|
-
if (orient === 'top' || orient === 'bottom') {
|
|
4594
|
-
return getXAxisLabelAlign(orient, angle);
|
|
4595
|
-
}
|
|
4596
|
-
if (orient === 'left' || orient === 'right') {
|
|
4597
|
-
return getYAxisLabelAlign(orient, angle);
|
|
4598
|
-
}
|
|
4313
|
+
getLabelAlign(vector, inside, angle) {
|
|
4314
|
+
const orient = this.attribute.orient;
|
|
4315
|
+
if (vutils.isValidNumber(angle)) {
|
|
4316
|
+
if (orient === 'top' || orient === 'bottom') {
|
|
4317
|
+
return getXAxisLabelAlign(orient, angle);
|
|
4318
|
+
}
|
|
4319
|
+
if (orient === 'left' || orient === 'right') {
|
|
4320
|
+
return getYAxisLabelAlign(orient, angle);
|
|
4321
|
+
}
|
|
4599
4322
|
}
|
|
4600
4323
|
return {
|
|
4601
4324
|
textAlign: this.getTextAlign(vector),
|
|
@@ -4800,29 +4523,9 @@
|
|
|
4800
4523
|
}
|
|
4801
4524
|
}
|
|
4802
4525
|
LineAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
4526
|
+
vutils.mixin(LineAxis, LineAxisMixin);
|
|
4803
4527
|
|
|
4804
|
-
class
|
|
4805
|
-
constructor(attributes) {
|
|
4806
|
-
super(vutils.merge({}, CircleAxis.defaultAttributes, attributes));
|
|
4807
|
-
}
|
|
4808
|
-
renderLine(container) {
|
|
4809
|
-
const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, radius, center, innerRadius = 0, line, inside = false } = this.attribute;
|
|
4810
|
-
let arcRadius = radius;
|
|
4811
|
-
let arcInnerRadius = innerRadius;
|
|
4812
|
-
if (inside && innerRadius > 0) {
|
|
4813
|
-
arcRadius = innerRadius;
|
|
4814
|
-
arcInnerRadius = 0;
|
|
4815
|
-
}
|
|
4816
|
-
const arcAttrs = Object.assign(Object.assign(Object.assign({}, center), { startAngle,
|
|
4817
|
-
endAngle, radius: arcRadius, innerRadius: arcInnerRadius }), line === null || line === void 0 ? void 0 : line.style);
|
|
4818
|
-
const axisLine = vrender.createCircle(arcAttrs);
|
|
4819
|
-
axisLine.name = exports.AXIS_ELEMENT_NAME.line;
|
|
4820
|
-
axisLine.id = this._getNodeId('line');
|
|
4821
|
-
if (!vutils.isEmpty(line === null || line === void 0 ? void 0 : line.state)) {
|
|
4822
|
-
axisLine.states = vutils.merge({}, DEFAULT_STATES$1, line.state);
|
|
4823
|
-
}
|
|
4824
|
-
container.add(axisLine);
|
|
4825
|
-
}
|
|
4528
|
+
class CircleAxisMixin {
|
|
4826
4529
|
isInValidValue(value) {
|
|
4827
4530
|
const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE } = this.attribute;
|
|
4828
4531
|
if (Math.abs(endAngle - startAngle) % (Math.PI * 2) === 0) {
|
|
@@ -4845,6 +4548,30 @@
|
|
|
4845
4548
|
const { center } = this.attribute;
|
|
4846
4549
|
return [point.y - center.y, -1 * (point.x - center.x)];
|
|
4847
4550
|
}
|
|
4551
|
+
}
|
|
4552
|
+
|
|
4553
|
+
class CircleAxis extends AxisBase {
|
|
4554
|
+
constructor(attributes) {
|
|
4555
|
+
super(vutils.merge({}, CircleAxis.defaultAttributes, attributes));
|
|
4556
|
+
}
|
|
4557
|
+
renderLine(container) {
|
|
4558
|
+
const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, radius, center, innerRadius = 0, line, inside = false } = this.attribute;
|
|
4559
|
+
let arcRadius = radius;
|
|
4560
|
+
let arcInnerRadius = innerRadius;
|
|
4561
|
+
if (inside && innerRadius > 0) {
|
|
4562
|
+
arcRadius = innerRadius;
|
|
4563
|
+
arcInnerRadius = 0;
|
|
4564
|
+
}
|
|
4565
|
+
const arcAttrs = Object.assign(Object.assign(Object.assign({}, center), { startAngle,
|
|
4566
|
+
endAngle, radius: arcRadius, innerRadius: arcInnerRadius }), line === null || line === void 0 ? void 0 : line.style);
|
|
4567
|
+
const axisLine = vrender.createCircle(arcAttrs);
|
|
4568
|
+
axisLine.name = exports.AXIS_ELEMENT_NAME.line;
|
|
4569
|
+
axisLine.id = this._getNodeId('line');
|
|
4570
|
+
if (!vutils.isEmpty(line === null || line === void 0 ? void 0 : line.state)) {
|
|
4571
|
+
axisLine.states = vutils.merge({}, DEFAULT_STATES$1, line.state);
|
|
4572
|
+
}
|
|
4573
|
+
container.add(axisLine);
|
|
4574
|
+
}
|
|
4848
4575
|
getTitleAttribute() {
|
|
4849
4576
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4850
4577
|
const { center, radius, innerRadius = 0 } = this.attribute;
|
|
@@ -4897,40 +4624,541 @@
|
|
|
4897
4624
|
if (background && background.visible) {
|
|
4898
4625
|
attrs.panel = Object.assign({ visible: true }, background.style);
|
|
4899
4626
|
}
|
|
4900
|
-
return attrs;
|
|
4901
|
-
}
|
|
4902
|
-
getSubTickLineItems() {
|
|
4903
|
-
var _a, _b;
|
|
4904
|
-
const { subTick } = this.attribute;
|
|
4905
|
-
const subTickLineItems = [];
|
|
4906
|
-
const { count: subCount = 4, inside = false, length = 2 } = subTick;
|
|
4907
|
-
const tickLineItems = this.tickLineItems;
|
|
4908
|
-
const tickLineCount = tickLineItems.length;
|
|
4909
|
-
if (tickLineCount >= 2) {
|
|
4910
|
-
const tickSegment = this.data[1].value - this.data[0].value;
|
|
4911
|
-
const isAlignWithLable = (_b = (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.tick) === null || _b === void 0 ? void 0 : _b.alignWithLabel;
|
|
4912
|
-
for (let i = 0; i < tickLineCount; i++) {
|
|
4913
|
-
const pre = tickLineItems[i];
|
|
4914
|
-
const next = tickLineItems[i + 1];
|
|
4915
|
-
for (let j = 0; j < subCount; j++) {
|
|
4916
|
-
const percent = (j + 1) / (subCount + 1);
|
|
4917
|
-
const value = (1 - percent) * pre.value + percent * (next ? next.value : isAlignWithLable ? 1 : pre.value + tickSegment);
|
|
4918
|
-
const point = this.getTickCoord(value);
|
|
4919
|
-
const endPoint = this.getVerticalCoord(point, length, inside);
|
|
4920
|
-
subTickLineItems.push({
|
|
4921
|
-
start: point,
|
|
4922
|
-
end: endPoint,
|
|
4923
|
-
value
|
|
4627
|
+
return attrs;
|
|
4628
|
+
}
|
|
4629
|
+
getSubTickLineItems() {
|
|
4630
|
+
var _a, _b;
|
|
4631
|
+
const { subTick } = this.attribute;
|
|
4632
|
+
const subTickLineItems = [];
|
|
4633
|
+
const { count: subCount = 4, inside = false, length = 2 } = subTick;
|
|
4634
|
+
const tickLineItems = this.tickLineItems;
|
|
4635
|
+
const tickLineCount = tickLineItems.length;
|
|
4636
|
+
if (tickLineCount >= 2) {
|
|
4637
|
+
const tickSegment = this.data[1].value - this.data[0].value;
|
|
4638
|
+
const isAlignWithLable = (_b = (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.tick) === null || _b === void 0 ? void 0 : _b.alignWithLabel;
|
|
4639
|
+
for (let i = 0; i < tickLineCount; i++) {
|
|
4640
|
+
const pre = tickLineItems[i];
|
|
4641
|
+
const next = tickLineItems[i + 1];
|
|
4642
|
+
for (let j = 0; j < subCount; j++) {
|
|
4643
|
+
const percent = (j + 1) / (subCount + 1);
|
|
4644
|
+
const value = (1 - percent) * pre.value + percent * (next ? next.value : isAlignWithLable ? 1 : pre.value + tickSegment);
|
|
4645
|
+
const point = this.getTickCoord(value);
|
|
4646
|
+
const endPoint = this.getVerticalCoord(point, length, inside);
|
|
4647
|
+
subTickLineItems.push({
|
|
4648
|
+
start: point,
|
|
4649
|
+
end: endPoint,
|
|
4650
|
+
value
|
|
4651
|
+
});
|
|
4652
|
+
}
|
|
4653
|
+
}
|
|
4654
|
+
}
|
|
4655
|
+
return subTickLineItems;
|
|
4656
|
+
}
|
|
4657
|
+
getTextBaseline(vector) {
|
|
4658
|
+
let base = 'middle';
|
|
4659
|
+
if (vutils.isNumberClose(vector[1], 0)) {
|
|
4660
|
+
base = 'middle';
|
|
4661
|
+
}
|
|
4662
|
+
else if (vector[1] > 0 && vector[1] > Math.abs(vector[0])) {
|
|
4663
|
+
base = 'top';
|
|
4664
|
+
}
|
|
4665
|
+
else if (vector[1] < 0 && Math.abs(vector[1]) > Math.abs(vector[0])) {
|
|
4666
|
+
base = 'bottom';
|
|
4667
|
+
}
|
|
4668
|
+
return base;
|
|
4669
|
+
}
|
|
4670
|
+
beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4671
|
+
return;
|
|
4672
|
+
}
|
|
4673
|
+
handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4674
|
+
return;
|
|
4675
|
+
}
|
|
4676
|
+
afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4677
|
+
return;
|
|
4678
|
+
}
|
|
4679
|
+
getLabelAlign(vector, inside, angle) {
|
|
4680
|
+
return {
|
|
4681
|
+
textAlign: this.getTextAlign(vector),
|
|
4682
|
+
textBaseline: this.getTextBaseline(vector)
|
|
4683
|
+
};
|
|
4684
|
+
}
|
|
4685
|
+
}
|
|
4686
|
+
CircleAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
4687
|
+
vutils.mixin(CircleAxis, CircleAxisMixin);
|
|
4688
|
+
|
|
4689
|
+
function getElMap(g) {
|
|
4690
|
+
const elMap = {};
|
|
4691
|
+
traverseGroup(g, (el) => {
|
|
4692
|
+
if (el.type !== 'group' && el.id) {
|
|
4693
|
+
elMap[el.id] = el;
|
|
4694
|
+
}
|
|
4695
|
+
});
|
|
4696
|
+
return elMap;
|
|
4697
|
+
}
|
|
4698
|
+
class GroupTransition extends vrender.ACustomAnimate {
|
|
4699
|
+
constructor() {
|
|
4700
|
+
super(...arguments);
|
|
4701
|
+
this.mode = vrender.AnimateMode.NORMAL;
|
|
4702
|
+
}
|
|
4703
|
+
onBind() {
|
|
4704
|
+
const currentInnerView = this.target.getInnerView();
|
|
4705
|
+
const prevInnerView = this.target.getPrevInnerView();
|
|
4706
|
+
if (!prevInnerView) {
|
|
4707
|
+
return;
|
|
4708
|
+
}
|
|
4709
|
+
this._oldElementMap = getElMap(prevInnerView);
|
|
4710
|
+
this._newElementAttrMap = {};
|
|
4711
|
+
traverseGroup(currentInnerView, (el) => {
|
|
4712
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4713
|
+
if (el.type !== 'group' && el.id) {
|
|
4714
|
+
const oldEl = this._oldElementMap[el.id];
|
|
4715
|
+
if (oldEl) {
|
|
4716
|
+
if (!vutils.isEqual(el.attribute, oldEl.attribute)) {
|
|
4717
|
+
const newProps = vutils.cloneDeep(el.attribute);
|
|
4718
|
+
this._newElementAttrMap[el.id] = {
|
|
4719
|
+
state: 'update',
|
|
4720
|
+
node: el,
|
|
4721
|
+
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 })
|
|
4722
|
+
};
|
|
4723
|
+
el.setAttributes(oldEl.attribute);
|
|
4724
|
+
}
|
|
4725
|
+
}
|
|
4726
|
+
else {
|
|
4727
|
+
const finalOpacityAttrs = {
|
|
4728
|
+
opacity: (_d = el.attribute.opacity) !== null && _d !== void 0 ? _d : 1,
|
|
4729
|
+
fillOpacity: (_e = el.attribute.fillOpacity) !== null && _e !== void 0 ? _e : 1,
|
|
4730
|
+
strokeOpacity: (_f = el.attribute.strokeOpacity) !== null && _f !== void 0 ? _f : 1
|
|
4731
|
+
};
|
|
4732
|
+
this._newElementAttrMap[el.id] = {
|
|
4733
|
+
state: 'enter',
|
|
4734
|
+
node: el,
|
|
4735
|
+
attrs: finalOpacityAttrs
|
|
4736
|
+
};
|
|
4737
|
+
el.setAttributes({
|
|
4738
|
+
opacity: 0,
|
|
4739
|
+
fillOpacity: 0,
|
|
4740
|
+
strokeOpacity: 0
|
|
4741
|
+
});
|
|
4742
|
+
}
|
|
4743
|
+
}
|
|
4744
|
+
});
|
|
4745
|
+
}
|
|
4746
|
+
onStart() {
|
|
4747
|
+
let duration = this.duration;
|
|
4748
|
+
let easing = this.easing;
|
|
4749
|
+
Object.keys(this._newElementAttrMap).forEach(id => {
|
|
4750
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4751
|
+
const { node, attrs, state } = this._newElementAttrMap[id];
|
|
4752
|
+
if (state === 'enter') {
|
|
4753
|
+
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;
|
|
4754
|
+
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;
|
|
4755
|
+
}
|
|
4756
|
+
if (node.type === 'path') {
|
|
4757
|
+
node
|
|
4758
|
+
.animate({
|
|
4759
|
+
interpolate(key, ratio, from, to, nextAttributes) {
|
|
4760
|
+
if (key === 'path') {
|
|
4761
|
+
nextAttributes.path = vutils.interpolateString(from, to)(ratio);
|
|
4762
|
+
return true;
|
|
4763
|
+
}
|
|
4764
|
+
return false;
|
|
4765
|
+
}
|
|
4766
|
+
})
|
|
4767
|
+
.to(attrs, duration, easing);
|
|
4768
|
+
}
|
|
4769
|
+
else {
|
|
4770
|
+
node
|
|
4771
|
+
.animate()
|
|
4772
|
+
.to(attrs, duration, easing);
|
|
4773
|
+
}
|
|
4774
|
+
});
|
|
4775
|
+
}
|
|
4776
|
+
onUpdate(end, ratio, out) {
|
|
4777
|
+
}
|
|
4778
|
+
}
|
|
4779
|
+
|
|
4780
|
+
class GroupFadeIn extends vrender.ACustomAnimate {
|
|
4781
|
+
constructor(from, to, duration, easing) {
|
|
4782
|
+
super(null, null, duration, easing);
|
|
4783
|
+
}
|
|
4784
|
+
getEndProps() {
|
|
4785
|
+
return {};
|
|
4786
|
+
}
|
|
4787
|
+
onBind() {
|
|
4788
|
+
this.target.setTheme({
|
|
4789
|
+
common: {
|
|
4790
|
+
opacity: 0
|
|
4791
|
+
}
|
|
4792
|
+
});
|
|
4793
|
+
return;
|
|
4794
|
+
}
|
|
4795
|
+
onEnd() {
|
|
4796
|
+
this.target.setTheme({
|
|
4797
|
+
common: {
|
|
4798
|
+
opacity: 1
|
|
4799
|
+
}
|
|
4800
|
+
});
|
|
4801
|
+
return;
|
|
4802
|
+
}
|
|
4803
|
+
onUpdate(end, ratio, out) {
|
|
4804
|
+
this.target.setTheme({
|
|
4805
|
+
common: {
|
|
4806
|
+
opacity: ratio
|
|
4807
|
+
}
|
|
4808
|
+
});
|
|
4809
|
+
}
|
|
4810
|
+
}
|
|
4811
|
+
class GroupFadeOut extends vrender.ACustomAnimate {
|
|
4812
|
+
constructor(from, to, duration, easing) {
|
|
4813
|
+
super(null, null, duration, easing);
|
|
4814
|
+
}
|
|
4815
|
+
getEndProps() {
|
|
4816
|
+
return {};
|
|
4817
|
+
}
|
|
4818
|
+
onBind() {
|
|
4819
|
+
this.target.setTheme({
|
|
4820
|
+
common: {
|
|
4821
|
+
opacity: 1
|
|
4822
|
+
}
|
|
4823
|
+
});
|
|
4824
|
+
return;
|
|
4825
|
+
}
|
|
4826
|
+
onEnd() {
|
|
4827
|
+
this.target.setTheme({
|
|
4828
|
+
common: {
|
|
4829
|
+
opacity: 0
|
|
4830
|
+
}
|
|
4831
|
+
});
|
|
4832
|
+
return;
|
|
4833
|
+
}
|
|
4834
|
+
onUpdate(end, ratio, out) {
|
|
4835
|
+
this.target.setTheme({
|
|
4836
|
+
common: {
|
|
4837
|
+
opacity: 1 - ratio
|
|
4838
|
+
}
|
|
4839
|
+
});
|
|
4840
|
+
}
|
|
4841
|
+
}
|
|
4842
|
+
|
|
4843
|
+
function getLinePath(points, closed) {
|
|
4844
|
+
let path = '';
|
|
4845
|
+
if (points.length === 0) {
|
|
4846
|
+
return path;
|
|
4847
|
+
}
|
|
4848
|
+
points.forEach((point, index) => {
|
|
4849
|
+
if (index === 0) {
|
|
4850
|
+
path = `M${point.x},${point.y}`;
|
|
4851
|
+
}
|
|
4852
|
+
else {
|
|
4853
|
+
path += `L${point.x},${point.y}`;
|
|
4854
|
+
}
|
|
4855
|
+
});
|
|
4856
|
+
if (closed) {
|
|
4857
|
+
path += 'Z';
|
|
4858
|
+
}
|
|
4859
|
+
return path;
|
|
4860
|
+
}
|
|
4861
|
+
function getArcPath(center, points, reverse, closed) {
|
|
4862
|
+
let path = '';
|
|
4863
|
+
if (!center || points.length === 0) {
|
|
4864
|
+
return path;
|
|
4865
|
+
}
|
|
4866
|
+
const firstPoint = points[0];
|
|
4867
|
+
const radius = vutils.PointService.distancePP(center, firstPoint);
|
|
4868
|
+
const sweepFlag = reverse ? 0 : 1;
|
|
4869
|
+
if (closed) {
|
|
4870
|
+
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`;
|
|
4871
|
+
}
|
|
4872
|
+
else {
|
|
4873
|
+
points.forEach((point, index) => {
|
|
4874
|
+
if (index === 0) {
|
|
4875
|
+
path = `M${point.x},${point.y}`;
|
|
4876
|
+
}
|
|
4877
|
+
else {
|
|
4878
|
+
path += `A${radius},${radius},0,0,${sweepFlag},${point.x},${point.y}`;
|
|
4879
|
+
}
|
|
4880
|
+
});
|
|
4881
|
+
}
|
|
4882
|
+
return path;
|
|
4883
|
+
}
|
|
4884
|
+
function getRegionPath(from, to, attribute) {
|
|
4885
|
+
const { type, closed } = attribute;
|
|
4886
|
+
const reversePoints = to.slice(0).reverse();
|
|
4887
|
+
let regionPath = '';
|
|
4888
|
+
let nextPath = '';
|
|
4889
|
+
if (type === 'line' && attribute.smoothLink && attribute.center) {
|
|
4890
|
+
const fromStart = from[0];
|
|
4891
|
+
const toEnd = reversePoints[0];
|
|
4892
|
+
const center = attribute.center;
|
|
4893
|
+
regionPath = getLinePath(from, !!closed);
|
|
4894
|
+
nextPath = getLinePath(reversePoints, !!closed);
|
|
4895
|
+
const toEndRadius = vutils.PointService.distancePP(toEnd, center);
|
|
4896
|
+
const fromStartRadius = vutils.PointService.distancePP(fromStart, center);
|
|
4897
|
+
regionPath += `A${toEndRadius},${toEndRadius},0,0,1,${toEnd.x},${toEnd.y}L${toEnd.x},${toEnd.y}`;
|
|
4898
|
+
nextPath += `A${fromStartRadius},${fromStartRadius},0,0,0,${fromStart.x},${fromStart.y}`;
|
|
4899
|
+
}
|
|
4900
|
+
else if (type === 'circle') {
|
|
4901
|
+
const { center } = attribute;
|
|
4902
|
+
regionPath = getArcPath(center, from, false, !!closed);
|
|
4903
|
+
nextPath = getArcPath(center, reversePoints, true, !!closed);
|
|
4904
|
+
}
|
|
4905
|
+
else if (type === 'line' || type === 'polygon') {
|
|
4906
|
+
regionPath = getLinePath(from, !!closed);
|
|
4907
|
+
nextPath = getLinePath(reversePoints, !!closed);
|
|
4908
|
+
}
|
|
4909
|
+
if (closed) {
|
|
4910
|
+
regionPath += nextPath;
|
|
4911
|
+
}
|
|
4912
|
+
else {
|
|
4913
|
+
nextPath = 'L' + nextPath.substring(1);
|
|
4914
|
+
regionPath += nextPath;
|
|
4915
|
+
regionPath += 'Z';
|
|
4916
|
+
}
|
|
4917
|
+
return regionPath;
|
|
4918
|
+
}
|
|
4919
|
+
class BaseGrid extends AbstractComponent {
|
|
4920
|
+
constructor() {
|
|
4921
|
+
super(...arguments);
|
|
4922
|
+
this.name = 'axis-grid';
|
|
4923
|
+
this.data = [];
|
|
4924
|
+
}
|
|
4925
|
+
getInnerView() {
|
|
4926
|
+
return this._innerView;
|
|
4927
|
+
}
|
|
4928
|
+
getPrevInnerView() {
|
|
4929
|
+
return this._prevInnerView;
|
|
4930
|
+
}
|
|
4931
|
+
render() {
|
|
4932
|
+
this.removeAllChild();
|
|
4933
|
+
this._prevInnerView = this._innerView;
|
|
4934
|
+
this._innerView = vrender.createGroup({ x: 0, y: 0, pickable: false });
|
|
4935
|
+
this.add(this._innerView);
|
|
4936
|
+
const { items, visible } = this.attribute;
|
|
4937
|
+
if (items && items.length && visible !== false) {
|
|
4938
|
+
this.data = this._transformItems(items);
|
|
4939
|
+
this._renderGrid(this._innerView);
|
|
4940
|
+
}
|
|
4941
|
+
}
|
|
4942
|
+
getVerticalCoord(point, offset, inside) {
|
|
4943
|
+
const vector = this.getVerticalVector(offset, inside, point);
|
|
4944
|
+
return {
|
|
4945
|
+
x: point.x + vector[0],
|
|
4946
|
+
y: point.y + vector[1]
|
|
4947
|
+
};
|
|
4948
|
+
}
|
|
4949
|
+
_transformItems(items) {
|
|
4950
|
+
const data = [];
|
|
4951
|
+
items.forEach((item) => {
|
|
4952
|
+
var _a;
|
|
4953
|
+
data.push(Object.assign(Object.assign({}, item), { point: this.getTickCoord(item.value), id: (_a = item.id) !== null && _a !== void 0 ? _a : item.label }));
|
|
4954
|
+
});
|
|
4955
|
+
return data;
|
|
4956
|
+
}
|
|
4957
|
+
_renderGrid(container) {
|
|
4958
|
+
const { visible } = this.attribute.subGrid || {};
|
|
4959
|
+
if (visible) {
|
|
4960
|
+
this._renderGridByType(true, container);
|
|
4961
|
+
}
|
|
4962
|
+
this._renderGridByType(false, container);
|
|
4963
|
+
}
|
|
4964
|
+
_renderGridByType(isSubGrid, container) {
|
|
4965
|
+
const gridAttrs = vutils.merge({}, this.attribute, this.getGridAttribute(isSubGrid));
|
|
4966
|
+
const { type, items, style, closed, alternateColor, depth = 0 } = gridAttrs;
|
|
4967
|
+
const name = isSubGrid ? `${exports.AXIS_ELEMENT_NAME.grid}-sub` : `${exports.AXIS_ELEMENT_NAME.grid}`;
|
|
4968
|
+
items.forEach((item, index) => {
|
|
4969
|
+
const { id, points } = item;
|
|
4970
|
+
let path = '';
|
|
4971
|
+
if (type === 'line' || type === 'polygon') {
|
|
4972
|
+
path = getLinePath(points, !!closed);
|
|
4973
|
+
}
|
|
4974
|
+
else if (type === 'circle') {
|
|
4975
|
+
const { center } = this.attribute;
|
|
4976
|
+
path = getArcPath(center, points, false, !!closed);
|
|
4977
|
+
}
|
|
4978
|
+
const shape = vrender.createPath(Object.assign({ path, z: depth }, (vutils.isFunction(style) ? vutils.merge({}, BaseGrid.defaultAttributes.style, style(item, index)) : style)));
|
|
4979
|
+
shape.name = `${name}-line`;
|
|
4980
|
+
shape.id = this._getNodeId(`${name}-path-${id}`);
|
|
4981
|
+
container.add(shape);
|
|
4982
|
+
});
|
|
4983
|
+
if (depth && type === 'line') {
|
|
4984
|
+
items.forEach((item, index) => {
|
|
4985
|
+
const { id, points } = item;
|
|
4986
|
+
const nextPoints = [];
|
|
4987
|
+
nextPoints.push(points[0]);
|
|
4988
|
+
const dir = { x: points[1].x - points[0].x, y: points[1].y - points[0].y };
|
|
4989
|
+
const dirLen = Math.sqrt(dir.x * dir.x + dir.y * dir.y);
|
|
4990
|
+
const ratio = depth / dirLen;
|
|
4991
|
+
nextPoints.push({ x: points[0].x + dir.x * ratio, y: points[0].y + dir.y * ratio });
|
|
4992
|
+
const path = getLinePath(nextPoints, !!closed);
|
|
4993
|
+
const deltaX = vutils.abs(nextPoints[0].x - nextPoints[1].x);
|
|
4994
|
+
const deltaY = vutils.abs(nextPoints[0].y - nextPoints[1].y);
|
|
4995
|
+
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)));
|
|
4996
|
+
shape.name = `${name}-line`;
|
|
4997
|
+
shape.id = this._getNodeId(`${name}-path-${id}`);
|
|
4998
|
+
container.add(shape);
|
|
4999
|
+
});
|
|
5000
|
+
}
|
|
5001
|
+
if (items.length > 1 && alternateColor) {
|
|
5002
|
+
const colors = vutils.isArray(alternateColor)
|
|
5003
|
+
? alternateColor
|
|
5004
|
+
: [alternateColor, 'transparent'];
|
|
5005
|
+
const getColor = (index) => colors[index % colors.length];
|
|
5006
|
+
for (let index = 0; index < items.length - 1; index++) {
|
|
5007
|
+
const [prev, curr] = [items[index].points, items[index + 1].points];
|
|
5008
|
+
const path = getRegionPath(prev, curr, gridAttrs);
|
|
5009
|
+
const shape = vrender.createPath({
|
|
5010
|
+
path,
|
|
5011
|
+
fill: getColor(index)
|
|
5012
|
+
});
|
|
5013
|
+
shape.name = `${name}-region`;
|
|
5014
|
+
shape.id = this._getNodeId(`${name}-region-${index}`);
|
|
5015
|
+
container.add(shape);
|
|
5016
|
+
}
|
|
5017
|
+
}
|
|
5018
|
+
}
|
|
5019
|
+
_getNodeId(id) {
|
|
5020
|
+
return `${this.id}-${id}`;
|
|
5021
|
+
}
|
|
5022
|
+
}
|
|
5023
|
+
BaseGrid.defaultAttributes = {
|
|
5024
|
+
style: {
|
|
5025
|
+
lineWidth: 1,
|
|
5026
|
+
stroke: '#999',
|
|
5027
|
+
strokeOpacity: 1,
|
|
5028
|
+
lineDash: [4, 4]
|
|
5029
|
+
},
|
|
5030
|
+
subGrid: {
|
|
5031
|
+
visible: false,
|
|
5032
|
+
style: {
|
|
5033
|
+
lineWidth: 1,
|
|
5034
|
+
stroke: '#999',
|
|
5035
|
+
strokeOpacity: 1,
|
|
5036
|
+
lineDash: [4, 4]
|
|
5037
|
+
}
|
|
5038
|
+
}
|
|
5039
|
+
};
|
|
5040
|
+
|
|
5041
|
+
function getCirclePoints(center, count, radius, startAngle, endAngle) {
|
|
5042
|
+
const points = [];
|
|
5043
|
+
const range = endAngle - startAngle;
|
|
5044
|
+
for (let i = 0; i < count; i++) {
|
|
5045
|
+
const angle = startAngle + (i * range) / count;
|
|
5046
|
+
points.push(vutils.polarToCartesian(center, radius, angle));
|
|
5047
|
+
}
|
|
5048
|
+
return points;
|
|
5049
|
+
}
|
|
5050
|
+
class LineAxisGrid extends BaseGrid {
|
|
5051
|
+
constructor(attributes, mode) {
|
|
5052
|
+
super(vutils.merge({}, BaseGrid.defaultAttributes, attributes), mode);
|
|
5053
|
+
if (mode === '3d') {
|
|
5054
|
+
this.setMode(mode);
|
|
5055
|
+
}
|
|
5056
|
+
}
|
|
5057
|
+
_getGridPoint(gridType, point) {
|
|
5058
|
+
let gridPoints;
|
|
5059
|
+
if (gridType === 'line') {
|
|
5060
|
+
const { length } = this.attribute;
|
|
5061
|
+
const endPoint = this.getVerticalCoord(point, length, true);
|
|
5062
|
+
gridPoints = [point, endPoint];
|
|
5063
|
+
}
|
|
5064
|
+
else if (gridType === 'circle' || gridType === 'polygon') {
|
|
5065
|
+
const { center, sides = 6, startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE } = this.attribute;
|
|
5066
|
+
const distance = vutils.PointService.distancePP(center, point);
|
|
5067
|
+
gridPoints = getCirclePoints(center, sides, distance, startAngle, endAngle);
|
|
5068
|
+
}
|
|
5069
|
+
return gridPoints;
|
|
5070
|
+
}
|
|
5071
|
+
getGridAttribute(isSubGrid) {
|
|
5072
|
+
const { type: gridType, alignWithLabel = true } = this.attribute;
|
|
5073
|
+
let tickSegment = 1;
|
|
5074
|
+
const count = this.data.length;
|
|
5075
|
+
if (count >= 2) {
|
|
5076
|
+
tickSegment = this.data[1].value - this.data[0].value;
|
|
5077
|
+
}
|
|
5078
|
+
let gridAttribute;
|
|
5079
|
+
let items = [];
|
|
5080
|
+
if (!isSubGrid) {
|
|
5081
|
+
gridAttribute = this.attribute;
|
|
5082
|
+
const gridItems = [];
|
|
5083
|
+
this.data.forEach(item => {
|
|
5084
|
+
let { point } = item;
|
|
5085
|
+
if (!alignWithLabel) {
|
|
5086
|
+
const value = item.value - tickSegment / 2;
|
|
5087
|
+
if (this.isInValidValue(value)) {
|
|
5088
|
+
return;
|
|
5089
|
+
}
|
|
5090
|
+
point = this.getTickCoord(value);
|
|
5091
|
+
}
|
|
5092
|
+
gridItems.push({
|
|
5093
|
+
id: item.label,
|
|
5094
|
+
datum: item,
|
|
5095
|
+
points: this._getGridPoint(gridType, point)
|
|
5096
|
+
});
|
|
5097
|
+
});
|
|
5098
|
+
items = gridItems;
|
|
5099
|
+
}
|
|
5100
|
+
else {
|
|
5101
|
+
gridAttribute = vutils.merge({}, this.attribute, this.attribute.subGrid);
|
|
5102
|
+
const subGridItems = [];
|
|
5103
|
+
const { count: subCount = 4 } = this.attribute.subGrid || {};
|
|
5104
|
+
const tickLineCount = this.data.length;
|
|
5105
|
+
if (tickLineCount >= 2) {
|
|
5106
|
+
const points = [];
|
|
5107
|
+
this.data.forEach((item) => {
|
|
5108
|
+
let tickValue = item.value;
|
|
5109
|
+
if (!alignWithLabel) {
|
|
5110
|
+
const value = item.value - tickSegment / 2;
|
|
5111
|
+
if (this.isInValidValue(value)) {
|
|
5112
|
+
return;
|
|
5113
|
+
}
|
|
5114
|
+
tickValue = value;
|
|
5115
|
+
}
|
|
5116
|
+
points.push({
|
|
5117
|
+
value: tickValue
|
|
5118
|
+
});
|
|
5119
|
+
});
|
|
5120
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
5121
|
+
const pre = points[i];
|
|
5122
|
+
const next = points[i + 1];
|
|
5123
|
+
subGridItems.push({
|
|
5124
|
+
id: `sub-${i}-0`,
|
|
5125
|
+
points: this._getGridPoint(gridType, this.getTickCoord(pre.value)),
|
|
5126
|
+
datum: {}
|
|
4924
5127
|
});
|
|
5128
|
+
for (let j = 0; j < subCount; j++) {
|
|
5129
|
+
const percent = (j + 1) / (subCount + 1);
|
|
5130
|
+
const value = (1 - percent) * pre.value + percent * next.value;
|
|
5131
|
+
const point = this.getTickCoord(value);
|
|
5132
|
+
subGridItems.push({
|
|
5133
|
+
id: `sub-${i}-${j + 1}`,
|
|
5134
|
+
points: this._getGridPoint(gridType, point),
|
|
5135
|
+
datum: {}
|
|
5136
|
+
});
|
|
5137
|
+
}
|
|
5138
|
+
if (i === points.length - 2) {
|
|
5139
|
+
subGridItems.push({
|
|
5140
|
+
id: `sub-${i}-${subCount + 1}`,
|
|
5141
|
+
points: this._getGridPoint(gridType, this.getTickCoord(next.value)),
|
|
5142
|
+
datum: {}
|
|
5143
|
+
});
|
|
5144
|
+
}
|
|
4925
5145
|
}
|
|
5146
|
+
items = subGridItems;
|
|
4926
5147
|
}
|
|
4927
5148
|
}
|
|
4928
|
-
return
|
|
5149
|
+
return Object.assign(Object.assign({}, gridAttribute), { items });
|
|
5150
|
+
}
|
|
5151
|
+
}
|
|
5152
|
+
vutils.mixin(LineAxisGrid, LineAxisMixin);
|
|
5153
|
+
|
|
5154
|
+
class CircleAxisGrid extends BaseGrid {
|
|
5155
|
+
constructor(attributes) {
|
|
5156
|
+
super(vutils.merge({}, BaseGrid.defaultAttributes, attributes));
|
|
4929
5157
|
}
|
|
4930
|
-
getGridAttribute(
|
|
5158
|
+
getGridAttribute(isSubGrid) {
|
|
4931
5159
|
let gridAttribute;
|
|
4932
5160
|
let items = [];
|
|
4933
|
-
const { radius, innerRadius = 0, startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, center,
|
|
5161
|
+
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"]);
|
|
4934
5162
|
const { alignWithLabel = true } = grid || {};
|
|
4935
5163
|
const length = radius - innerRadius;
|
|
4936
5164
|
let tickSegment = 1;
|
|
@@ -4938,8 +5166,8 @@
|
|
|
4938
5166
|
if (count >= 2) {
|
|
4939
5167
|
tickSegment = this.data[1].value - this.data[0].value;
|
|
4940
5168
|
}
|
|
4941
|
-
if (
|
|
4942
|
-
gridAttribute =
|
|
5169
|
+
if (!isSubGrid) {
|
|
5170
|
+
gridAttribute = grid;
|
|
4943
5171
|
const gridItems = [];
|
|
4944
5172
|
let data;
|
|
4945
5173
|
if (Math.abs(endAngle - startAngle) % (Math.PI * 2) === 0) {
|
|
@@ -4967,9 +5195,9 @@
|
|
|
4967
5195
|
items = gridItems;
|
|
4968
5196
|
}
|
|
4969
5197
|
else {
|
|
4970
|
-
gridAttribute = vutils.merge({},
|
|
5198
|
+
gridAttribute = vutils.merge({}, grid, subGrid);
|
|
4971
5199
|
const subGridItems = [];
|
|
4972
|
-
const { count: subCount = 4 } =
|
|
5200
|
+
const { count: subCount = 4 } = subGrid || {};
|
|
4973
5201
|
const tickLineCount = this.data.length;
|
|
4974
5202
|
if (tickLineCount >= 2) {
|
|
4975
5203
|
const points = [];
|
|
@@ -5013,192 +5241,10 @@
|
|
|
5013
5241
|
}
|
|
5014
5242
|
}
|
|
5015
5243
|
return Object.assign(Object.assign({}, gridAttribute), { items,
|
|
5016
|
-
center });
|
|
5017
|
-
}
|
|
5018
|
-
getTextBaseline(vector) {
|
|
5019
|
-
let base = 'middle';
|
|
5020
|
-
if (vutils.isNumberClose(vector[1], 0)) {
|
|
5021
|
-
base = 'middle';
|
|
5022
|
-
}
|
|
5023
|
-
else if (vector[1] > 0 && vector[1] > Math.abs(vector[0])) {
|
|
5024
|
-
base = 'top';
|
|
5025
|
-
}
|
|
5026
|
-
else if (vector[1] < 0 && Math.abs(vector[1]) > Math.abs(vector[0])) {
|
|
5027
|
-
base = 'bottom';
|
|
5028
|
-
}
|
|
5029
|
-
return base;
|
|
5030
|
-
}
|
|
5031
|
-
beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
5032
|
-
return;
|
|
5033
|
-
}
|
|
5034
|
-
handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
5035
|
-
return;
|
|
5036
|
-
}
|
|
5037
|
-
afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
5038
|
-
return;
|
|
5039
|
-
}
|
|
5040
|
-
getLabelAlign(vector, inside, angle) {
|
|
5041
|
-
return {
|
|
5042
|
-
textAlign: this.getTextAlign(vector),
|
|
5043
|
-
textBaseline: this.getTextBaseline(vector)
|
|
5044
|
-
};
|
|
5045
|
-
}
|
|
5046
|
-
}
|
|
5047
|
-
CircleAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
5048
|
-
|
|
5049
|
-
function getElMap(g) {
|
|
5050
|
-
const elMap = {};
|
|
5051
|
-
traverseGroup(g, (el) => {
|
|
5052
|
-
if (el.type !== 'group' && el.id) {
|
|
5053
|
-
elMap[el.id] = el;
|
|
5054
|
-
}
|
|
5055
|
-
});
|
|
5056
|
-
return elMap;
|
|
5057
|
-
}
|
|
5058
|
-
class GroupTransition extends vrender.ACustomAnimate {
|
|
5059
|
-
constructor() {
|
|
5060
|
-
super(...arguments);
|
|
5061
|
-
this.mode = vrender.AnimateMode.NORMAL;
|
|
5062
|
-
}
|
|
5063
|
-
onBind() {
|
|
5064
|
-
const currentInnerView = this.target.getInnerView();
|
|
5065
|
-
const prevInnerView = this.target.getPrevInnerView();
|
|
5066
|
-
if (!prevInnerView) {
|
|
5067
|
-
return;
|
|
5068
|
-
}
|
|
5069
|
-
this._oldElementMap = getElMap(prevInnerView);
|
|
5070
|
-
this._newElementAttrMap = {};
|
|
5071
|
-
traverseGroup(currentInnerView, (el) => {
|
|
5072
|
-
var _a, _b, _c, _d, _e, _f;
|
|
5073
|
-
if (el.type !== 'group' && el.id) {
|
|
5074
|
-
const oldEl = this._oldElementMap[el.id];
|
|
5075
|
-
if (oldEl) {
|
|
5076
|
-
if (!vutils.isEqual(el.attribute, oldEl.attribute)) {
|
|
5077
|
-
const newProps = vutils.cloneDeep(el.attribute);
|
|
5078
|
-
this._newElementAttrMap[el.id] = {
|
|
5079
|
-
state: 'update',
|
|
5080
|
-
node: el,
|
|
5081
|
-
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 })
|
|
5082
|
-
};
|
|
5083
|
-
el.setAttributes(oldEl.attribute);
|
|
5084
|
-
}
|
|
5085
|
-
}
|
|
5086
|
-
else {
|
|
5087
|
-
const finalOpacityAttrs = {
|
|
5088
|
-
opacity: (_d = el.attribute.opacity) !== null && _d !== void 0 ? _d : 1,
|
|
5089
|
-
fillOpacity: (_e = el.attribute.fillOpacity) !== null && _e !== void 0 ? _e : 1,
|
|
5090
|
-
strokeOpacity: (_f = el.attribute.strokeOpacity) !== null && _f !== void 0 ? _f : 1
|
|
5091
|
-
};
|
|
5092
|
-
this._newElementAttrMap[el.id] = {
|
|
5093
|
-
state: 'enter',
|
|
5094
|
-
node: el,
|
|
5095
|
-
attrs: finalOpacityAttrs
|
|
5096
|
-
};
|
|
5097
|
-
el.setAttributes({
|
|
5098
|
-
opacity: 0,
|
|
5099
|
-
fillOpacity: 0,
|
|
5100
|
-
strokeOpacity: 0
|
|
5101
|
-
});
|
|
5102
|
-
}
|
|
5103
|
-
}
|
|
5104
|
-
});
|
|
5105
|
-
}
|
|
5106
|
-
onStart() {
|
|
5107
|
-
let duration = this.duration;
|
|
5108
|
-
let easing = this.easing;
|
|
5109
|
-
Object.keys(this._newElementAttrMap).forEach(id => {
|
|
5110
|
-
var _a, _b, _c;
|
|
5111
|
-
const { node, attrs, state } = this._newElementAttrMap[id];
|
|
5112
|
-
if (state === 'enter') {
|
|
5113
|
-
duration = vutils.isValidNumber((_a = this.params.enter) === null || _a === void 0 ? void 0 : _a.duration) ? this.params.enter.duration : duration;
|
|
5114
|
-
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;
|
|
5115
|
-
}
|
|
5116
|
-
if (node.type === 'path') {
|
|
5117
|
-
node
|
|
5118
|
-
.animate({
|
|
5119
|
-
interpolate(key, ratio, from, to, nextAttributes) {
|
|
5120
|
-
if (key === 'path') {
|
|
5121
|
-
nextAttributes.path = vutils.interpolateString(from, to)(ratio);
|
|
5122
|
-
return true;
|
|
5123
|
-
}
|
|
5124
|
-
return false;
|
|
5125
|
-
}
|
|
5126
|
-
})
|
|
5127
|
-
.to(attrs, duration, easing);
|
|
5128
|
-
}
|
|
5129
|
-
else {
|
|
5130
|
-
node
|
|
5131
|
-
.animate()
|
|
5132
|
-
.to(attrs, duration, easing);
|
|
5133
|
-
}
|
|
5134
|
-
});
|
|
5135
|
-
}
|
|
5136
|
-
onUpdate(end, ratio, out) {
|
|
5137
|
-
}
|
|
5138
|
-
}
|
|
5139
|
-
|
|
5140
|
-
class GroupFadeIn extends vrender.ACustomAnimate {
|
|
5141
|
-
constructor(from, to, duration, easing) {
|
|
5142
|
-
super(null, null, duration, easing);
|
|
5143
|
-
}
|
|
5144
|
-
getEndProps() {
|
|
5145
|
-
return {};
|
|
5146
|
-
}
|
|
5147
|
-
onBind() {
|
|
5148
|
-
this.target.setTheme({
|
|
5149
|
-
common: {
|
|
5150
|
-
opacity: 0
|
|
5151
|
-
}
|
|
5152
|
-
});
|
|
5153
|
-
return;
|
|
5154
|
-
}
|
|
5155
|
-
onEnd() {
|
|
5156
|
-
this.target.setTheme({
|
|
5157
|
-
common: {
|
|
5158
|
-
opacity: 1
|
|
5159
|
-
}
|
|
5160
|
-
});
|
|
5161
|
-
return;
|
|
5162
|
-
}
|
|
5163
|
-
onUpdate(end, ratio, out) {
|
|
5164
|
-
this.target.setTheme({
|
|
5165
|
-
common: {
|
|
5166
|
-
opacity: ratio
|
|
5167
|
-
}
|
|
5168
|
-
});
|
|
5169
|
-
}
|
|
5170
|
-
}
|
|
5171
|
-
class GroupFadeOut extends vrender.ACustomAnimate {
|
|
5172
|
-
constructor(from, to, duration, easing) {
|
|
5173
|
-
super(null, null, duration, easing);
|
|
5174
|
-
}
|
|
5175
|
-
getEndProps() {
|
|
5176
|
-
return {};
|
|
5177
|
-
}
|
|
5178
|
-
onBind() {
|
|
5179
|
-
this.target.setTheme({
|
|
5180
|
-
common: {
|
|
5181
|
-
opacity: 1
|
|
5182
|
-
}
|
|
5183
|
-
});
|
|
5184
|
-
return;
|
|
5185
|
-
}
|
|
5186
|
-
onEnd() {
|
|
5187
|
-
this.target.setTheme({
|
|
5188
|
-
common: {
|
|
5189
|
-
opacity: 0
|
|
5190
|
-
}
|
|
5191
|
-
});
|
|
5192
|
-
return;
|
|
5193
|
-
}
|
|
5194
|
-
onUpdate(end, ratio, out) {
|
|
5195
|
-
this.target.setTheme({
|
|
5196
|
-
common: {
|
|
5197
|
-
opacity: 1 - ratio
|
|
5198
|
-
}
|
|
5199
|
-
});
|
|
5244
|
+
center, type: 'line' });
|
|
5200
5245
|
}
|
|
5201
5246
|
}
|
|
5247
|
+
vutils.mixin(CircleAxisGrid, CircleAxisMixin);
|
|
5202
5248
|
|
|
5203
5249
|
var DataZoomActiveTag;
|
|
5204
5250
|
(function (DataZoomActiveTag) {
|
|
@@ -10275,7 +10321,11 @@
|
|
|
10275
10321
|
}
|
|
10276
10322
|
Tooltip.defaultAttributes = defaultAttributes;
|
|
10277
10323
|
|
|
10278
|
-
|
|
10324
|
+
function VTag(params) {
|
|
10325
|
+
return new Tag(params ? params.attribute : {});
|
|
10326
|
+
}
|
|
10327
|
+
|
|
10328
|
+
const version = "0.15.0-alpha.11";
|
|
10279
10329
|
|
|
10280
10330
|
exports.AbstractComponent = AbstractComponent;
|
|
10281
10331
|
exports.ArcInfo = ArcInfo;
|
|
@@ -10283,6 +10333,7 @@
|
|
|
10283
10333
|
exports.BasePlayer = BasePlayer;
|
|
10284
10334
|
exports.Brush = Brush;
|
|
10285
10335
|
exports.CircleAxis = CircleAxis;
|
|
10336
|
+
exports.CircleAxisGrid = CircleAxisGrid;
|
|
10286
10337
|
exports.CircleCrosshair = CircleCrosshair;
|
|
10287
10338
|
exports.ColorContinuousLegend = ColorContinuousLegend;
|
|
10288
10339
|
exports.ContinuousPlayer = ContinuousPlayer;
|
|
@@ -10299,13 +10350,13 @@
|
|
|
10299
10350
|
exports.DataZoom = DataZoom;
|
|
10300
10351
|
exports.DiscreteLegend = DiscreteLegend;
|
|
10301
10352
|
exports.DiscretePlayer = DiscretePlayer;
|
|
10302
|
-
exports.Grid = Grid;
|
|
10303
10353
|
exports.GroupFadeIn = GroupFadeIn;
|
|
10304
10354
|
exports.GroupFadeOut = GroupFadeOut;
|
|
10305
10355
|
exports.GroupTransition = GroupTransition;
|
|
10306
10356
|
exports.Indicator = Indicator;
|
|
10307
10357
|
exports.LabelBase = LabelBase;
|
|
10308
10358
|
exports.LineAxis = LineAxis;
|
|
10359
|
+
exports.LineAxisGrid = LineAxisGrid;
|
|
10309
10360
|
exports.LineCrosshair = LineCrosshair;
|
|
10310
10361
|
exports.LineLabel = LineLabel;
|
|
10311
10362
|
exports.LinkPath = LinkPath;
|
|
@@ -10326,6 +10377,7 @@
|
|
|
10326
10377
|
exports.Tag = Tag;
|
|
10327
10378
|
exports.Title = Title;
|
|
10328
10379
|
exports.Tooltip = Tooltip;
|
|
10380
|
+
exports.VTag = VTag;
|
|
10329
10381
|
exports.getHorizontalPath = getHorizontalPath;
|
|
10330
10382
|
exports.getSizeHandlerPath = getSizeHandlerPath;
|
|
10331
10383
|
exports.getVerticalPath = getVerticalPath;
|