@visactor/vrender-components 0.20.1-alpha.4 → 0.20.1-alpha.5

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 (68) hide show
  1. package/cjs/axis/base.d.ts +1 -0
  2. package/cjs/axis/base.js +4 -3
  3. package/cjs/axis/base.js.map +1 -1
  4. package/cjs/axis/config.d.ts +0 -6
  5. package/cjs/axis/config.js +1 -7
  6. package/cjs/axis/config.js.map +1 -1
  7. package/cjs/axis/constant.d.ts +1 -2
  8. package/cjs/axis/constant.js +1 -2
  9. package/cjs/axis/constant.js.map +1 -1
  10. package/cjs/axis/line.d.ts +0 -1
  11. package/cjs/axis/line.js +11 -45
  12. package/cjs/axis/line.js.map +1 -1
  13. package/cjs/axis/overlap/auto-rotate.js +3 -3
  14. package/cjs/axis/overlap/auto-rotate.js.map +1 -1
  15. package/cjs/axis/tick-data/continuous.js +10 -36
  16. package/cjs/axis/tick-data/continuous.js.map +1 -1
  17. package/cjs/axis/type.d.ts +4 -24
  18. package/cjs/axis/type.js.map +1 -1
  19. package/cjs/axis/util.d.ts +0 -2
  20. package/cjs/axis/util.js +4 -15
  21. package/cjs/axis/util.js.map +1 -1
  22. package/cjs/brush/type.js +2 -1
  23. package/cjs/index.d.ts +1 -1
  24. package/cjs/index.js +1 -1
  25. package/cjs/index.js.map +1 -1
  26. package/cjs/indicator/indicator.js +4 -3
  27. package/cjs/indicator/indicator.js.map +1 -1
  28. package/cjs/label/line.js +7 -1
  29. package/cjs/label/line.js.map +1 -1
  30. package/cjs/poptip/contribution.js +3 -3
  31. package/cjs/poptip/contribution.js.map +1 -1
  32. package/cjs/util/align.js +31 -51
  33. package/cjs/util/align.js.map +1 -1
  34. package/dist/index.es.js +68 -177
  35. package/es/axis/base.d.ts +1 -0
  36. package/es/axis/base.js +4 -3
  37. package/es/axis/base.js.map +1 -1
  38. package/es/axis/config.d.ts +0 -6
  39. package/es/axis/config.js +0 -7
  40. package/es/axis/config.js.map +1 -1
  41. package/es/axis/constant.d.ts +1 -2
  42. package/es/axis/constant.js +1 -2
  43. package/es/axis/constant.js.map +1 -1
  44. package/es/axis/line.d.ts +0 -1
  45. package/es/axis/line.js +10 -45
  46. package/es/axis/line.js.map +1 -1
  47. package/es/axis/overlap/auto-rotate.js +3 -3
  48. package/es/axis/overlap/auto-rotate.js.map +1 -1
  49. package/es/axis/tick-data/continuous.js +10 -35
  50. package/es/axis/tick-data/continuous.js.map +1 -1
  51. package/es/axis/type.d.ts +4 -24
  52. package/es/axis/type.js.map +1 -1
  53. package/es/axis/util.d.ts +0 -2
  54. package/es/axis/util.js +2 -14
  55. package/es/axis/util.js.map +1 -1
  56. package/es/brush/type.js +2 -1
  57. package/es/index.d.ts +1 -1
  58. package/es/index.js +1 -1
  59. package/es/index.js.map +1 -1
  60. package/es/indicator/indicator.js +4 -3
  61. package/es/indicator/indicator.js.map +1 -1
  62. package/es/label/line.js +7 -1
  63. package/es/label/line.js.map +1 -1
  64. package/es/poptip/contribution.js +3 -3
  65. package/es/poptip/contribution.js.map +1 -1
  66. package/es/util/align.js +31 -51
  67. package/es/util/align.js.map +1 -1
  68. package/package.json +3 -3
@@ -18,7 +18,7 @@ function wrapPoptip(target, source) {
18
18
 
19
19
  let PopTipRenderContribution = class {
20
20
  render(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
21
- var _a;
21
+ var _a, _b;
22
22
  if (1 === graphic._showPoptip) {
23
23
  const {visible: visible, visibleCb: visibleCb} = graphic.attribute.poptip || {};
24
24
  if (!1 === visible || visibleCb && !1 === visibleCb(graphic)) return;
@@ -41,9 +41,9 @@ let PopTipRenderContribution = class {
41
41
  })), drawContext.stage.tryInitInteractiveLayer();
42
42
  const interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
43
43
  interactiveLayer && interactiveLayer.add(this.poptipComponent);
44
- } else 2 === graphic._showPoptip && (graphic._showPoptip = 0, this.poptipComponent && this.poptipComponent.setAttributes({
44
+ } else 2 === graphic._showPoptip && (graphic._showPoptip = 0, this.poptipComponent && (this.poptipComponent.setAttributes({
45
45
  visibleAll: !1
46
- }));
46
+ }), null === (_b = this.poptipComponent.parent) || void 0 === _b || _b.removeChild(this.poptipComponent)));
47
47
  }
48
48
  };
