@visactor/vrender-components 0.15.0-alpha.15 → 0.15.0-alpha.16

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.
Files changed (143) hide show
  1. package/cjs/axis/animate/group-transition.d.ts +1 -2
  2. package/cjs/axis/animate/group-transition.js +3 -3
  3. package/cjs/axis/animate/group-transition.js.map +1 -1
  4. package/cjs/axis/base.d.ts +8 -5
  5. package/cjs/axis/base.js +32 -16
  6. package/cjs/axis/base.js.map +1 -1
  7. package/cjs/axis/circle.d.ts +23 -3
  8. package/cjs/axis/circle.js +84 -3
  9. package/cjs/axis/circle.js.map +1 -1
  10. package/cjs/axis/config.d.ts +17 -0
  11. package/cjs/axis/config.js +17 -0
  12. package/cjs/axis/config.js.map +1 -1
  13. package/cjs/axis/grid.d.ts +9 -0
  14. package/cjs/axis/{grid/base.js → grid.js} +20 -67
  15. package/cjs/axis/grid.js.map +1 -0
  16. package/cjs/axis/index.d.ts +1 -0
  17. package/cjs/axis/index.js +3 -3
  18. package/cjs/axis/index.js.map +1 -1
  19. package/cjs/axis/line.d.ts +24 -3
  20. package/cjs/axis/line.js +117 -16
  21. package/cjs/axis/line.js.map +1 -1
  22. package/cjs/axis/type.d.ts +55 -0
  23. package/cjs/axis/type.js.map +1 -1
  24. package/cjs/core/type.js +1 -2
  25. package/cjs/crosshair/base.js +2 -1
  26. package/cjs/index.d.ts +1 -3
  27. package/cjs/index.js +8 -9
  28. package/cjs/index.js.map +1 -1
  29. package/cjs/indicator/type.js +1 -2
  30. package/cjs/label/arc.d.ts +2 -1
  31. package/cjs/label/arc.js +34 -11
  32. package/cjs/label/arc.js.map +1 -1
  33. package/cjs/label/type.d.ts +3 -2
  34. package/cjs/label/type.js.map +1 -1
  35. package/cjs/link-path/index.js +2 -1
  36. package/cjs/link-path/link-path.js +1 -2
  37. package/cjs/marker/point.js +1 -1
  38. package/cjs/poptip/register.d.ts +1 -1
  39. package/cjs/poptip/register.js +6 -8
  40. package/cjs/poptip/register.js.map +1 -1
  41. package/cjs/util/matrix.d.ts +1 -1
  42. package/cjs/util/matrix.js.map +1 -1
  43. package/cjs/util/text.js +3 -3
  44. package/cjs/util/text.js.map +1 -1
  45. package/dist/index.js +623 -646
  46. package/dist/index.min.js +1 -1
  47. package/es/axis/animate/group-transition.d.ts +1 -2
  48. package/es/axis/animate/group-transition.js +3 -3
  49. package/es/axis/animate/group-transition.js.map +1 -1
  50. package/es/axis/base.d.ts +8 -5
  51. package/es/axis/base.js +33 -15
  52. package/es/axis/base.js.map +1 -1
  53. package/es/axis/circle.d.ts +23 -3
  54. package/es/axis/circle.js +85 -4
  55. package/es/axis/circle.js.map +1 -1
  56. package/es/axis/config.d.ts +17 -0
  57. package/es/axis/config.js +17 -0
  58. package/es/axis/config.js.map +1 -1
  59. package/es/axis/grid.d.ts +9 -0
  60. package/es/axis/{grid/base.js → grid.js} +21 -69
  61. package/es/axis/grid.js.map +1 -0
  62. package/es/axis/index.d.ts +1 -0
  63. package/es/axis/index.js +2 -0
  64. package/es/axis/index.js.map +1 -1
  65. package/es/axis/line.d.ts +24 -3
  66. package/es/axis/line.js +109 -8
  67. package/es/axis/line.js.map +1 -1
  68. package/es/axis/type.d.ts +55 -0
  69. package/es/axis/type.js.map +1 -1
  70. package/es/core/type.js +1 -2
  71. package/es/crosshair/base.js +2 -1
  72. package/es/index.d.ts +1 -3
  73. package/es/index.js +1 -5
  74. package/es/index.js.map +1 -1
  75. package/es/indicator/type.js +1 -2
  76. package/es/label/arc.d.ts +2 -1
  77. package/es/label/arc.js +34 -11
  78. package/es/label/arc.js.map +1 -1
  79. package/es/label/type.d.ts +3 -2
  80. package/es/label/type.js.map +1 -1
  81. package/es/link-path/index.js +2 -1
  82. package/es/link-path/link-path.js +1 -2
  83. package/es/marker/point.js +1 -1
  84. package/es/poptip/register.d.ts +1 -1
  85. package/es/poptip/register.js +6 -7
  86. package/es/poptip/register.js.map +1 -1
  87. package/es/util/matrix.d.ts +1 -1
  88. package/es/util/matrix.js.map +1 -1
  89. package/es/util/text.js +3 -3
  90. package/es/util/text.js.map +1 -1
  91. package/package.json +2 -2
  92. package/cjs/axis/grid/base.d.ts +0 -24
  93. package/cjs/axis/grid/base.js.map +0 -1
  94. package/cjs/axis/grid/circle.d.ts +0 -9
  95. package/cjs/axis/grid/circle.js +0 -92
  96. package/cjs/axis/grid/circle.js.map +0 -1
  97. package/cjs/axis/grid/index.d.ts +0 -3
  98. package/cjs/axis/grid/index.js +0 -22
  99. package/cjs/axis/grid/index.js.map +0 -1
  100. package/cjs/axis/grid/line.d.ts +0 -10
  101. package/cjs/axis/grid/line.js +0 -103
  102. package/cjs/axis/grid/line.js.map +0 -1
  103. package/cjs/axis/grid/type.d.ts +0 -63
  104. package/cjs/axis/grid/type.js +0 -6
  105. package/cjs/axis/grid/type.js.map +0 -1
  106. package/cjs/axis/mixin/circle.d.ts +0 -17
  107. package/cjs/axis/mixin/circle.js +0 -30
  108. package/cjs/axis/mixin/circle.js.map +0 -1
  109. package/cjs/axis/mixin/line.d.ts +0 -14
  110. package/cjs/axis/mixin/line.js +0 -32
  111. package/cjs/axis/mixin/line.js.map +0 -1
  112. package/cjs/jsx/component-type.d.ts +0 -4
  113. package/cjs/jsx/component-type.js +0 -13
  114. package/cjs/jsx/component-type.js.map +0 -1
  115. package/cjs/jsx/index.d.ts +0 -1
  116. package/cjs/jsx/index.js +0 -21
  117. package/cjs/jsx/index.js.map +0 -1
  118. package/es/axis/grid/base.d.ts +0 -24
  119. package/es/axis/grid/base.js.map +0 -1
  120. package/es/axis/grid/circle.d.ts +0 -9
  121. package/es/axis/grid/circle.js +0 -92
  122. package/es/axis/grid/circle.js.map +0 -1
  123. package/es/axis/grid/index.d.ts +0 -3
  124. package/es/axis/grid/index.js +0 -6
  125. package/es/axis/grid/index.js.map +0 -1
  126. package/es/axis/grid/line.d.ts +0 -10
  127. package/es/axis/grid/line.js +0 -102
  128. package/es/axis/grid/line.js.map +0 -1
  129. package/es/axis/grid/type.d.ts +0 -63
  130. package/es/axis/grid/type.js +0 -2
  131. package/es/axis/grid/type.js.map +0 -1
  132. package/es/axis/mixin/circle.d.ts +0 -17
  133. package/es/axis/mixin/circle.js +0 -25
  134. package/es/axis/mixin/circle.js.map +0 -1
  135. package/es/axis/mixin/line.d.ts +0 -14
  136. package/es/axis/mixin/line.js +0 -23
  137. package/es/axis/mixin/line.js.map +0 -1
  138. package/es/jsx/component-type.d.ts +0 -4
  139. package/es/jsx/component-type.js +0 -5
  140. package/es/jsx/component-type.js.map +0 -1
  141. package/es/jsx/index.d.ts +0 -1
  142. package/es/jsx/index.js +0 -2
  143. package/es/jsx/index.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, _b;
579
579
  if (!text) {
580
580
  return { width: 0, height: 0 };
581
581
  }
582
582
  const bounds = vrender.getTextBounds({
583
583
  text,
584
- fontFamily: textSpec.fontFamily,
584
+ fontFamily: (_a = textSpec.fontFamily) !== null && _a !== void 0 ? _a : '',
585
585
  fontSize: textSpec.fontSize || 12,
586
586
  fontWeight: textSpec.fontWeight,
587
- textAlign: (_a = textSpec.textAlign) !== null && _a !== void 0 ? _a : 'center',
587
+ textAlign: (_b = textSpec.textAlign) !== null && _b !== void 0 ? _b : 'center',
588
588
  textBaseline: textSpec.textBaseline,
589
589
  ellipsis: !!textSpec.ellipsis,
590
590
  maxLineWidth: textSpec.maxLineWidth || Infinity,
@@ -1103,21 +1103,16 @@
1103
1103
  injectable()
1104
1104
  ], PopTipForClipedTextPlugin);
1105
1105
 
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
- }
1106
+ const popTipModule = new ContainerModule(bind => {
1107
+ bind(PopTipRenderContribution).toSelf().inSingletonScope();
1108
+ bind(vrender.InteractiveSubRenderContribution).toService(PopTipRenderContribution);
1109
+ bind(PopTipPlugin).toSelf().inSingletonScope();
1110
+ bind(vrender.AutoEnablePlugins).toService(PopTipPlugin);
1111
+ bind(PopTipForClipedTextPlugin).toSelf().inSingletonScope();
1112
+ bind(vrender.AutoEnablePlugins).toService(PopTipForClipedTextPlugin);
1119
1113
  });
1120
- function loadPoptip() {
1114
+ function loadPoptip(defaultPoptipTheme) {
1115
+ vutils.merge(theme.poptip, defaultPoptipTheme);
1121
1116
  vrender.container.load(popTipModule);
1122
1117
  }
1123
1118
  function setPoptipTheme(defaultPoptipTheme) {
@@ -2471,7 +2466,8 @@
2471
2466
  maxLineWidth: basedArc.labelLimit,
2472
2467
  points: (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointA) && (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointB) && (basedArc === null || basedArc === void 0 ? void 0 : basedArc.pointC)
2473
2468
  ? [basedArc.pointA, basedArc.pointB, basedArc.pointC]
2474
- : undefined
2469
+ : undefined,
2470
+ line: basedArc === null || basedArc === void 0 ? void 0 : basedArc.labelLine
2475
2471
  };
2476
2472
  labels[i].setAttributes(labelAttribute);
2477
2473
  }
@@ -2633,6 +2629,7 @@
2633
2629
  arc.labelVisible = false;
2634
2630
  }
2635
2631
  arc.angle = (_b = (_a = attribute === null || attribute === void 0 ? void 0 : attribute.textStyle) === null || _a === void 0 ? void 0 : _a.angle) !== null && _b !== void 0 ? _b : 0;
2632
+ arc.labelLine = Object.assign({}, attribute === null || attribute === void 0 ? void 0 : attribute.line);
2636
2633
  });
2637
2634
  return arcs;
2638
2635
  }