49
49
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/poptip/contribution.ts"],"names":[],"mappings":";;;;;;;;;AAQA,yDAAoD;AACpD,qCAAkC;AAClC,6CAAyC;AACzC,mCAAgC;AAEhC,SAAS,UAAU,CAAC,MAA2B,EAAE,MAA2B;IAC1E,IAAA,cAAK,EAAC,MAAM,EAAE,aAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC;AAChB,CAAC;AAGM,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEnC,MAAM,CACJ,OAA6C,EAC7C,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,gBAA6C,EAC7C,WAAyB,EACzB,MAAiH,EACjH,QAAmH,EACnH,OAAa;;QAEb,IAAI,OAAO,CAAC,WAAW,KAAK,CAAC,EAAE;YAC7B,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAI,OAAO,CAAC,SAAiB,CAAC,MAAM,IAAI,EAAE,CAAC;YACvE,IAAI,OAAO,KAAK,KAAK,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,OAAO,CAAC,KAAK,KAAK,CAAC,EAAE;gBACpE,OAAO;aACR;YACD,MAAM,SAAS,GAAG,EAAE,CAAC;YACrB,IAAA,cAAK,EACH,SAAS,EACT,eAAM,CAAC,iBAAiB,EACvB,OAAO,CAAC,SAAiB,CAAC,MAAM,CAAC,CAAC,CAAE,OAAO,CAAC,SAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAC3E,CAAC;YACF,IAAI,CAAC,IAAI,CAAC,eAAe,EA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AAE,KAAK;iBAClB,CAAC,CAAC;SACN;IACH,CAAC;CACF,CAAA;AAhEY,wBAAwB;IADpC,IAAA,yBAAU,GAAE;GACA,wBAAwB,CAgEpC;AAhEY,4DAAwB","file":"contribution.js","sourcesContent":["import type {\n IContext2d,\n IGraphic,\n IGraphicAttribute,\n IInteractiveSubRenderContribution,\n IThemeAttribute,\n IDrawContext\n} from '@visactor/vrender-core';\nimport { injectable } from '@visactor/vrender-core';\nimport { PopTip } from './poptip';\nimport { merge } from '@visactor/vutils';\nimport { theme } from './theme';\n\nfunction wrapPoptip(target: Record<string, any>, source: Record<string, any>) {\n merge(target, theme.poptip, source);\n return target;\n}\n\n@injectable()\nexport class PopTipRenderContribution implements IInteractiveSubRenderContribution {\n declare poptipComponent: PopTip;\n render(\n graphic: IGraphic<Partial<IGraphicAttribute>>,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ): void {\n if (graphic._showPoptip === 1) {\n const { visible, visibleCb } = (graphic.attribute as any).poptip || {};\n if (visible === false || (visibleCb && visibleCb(graphic) === false)) {\n return;\n }\n const attribute = {};\n merge(\n attribute,\n PopTip.defaultAttributes,\n (graphic.attribute as any).poptip ? (graphic.attribute as any).poptip : {}\n );\n if (!this.poptipComponent) {\n this.poptipComponent = new PopTip(attribute);\n } else {\n this.poptipComponent.initAttributes(attribute);\n }\n // 如果text图元没有配置title和content的话\n let poptip = (graphic.attribute as any).poptip || {};\n if (graphic.type === 'text' && poptip.title == null && poptip.content == null) {\n const out = {};\n wrapPoptip(out, poptip);\n poptip = out;\n poptip.content = poptip.content ?? (graphic.attribute as any).text;\n }\n const matrix = graphic.globalTransMatrix;\n this.poptipComponent.setAttributes({\n visibleAll: true,\n pickable: false,\n childrenPickable: false,\n ...poptip,\n x: matrix.e,\n y: matrix.f\n });\n // 添加到交互层中\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n interactiveLayer.add(this.poptipComponent);\n }\n } else if (graphic._showPoptip === 2) {\n graphic._showPoptip = 0;\n this.poptipComponent &&\n this.poptipComponent.setAttributes({\n visibleAll: false\n });\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/poptip/contribution.ts"],"names":[],"mappings":";;;;;;;;;AAQA,yDAAoD;AACpD,qCAAkC;AAClC,6CAAyC;AACzC,mCAAgC;AAEhC,SAAS,UAAU,CAAC,MAA2B,EAAE,MAA2B;IAC1E,IAAA,cAAK,EAAC,MAAM,EAAE,aAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC;AAChB,CAAC;AAGM,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAEnC,MAAM,CACJ,OAA6C,EAC7C,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,MAAe,EACf,QAAiB,EACjB,QAAiB,EACjB,QAAiB,EACjB,gBAA6C,EAC7C,WAAyB,EACzB,MAAiH,EACjH,QAAmH,EACnH,OAAa;;QAEb,IAAI,OAAO,CAAC,WAAW,KAAK,CAAC,EAAE;YAC7B,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAI,OAAO,CAAC,SAAiB,CAAC,MAAM,IAAI,EAAE,CAAC;YACvE,IAAI,OAAO,KAAK,KAAK,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,OAAO,CAAC,KAAK,KAAK,CAAC,EAAE;gBACpE,OAAO;aACR;YACD,MAAM,SAAS,GAAG,EAAE,CAAC;YACrB,IAAA,cAAK,EACH,SAAS,EACT,eAAM,CAAC,iBAAiB,EACvB,OAAO,CAA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AW,KAAK,CAAC,EAAE;YACpC,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC;YACxB,IAAI,IAAI,CAAC,eAAe,EAAE;gBACxB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;oBACjC,UAAU,EAAE,KAAK;iBAClB,CAAC,CAAC;gBACH,MAAA,IAAI,CAAC,eAAe,CAAC,MAAM,0CAAE,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;aAChE;SACF;IACH,CAAC;CACF,CAAA;AAlEY,wBAAwB;IADpC,IAAA,yBAAU,GAAE;GACA,wBAAwB,CAkEpC;AAlEY,4DAAwB","file":"contribution.js","sourcesContent":["import type {\n IContext2d,\n IGraphic,\n IGraphicAttribute,\n IInteractiveSubRenderContribution,\n IThemeAttribute,\n IDrawContext\n} from '@visactor/vrender-core';\nimport { injectable } from '@visactor/vrender-core';\nimport { PopTip } from './poptip';\nimport { merge } from '@visactor/vutils';\nimport { theme } from './theme';\n\nfunction wrapPoptip(target: Record<string, any>, source: Record<string, any>) {\n merge(target, theme.poptip, source);\n return target;\n}\n\n@injectable()\nexport class PopTipRenderContribution implements IInteractiveSubRenderContribution {\n declare poptipComponent: PopTip;\n render(\n graphic: IGraphic<Partial<IGraphicAttribute>>,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ): void {\n if (graphic._showPoptip === 1) {\n const { visible, visibleCb } = (graphic.attribute as any).poptip || {};\n if (visible === false || (visibleCb && visibleCb(graphic) === false)) {\n return;\n }\n const attribute = {};\n merge(\n attribute,\n PopTip.defaultAttributes,\n (graphic.attribute as any).poptip ? (graphic.attribute as any).poptip : {}\n );\n if (!this.poptipComponent) {\n this.poptipComponent = new PopTip(attribute);\n } else {\n this.poptipComponent.initAttributes(attribute);\n }\n // 如果text图元没有配置title和content的话\n let poptip = (graphic.attribute as any).poptip || {};\n if (graphic.type === 'text' && poptip.title == null && poptip.content == null) {\n const out = {};\n wrapPoptip(out, poptip);\n poptip = out;\n poptip.content = poptip.content ?? (graphic.attribute as any).text;\n }\n const matrix = graphic.globalTransMatrix;\n this.poptipComponent.setAttributes({\n visibleAll: true,\n pickable: false,\n childrenPickable: false,\n ...poptip,\n x: matrix.e,\n y: matrix.f\n });\n // 添加到交互层中\n drawContext.stage.tryInitInteractiveLayer();\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n interactiveLayer.add(this.poptipComponent);\n }\n } else if (graphic._showPoptip === 2) {\n graphic._showPoptip = 0;\n if (this.poptipComponent) {\n this.poptipComponent.setAttributes({\n visibleAll: false\n });\n this.poptipComponent.parent?.removeChild(this.poptipComponent);\n }\n }\n }\n}\n"]}
package/cjs/util/align.js CHANGED
@@ -1,57 +1,37 @@
1
1
  "use strict";
2
2
 
3
3
  function alignAxisLabels(labels, start, containerSize, orient, align) {
4
- if ("right" === orient || "left" === orient) {
5
- if ("left" === align) {
6
- const flag = "right" === orient ? 0 : -1;
7
- labels.forEach((label => {
8
- label.setAttributes({
9
- x: start + containerSize * flag,
10
- textAlign: "left"
11
- });
12
- }));
13
- } else if ("right" === align) {
14
- const flag = "right" === orient ? 1 : 0;
15
- labels.forEach((label => {
16
- label.setAttributes({
17
- x: start + containerSize * flag,
18
- textAlign: "right"
19
- });
20
- }));
21
- } else if ("center" === align) {
22
- const flag = "right" === orient ? 1 : -1;
23
- labels.forEach((label => {
24
- label.setAttributes({
25
- x: start + .5 * containerSize * flag,
26
- textAlign: "center"
27
- });
28
- }));
29
- }
30
- } else if ("bottom" === orient || "top" === orient) if ("top" === align) {
31
- const flag = "bottom" === orient ? 0 : -1;
32
- labels.forEach((label => {
33
- label.setAttributes({
34
- y: start + containerSize * flag,
35
- textBaseline: "top"
36
- });
37
- }));
38
- } else if ("bottom" === align) {
39
- const flag = "bottom" === orient ? 1 : 0;
40
- labels.forEach((label => {
41
- label.setAttributes({
42
- y: start + containerSize * flag,
43
- textBaseline: "bottom"
44
- });
45
- }));
46
- } else if ("middle" === align) {
47
- const flag = "bottom" === orient ? 1 : -1;
48
- labels.forEach((label => {
49
- label.setAttributes({
50
- y: start + .5 * containerSize * flag,
51
- textBaseline: "middle"
52
- });
53
- }));
54
- }
4
+ "left" === orient || "right" === orient ? "left" === align ? labels.forEach((label => {
5
+ var _a;
6
+ label.setAttributes({
7
+ dx: (null !== (_a = label.attribute.dx) && void 0 !== _a ? _a : 0) + start - label.AABBBounds.x1
8
+ });
9
+ })) : "right" === align ? labels.forEach((label => {
10
+ var _a;
11
+ label.setAttributes({
12
+ dx: (null !== (_a = label.attribute.dx) && void 0 !== _a ? _a : 0) + start + containerSize - label.AABBBounds.x2
13
+ });
14
+ })) : "center" === align && labels.forEach((label => {
15
+ var _a;
16
+ label.setAttributes({
17
+ dx: (null !== (_a = label.attribute.dx) && void 0 !== _a ? _a : 0) + start + containerSize / 2 - (label.AABBBounds.x1 + label.AABBBounds.x2) / 2
18
+ });
19
+ })) : "bottom" !== orient && "top" !== orient || ("top" === align ? labels.forEach((label => {
20
+ var _a;
21
+ label.setAttributes({
22
+ dy: (null !== (_a = label.attribute.dy) && void 0 !== _a ? _a : 0) + start - label.AABBBounds.y1
23
+ });
24
+ })) : "bottom" === align ? labels.forEach((label => {
25
+ var _a;
26
+ label.setAttributes({
27
+ dy: (null !== (_a = label.attribute.dy) && void 0 !== _a ? _a : 0) + start + containerSize - label.AABBBounds.y2
28
+ });
29
+ })) : "middle" === align && labels.forEach((label => {
30
+ var _a;
31
+ label.setAttributes({
32
+ dy: (null !== (_a = label.attribute.dy) && void 0 !== _a ? _a : 0) + start + containerSize / 2 - (label.AABBBounds.y1 + label.AABBB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Content":["import type { IText } from '@visactor/vrender-core';\n\nexport function alignAxisLabels(labels: IText[], start: number, containerSize: number, orient: string, align: string) {\n if (orient === 'right' || orient === 'left') {\n if (align === 'left') {\n const flag = orient === 'right' ? 0 : -1;\n labels.forEach(label => {\n label.setAttributes({\n x: start + containerSize * flag,\n textAlign: 'left'\n });\n });\n } else if (align === 'right') {\n const flag = orient === 'right' ? 1 : 0;\n labels.forEach(label => {\n label.setAttributes({\n x: start + containerSize * flag,\n textAlign: 'right'\n });\n });\n } else if (align === 'center') {\n const flag = orient === 'right' ? 1 : -1;\n labels.forEach(label => {\n label.setAttributes({\n x: start + containerSize * 0.5 * flag,\n textAlign: 'center'\n });\n });\n }\n } else if (orient === 'bottom' || orient === 'top') {\n if (align === 'top') {\n const flag = orient === 'bottom' ? 0 : -1;\n labels.forEach(label => {\n label.setAttributes({\n y: start + containerSize * flag,\n textBaseline: 'top'\n });\n });\n } else if (align === 'bottom') {\n const flag = orient === 'bottom' ? 1 : 0;\n labels.forEach(label => {\n label.setAttributes({\n y: start + containerSize * flag,\n textBaseline: 'bottom'\n });\n });\n } else if (align === 'middle') {\n const flag = orient === 'bottom' ? 1 : -1;\n labels.forEach(label => {\n label.setAttributes({\n y: start + containerSize * 0.5 * flag,\n textBaseline: 'middle'\n });\n });\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/util/align.ts"],"names":[],"mappings":";;;AAEA,SAAgB,eAAe,CAAC,MAAe,EAAE,KAAa,EAAE,aAAqB,EAAE,MAAc,EAAE,KAAa;IAClH,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,OAAO,EAAE;QAC3C,IAAI,KAAK,KAAK,MAAM,EAAE;YACpB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;;gBACrB,KAAK,CAAC,aAAa,CAAC;oBAClB,EAAE,EAAE,CAAC,MAAA,KAAK,CAAC,SAAS,CAAC,EAAE,mCAAI,CAAC,CAAC,GAAG,KAAK,GAAG,KAAK,CAA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,CAAC;oBAClB,EAAE,EAAE,CAAC,MAAA,KAAK,CAAC,SAAS,CAAC,EAAE,mCAAI,CAAC,CAAC,GAAG,KAAK,GAAG,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE;iBAC5E,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;aAAM,IAAI,KAAK,KAAK,QAAQ,EAAE;YAC7B,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;;gBACrB,KAAK,CAAC,aAAa,CAAC;oBAClB,EAAE,EAAE,CAAC,MAAA,KAAK,CAAC,SAAS,CAAC,EAAE,mCAAI,CAAC,CAAC,GAAG,KAAK,GAAG,aAAa,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC;iBAC5G,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;KACF;AACH,CAAC;AA1CD,0CA0CC","file":"align.js","sourcesContent":["import type { IText } from '@visactor/vrender-core';\n\nexport function alignAxisLabels(labels: IText[], start: number, containerSize: number, orient: string, align: string) {\n if (orient === 'left' || orient === 'right') {\n if (align === 'left') {\n labels.forEach(label => {\n label.setAttributes({\n dx: (label.attribute.dx ?? 0) + start - label.AABBBounds.x1\n });\n });\n } else if (align === 'right') {\n labels.forEach(label => {\n label.setAttributes({\n dx: (label.attribute.dx ?? 0) + start + containerSize - label.AABBBounds.x2\n });\n });\n } else if (align === 'center') {\n labels.forEach(label => {\n label.setAttributes({\n dx: (label.attribute.dx ?? 0) + start + containerSize / 2 - (label.AABBBounds.x1 + label.AABBBounds.x2) / 2\n });\n });\n }\n } else if (orient === 'bottom' || orient === 'top') {\n if (align === 'top') {\n labels.forEach(label => {\n label.setAttributes({\n dy: (label.attribute.dy ?? 0) + start - label.AABBBounds.y1\n });\n });\n } else if (align === 'bottom') {\n labels.forEach(label => {\n label.setAttributes({\n dy: (label.attribute.dy ?? 0) + start + containerSize - label.AABBBounds.y2\n });\n });\n } else if (align === 'middle') {\n labels.forEach(label => {\n label.setAttributes({\n dy: (label.attribute.dy ?? 0) + start + containerSize / 2 - (label.AABBBounds.y1 + label.AABBBounds.y2) / 2\n });\n });\n }\n }\n}\n"]}
package/dist/index.es.js CHANGED
@@ -3857,7 +3857,7 @@ class Animate {
3857
3857
  delta = this._duringTime + delta * this.timeScale - this._startTime, this._duringTime = this._startTime;
3858
3858
  }
3859
3859
  this.status === AnimateStatus.INITIAL && (this.status = AnimateStatus.RUNNING, this._onStart && this._onStart.forEach(cb => cb()));
3860
- this.setPosition(this.rawPosition + delta * this.timeScale) && this.status === AnimateStatus.RUNNING && (this.status = AnimateStatus.END, this._onEnd && this._onEnd.forEach(cb => cb()));
3860
+ this.setPosition(Math.max(this.rawPosition, 0) + delta * this.timeScale) && this.status === AnimateStatus.RUNNING && (this.status = AnimateStatus.END, this._onEnd && this._onEnd.forEach(cb => cb()));
3861
3861
  }
3862
3862
  setPosition(rawPosition) {
3863
3863
  let sa,
@@ -3980,7 +3980,7 @@ class SubAnimate {
3980
3980
  end = !1;
3981
3981
  const startAt = null !== (_a = this._startAt) && void 0 !== _a ? _a : 0;
3982
3982
  if (rawPosition < 0 && (rawPosition = 0), rawPosition < startAt) return this.rawPosition = rawPosition, !1;
3983
- if (rawPosition -= startAt, d <= 0) return end = !0, end;
3983
+ if (rawPosition -= startAt, d <= 0 && (end = !0, d < 0)) return end;
3984
3984
  if (loop = Math.floor(rawPosition / d), position = rawPosition - loop * d, end = rawPosition >= loopCount * d + d, end && (position = d, loop = loopCount, rawPosition = position * loop + d), rawPosition === prevRawPos) return end;
3985
3985
  const rev = !this.reversed != !(this.bounce && loop % 2);
3986
3986
  return rev && (position = d - position), this._deltaPosition = position - this.position, this.position = position, this.rawPosition = rawPosition + startAt, this.updatePosition(end, rev), end;
@@ -15166,7 +15166,7 @@ function wrapPoptip(target, source) {
15166
15166
  }
15167
15167
  let PopTipRenderContribution = class PopTipRenderContribution {
15168
15168
  render(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
15169
- var _a;
15169
+ var _a, _b;
15170
15170
  if (graphic._showPoptip === 1) {
15171
15171
  const { visible, visibleCb } = graphic.attribute.poptip || {};
15172
15172
  if (visible === false || (visibleCb && visibleCb(graphic) === false)) {
@@ -15197,10 +15197,12 @@ let PopTipRenderContribution = class PopTipRenderContribution {
15197
15197
  }
15198
15198
  else if (graphic._showPoptip === 2) {
15199
15199
  graphic._showPoptip = 0;
15200
- this.poptipComponent &&
15200
+ if (this.poptipComponent) {
15201
15201
  this.poptipComponent.setAttributes({
15202
15202
  visibleAll: false
15203
15203
  });
15204
+ (_b = this.poptipComponent.parent) === null || _b === void 0 ? void 0 : _b.removeChild(this.poptipComponent);
15205
+ }
15204
15206
  }
15205
15207
  }
15206
15208
  };
@@ -16853,7 +16855,17 @@ class LineLabel extends LabelBase {
16853
16855
  if (!graphic || (graphic.type !== 'line' && graphic.type !== 'area')) {
16854
16856
  return super.getGraphicBounds(graphic, point);
16855
16857
  }
16856
- const points = graphic.attribute.points || [point];
16858
+ let points = graphic.attribute.points;
16859
+ const segments = graphic.attribute.segments;
16860
+ if (!points && segments && segments.length) {
16861
+ points = segments.reduce((res, seg) => {
16862
+ var _a;
16863
+ return res.concat((_a = seg.points) !== null && _a !== void 0 ? _a : []);
16864
+ }, []);
16865
+ }
16866
+ if (!points || points.length === 0) {
16867
+ points = [point];
16868
+ }
16857
16869
  const index = position === 'start' ? 0 : points.length - 1;
16858
16870
  if (!points[index]) {
16859
16871
  return;
@@ -18010,7 +18022,6 @@ var AXIS_ELEMENT_NAME;
18010
18022
  AXIS_ELEMENT_NAME["line"] = "axis-line";
18011
18023
  AXIS_ELEMENT_NAME["background"] = "axis-background";
18012
18024
  AXIS_ELEMENT_NAME["axisLabelBackground"] = "axis-label-background";
18013
- AXIS_ELEMENT_NAME["axisBreakSymbol"] = "axis-break-symbol";
18014
18025
  })(AXIS_ELEMENT_NAME || (AXIS_ELEMENT_NAME = {}));
18015
18026
  var AxisStateValue;
18016
18027
  (function (AxisStateValue) {
@@ -18080,12 +18091,6 @@ const DEFAULT_AXIS_THEME = {
18080
18091
  }
18081
18092
  }
18082
18093
  };
18083
- const DEFAULT_AXIS_BREAK_SYMBOL_STYLE = {
18084
- size: 8,
18085
- stroke: '#000',
18086
- lineWidth: 1,
18087
- zIndex: 1
18088
- };
18089
18094
 
18090
18095
  const clampRadian = (angle = 0) => {
18091
18096
  if (angle < 0) {
@@ -18143,13 +18148,6 @@ function getCircleLabelPosition(tickPosition, tickVector, text, style) {
18143
18148
  const y = baseY - dy;
18144
18149
  return { x, y };
18145
18150
  }
18146
- function getAxisBreakSymbolAttrs(props = {}) {
18147
- var _a, _b;
18148
- const { style = {} } = props;
18149
- const symbolStyle = merge({}, DEFAULT_AXIS_BREAK_SYMBOL_STYLE, style);
18150
- const symbolSize = (_a = symbolStyle.size) !== null && _a !== void 0 ? _a : DEFAULT_AXIS_BREAK_SYMBOL_STYLE.size;
18151
- return Object.assign(Object.assign({}, symbolStyle), { symbolType: (_b = symbolStyle.symbolType) !== null && _b !== void 0 ? _b : `M ${-symbolSize / 2} ${symbolSize / 6} L ${symbolSize / 2} ${-symbolSize / 6}`, symbolSize });
18152
- }
18153
18151
  function getElMap(g) {
18154
18152
  const elMap = {};
18155
18153
  traverseGroup(g, (el) => {
@@ -18366,7 +18364,8 @@ class AxisBase extends AbstractComponent {
18366
18364
  let maxTextHeight = 0;
18367
18365
  let textAlign = 'center';
18368
18366
  let textBaseline = 'middle';
18369
- labels.forEach((label) => {
18367
+ let labelPos = 0;
18368
+ labels.forEach((label, index) => {
18370
18369
  var _a;
18371
18370
  const labelStyle = label.attribute;
18372
18371
  const angle = (_a = labelStyle.angle) !== null && _a !== void 0 ? _a : 0;
@@ -18381,10 +18380,14 @@ class AxisBase extends AbstractComponent {
18381
18380
  maxTextHeight = Math.max(maxTextHeight, textHeight);
18382
18381
  textAlign = labelStyle.textAlign;
18383
18382
  textBaseline = labelStyle.textBaseline;
18383
+ if (index === 0) {
18384
+ labelPos = labelStyle.x;
18385
+ }
18384
18386
  });
18385
18387
  this.axisLabelLayerSize[layer] = {
18386
18388
  width: maxTextWidth,
18387
18389
  height: maxTextHeight,
18390
+ labelPos,
18388
18391
  textAlign,
18389
18392
  textBaseline
18390
18393
  };
@@ -18876,11 +18879,11 @@ function getXAxisLabelAlign(orient, angle = 0) {
18876
18879
  };
18877
18880
  }
18878
18881
  function getYAxisLabelAlign(orient, angle = 0) {
18879
- let align = ['right', 'right', 'center', 'left', 'center', 'left', 'center', 'right', 'right'];
18882
+ let align = ['right', 'right', 'center', 'left', 'left', 'left', 'center', 'right', 'right'];
18880
18883
  let baseline = ['middle', 'middle', 'top', 'top', 'middle', 'middle', 'bottom', 'bottom', 'middle'];
18881
18884
  if (orient === 'right') {
18882
- align = ['left', 'right', 'right', 'right', 'left', 'left', 'left', 'left', 'right'];
18883
- baseline = ['middle', 'bottom', 'middle', 'top', 'top', 'top', 'middle', 'bottom', 'bottom'];
18885
+ align = ['left', 'left', 'center', 'right', 'right', 'right', 'center', 'left', 'left'];
18886
+ baseline = ['middle', 'middle', 'bottom', 'bottom', 'middle', 'middle', 'top', 'middle', 'middle'];
18884
18887
  }
18885
18888
  angle = clampAngle(angle);
18886
18889
  const step = angle / (Math.PI * 0.5);
@@ -18972,60 +18975,54 @@ function autoLimit(labels, config) {
18972
18975
  }
18973
18976
 
18974
18977
  function alignAxisLabels(labels, start, containerSize, orient, align) {
18975
- if (orient === 'right' || orient === 'left') {
18978
+ if (orient === 'left' || orient === 'right') {
18976
18979
  if (align === 'left') {
18977
- const flag = orient === 'right' ? 0 : -1;
18978
18980
  labels.forEach(label => {
18981
+ var _a;
18979
18982
  label.setAttributes({
18980
- x: start + containerSize * flag,
18981
- textAlign: 'left'
18983
+ dx: ((_a = label.attribute.dx) !== null && _a !== void 0 ? _a : 0) + start - label.AABBBounds.x1
18982
18984
  });
18983
18985
  });
18984
18986
  }
18985
18987
  else if (align === 'right') {
18986
- const flag = orient === 'right' ? 1 : 0;
18987
18988
  labels.forEach(label => {
18989
+ var _a;
18988
18990
  label.setAttributes({
18989
- x: start + containerSize * flag,
18990
- textAlign: 'right'
18991
+ dx: ((_a = label.attribute.dx) !== null && _a !== void 0 ? _a : 0) + start + containerSize - label.AABBBounds.x2
18991
18992
  });
18992
18993
  });
18993
18994
  }
18994
18995
  else if (align === 'center') {
18995
- const flag = orient === 'right' ? 1 : -1;
18996
18996
  labels.forEach(label => {
18997
+ var _a;
18997
18998
  label.setAttributes({
18998
- x: start + containerSize * 0.5 * flag,
18999
- textAlign: 'center'
18999
+ dx: ((_a = label.attribute.dx) !== null && _a !== void 0 ? _a : 0) + start + containerSize / 2 - (label.AABBBounds.x1 + label.AABBBounds.x2) / 2
19000
19000
  });
19001
19001
  });
19002
19002
  }
19003
19003
  }
19004
19004
  else if (orient === 'bottom' || orient === 'top') {
19005
19005
  if (align === 'top') {
19006
- const flag = orient === 'bottom' ? 0 : -1;
19007
19006
  labels.forEach(label => {
19007
+ var _a;
19008
19008
  label.setAttributes({
19009
- y: start + containerSize * flag,
19010
- textBaseline: 'top'
19009
+ dy: ((_a = label.attribute.dy) !== null && _a !== void 0 ? _a : 0) + start - label.AABBBounds.y1
19011
19010
  });
19012
19011
  });
19013
19012
  }
19014
19013
  else if (align === 'bottom') {
19015
- const flag = orient === 'bottom' ? 1 : 0;
19016
19014
  labels.forEach(label => {
19015
+ var _a;
19017
19016
  label.setAttributes({
19018
- y: start + containerSize * flag,
19019
- textBaseline: 'bottom'
19017
+ dy: ((_a = label.attribute.dy) !== null && _a !== void 0 ? _a : 0) + start + containerSize - label.AABBBounds.y2
19020
19018
  });
19021
19019
  });
19022
19020
  }
19023
19021
  else if (align === 'middle') {
19024
- const flag = orient === 'bottom' ? 1 : -1;
19025
19022
  labels.forEach(label => {
19023
+ var _a;
19026
19024
  label.setAttributes({
19027
- y: start + containerSize * 0.5 * flag,
19028
- textBaseline: 'middle'
19025
+ dy: ((_a = label.attribute.dy) !== null && _a !== void 0 ? _a : 0) + start + containerSize / 2 - (label.AABBBounds.y1 + label.AABBBounds.y2) / 2
19029
19026
  });
19030
19027
  });
19031
19028
  }
@@ -19087,34 +19084,7 @@ class LineAxis extends AxisBase {
19087
19084
  }
19088
19085
  _renderInner(container) {
19089
19086
  var _a;
19090
- if (this.attribute.breaks && this.attribute.breaks.length) {
19091
- this._breaks = this.attribute.breaks
19092
- .sort((preBreak, currBreak) => preBreak.range[0] - currBreak.range[1])
19093
- .map(breakProps => {
19094
- const { range, breakSymbol } = breakProps;
19095
- return {
19096
- startPoint: this.getTickCoord(range[0]),
19097
- endPoint: this.getTickCoord(range[1]),
19098
- range,
19099
- breakSymbol
19100
- };
19101
- });
19102
- }
19103
19087
  super._renderInner(container);
19104
- if (this._breaks && this._breaks.length) {
19105
- this._breaks.forEach(b => {
19106
- const { startPoint, endPoint, breakSymbol } = b;
19107
- if ((breakSymbol === null || breakSymbol === void 0 ? void 0 : breakSymbol.visible) !== false) {
19108
- const symbolStyle = getAxisBreakSymbolAttrs(breakSymbol);
19109
- const shape1 = graphicCreator.symbol(Object.assign({ x: startPoint.x, y: startPoint.y }, symbolStyle));
19110
- shape1.name = AXIS_ELEMENT_NAME.axisBreakSymbol;
19111
- const shape2 = graphicCreator.symbol(Object.assign({ x: endPoint.x, y: endPoint.y }, symbolStyle));
19112
- shape2.name = AXIS_ELEMENT_NAME.axisBreakSymbol;
19113
- container.add(shape1);
19114
- container.add(shape2);
19115
- }
19116
- });
19117
- }
19118
19088
  const { panel } = this.attribute;
19119
19089
  if (panel && panel.visible) {
19120
19090
  const axisContainer = this.axisContainer;
@@ -19128,24 +19098,9 @@ class LineAxis extends AxisBase {
19128
19098
  }
19129
19099
  renderLine(container) {
19130
19100
  const { start, end, line } = this.attribute;
19131
- const _a = line, { startSymbol, endSymbol, style, state } = _a, restLineAttrs = __rest(_a, ["startSymbol", "endSymbol", "style", "state"]);
19132
- const lineAttrs = Object.assign({ startSymbol,
19101
+ const _a = line, { startSymbol, endSymbol, style, breakRange, breakShape, breakShapeStyle, state } = _a, restLineAttrs = __rest(_a, ["startSymbol", "endSymbol", "style", "breakRange", "breakShape", "breakShapeStyle", "state"]);
19102
+ const lineAttrs = Object.assign({ points: [start, end], startSymbol,
19133
19103
  endSymbol, lineStyle: style }, restLineAttrs);
19134
- if (this._breaks && this._breaks.length) {
19135
- const linePoints = [];
19136
- let lastStartPoint = start;
19137
- this._breaks.forEach(b => {
19138
- const { startPoint, endPoint } = b;
19139
- linePoints.push([lastStartPoint, startPoint]);
19140
- lastStartPoint = endPoint;
19141
- });
19142
- linePoints.push([lastStartPoint, end]);
19143
- lineAttrs.points = linePoints;
19144
- lineAttrs.multiSegment = true;
19145
- }
19146
- else {
19147
- lineAttrs.points = [start, end];
19148
- }
19149
19104
  if (!isEmpty(state)) {
19150
19105
  lineAttrs.state = {
19151
19106
  line: merge({}, DEFAULT_STATES$1, state),
@@ -19187,9 +19142,20 @@ class LineAxis extends AxisBase {
19187
19142
  }
19188
19143
  else {
19189
19144
  if (axisVector[0] === 0) {
19190
- const boundsWidth = this.axisLabelsContainer ? this.axisLabelsContainer.AABBBounds.width() : 0;
19191
- if (isFinite(boundsWidth)) {
19192
- labelLength += boundsWidth + (layerCount - 1) * space;
19145
+ if (this.axisLabelsContainer &&
19146
+ this.axisLabelsContainer.AABBBounds &&
19147
+ !this.axisLabelsContainer.AABBBounds.empty()) {
19148
+ const baseX = this.axisLabelLayerSize[0].labelPos;
19149
+ const bounds = this.axisLabelsContainer.AABBBounds;
19150
+ labelLength +=
19151
+ (factor === 1
19152
+ ? bounds.x2 > baseX
19153
+ ? Math.min(bounds.x2 - baseX, bounds.width())
19154
+ : 0
19155
+ : bounds.x1 < baseX
19156
+ ? Math.min(baseX - bounds.x1, bounds.width())
19157
+ : 0) +
19158
+ (layerCount - 1) * space;
19193
19159
  }
19194
19160
  else {
19195
19161
  labelLength = 0;
@@ -19200,36 +19166,6 @@ class LineAxis extends AxisBase {
19200
19166
  labelLength += this.axisLabelLayerSize[layer].width + (index > 0 ? space : 0);
19201
19167
  });
19202
19168
  }
19203
- const textAlign = this.axisLabelLayerSize[0].textAlign;
19204
- const isTextAlignStart = textAlign === 'start' || textAlign === 'left';
19205
- const isTextCenter = textAlign === 'center';
19206
- const isReverse = axisVector[1] > 0;
19207
- if (factor === 1) {
19208
- labelLength = isReverse
19209
- ? isTextAlignStart
19210
- ? labelLength
19211
- : isTextCenter
19212
- ? labelLength / 2
19213
- : space
19214
- : isTextAlignStart
19215
- ? space
19216
- : isTextCenter
19217
- ? labelLength / 2
19218
- : labelLength;
19219
- }
19220
- else {
19221
- labelLength = isReverse
19222
- ? isTextAlignStart
19223
- ? space
19224
- : isTextCenter
19225
- ? labelLength / 2
19226
- : labelLength
19227
- : isTextAlignStart
19228
- ? labelLength
19229
- : isTextCenter
19230
- ? labelLength / 2
19231
- : space;
19232
- }
19233
19169
  }
19234
19170
  }
19235
19171
  let tickLength = 0;
@@ -19517,13 +19453,13 @@ class LineAxis extends AxisBase {
19517
19453
  if (isValid(this.attribute.label.containerAlign)) {
19518
19454
  let start;
19519
19455
  if (orient === 'left') {
19520
- start = axisLabelContainerBounds.x2;
19456
+ start = axisLabelContainerBounds.x2 - axisLabelContainerSize;
19521
19457
  }
19522
19458
  else if (orient === 'right') {
19523
19459
  start = axisLabelContainerBounds.x1;
19524
19460
  }
19525
19461
  else if (orient === 'top') {
19526
- start = axisLabelContainerBounds.y2;
19462
+ start = axisLabelContainerBounds.y2 - axisLabelContainerSize;
19527
19463
  }
19528
19464
  else if (orient === 'bottom') {
19529
19465
  start = axisLabelContainerBounds.y1;
@@ -19919,38 +19855,8 @@ const isAxisHorizontal = (axisOrientType) => {
19919
19855
  return ['bottom', 'top', 'z'].includes(axisOrientType);
19920
19856
  };
19921
19857
 
19922
- function getScaleTicks(op, scale, count, getTicks) {
19923
- let scaleTicks;
19924
- const { breakData } = op;
19925
- if (breakData) {
19926
- const { scope, range: breakRanges } = breakData();
19927
- const domain = scale.domain();
19928
- scaleTicks = [];
19929
- for (let i = 0; i < domain.length; i++) {
19930
- if (i < domain.length - 1) {
19931
- const range = [domain[i], domain[i + 1]];
19932
- const [start, end] = scope[i];
19933
- const subCount = (end - start) * count;
19934
- if (subCount > 0) {
19935
- const ticks = getTicks(subCount > 1 ? Math.floor(subCount) : 1, range);
19936
- ticks.forEach(tick => {
19937
- if (!breakRanges.some((breakRange) => tick >= breakRange[0] && tick <= breakRange[1])) {
19938
- scaleTicks.push(tick);
19939
- }
19940
- });
19941
- }
19942
- }
19943
- }
19944
- scale.domain(domain);
19945
- }
19946
- else {
19947
- scaleTicks = getTicks(count);
19948
- }
19949
- return scaleTicks;
19950
- }
19951
19858
  const DEFAULT_CONTINUOUS_TICK_COUNT = 5;
19952
19859
  const continuousTicks = (scale, op) => {
19953
- var _a, _b;
19954
19860
  if (!isContinuous(scale.type)) {
19955
19861
  return convertDomainToTickData(scale.domain());
19956
19862
  }
@@ -19959,37 +19865,22 @@ const continuousTicks = (scale, op) => {
19959
19865
  if (rangeSize < 2) {
19960
19866
  return convertDomainToTickData([scale.domain()[0]]);
19961
19867
  }
19962
- const { tickCount, forceTickCount, tickStep, noDecimals = false, labelStyle, breakData } = op;
19868
+ const { tickCount, forceTickCount, tickStep, noDecimals = false, labelStyle } = op;
19963
19869
  let scaleTicks;
19964
19870
  if (isValid(tickStep)) {
19965
19871
  scaleTicks = scale.stepTicks(tickStep);
19966
19872
  }
19967
19873
  else if (isValid(forceTickCount)) {
19968
- scaleTicks = getScaleTicks(op, scale, forceTickCount, (count, range) => {
19969
- if (range && range.length) {
19970
- return scale.domain(range).forceTicks(count);
19971
- }
19972
- return scale.forceTicks(count);
19973
- });
19874
+ scaleTicks = scale.forceTicks(forceTickCount);
19974
19875
  }
19975
19876
  else if (op.tickMode === 'd3') {
19976
- const count = (_a = (isFunction(tickCount) ? tickCount({ axisLength: rangeSize, labelStyle }) : tickCount)) !== null && _a !== void 0 ? _a : DEFAULT_CONTINUOUS_TICK_COUNT;
19977
- scaleTicks = getScaleTicks(op, scale, count, (count, range) => {
19978
- if (range && range.length) {
19979
- return scale.domain(range).d3Ticks(count, { noDecimals });
19980
- }
19981
- return scale.d3Ticks(count, { noDecimals });
19982
- });
19877
+ const count = isFunction(tickCount) ? tickCount({ axisLength: rangeSize, labelStyle }) : tickCount;
19878
+ scaleTicks = scale.d3Ticks(count !== null && count !== void 0 ? count : DEFAULT_CONTINUOUS_TICK_COUNT, { noDecimals });
19983
19879
  }
19984
19880
  else {
19985
- const count = (_b = (isFunction(tickCount) ? tickCount({ axisLength: rangeSize, labelStyle }) : tickCount)) !== null && _b !== void 0 ? _b : DEFAULT_CONTINUOUS_TICK_COUNT;
19881
+ const count = isFunction(tickCount) ? tickCount({ axisLength: rangeSize, labelStyle }) : tickCount;
19986
19882
  const customTicks = isFunction(op.tickMode) ? op.tickMode : undefined;
19987
- scaleTicks = getScaleTicks(op, scale, count, (count, range) => {
19988
- if (range && range.length) {
19989
- return scale.domain(range).ticks(count, { noDecimals, customTicks });
19990
- }
19991
- return scale.ticks(count, { noDecimals, customTicks });
19992
- });
19883
+ scaleTicks = scale.ticks(count !== null && count !== void 0 ? count : DEFAULT_CONTINUOUS_TICK_COUNT, { noDecimals, customTicks });
19993
19884
  }
19994
19885
  if (op.sampling) {
19995
19886
  if (op.coordinateType === 'cartesian' || (op.coordinateType === 'polar' && op.axisOrientType === 'radius')) {
@@ -26206,14 +26097,14 @@ class Indicator extends AbstractComponent {
26206
26097
  return undefined;
26207
26098
  }
26208
26099
  render() {
26209
- var _a;
26100
+ var _a, _b;
26210
26101
  this.removeAllChild(true);
26211
26102
  if (this.attribute.visible !== true) {
26212
26103
  return;
26213
26104
  }
26214
26105
  const { title = {}, content, size, limitRatio = Infinity } = this.attribute;
26215
26106
  const limit = Math.min(size.width, size.height) * limitRatio;
26216
- const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group');
26107
+ const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1, pickable: (_a = this.attribute.pickable) !== null && _a !== void 0 ? _a : true }, 'group');
26217
26108
  if (isValid(title)) {
26218
26109
  this._title = this._renderText(group, title, limit, limitRatio, 'title.style', 'indicator-title');
26219
26110
  }
@@ -26229,7 +26120,7 @@ class Indicator extends AbstractComponent {
26229
26120
  }
26230
26121
  this._setGlobalAutoFit(limit);
26231
26122
  this._setYPosition();
26232
- const totalHeight = (_a = group === null || group === void 0 ? void 0 : group.AABBBounds.height()) !== null && _a !== void 0 ? _a : 0;
26123
+ const totalHeight = (_b = group === null || group === void 0 ? void 0 : group.AABBBounds.height()) !== null && _b !== void 0 ? _b : 0;
26233
26124
  group.setAttribute('y', size.height / 2 - totalHeight / 2);
26234
26125
  group.setAttribute('x', size.width / 2);
26235
26126
  }
@@ -28618,6 +28509,6 @@ EmptyTip.defaultAttributes = {
28618
28509
  }
28619
28510
  };
28620
28511
 
28621
- const version = "0.20.1-alpha.4";
28512
+ const version = "0.20.1-alpha.5";
28622
28513
 
28623
- export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, ticks, traverseGroup, version };
28514
+ export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, ticks, traverseGroup, version };
package/es/axis/base.d.ts CHANGED
@@ -22,6 +22,7 @@ export declare abstract class AxisBase<T extends AxisBaseAttributes> extends Abs
22
22
  height: number;
23
23
  textAlign: string;
24
24
  textBaseline: string;
25
+ labelPos: number;
25
26
  }>;
26
27
  protected axisLabelsContainer: IGroup | null;
27
28
  protected axisContainer: IGroup;