@@ -2641,7 +2638,13 @@
2641
2638
  const center = { x: (_b = (_a = currentMarks[0].attribute) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0, y: (_d = (_c = currentMarks[0].attribute) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0 };
2642
2639
  const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
2643
2640
  const plotLayout = { width: center.x * 2, height: center.y * 2 };
2644
- const radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
2641
+ let maxRadius = 0;
2642
+ currentMarks.forEach((currentMark) => {
2643
+ if (currentMark.attribute.outerRadius > maxRadius) {
2644
+ maxRadius = currentMark.attribute.outerRadius;
2645
+ }
2646
+ });
2647
+ const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
2645
2648
  const line1MinLength = attribute.line.line1MinLength;
2646
2649
  const line2MinLength = attribute.line.line2MinLength;
2647
2650
  const labelLayoutAlign = (_f = attribute.layout) === null || _f === void 0 ? void 0 : _f.align;
@@ -2872,7 +2875,13 @@
2872
2875
  _computePointB(arc, r, attribute, currentMarks) {
2873
2876
  var _a, _b, _c, _d, _e;
2874
2877
  const labelConfig = attribute;
2875
- const radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
2878
+ let maxRadius = 0;
2879
+ currentMarks.forEach((currentMark) => {
2880
+ if (currentMark.attribute.outerRadius > maxRadius) {
2881
+ maxRadius = currentMark.attribute.outerRadius;
2882
+ }
2883
+ });
2884
+ const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
2876
2885
  const line1MinLength = labelConfig.line.line1MinLength;
2877
2886
  const labelLayout = labelConfig.layout;
2878
2887
  if (labelLayout.strategy === 'none') {
@@ -2911,7 +2920,13 @@
2911
2920
  var _a, _b, _c, _d, _e;
2912
2921
  const center = { x: (_b = (_a = currentMarks[0].attribute) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0, y: (_d = (_c = currentMarks[0].attribute) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0 };
2913
2922
  const plotRect = { width: center.x * 2, height: center.y * 2 };
2914
- const radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
2923
+ let maxRadius = 0;
2924
+ currentMarks.forEach((currentMark) => {
2925
+ if (currentMark.attribute.outerRadius > maxRadius) {
2926
+ maxRadius = currentMark.attribute.outerRadius;
2927
+ }
2928
+ });
2929
+ const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
2915
2930
  const line1MinLength = attribute.line.line1MinLength;
2916
2931
  const { width, height } = plotRect;
2917
2932
  const centerOffset = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _e !== void 0 ? _e : 0;
@@ -2978,7 +2993,13 @@
2978
2993
  const labelConfig = attribute;
2979
2994
  const layoutArcGap = labelConfig.layoutArcGap;
2980
2995
  const line1MinLength = labelConfig.line.line1MinLength;
2981
- const radiusRatio = this.computeLayoutOuterRadius(currentMarks[0].attribute.outerRadius, attribute.width, attribute.height);
2996
+ let maxRadius = 0;
2997
+ currentMarks.forEach((currentMark) => {
2998
+ if (currentMark.attribute.outerRadius > maxRadius) {
2999
+ maxRadius = currentMark.attribute.outerRadius;
3000
+ }
3001
+ });
3002
+ const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
2982
3003
  const centerOffset = (_a = attribute === null || attribute === void 0 ? void 0 : attribute.centerOffset) !== null && _a !== void 0 ? _a : 0;
2983
3004
  const radius = this.computeRadius(radiusRatio, attribute.width, attribute.height, centerOffset);
2984
3005
  const outerR = radius + line1MinLength;
@@ -3047,13 +3068,14 @@
3047
3068
  }
3048
3069
  }
3049
3070
  _labelLine(text) {
3050
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
3071
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
3051
3072
  const labelLine = ((_a = text.attribute) === null || _a === void 0 ? void 0 : _a.points)
3052
3073
  ? vrender.createLine({
3053
- visible: (_c = (_b = text.attribute) === null || _b === void 0 ? void 0 : _b.visible) !== null && _c !== void 0 ? _c : true,
3054
- stroke: (_f = (_e = (_d = text.attribute) === null || _d === void 0 ? void 0 : _d.line) === null || _e === void 0 ? void 0 : _e.stroke) !== null && _f !== void 0 ? _f : (_g = text.attribute) === null || _g === void 0 ? void 0 : _g.fill,
3055
- lineWidth: (_k = (_j = (_h = text.attribute) === null || _h === void 0 ? void 0 : _h.line) === null || _j === void 0 ? void 0 : _j.lineWidth) !== null && _k !== void 0 ? _k : 1,
3056
- points: (_l = text.attribute) === null || _l === void 0 ? void 0 : _l.points
3074
+ 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,
3075
+ stroke: (_k = (_j = (_h = text.attribute) === null || _h === void 0 ? void 0 : _h.line) === null || _j === void 0 ? void 0 : _j.stroke) !== null && _k !== void 0 ? _k : (_l = text.attribute) === null || _l === void 0 ? void 0 : _l.fill,
3076
+ lineWidth: (_p = (_o = (_m = text.attribute) === null || _m === void 0 ? void 0 : _m.line) === null || _o === void 0 ? void 0 : _o.lineWidth) !== null && _p !== void 0 ? _p : 1,
3077
+ points: (_q = text.attribute) === null || _q === void 0 ? void 0 : _q.points,
3078
+ curveType: ((_s = (_r = text.attribute) === null || _r === void 0 ? void 0 : _r.line) === null || _s === void 0 ? void 0 : _s.smooth) ? 'basis' : null
3057
3079
  })
3058
3080
  : undefined;
3059
3081
  return labelLine;
@@ -3176,6 +3198,156 @@
3176
3198
  pickable: false
3177
3199
  };
3178
3200
 
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
+
3179
3351
  class Segment extends AbstractComponent {
3180
3352
  constructor(attributes) {
3181
3353
  super(vutils.merge({}, Segment.defaultAttributes, attributes));
@@ -3393,6 +3565,23 @@
3393
3565
  stroke: '#000',
3394
3566
  strokeOpacity: 1
3395
3567
  }
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
+ }
3396
3585
  }
3397
3586
  };
3398
3587
 
@@ -3489,7 +3678,7 @@
3489
3678
  }
3490
3679
  }
3491
3680
  _renderInner(container) {
3492
- const { title, label, tick, line, items } = this.attribute;
3681
+ const { title, label, tick, line, grid, items } = this.attribute;
3493
3682
  const axisContainer = vrender.createGroup({ x: 0, y: 0, zIndex: 1 });
3494
3683
  axisContainer.name = exports.AXIS_ELEMENT_NAME.axisContainer;
3495
3684
  axisContainer.id = this._getNodeId('container');
@@ -3518,6 +3707,9 @@
3518
3707
  this.afterLabelsOverlap(labels, axisItems, layerLabelGroup, layer, items.length);
3519
3708
  });
3520
3709
  }
3710
+ if (grid === null || grid === void 0 ? void 0 : grid.visible) {
3711
+ this.renderGrid(container);
3712
+ }
3521
3713
  }
3522
3714
  if (title === null || title === void 0 ? void 0 : title.visible) {
3523
3715
  this.renderTitle(axisContainer);
@@ -3634,6 +3826,13 @@
3634
3826
  axisTitle.id = this._getNodeId('title');
3635
3827
  container.add(axisTitle);
3636
3828
  }
3829
+ renderGrid(container) {
3830
+ const { visible } = this.attribute.subGrid || {};
3831
+ if (visible) {
3832
+ this._renderGridByType('subGrid', container);
3833
+ }
3834
+ this._renderGridByType('grid', container);
3835
+ }
3637
3836
  getVerticalCoord(point, offset, inside) {
3638
3837
  const vector = this.getVerticalVector(offset, inside, point);
3639
3838
  return {
@@ -3804,6 +4003,13 @@
3804
4003
  });
3805
4004
  return data;
3806
4005
  }
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
+ }
3807
4013
  }
3808
4014
 
3809
4015
  const methods = {
@@ -4102,31 +4308,15 @@
4102
4308
  }
4103
4309
  }
4104
4310
 
4105
- class LineAxisMixin {
4106
- isInValidValue(value) {
4107
- return value < 0 || value > 1;
4108
- }
4109
- getTickCoord(tickValue) {
4110
- const { start } = this.attribute;
4111
- const axisVector = this.getRelativeVector();
4112
- return {
4113
- x: start.x + axisVector[0] * tickValue,
4114
- y: start.y + axisVector[1] * tickValue
4115
- };
4116
- }
4117
- getRelativeVector(point) {
4118
- const { start, end } = this.attribute;
4119
- return [end.x - start.x, end.y - start.y];
4120
- }
4121
- getVerticalVector(offset, inside = false, point) {
4122
- const { verticalFactor = 1 } = this.attribute;
4123
- const axisVector = this.getRelativeVector();
4124
- const normalizedAxisVector = normalize(axisVector);
4125
- const verticalVector = [normalizedAxisVector[1], normalizedAxisVector[0] * -1];
4126
- return scale(verticalVector, offset * (inside ? 1 : -1) * verticalFactor);
4311
+ function getCirclePoints(center, count, radius, startAngle, endAngle) {
4312
+ const points = [];
4313
+ const range = endAngle - startAngle;
4314
+ for (let i = 0; i < count; i++) {
4315
+ const angle = startAngle + (i * range) / count;
4316
+ points.push(vutils.polarToCartesian(center, radius, angle));
4127
4317
  }
4318
+ return points;
4128
4319
  }
4129
-
4130
4320
  class LineAxis extends AxisBase {
4131
4321
  constructor(attributes, mode) {
4132
4322
  super(vutils.merge({}, LineAxis.defaultAttributes, attributes), mode);
@@ -4164,6 +4354,28 @@
4164
4354
  axisLineGroup.id = this._getNodeId('line');
4165
4355
  container.add(axisLineGroup);
4166
4356
  }
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
+ }
4167
4379
  getTitleAttribute() {
4168
4380
  var _a, _b, _c, _d, _e, _f, _g, _h;
4169
4381
  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"]);
@@ -4248,7 +4460,7 @@
4248
4460
  }
4249
4461
  const offset = tickLength + labelLength + space;
4250
4462
  const titlePoint = this.getVerticalCoord(point, offset, false);
4251
- const vector = this.getVerticalVector(offset, false, { x: 0, y: 0 });
4463
+ const vector = this.getVerticalVector(offset, false);
4252
4464
  let { angle } = restAttrs;
4253
4465
  let textAlign;
4254
4466
  if (position === 'start') {
@@ -4296,35 +4508,129 @@
4296
4508
  }
4297
4509
  return attrs;
4298
4510
  }
4299
- getTextBaseline(vector, inside) {
4300
- let base = 'middle';
4301
- const { verticalFactor = 1 } = this.attribute;
4302
- const factor = (inside ? 1 : -1) * verticalFactor;
4303
- if (vutils.isNumberClose(vector[1], 0)) {
4304
- if (vutils.isNumberClose(vector[0], 0) && !Object.is(vector[0], -0) && !Object.is(vector[1], -0)) {
4305
- base = factor === 1 ? 'bottom' : 'top';
4306
- }
4307
- else {
4308
- base = 'middle';
4309
- }
4310
- }
4311
- else if (vector[1] > 0) {
4312
- base = 'top';
4511
+ _getGridPoint(gridType, point) {
4512
+ let gridPoints;
4513
+ if (gridType === 'line') {
4514
+ const { length } = this.attribute.grid;
4515
+ const endPoint = this.getVerticalCoord(point, length, true);
4516
+ gridPoints = [point, endPoint];
4313
4517
  }
4314
- else if (vector[1] < 0) {
4315
- base = 'bottom';
4518
+ else if (gridType === 'circle' || gridType === 'polygon') {
4519
+ const { center, sides, startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE } = this.attribute.grid;
4520
+ const distance = vutils.PointService.distancePP(center, point);
4521
+ gridPoints = getCirclePoints(center, sides, distance, startAngle, endAngle);
4316
4522
  }
4317
- return base;
4523
+ return gridPoints;
4318
4524
  }
4319
- getLabelAlign(vector, inside, angle) {
4320
- const orient = this.attribute.orient;
4321
- if (vutils.isValidNumber(angle)) {
4322
- if (orient === 'top' || orient === 'bottom') {
4323
- return getXAxisLabelAlign(orient, angle);
4324
- }
4325
- if (orient === 'left' || orient === 'right') {
4326
- return getYAxisLabelAlign(orient, angle);
4327
- }
4525
+ getGridAttribute(type) {
4526
+ const { type: gridType, alignWithLabel = true } = this.attribute.grid;
4527
+ let tickSegment = 1;
4528
+ const count = this.data.length;
4529
+ if (count >= 2) {
4530
+ tickSegment = this.data[1].value - this.data[0].value;
4531
+ }
4532
+ let gridAttribute;
4533
+ let items = [];
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
+ }
4328
4634
  }
4329
4635
  return {
4330
4636
  textAlign: this.getTextAlign(vector),
@@ -4529,32 +4835,6 @@
4529
4835
  }
4530
4836
  }
4531
4837
  LineAxis.defaultAttributes = DEFAULT_AXIS_THEME;
4532
- vutils.mixin(LineAxis, LineAxisMixin);
4533
-
4534
- class CircleAxisMixin {
4535
- isInValidValue(value) {
4536
- const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE } = this.attribute;
4537
- if (Math.abs(endAngle - startAngle) % (Math.PI * 2) === 0) {
4538
- return value > 1;
4539
- }
4540
- return value < 0 || value > 1;
4541
- }
4542
- getTickCoord(tickValue) {
4543
- const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, center, radius, inside = false, innerRadius = 0 } = this.attribute;
4544
- const angle = startAngle + (endAngle - startAngle) * tickValue;
4545
- return vutils.polarToCartesian(center, inside && innerRadius > 0 ? innerRadius : radius, angle);
4546
- }
4547
- getVerticalVector(offset, inside = false, point) {
4548
- const { inside: axisInside = false } = this.attribute;
4549
- const { center } = this.attribute;
4550
- const vector = [point.x - center.x, point.y - center.y];
4551
- return scale(vector, ((inside ? -1 : 1) * (axisInside ? -1 : 1) * offset) / length(vector));
4552
- }
4553
- getRelativeVector(point) {
4554
- const { center } = this.attribute;
4555
- return [point.y - center.y, -1 * (point.x - center.x)];
4556
- }
4557
- }
4558
4838
 
4559
4839
  class CircleAxis extends AxisBase {
4560
4840
  constructor(attributes) {
@@ -4578,6 +4858,28 @@
4578
4858
  }
4579
4859
  container.add(axisLine);
4580
4860
  }
4861
+ isInValidValue(value) {
4862
+ const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE } = this.attribute;
4863
+ if (Math.abs(endAngle - startAngle) % (Math.PI * 2) === 0) {
4864
+ return value > 1;
4865
+ }
4866
+ return value < 0 || value > 1;
4867
+ }
4868
+ getTickCoord(tickValue) {
4869
+ const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, center, radius, inside = false, innerRadius = 0 } = this.attribute;
4870
+ const angle = startAngle + (endAngle - startAngle) * tickValue;
4871
+ return vutils.polarToCartesian(center, inside && innerRadius > 0 ? innerRadius : radius, angle);
4872
+ }
4873
+ getVerticalVector(offset, inside = false, point) {
4874
+ const { inside: axisInside = false } = this.attribute;
4875
+ const { center } = this.attribute;
4876
+ const vector = [point.x - center.x, point.y - center.y];
4877
+ return scale(vector, ((inside ? -1 : 1) * (axisInside ? -1 : 1) * offset) / length(vector));
4878
+ }
4879
+ getRelativeVector(point) {
4880
+ const { center } = this.attribute;
4881
+ return [point.y - center.y, -1 * (point.x - center.x)];
4882
+ }
4581
4883
  getTitleAttribute() {
4582
4884
  var _a, _b, _c, _d, _e, _f, _g, _h;
4583
4885
  const { center, radius, innerRadius = 0 } = this.attribute;
@@ -4630,541 +4932,40 @@
4630
4932
  if (background && background.visible) {
4631
4933
  attrs.panel = Object.assign({ visible: true }, background.style);
4632
4934
  }
4633
- return attrs;
4634
- }
4635
- getSubTickLineItems() {
4636
- var _a, _b;
4637
- const { subTick } = this.attribute;
4638
- const subTickLineItems = [];
4639
- const { count: subCount = 4, inside = false, length = 2 } = subTick;
4640
- const tickLineItems = this.tickLineItems;
4641
- const tickLineCount = tickLineItems.length;
4642
- if (tickLineCount >= 2) {
4643
- const tickSegment = this.data[1].value - this.data[0].value;
4644
- const isAlignWithLable = (_b = (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.tick) === null || _b === void 0 ? void 0 : _b.alignWithLabel;
4645
- for (let i = 0; i < tickLineCount; i++) {
4646
- const pre = tickLineItems[i];
4647
- const next = tickLineItems[i + 1];
4648
- for (let j = 0; j < subCount; j++) {
4649
- const percent = (j + 1) / (subCount + 1);
4650
- const value = (1 - percent) * pre.value + percent * (next ? next.value : isAlignWithLable ? 1 : pre.value + tickSegment);
4651
- const point = this.getTickCoord(value);
4652
- const endPoint = this.getVerticalCoord(point, length, inside);
4653
- subTickLineItems.push({
4654
- start: point,
4655
- end: endPoint,
4656
- value
4657
- });
4658
- }
4659
- }
4660
- }
4661
- return subTickLineItems;
4662
- }
4663
- getTextBaseline(vector) {
4664
- let base = 'middle';
4665
- if (vutils.isNumberClose(vector[1], 0)) {
4666
- base = 'middle';
4667
- }
4668
- else if (vector[1] > 0 && vector[1] > Math.abs(vector[0])) {
4669
- base = 'top';
4670
- }
4671
- else if (vector[1] < 0 && Math.abs(vector[1]) > Math.abs(vector[0])) {
4672
- base = 'bottom';
4673
- }
4674
- return base;
4675
- }
4676
- beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
4677
- return;
4678
- }
4679
- handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
4680
- return;
4681
- }
4682
- afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
4683
- return;
4684
- }
4685
- getLabelAlign(vector, inside, angle) {
4686
- return {
4687
- textAlign: this.getTextAlign(vector),
4688
- textBaseline: this.getTextBaseline(vector)
4689
- };
4690
- }
4691
- }
4692
- CircleAxis.defaultAttributes = DEFAULT_AXIS_THEME;
4693
- vutils.mixin(CircleAxis, CircleAxisMixin);
4694
-
4695
- function getElMap(g) {
4696
- const elMap = {};
4697
- traverseGroup(g, (el) => {
4698
- if (el.type !== 'group' && el.id) {
4699
- elMap[el.id] = el;
4700
- }
4701
- });
4702
- return elMap;
4703
- }
4704
- class GroupTransition extends vrender.ACustomAnimate {
4705
- constructor() {
4706
- super(...arguments);
4707
- this.mode = vrender.AnimateMode.NORMAL;
4708
- }
4709
- onBind() {
4710
- const currentInnerView = this.target.getInnerView();
4711
- const prevInnerView = this.target.getPrevInnerView();
4712
- if (!prevInnerView) {
4713
- return;
4714
- }
4715
- this._oldElementMap = getElMap(prevInnerView);
4716
- this._newElementAttrMap = {};
4717
- traverseGroup(currentInnerView, (el) => {
4718
- var _a, _b, _c, _d, _e, _f;
4719
- if (el.type !== 'group' && el.id) {
4720
- const oldEl = this._oldElementMap[el.id];
4721
- if (oldEl) {
4722
- if (!vutils.isEqual(el.attribute, oldEl.attribute)) {
4723
- const newProps = vutils.cloneDeep(el.attribute);
4724
- this._newElementAttrMap[el.id] = {
4725
- state: 'update',
4726
- node: el,
4727
- 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 })
4728
- };
4729
- el.setAttributes(oldEl.attribute);
4730
- }
4731
- }
4732
- else {
4733
- const finalOpacityAttrs = {
4734
- opacity: (_d = el.attribute.opacity) !== null && _d !== void 0 ? _d : 1,
4735
- fillOpacity: (_e = el.attribute.fillOpacity) !== null && _e !== void 0 ? _e : 1,
4736
- strokeOpacity: (_f = el.attribute.strokeOpacity) !== null && _f !== void 0 ? _f : 1
4737
- };
4738
- this._newElementAttrMap[el.id] = {
4739
- state: 'enter',
4740
- node: el,
4741
- attrs: finalOpacityAttrs
4742
- };
4743
- el.setAttributes({
4744
- opacity: 0,
4745
- fillOpacity: 0,
4746
- strokeOpacity: 0
4747
- });
4748
- }
4749
- }
4750
- });
4751
- }
4752
- onStart() {
4753
- let duration = this.duration;
4754
- let easing = this.easing;
4755
- Object.keys(this._newElementAttrMap).forEach(id => {
4756
- var _a, _b, _c, _d, _e, _f, _g;
4757
- const { node, attrs, state } = this._newElementAttrMap[id];
4758
- if (state === 'enter') {
4759
- 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;
4760
- 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;
4761
- }
4762
- if (node.type === 'path') {
4763
- node
4764
- .animate({
4765
- interpolate(key, ratio, from, to, nextAttributes) {
4766
- if (key === 'path') {
4767
- nextAttributes.path = vutils.interpolateString(from, to)(ratio);
4768
- return true;
4769
- }
4770
- return false;
4771
- }
4772
- })
4773
- .to(attrs, duration, easing);
4774
- }
4775
- else {
4776
- node
4777
- .animate()
4778
- .to(attrs, duration, easing);
4779
- }
4780
- });
4781
- }
4782
- onUpdate(end, ratio, out) {
4783
- }
4784
- }
4785
-
4786
- class GroupFadeIn extends vrender.ACustomAnimate {
4787
- constructor(from, to, duration, easing) {
4788
- super(null, null, duration, easing);
4789
- }
4790
- getEndProps() {
4791
- return {};
4792
- }
4793
- onBind() {
4794
- this.target.setTheme({
4795
- common: {
4796
- opacity: 0
4797
- }
4798
- });
4799
- return;
4800
- }
4801
- onEnd() {
4802
- this.target.setTheme({
4803
- common: {
4804
- opacity: 1
4805
- }
4806
- });
4807
- return;
4808
- }
4809
- onUpdate(end, ratio, out) {
4810
- this.target.setTheme({
4811
- common: {
4812
- opacity: ratio
4813
- }
4814
- });
4815
- }
4816
- }
4817
- class GroupFadeOut extends vrender.ACustomAnimate {
4818
- constructor(from, to, duration, easing) {
4819
- super(null, null, duration, easing);
4820
- }
4821
- getEndProps() {
4822
- return {};
4823
- }
4824
- onBind() {
4825
- this.target.setTheme({
4826
- common: {
4827
- opacity: 1
4828
- }
4829
- });
4830
- return;
4831
- }
4832
- onEnd() {
4833
- this.target.setTheme({
4834
- common: {
4835
- opacity: 0
4836
- }
4837
- });
4838
- return;
4839
- }
4840
- onUpdate(end, ratio, out) {
4841
- this.target.setTheme({
4842
- common: {
4843
- opacity: 1 - ratio
4844
- }
4845
- });
4846
- }
4847
- }
4848
-
4849
- function getLinePath(points, closed) {
4850
- let path = '';
4851
- if (points.length === 0) {
4852
- return path;
4853
- }
4854
- points.forEach((point, index) => {
4855
- if (index === 0) {
4856
- path = `M${point.x},${point.y}`;
4857
- }
4858
- else {
4859
- path += `L${point.x},${point.y}`;
4860
- }
4861
- });
4862
- if (closed) {
4863
- path += 'Z';
4864
- }
4865
- return path;
4866
- }
4867
- function getArcPath(center, points, reverse, closed) {
4868
- let path = '';
4869
- if (!center || points.length === 0) {
4870
- return path;
4871
- }
4872
- const firstPoint = points[0];
4873
- const radius = vutils.PointService.distancePP(center, firstPoint);
4874
- const sweepFlag = reverse ? 0 : 1;
4875
- if (closed) {
4876
- 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`;
4877
- }
4878
- else {
4879
- points.forEach((point, index) => {
4880
- if (index === 0) {
4881
- path = `M${point.x},${point.y}`;
4882
- }
4883
- else {
4884
- path += `A${radius},${radius},0,0,${sweepFlag},${point.x},${point.y}`;
4885
- }
4886
- });
4887
- }
4888
- return path;
4889
- }
4890
- function getRegionPath(from, to, attribute) {
4891
- const { type, closed } = attribute;
4892
- const reversePoints = to.slice(0).reverse();
4893
- let regionPath = '';
4894
- let nextPath = '';
4895
- if (type === 'line' && attribute.smoothLink && attribute.center) {
4896
- const fromStart = from[0];
4897
- const toEnd = reversePoints[0];
4898
- const center = attribute.center;
4899
- regionPath = getLinePath(from, !!closed);
4900
- nextPath = getLinePath(reversePoints, !!closed);
4901
- const toEndRadius = vutils.PointService.distancePP(toEnd, center);
4902
- const fromStartRadius = vutils.PointService.distancePP(fromStart, center);
4903
- regionPath += `A${toEndRadius},${toEndRadius},0,0,1,${toEnd.x},${toEnd.y}L${toEnd.x},${toEnd.y}`;
4904
- nextPath += `A${fromStartRadius},${fromStartRadius},0,0,0,${fromStart.x},${fromStart.y}`;
4905
- }
4906
- else if (type === 'circle') {
4907
- const { center } = attribute;
4908
- regionPath = getArcPath(center, from, false, !!closed);
4909
- nextPath = getArcPath(center, reversePoints, true, !!closed);
4910
- }
4911
- else if (type === 'line' || type === 'polygon') {
4912
- regionPath = getLinePath(from, !!closed);
4913
- nextPath = getLinePath(reversePoints, !!closed);
4914
- }
4915
- if (closed) {
4916
- regionPath += nextPath;
4917
- }
4918
- else {
4919
- nextPath = 'L' + nextPath.substring(1);
4920
- regionPath += nextPath;
4921
- regionPath += 'Z';
4922
- }
4923
- return regionPath;
4924
- }
4925
- class BaseGrid extends AbstractComponent {
4926
- constructor() {
4927
- super(...arguments);
4928
- this.name = 'axis-grid';
4929
- this.data = [];
4930
- }
4931
- getInnerView() {
4932
- return this._innerView;
4933
- }
4934
- getPrevInnerView() {
4935
- return this._prevInnerView;
4936
- }
4937
- render() {
4938
- this.removeAllChild();
4939
- this._prevInnerView = this._innerView;
4940
- this._innerView = vrender.createGroup({ x: 0, y: 0, pickable: false });
4941
- this.add(this._innerView);
4942
- const { items, visible } = this.attribute;
4943
- if (items && items.length && visible !== false) {
4944
- this.data = this._transformItems(items);
4945
- this._renderGrid(this._innerView);
4946
- }
4947
- }
4948
- getVerticalCoord(point, offset, inside) {
4949
- const vector = this.getVerticalVector(offset, inside, point);
4950
- return {
4951
- x: point.x + vector[0],
4952
- y: point.y + vector[1]
4953
- };
4954
- }
4955
- _transformItems(items) {
4956
- const data = [];
4957
- items.forEach((item) => {
4958
- var _a;
4959
- data.push(Object.assign(Object.assign({}, item), { point: this.getTickCoord(item.value), id: (_a = item.id) !== null && _a !== void 0 ? _a : item.label }));
4960
- });
4961
- return data;
4962
- }
4963
- _renderGrid(container) {
4964
- const { visible } = this.attribute.subGrid || {};
4965
- if (visible) {
4966
- this._renderGridByType(true, container);
4967
- }
4968
- this._renderGridByType(false, container);
4969
- }
4970
- _renderGridByType(isSubGrid, container) {
4971
- const gridAttrs = vutils.merge({}, this.attribute, this.getGridAttribute(isSubGrid));
4972
- const { type, items, style, closed, alternateColor, depth = 0 } = gridAttrs;
4973
- const name = isSubGrid ? `${exports.AXIS_ELEMENT_NAME.grid}-sub` : `${exports.AXIS_ELEMENT_NAME.grid}`;
4974
- items.forEach((item, index) => {
4975
- const { id, points } = item;
4976
- let path = '';
4977
- if (type === 'line' || type === 'polygon') {
4978
- path = getLinePath(points, !!closed);
4979
- }
4980
- else if (type === 'circle') {
4981
- const { center } = this.attribute;
4982
- path = getArcPath(center, points, false, !!closed);
4983
- }
4984
- const shape = vrender.createPath(Object.assign({ path, z: depth }, (vutils.isFunction(style) ? vutils.merge({}, BaseGrid.defaultAttributes.style, style(item, index)) : style)));
4985
- shape.name = `${name}-line`;
4986
- shape.id = this._getNodeId(`${name}-path-${id}`);
4987
- container.add(shape);
4988
- });
4989
- if (depth && type === 'line') {
4990
- items.forEach((item, index) => {
4991
- const { id, points } = item;
4992
- const nextPoints = [];
4993
- nextPoints.push(points[0]);
4994
- const dir = { x: points[1].x - points[0].x, y: points[1].y - points[0].y };
4995
- const dirLen = Math.sqrt(dir.x * dir.x + dir.y * dir.y);
4996
- const ratio = depth / dirLen;
4997
- nextPoints.push({ x: points[0].x + dir.x * ratio, y: points[0].y + dir.y * ratio });
4998
- const path = getLinePath(nextPoints, !!closed);
4999
- const deltaX = vutils.abs(nextPoints[0].x - nextPoints[1].x);
5000
- const deltaY = vutils.abs(nextPoints[0].y - nextPoints[1].y);
5001
- 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)));
5002
- shape.name = `${name}-line`;
5003
- shape.id = this._getNodeId(`${name}-path-${id}`);
5004
- container.add(shape);
5005
- });
5006
- }
5007
- if (items.length > 1 && alternateColor) {
5008
- const colors = vutils.isArray(alternateColor)
5009
- ? alternateColor
5010
- : [alternateColor, 'transparent'];
5011
- const getColor = (index) => colors[index % colors.length];
5012
- for (let index = 0; index < items.length - 1; index++) {
5013
- const [prev, curr] = [items[index].points, items[index + 1].points];
5014
- const path = getRegionPath(prev, curr, gridAttrs);
5015
- const shape = vrender.createPath({
5016
- path,
5017
- fill: getColor(index)
5018
- });
5019
- shape.name = `${name}-region`;
5020
- shape.id = this._getNodeId(`${name}-region-${index}`);
5021
- container.add(shape);
5022
- }
5023
- }
5024
- }
5025
- _getNodeId(id) {
5026
- return `${this.id}-${id}`;
5027
- }
5028
- }
5029
- BaseGrid.defaultAttributes = {
5030
- style: {
5031
- lineWidth: 1,
5032
- stroke: '#999',
5033
- strokeOpacity: 1,
5034
- lineDash: [4, 4]
5035
- },
5036
- subGrid: {
5037
- visible: false,
5038
- style: {
5039
- lineWidth: 1,
5040
- stroke: '#999',
5041
- strokeOpacity: 1,
5042
- lineDash: [4, 4]
5043
- }
5044
- }
5045
- };
5046
-
5047
- function getCirclePoints(center, count, radius, startAngle, endAngle) {
5048
- const points = [];
5049
- const range = endAngle - startAngle;
5050
- for (let i = 0; i < count; i++) {
5051
- const angle = startAngle + (i * range) / count;
5052
- points.push(vutils.polarToCartesian(center, radius, angle));
5053
- }
5054
- return points;
5055
- }
5056
- class LineAxisGrid extends BaseGrid {
5057
- constructor(attributes, mode) {
5058
- super(vutils.merge({}, BaseGrid.defaultAttributes, attributes), mode);
5059
- if (mode === '3d') {
5060
- this.setMode(mode);
5061
- }
5062
- }
5063
- _getGridPoint(gridType, point) {
5064
- let gridPoints;
5065
- if (gridType === 'line') {
5066
- const { length } = this.attribute;
5067
- const endPoint = this.getVerticalCoord(point, length, true);
5068
- gridPoints = [point, endPoint];
5069
- }
5070
- else if (gridType === 'circle' || gridType === 'polygon') {
5071
- const { center, sides = 6, startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE } = this.attribute;
5072
- const distance = vutils.PointService.distancePP(center, point);
5073
- gridPoints = getCirclePoints(center, sides, distance, startAngle, endAngle);
5074
- }
5075
- return gridPoints;
5076
- }
5077
- getGridAttribute(isSubGrid) {
5078
- const { type: gridType, alignWithLabel = true } = this.attribute;
5079
- let tickSegment = 1;
5080
- const count = this.data.length;
5081
- if (count >= 2) {
5082
- tickSegment = this.data[1].value - this.data[0].value;
5083
- }
5084
- let gridAttribute;
5085
- let items = [];
5086
- if (!isSubGrid) {
5087
- gridAttribute = this.attribute;
5088
- const gridItems = [];
5089
- this.data.forEach(item => {
5090
- let { point } = item;
5091
- if (!alignWithLabel) {
5092
- const value = item.value - tickSegment / 2;
5093
- if (this.isInValidValue(value)) {
5094
- return;
5095
- }
5096
- point = this.getTickCoord(value);
5097
- }
5098
- gridItems.push({
5099
- id: item.label,
5100
- datum: item,
5101
- points: this._getGridPoint(gridType, point)
5102
- });
5103
- });
5104
- items = gridItems;
5105
- }
5106
- else {
5107
- gridAttribute = vutils.merge({}, this.attribute, this.attribute.subGrid);
5108
- const subGridItems = [];
5109
- const { count: subCount = 4 } = this.attribute.subGrid || {};
5110
- const tickLineCount = this.data.length;
5111
- if (tickLineCount >= 2) {
5112
- const points = [];
5113
- this.data.forEach((item) => {
5114
- let tickValue = item.value;
5115
- if (!alignWithLabel) {
5116
- const value = item.value - tickSegment / 2;
5117
- if (this.isInValidValue(value)) {
5118
- return;
5119
- }
5120
- tickValue = value;
5121
- }
5122
- points.push({
5123
- value: tickValue
5124
- });
5125
- });
5126
- for (let i = 0; i < points.length - 1; i++) {
5127
- const pre = points[i];
5128
- const next = points[i + 1];
5129
- subGridItems.push({
5130
- id: `sub-${i}-0`,
5131
- points: this._getGridPoint(gridType, this.getTickCoord(pre.value)),
5132
- datum: {}
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
5133
4959
  });
5134
- for (let j = 0; j < subCount; j++) {
5135
- const percent = (j + 1) / (subCount + 1);
5136
- const value = (1 - percent) * pre.value + percent * next.value;
5137
- const point = this.getTickCoord(value);
5138
- subGridItems.push({
5139
- id: `sub-${i}-${j + 1}`,
5140
- points: this._getGridPoint(gridType, point),
5141
- datum: {}
5142
- });
5143
- }
5144
- if (i === points.length - 2) {
5145
- subGridItems.push({
5146
- id: `sub-${i}-${subCount + 1}`,
5147
- points: this._getGridPoint(gridType, this.getTickCoord(next.value)),
5148
- datum: {}
5149
- });
5150
- }
5151
4960
  }
5152
- items = subGridItems;
5153
4961
  }
5154
4962
  }
5155
- return Object.assign(Object.assign({}, gridAttribute), { items });
5156
- }
5157
- }
5158
- vutils.mixin(LineAxisGrid, LineAxisMixin);
5159
-
5160
- class CircleAxisGrid extends BaseGrid {
5161
- constructor(attributes) {
5162
- super(vutils.merge({}, BaseGrid.defaultAttributes, attributes));
4963
+ return subTickLineItems;
5163
4964
  }
5164
- getGridAttribute(isSubGrid) {
4965
+ getGridAttribute(type) {
5165
4966
  let gridAttribute;
5166
4967
  let items = [];
5167
- 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"]);
4968
+ const { radius, innerRadius = 0, startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, center, grid } = this.attribute;
5168
4969
  const { alignWithLabel = true } = grid || {};
5169
4970
  const length = radius - innerRadius;
5170
4971
  let tickSegment = 1;
@@ -5172,8 +4973,8 @@
5172
4973
  if (count >= 2) {
5173
4974
  tickSegment = this.data[1].value - this.data[0].value;
5174
4975
  }
5175
- if (!isSubGrid) {
5176
- gridAttribute = grid;
4976
+ if (type === 'grid') {
4977
+ gridAttribute = this.attribute.grid;
5177
4978
  const gridItems = [];
5178
4979
  let data;
5179
4980
  if (Math.abs(endAngle - startAngle) % (Math.PI * 2) === 0) {
@@ -5201,9 +5002,9 @@
5201
5002
  items = gridItems;
5202
5003
  }
5203
5004
  else {
5204
- gridAttribute = vutils.merge({}, grid, subGrid);
5005
+ gridAttribute = vutils.merge({}, this.attribute.grid, this.attribute.subGrid);
5205
5006
  const subGridItems = [];
5206
- const { count: subCount = 4 } = subGrid || {};
5007
+ const { count: subCount = 4 } = this.attribute.subTick || {};
5207
5008
  const tickLineCount = this.data.length;
5208
5009
  if (tickLineCount >= 2) {
5209
5010
  const points = [];
@@ -5247,10 +5048,192 @@
5247
5048
  }
5248
5049
  }
5249
5050
  return Object.assign(Object.assign({}, gridAttribute), { items,
5250
- center, type: 'line' });
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
+ });
5251
5235
  }
5252
5236
  }
5253
- vutils.mixin(CircleAxisGrid, CircleAxisMixin);
5254
5237
 
5255
5238
  var DataZoomActiveTag;
5256
5239
  (function (DataZoomActiveTag) {
@@ -10327,11 +10310,7 @@
10327
10310
  }
10328
10311
  Tooltip.defaultAttributes = defaultAttributes;
10329
10312
 
10330
- function VTag(params) {
10331
- return new Tag(params ? params.attribute : {});
10332
- }
10333
-
10334
- const version = "0.15.0-alpha.15";
10313
+ const version = "0.15.0-alpha.16";
10335
10314
 
10336
10315
  exports.AbstractComponent = AbstractComponent;
10337
10316
  exports.ArcInfo = ArcInfo;
@@ -10339,7 +10318,6 @@
10339
10318
  exports.BasePlayer = BasePlayer;
10340
10319
  exports.Brush = Brush;
10341
10320
  exports.CircleAxis = CircleAxis;
10342
- exports.CircleAxisGrid = CircleAxisGrid;
10343
10321
  exports.CircleCrosshair = CircleCrosshair;
10344
10322
  exports.ColorContinuousLegend = ColorContinuousLegend;
10345
10323
  exports.ContinuousPlayer = ContinuousPlayer;
@@ -10356,13 +10334,13 @@
10356
10334
  exports.DataZoom = DataZoom;
10357
10335
  exports.DiscreteLegend = DiscreteLegend;
10358
10336
  exports.DiscretePlayer = DiscretePlayer;
10337
+ exports.Grid = Grid;
10359
10338
  exports.GroupFadeIn = GroupFadeIn;
10360
10339
  exports.GroupFadeOut = GroupFadeOut;
10361
10340
  exports.GroupTransition = GroupTransition;
10362
10341
  exports.Indicator = Indicator;
10363
10342
  exports.LabelBase = LabelBase;
10364
10343
  exports.LineAxis = LineAxis;
10365
- exports.LineAxisGrid = LineAxisGrid;
10366
10344
  exports.LineCrosshair = LineCrosshair;
10367
10345
  exports.LineLabel = LineLabel;
10368
10346
  exports.LinkPath = LinkPath;
@@ -10383,7 +10361,6 @@
10383
10361
  exports.Tag = Tag;
10384
10362
  exports.Title = Title;
10385
10363
  exports.Tooltip = Tooltip;
10386
- exports.VTag = VTag;
10387
10364
  exports.getHorizontalPath = getHorizontalPath;
10388
10365
  exports.getSizeHandlerPath = getSizeHandlerPath;
10389
10366
  exports.getVerticalPath = getVerticalPath;