@visactor/vchart-extension 2.1.0-alpha.16 → 2.1.0-alpha.17

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 (99) hide show
  1. package/build/index.js +401 -469
  2. package/build/index.min.js +1 -1
  3. package/cjs/charts/bar-3d/interface.js +1 -2
  4. package/cjs/charts/candlestick/candlestick.js +2 -1
  5. package/cjs/charts/conversion-funnel/arrow-data-transform.js +0 -1
  6. package/cjs/charts/funnel-3d/chart.js +1 -1
  7. package/cjs/charts/funnel-3d/constant.js +1 -1
  8. package/cjs/charts/funnel-3d/index.js +1 -1
  9. package/cjs/charts/funnel-3d/interface.js +1 -1
  10. package/cjs/charts/funnel-3d/series-spec-transformer.js +1 -1
  11. package/cjs/charts/funnel-3d/series.js +1 -1
  12. package/cjs/charts/funnel-3d/theme.js +1 -1
  13. package/cjs/charts/histogram-3d/chart.js +2 -1
  14. package/cjs/charts/histogram-3d/index.js +1 -1
  15. package/cjs/charts/histogram-3d/interface.js +1 -1
  16. package/cjs/charts/image-cloud/image-cloud-transformer.js +1 -1
  17. package/cjs/charts/image-cloud/image-cloud.js +1 -1
  18. package/cjs/charts/image-cloud/index.js +1 -1
  19. package/cjs/charts/image-cloud/interface.js +1 -1
  20. package/cjs/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
  21. package/cjs/charts/storyline/interface.d.ts +8 -2
  22. package/cjs/charts/storyline/interface.js.map +1 -1
  23. package/cjs/charts/storyline/layout.js +19 -25
  24. package/cjs/charts/storyline/layout.js.map +1 -1
  25. package/cjs/charts/storyline/layouts/arc.d.ts +5 -0
  26. package/cjs/charts/storyline/layouts/{dome.js → arc.js} +56 -61
  27. package/cjs/charts/storyline/layouts/arc.js.map +1 -0
  28. package/cjs/charts/storyline/layouts/clock.js +8 -9
  29. package/cjs/charts/storyline/layouts/clock.js.map +1 -1
  30. package/cjs/charts/storyline/layouts/common.d.ts +3 -2
  31. package/cjs/charts/storyline/layouts/common.js +7 -7
  32. package/cjs/charts/storyline/layouts/common.js.map +1 -1
  33. package/cjs/charts/storyline/layouts/default.js +6 -4
  34. package/cjs/charts/storyline/layouts/default.js.map +1 -1
  35. package/cjs/charts/storyline/layouts/ladder.d.ts +5 -0
  36. package/cjs/charts/storyline/layouts/ladder.js +205 -0
  37. package/cjs/charts/storyline/layouts/ladder.js.map +1 -0
  38. package/cjs/charts/storyline/layouts/landscape.js +5 -3
  39. package/cjs/charts/storyline/layouts/landscape.js.map +1 -1
  40. package/cjs/charts/storyline/layouts/portrait.js +16 -42
  41. package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
  42. package/cjs/charts/storyline/layouts/wing.js +14 -14
  43. package/cjs/charts/storyline/layouts/wing.js.map +1 -1
  44. package/cjs/charts/storyline/storyline-transformer.js +27 -15
  45. package/cjs/charts/storyline/storyline-transformer.js.map +1 -1
  46. package/esm/charts/bar-3d/interface.js +1 -2
  47. package/esm/charts/candlestick/candlestick.js +2 -1
  48. package/esm/charts/conversion-funnel/arrow-data-transform.js +1 -2
  49. package/esm/charts/funnel-3d/chart.js +1 -1
  50. package/esm/charts/funnel-3d/constant.js +1 -1
  51. package/esm/charts/funnel-3d/index.js +1 -1
  52. package/esm/charts/funnel-3d/interface.js +1 -1
  53. package/esm/charts/funnel-3d/series-spec-transformer.js +1 -1
  54. package/esm/charts/funnel-3d/series.js +1 -1
  55. package/esm/charts/funnel-3d/theme.js +1 -1
  56. package/esm/charts/histogram-3d/chart.js +2 -1
  57. package/esm/charts/histogram-3d/index.js +1 -1
  58. package/esm/charts/histogram-3d/interface.js +1 -1
  59. package/esm/charts/image-cloud/image-cloud-transformer.js +1 -1
  60. package/esm/charts/image-cloud/image-cloud.js +1 -1
  61. package/esm/charts/image-cloud/index.js +1 -1
  62. package/esm/charts/image-cloud/interface.js +1 -1
  63. package/esm/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
  64. package/esm/charts/storyline/interface.d.ts +8 -2
  65. package/esm/charts/storyline/interface.js.map +1 -1
  66. package/esm/charts/storyline/layout.js +19 -25
  67. package/esm/charts/storyline/layout.js.map +1 -1
  68. package/esm/charts/storyline/layouts/arc.d.ts +5 -0
  69. package/esm/charts/storyline/layouts/{dome.js → arc.js} +51 -57
  70. package/esm/charts/storyline/layouts/arc.js.map +1 -0
  71. package/esm/charts/storyline/layouts/clock.js +8 -9
  72. package/esm/charts/storyline/layouts/clock.js.map +1 -1
  73. package/esm/charts/storyline/layouts/common.d.ts +3 -2
  74. package/esm/charts/storyline/layouts/common.js +3 -3
  75. package/esm/charts/storyline/layouts/common.js.map +1 -1
  76. package/esm/charts/storyline/layouts/default.js +6 -4
  77. package/esm/charts/storyline/layouts/default.js.map +1 -1
  78. package/esm/charts/storyline/layouts/ladder.d.ts +5 -0
  79. package/esm/charts/storyline/layouts/ladder.js +196 -0
  80. package/esm/charts/storyline/layouts/ladder.js.map +1 -0
  81. package/esm/charts/storyline/layouts/landscape.js +5 -3
  82. package/esm/charts/storyline/layouts/landscape.js.map +1 -1
  83. package/esm/charts/storyline/layouts/portrait.js +16 -42
  84. package/esm/charts/storyline/layouts/portrait.js.map +1 -1
  85. package/esm/charts/storyline/layouts/wing.js +14 -14
  86. package/esm/charts/storyline/layouts/wing.js.map +1 -1
  87. package/esm/charts/storyline/storyline-transformer.js +25 -15
  88. package/esm/charts/storyline/storyline-transformer.js.map +1 -1
  89. package/package.json +2 -2
  90. package/cjs/charts/storyline/layouts/bowl.d.ts +0 -5
  91. package/cjs/charts/storyline/layouts/bowl.js +0 -285
  92. package/cjs/charts/storyline/layouts/bowl.js.map +0 -1
  93. package/cjs/charts/storyline/layouts/dome.d.ts +0 -5
  94. package/cjs/charts/storyline/layouts/dome.js.map +0 -1
  95. package/esm/charts/storyline/layouts/bowl.d.ts +0 -5
  96. package/esm/charts/storyline/layouts/bowl.js +0 -277
  97. package/esm/charts/storyline/layouts/bowl.js.map +0 -1
  98. package/esm/charts/storyline/layouts/dome.d.ts +0 -5
  99. package/esm/charts/storyline/layouts/dome.js.map +0 -1
@@ -2,5 +2,4 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- });
6
- //# sourceMappingURL=interface.js.map
5
+ });
@@ -22,4 +22,5 @@ const registerCandlestickChart = () => {
22
22
  (0, candlestick_1.registerCandlestickSeries)(), vchart_1.Factory.registerChart(CandlestickChart.type, CandlestickChart);
23
23
  };
24
24
 
25
- exports.registerCandlestickChart = registerCandlestickChart;
25
+ exports.registerCandlestickChart = registerCandlestickChart;
26
+ //# sourceMappingURL=candlestick.js.map
@@ -95,5 +95,4 @@ function computeIndex(arrow, totalArrows) {
95
95
  return index;
96
96
  }
97
97
 
98
- //# sourceMappingURL=arrow-data-transform.js.map
99
98
  exports.conversionArrowTransform = conversionArrowTransform;
@@ -22,4 +22,4 @@ const registerFunnel3dChart = () => {
22
22
  };
23
23
 
24
24
  exports.registerFunnel3dChart = registerFunnel3dChart;
25
- //# sourceMappingURL=chart.js.map
25
+ //# sourceMappingURL=chart.js.map
@@ -28,4 +28,4 @@ exports.funnel3dSeriesMark = Object.assign(Object.assign({}, vchart_1.baseSeries
28
28
  type: "rule"
29
29
  }
30
30
  });
31
- //# sourceMappingURL=constant.js.map
31
+ //# sourceMappingURL=constant.js.map
@@ -19,4 +19,4 @@ Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
20
  }), __exportStar(require("./chart"), exports), __exportStar(require("./series"), exports),
21
21
  __exportStar(require("./series-spec-transformer"), exports), __exportStar(require("./interface"), exports);
22
- //# sourceMappingURL=index.js.map
22
+ //# sourceMappingURL=index.js.map
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  });
6
- //# sourceMappingURL=interface.js.map
6
+ //# sourceMappingURL=interface.js.map
@@ -13,4 +13,4 @@ class Funnel3dSeriesSpecTransformer extends vchart_1.FunnelSeriesSpecTransformer
13
13
  }
14
14
 
15
15
  exports.Funnel3dSeriesSpecTransformer = Funnel3dSeriesSpecTransformer;
16
- //# sourceMappingURL=series-spec-transformer.js.map
16
+ //# sourceMappingURL=series-spec-transformer.js.map
@@ -80,4 +80,4 @@ const registerFunnel3dSeries = () => {
80
80
  };
81
81
 
82
82
  exports.registerFunnel3dSeries = registerFunnel3dSeries;
83
- //# sourceMappingURL=series.js.map
83
+ //# sourceMappingURL=series.js.map
@@ -7,4 +7,4 @@ Object.defineProperty(exports, "__esModule", {
7
7
  const vchart_1 = require("@visactor/vchart");
8
8
 
9
9
  exports.funnel3d = (0, vchart_1.getFunnelTheme)(!0);
10
- //# sourceMappingURL=theme.js.map
10
+ //# sourceMappingURL=theme.js.map
@@ -27,4 +27,5 @@ const registerHistogram3dChart = () => {
27
27
  (0, series_1.registerBar3dSeries)(), vchart_1.Factory.registerChart(Histogram3dChart.type, Histogram3dChart);
28
28
  };
29
29
 
30
- exports.registerHistogram3dChart = registerHistogram3dChart;
30
+ exports.registerHistogram3dChart = registerHistogram3dChart;
31
+ //# sourceMappingURL=chart.js.map
@@ -18,4 +18,4 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
20
  }), __exportStar(require("./chart"), exports), __exportStar(require("./interface"), exports);
21
- //# sourceMappingURL=index.js.map
21
+ //# sourceMappingURL=index.js.map
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  });
6
- //# sourceMappingURL=interface.js.map
6
+ //# sourceMappingURL=interface.js.map
@@ -16,4 +16,4 @@ class ImageCloudChartSpecTransformer extends vchart_1.BaseChartSpecTransformer {
16
16
  }
17
17
 
18
18
  exports.ImageCloudChartSpecTransformer = ImageCloudChartSpecTransformer;
19
- //# sourceMappingURL=image-cloud-transformer.js.map
19
+ //# sourceMappingURL=image-cloud-transformer.js.map
@@ -21,4 +21,4 @@ const registerImageCloudChart = () => {
21
21
  };
22
22
 
23
23
  exports.registerImageCloudChart = registerImageCloudChart;
24
- //# sourceMappingURL=image-cloud.js.map
24
+ //# sourceMappingURL=image-cloud.js.map
@@ -18,4 +18,4 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
20
  }), __exportStar(require("./image-cloud"), exports), __exportStar(require("./interface"), exports);
21
- //# sourceMappingURL=index.js.map
21
+ //# sourceMappingURL=index.js.map
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  });
6
- //# sourceMappingURL=interface.js.map
6
+ //# sourceMappingURL=interface.js.map
@@ -50,4 +50,4 @@ const registerElementHighlightByGraphicName = () => {
50
50
  };
51
51
 
52
52
  exports.registerElementHighlightByGraphicName = registerElementHighlightByGraphicName;
53
- //# sourceMappingURL=element-highlight-by-graphic-name.js.map
53
+ //# sourceMappingURL=element-highlight-by-graphic-name.js.map
@@ -1,13 +1,16 @@
1
1
  import type { IChartSpec, IComposedTextMarkSpec, IImageMarkSpec, IMarkSpec, IPathMarkSpec, IRectMarkSpec, ITextMarkSpec, StringOrNumber } from '@visactor/vchart';
2
- export type StorylineLayoutType = 'clock' | 'bowl' | 'dome' | 'wing' | 'landscape' | 'portrait' | 'up-ladder' | 'down-ladder' | 'pulse' | 'spiral';
2
+ export type StorylineLayoutType = 'clock' | 'arc' | 'wing' | 'landscape' | 'portrait' | 'ladder' | 'spiral';
3
3
  export type StorylineImagePosition = 'top' | 'left' | 'right' | 'bottom';
4
4
  export type StorylineLineType = 'line' | 'polyline' | 'curve';
5
5
  export type StorylineWingDirection = 'left' | 'right';
6
+ export type StorylineLadderDirection = 'up' | 'down';
7
+ export type StorylineArcDirection = 'up' | 'down';
6
8
  export interface IStorylineBlock {
7
9
  id?: StringOrNumber;
8
10
  title?: string;
9
11
  content?: string | string[];
10
12
  image?: string | HTMLImageElement | HTMLCanvasElement;
13
+ subImage?: string | HTMLImageElement | HTMLCanvasElement;
11
14
  datum?: unknown;
12
15
  }
13
16
  export interface IStorylineLayoutOptions {
@@ -16,7 +19,8 @@ export interface IStorylineLayoutOptions {
16
19
  radiusRatio?: number;
17
20
  startAngle?: number;
18
21
  endAngle?: number;
19
- direction?: StorylineWingDirection;
22
+ direction?: StorylineWingDirection | StorylineLadderDirection | StorylineArcDirection;
23
+ headline?: string;
20
24
  }
21
25
  export interface IStorylineBlockSpec {
22
26
  width?: number;
@@ -26,6 +30,7 @@ export interface IStorylineBlockSpec {
26
30
  height?: number;
27
31
  padding?: number | [number, number, number, number];
28
32
  gap?: number;
33
+ showBackground?: boolean;
29
34
  style?: Partial<IRectMarkSpec>;
30
35
  }
31
36
  export interface IStorylineImageSpec extends IMarkSpec<IImageMarkSpec> {
@@ -33,6 +38,7 @@ export interface IStorylineImageSpec extends IMarkSpec<IImageMarkSpec> {
33
38
  height?: number;
34
39
  position?: StorylineImagePosition;
35
40
  gap?: number;
41
+ showBackground?: boolean;
36
42
  }
37
43
  export interface IStorylineCenterImageSpec extends IMarkSpec<IImageMarkSpec> {
38
44
  width?: number;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/charts/storyline/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type {\n IChartSpec,\n IComposedTextMarkSpec,\n IImageMarkSpec,\n IMarkSpec,\n IPathMarkSpec,\n IRectMarkSpec,\n ITextMarkSpec,\n StringOrNumber\n} from '@visactor/vchart';\n\nexport type StorylineLayoutType =\n | 'clock'\n | 'bowl'\n | 'dome'\n | 'wing'\n | 'landscape'\n | 'portrait'\n | 'up-ladder'\n | 'down-ladder'\n | 'pulse'\n | 'spiral';\n\nexport type StorylineImagePosition = 'top' | 'left' | 'right' | 'bottom';\nexport type StorylineLineType = 'line' | 'polyline' | 'curve';\nexport type StorylineWingDirection = 'left' | 'right';\n\nexport interface IStorylineBlock {\n id?: StringOrNumber;\n title?: string;\n content?: string | string[];\n image?: string | HTMLImageElement | HTMLCanvasElement;\n datum?: unknown;\n}\n\nexport interface IStorylineLayoutOptions {\n type: StorylineLayoutType;\n /**\n * 边缘留白,支持单值或 [top, right, bottom, left]。\n */\n padding?: number | [number, number, number, number];\n /**\n * 对 circular/arc 布局生效,控制半径占可用空间的比例。\n */\n radiusRatio?: number;\n /**\n * 对 circular/arc 布局生效,角度单位为度。\n */\n startAngle?: number;\n /**\n * 对 circular/arc 布局生效,角度单位为度。\n */\n endAngle?: number;\n /**\n * wing 布局生效,控制翅膀展开方向。\n * - 'left':圆心锚在画布左侧、弧凸向右展开(默认);\n * - 'right':圆心锚在画布右侧、弧凸向左展开。\n */\n direction?: StorylineWingDirection;\n}\n\nexport interface IStorylineBlockSpec {\n width?: number;\n widthRatio?: number;\n minWidth?: number;\n maxWidth?: number;\n height?: number;\n padding?: number | [number, number, number, number];\n gap?: number;\n style?: Partial<IRectMarkSpec>;\n}\n\nexport interface IStorylineImageSpec extends IMarkSpec<IImageMarkSpec> {\n width?: number;\n height?: number;\n position?: StorylineImagePosition;\n gap?: number;\n}\n\nexport interface IStorylineCenterImageSpec extends IMarkSpec<IImageMarkSpec> {\n width?: number;\n height?: number;\n visible?: boolean;\n image?: string | HTMLImageElement | HTMLCanvasElement;\n}\n\nexport interface IStorylineLineSpec extends IMarkSpec<IPathMarkSpec> {\n visible?: boolean;\n type?: StorylineLineType;\n showArrow?: boolean;\n arrowSize?: number;\n /**\n * 连接线和 block 边缘之间的距离。\n */\n distance?: number;\n}\n\nexport interface IStorylineSpec extends Omit<IChartSpec, 'type' | 'data' | 'series' | 'title' | 'layout'> {\n type: 'storyline';\n data: IStorylineBlock[];\n layout?: StorylineLayoutType | IStorylineLayoutOptions;\n block?: IStorylineBlockSpec;\n title?: IMarkSpec<ITextMarkSpec>;\n content?: IMarkSpec<IComposedTextMarkSpec>;\n image?: IStorylineImageSpec;\n centerImage?: IStorylineCenterImageSpec;\n line?: IStorylineLineSpec;\n themeColor?: string;\n}\n"]}
1
+ {"version":3,"sources":["../src/charts/storyline/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type {\n IChartSpec,\n IComposedTextMarkSpec,\n IImageMarkSpec,\n IMarkSpec,\n IPathMarkSpec,\n IRectMarkSpec,\n ITextMarkSpec,\n StringOrNumber\n} from '@visactor/vchart';\n\nexport type StorylineLayoutType = 'clock' | 'arc' | 'wing' | 'landscape' | 'portrait' | 'ladder' | 'spiral';\n\nexport type StorylineImagePosition = 'top' | 'left' | 'right' | 'bottom';\nexport type StorylineLineType = 'line' | 'polyline' | 'curve';\nexport type StorylineWingDirection = 'left' | 'right';\nexport type StorylineLadderDirection = 'up' | 'down';\nexport type StorylineArcDirection = 'up' | 'down';\n\nexport interface IStorylineBlock {\n id?: StringOrNumber;\n title?: string;\n content?: string | string[];\n image?: string | HTMLImageElement | HTMLCanvasElement;\n /**\n * 绘制在主 image 背后的装饰图(如 portrait 布局的错位 shadow image)。\n * 仅在对应布局的 image.showBackground 为 true 时生效。\n * 若未配置,则不会绘制装饰 image。\n */\n subImage?: string | HTMLImageElement | HTMLCanvasElement;\n datum?: unknown;\n}\n\nexport interface IStorylineLayoutOptions {\n type: StorylineLayoutType;\n /**\n * 边缘留白,支持单值或 [top, right, bottom, left]。\n */\n padding?: number | [number, number, number, number];\n /**\n * 对 circular/arc 布局生效,控制半径占可用空间的比例。\n */\n radiusRatio?: number;\n /**\n * 对 circular/arc 布局生效,角度单位为度。\n */\n startAngle?: number;\n /**\n * 对 circular/arc 布局生效,角度单位为度。\n */\n endAngle?: number;\n /**\n * 方向控制:\n * - wing 布局:'left' | 'right',圆心锚位置;\n * - ladder 布局:'up' | 'down','up' 表示左下→右上对角线(默认),'down' 表示左上→右下对角线;\n * - arc 布局:'up' | 'down','up' 表示穹顶(centerImage 贴底,弧线在上方),'down' 表示碗形(centerImage 贴顶,弧线在下方)。\n */\n direction?: StorylineWingDirection | StorylineLadderDirection | StorylineArcDirection;\n /**\n * 对 ladder 布局生效:贯穿画布的倾斜大字 headline。\n * 缺省时使用占位文本。倾斜方向自动跟随对角线。\n */\n headline?: string;\n}\n\nexport interface IStorylineBlockSpec {\n width?: number;\n widthRatio?: number;\n minWidth?: number;\n maxWidth?: number;\n height?: number;\n padding?: number | [number, number, number, number];\n gap?: number;\n /**\n * 是否展示 block 背后的卡片背景 rect(白底 + 描边 + 阴影)。\n * 仅 up-ladder 等少数布局支持,默认 false(不展示)。\n */\n showBackground?: boolean;\n style?: Partial<IRectMarkSpec>;\n}\n\nexport interface IStorylineImageSpec extends IMarkSpec<IImageMarkSpec> {\n width?: number;\n height?: number;\n position?: StorylineImagePosition;\n gap?: number;\n /**\n * 是否展示 image 背后的装饰图元(halo / shadow / 背景 rect 等)。\n * 不同布局对应的装饰图元不同:\n * - wing: 圆形 halo symbol\n * - portrait: 错位 shadow image + mask\n * - clock: 楔形/圆形背景 rect\n * - dome / bowl / landscape: image-bg(无图时的占位 rect 不受此开关影响)\n * 默认 false(不展示)。\n */\n showBackground?: boolean;\n}\n\nexport interface IStorylineCenterImageSpec extends IMarkSpec<IImageMarkSpec> {\n width?: number;\n height?: number;\n visible?: boolean;\n image?: string | HTMLImageElement | HTMLCanvasElement;\n}\n\nexport interface IStorylineLineSpec extends IMarkSpec<IPathMarkSpec> {\n visible?: boolean;\n type?: StorylineLineType;\n showArrow?: boolean;\n arrowSize?: number;\n /**\n * 连接线和 block 边缘之间的距离。\n */\n distance?: number;\n}\n\nexport interface IStorylineSpec extends Omit<IChartSpec, 'type' | 'data' | 'series' | 'title' | 'layout'> {\n type: 'storyline';\n data: IStorylineBlock[];\n layout?: StorylineLayoutType | IStorylineLayoutOptions;\n block?: IStorylineBlockSpec;\n title?: IMarkSpec<ITextMarkSpec>;\n content?: IMarkSpec<IComposedTextMarkSpec>;\n image?: IStorylineImageSpec;\n centerImage?: IStorylineCenterImageSpec;\n line?: IStorylineLineSpec;\n themeColor?: string;\n}\n"]}
@@ -61,17 +61,18 @@ const computeBlockPositions = (data, layout, viewBox, block, padding, gap) => {
61
61
  centers = lineCenters(count, center.x, inner.y + block.height / 2, center.x, inner.y + inner.height - block.height / 2);
62
62
  break;
63
63
 
64
- case "up-ladder":
65
- centers = lineCenters(count, inner.x + block.width / 2, inner.y + inner.height - block.height / 2, inner.x + inner.width - block.width / 2, inner.y + block.height / 2);
66
- break;
67
-
68
- case "down-ladder":
69
- centers = lineCenters(count, inner.x + block.width / 2, inner.y + block.height / 2, inner.x + inner.width - block.width / 2, inner.y + inner.height - block.height / 2);
70
- break;
71
-
72
- case "pulse":
73
- centers = alternatingHorizontalCenters(count, inner, block, gap);
74
- break;
64
+ case "ladder":
65
+ {
66
+ const isDown = "down" === layout.direction, x0 = inner.x + block.width / 2, x1 = inner.x + inner.width - block.width / 2, yTop = inner.y + block.height / 2, yBot = inner.y + inner.height - block.height / 2, y0 = isDown ? yTop : yBot, y1 = isDown ? yBot : yTop, anchors = lineCenters(count, x0, y0, x1, y1), dx = x1 - x0, dy = y1 - y0, len = Math.hypot(dx, dy) || 1, nx = -dy / len, ny = dx / len, offset = 1.2 * Math.max(80, Math.min(240, Math.round(.42 * inner.height)));
67
+ centers = anchors.map(((p, i) => {
68
+ const sign = i % 2 == 0 ? 1 : -1;
69
+ return {
70
+ x: p.x + nx * offset * sign,
71
+ y: p.y + ny * offset * sign
72
+ };
73
+ }));
74
+ break;
75
+ }
75
76
 
76
77
  case "spiral":
77
78
  centers = alternatingVerticalCenters(count, inner, block, gap);
@@ -81,13 +82,12 @@ const computeBlockPositions = (data, layout, viewBox, block, padding, gap) => {
81
82
  centers = circularCenters(count, viewBox, block, padding, layout);
82
83
  break;
83
84
 
84
- case "bowl":
85
- centers = arcCenters(count, inner, block, layout, 200, 340);
86
- break;
87
-
88
- case "dome":
89
- centers = arcCenters(count, inner, block, layout, 160, 20);
90
- break;
85
+ case "arc":
86
+ {
87
+ const isDown = "down" === layout.direction, [s, e] = isDown ? [ 20, 160 ] : [ 200, 340 ];
88
+ centers = arcCenters(count, inner, block, layout, s, e);
89
+ break;
90
+ }
91
91
 
92
92
  case "wing":
93
93
  {
@@ -123,13 +123,7 @@ const computeBlockPositions = (data, layout, viewBox, block, padding, gap) => {
123
123
  x: x0 + (x1 - x0) * t,
124
124
  y: y0 + (y1 - y0) * t
125
125
  };
126
- })), alternatingHorizontalCenters = (count, inner, block, gap) => {
127
- const baseY = inner.y + inner.height / 2, offset = Math.min(Math.max(.65 * block.height + gap / 2, 0), Math.max((inner.height - block.height) / 2, 0));
128
- return lineCenters(count, inner.x + block.width / 2, baseY, inner.x + inner.width - block.width / 2, baseY).map(((point, index) => ({
129
- x: point.x,
130
- y: point.y + (index % 2 == 0 ? -offset : offset)
131
- })));
132
- }, alternatingVerticalCenters = (count, inner, block, gap) => {
126
+ })), alternatingVerticalCenters = (count, inner, block, gap) => {
133
127
  const baseX = inner.x + inner.width / 2, offset = Math.min(Math.max(.65 * block.width + gap / 2, 0), Math.max((inner.width - block.width) / 2, 0));
134
128
  return lineCenters(count, baseX, inner.y + block.height / 2, baseX, inner.y + inner.height - block.height / 2).map(((point, index) => ({
135
129
  x: point.x + (index % 2 == 0 ? -offset : offset),
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/charts/storyline/layout.ts"],"names":[],"mappings":";;;AAsDA,MAAM,cAAc,GAAwB,WAAW,CAAC;AACxD,MAAM,eAAe,GAAG,EAAE,CAAC;AAEpB,MAAM,gBAAgB,GAAG,CAAC,OAAmD,EAAoB,EAAE;;IACxG,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC1B,OAAO;YACL,GAAG,EAAE,MAAA,OAAO,CAAC,CAAC,CAAC,mCAAI,CAAC;YACpB,KAAK,EAAE,MAAA,OAAO,CAAC,CAAC,CAAC,mCAAI,CAAC;YACtB,MAAM,EAAE,MAAA,OAAO,CAAC,CAAC,CAAC,mCAAI,CAAC;YACvB,IAAI,EAAE,MAAA,OAAO,CAAC,CAAC,CAAC,mCAAI,CAAC;SACtB,CAAC;KACH;IACD,MAAM,KAAK,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,eAAe,CAAC;IACzC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KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,QAAQ;QACzD,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,QAAQ;KAC1D,CAAC;AACJ,CAAC,CAAC","file":"layout.js","sourcesContent":["import type { IStorylineBlock, IStorylineLayoutOptions, StorylineLayoutType } from './interface';\n\nexport interface StorylineSize {\n width: number;\n height: number;\n}\n\nexport interface StorylinePadding {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\nexport interface StorylinePoint {\n x: number;\n y: number;\n}\n\nexport interface StorylineBlockPosition extends StorylinePoint, StorylineSize {\n id: string | number;\n index: number;\n datum: IStorylineBlock;\n center: StorylinePoint;\n}\n\nexport interface StorylineLinkPosition {\n from: StorylineBlockPosition;\n to: StorylineBlockPosition;\n start: StorylinePoint;\n end: StorylinePoint;\n points: StorylinePoint[];\n}\n\nexport interface StorylineCircleGuide {\n center: StorylinePoint;\n radius: number;\n}\n\nexport interface StorylineLayoutResult {\n blocks: StorylineBlockPosition[];\n links: StorylineLinkPosition[];\n circleGuide?: StorylineCircleGuide;\n}\n\nexport interface StorylineComputeOptions {\n layout: StorylineLayoutType | IStorylineLayoutOptions | undefined;\n viewBox: StorylineSize;\n block: StorylineSize;\n gap?: number;\n padding?: number | [number, number, number, number];\n lineDistance?: number;\n}\n\nconst DEFAULT_LAYOUT: StorylineLayoutType = 'landscape';\nconst DEFAULT_PADDING = 24;\n\nexport const normalizePadding = (padding?: number | [number, number, number, number]): StorylinePadding => {\n if (Array.isArray(padding)) {\n return {\n top: padding[0] ?? 0,\n right: padding[1] ?? 0,\n bottom: padding[2] ?? 0,\n left: padding[3] ?? 0\n };\n }\n const value = padding ?? DEFAULT_PADDING;\n return { top: value, right: value, bottom: value, left: value };\n};\n\nexport const normalizeLayout = (layout?: StorylineLayoutType | IStorylineLayoutOptions): IStorylineLayoutOptions => {\n if (!layout) {\n return { type: DEFAULT_LAYOUT };\n }\n if (typeof layout === 'string') {\n return { type: layout };\n }\n return layout;\n};\n\nexport const computeStorylineLayout = (\n data: IStorylineBlock[],\n options: StorylineComputeOptions\n): StorylineLayoutResult => {\n const layout = normalizeLayout(options.layout);\n const padding = normalizePadding(layout.padding ?? options.padding);\n const gap = options.gap ?? 40;\n const lineDistance = options.lineDistance ?? 8;\n const blocks = computeBlockPositions(data, layout, options.viewBox, options.block, padding, gap);\n const circleGuide =\n layout.type === 'clock' ? computeClockCircleGuide(options.viewBox, options.block, padding, layout) : undefined;\n return {\n blocks,\n links: computeLinks(blocks, lineDistance),\n circleGuide\n };\n};\n\nconst computeBlockPositions = (\n data: IStorylineBlock[],\n layout: IStorylineLayoutOptions,\n viewBox: StorylineSize,\n block: StorylineSize,\n padding: StorylinePadding,\n gap: number\n): StorylineBlockPosition[] => {\n const count = data.length;\n if (!count) {\n return [];\n }\n\n const inner = {\n x: padding.left,\n y: padding.top,\n width: Math.max(viewBox.width - padding.left - padding.right, block.width),\n height: Math.max(viewBox.height - padding.top - padding.bottom, block.height)\n };\n const center = {\n x: inner.x + inner.width / 2,\n y: inner.y + inner.height / 2\n };\n\n let centers: StorylinePoint[];\n switch (layout.type) {\n case 'portrait':\n centers = lineCenters(\n count,\n center.x,\n inner.y + block.height / 2,\n center.x,\n inner.y + inner.height - block.height / 2\n );\n break;\n case 'up-ladder':\n centers = lineCenters(\n count,\n inner.x + block.width / 2,\n inner.y + inner.height - block.height / 2,\n inner.x + inner.width - block.width / 2,\n inner.y + block.height / 2\n );\n break;\n case 'down-ladder':\n centers = lineCenters(\n count,\n inner.x + block.width / 2,\n inner.y + block.height / 2,\n inner.x + inner.width - block.width / 2,\n inner.y + inner.height - block.height / 2\n );\n break;\n case 'pulse':\n centers = alternatingHorizontalCenters(count, inner, block, gap);\n break;\n case 'spiral':\n centers = alternatingVerticalCenters(count, inner, block, gap);\n break;\n case 'clock':\n centers = circularCenters(count, viewBox, block, padding, layout);\n break;\n case 'bowl':\n centers = arcCenters(count, inner, block, layout, 200, 340);\n break;\n case 'dome':\n centers = arcCenters(count, inner, block, layout, 160, 20);\n break;\n case 'wing': {\n const direction = layout.direction === 'right' ? 'right' : 'left';\n const [s, e] = direction === 'right' ? [110, 250] : [-70, 70];\n centers = arcCenters(count, inner, block, layout, s, e);\n break;\n }\n case 'landscape':\n default:\n centers = lineCenters(\n count,\n inner.x + block.width / 2,\n center.y,\n inner.x + inner.width - block.width / 2,\n center.y\n );\n break;\n }\n\n return centers.map((point, index) => ({\n id: data[index]?.id ?? index,\n index,\n datum: data[index],\n width: block.width,\n height: block.height,\n x: point.x - block.width / 2,\n y: point.y - block.height / 2,\n center: point\n }));\n};\n\nconst lineCenters = (count: number, x0: number, y0: number, x1: number, y1: number): StorylinePoint[] => {\n if (count === 1) {\n return [{ x: (x0 + x1) / 2, y: (y0 + y1) / 2 }];\n }\n return Array.from({ length: count }, (_, index) => {\n const t = index / (count - 1);\n return {\n x: x0 + (x1 - x0) * t,\n y: y0 + (y1 - y0) * t\n };\n });\n};\n\nconst alternatingHorizontalCenters = (\n count: number,\n inner: { x: number; y: number; width: number; height: number },\n block: StorylineSize,\n gap: number\n) => {\n const baseY = inner.y + inner.height / 2;\n const offset = Math.min(Math.max(block.height * 0.65 + gap / 2, 0), Math.max((inner.height - block.height) / 2, 0));\n const points = lineCenters(count, inner.x + block.width / 2, baseY, inner.x + inner.width - block.width / 2, baseY);\n return points.map((point, index) => ({\n x: point.x,\n y: point.y + (index % 2 === 0 ? -offset : offset)\n }));\n};\n\nconst alternatingVerticalCenters = (\n count: number,\n inner: { x: number; y: number; width: number; height: number },\n block: StorylineSize,\n gap: number\n) => {\n const baseX = inner.x + inner.width / 2;\n const offset = Math.min(Math.max(block.width * 0.65 + gap / 2, 0), Math.max((inner.width - block.width) / 2, 0));\n const points = lineCenters(\n count,\n baseX,\n inner.y + block.height / 2,\n baseX,\n inner.y + inner.height - block.height / 2\n );\n return points.map((point, index) => ({\n x: point.x + (index % 2 === 0 ? -offset : offset),\n y: point.y\n }));\n};\n\nconst circularCenters = (\n count: number,\n viewBox: StorylineSize,\n block: StorylineSize,\n padding: StorylinePadding,\n layout: IStorylineLayoutOptions\n) => {\n const guide = computeClockCircleGuide(viewBox, block, padding, layout);\n const startAngle = layout.startAngle ?? -90;\n const delta = 360;\n\n if (count === 1) {\n const angle = degreeToRadian(startAngle);\n return [\n {\n x: guide.center.x + Math.cos(angle) * guide.radius,\n y: guide.center.y + Math.sin(angle) * guide.radius\n }\n ];\n }\n\n return Array.from({ length: count }, (_, index) => {\n const angle = degreeToRadian(startAngle + (delta * index) / count);\n return {\n x: guide.center.x + Math.cos(angle) * guide.radius,\n y: guide.center.y + Math.sin(angle) * guide.radius\n };\n });\n};\n\nconst computeClockCircleGuide = (\n viewBox: StorylineSize,\n block: StorylineSize,\n padding: StorylinePadding,\n layout: IStorylineLayoutOptions\n): StorylineCircleGuide => {\n const innerWidth = Math.max(viewBox.width - padding.left - padding.right, 1);\n const innerHeight = Math.max(viewBox.height - padding.top - padding.bottom, 1);\n const center = {\n x: padding.left + innerWidth / 2,\n y: padding.top + innerHeight / 2\n };\n const ratio = layout.radiusRatio ?? 0.7;\n const maxRadius = Math.max(Math.min(innerWidth - block.width, innerHeight - block.height) / 2, 1);\n\n return {\n center,\n radius: Math.max(1, maxRadius * ratio)\n };\n};\n\nconst arcCenters = (\n count: number,\n inner: { x: number; y: number; width: number; height: number },\n block: StorylineSize,\n layout: IStorylineLayoutOptions,\n fallbackStartAngle?: number,\n fallbackEndAngle?: number,\n defaultRatio = 0.88\n) => {\n const startAngle = layout.startAngle ?? fallbackStartAngle ?? -90;\n const endAngle = layout.endAngle ?? fallbackEndAngle ?? 270;\n const ratio = layout.radiusRatio ?? defaultRatio;\n const rx = Math.max((inner.width - block.width) / 2, 1) * ratio;\n const ry = Math.max((inner.height - block.height) / 2, 1) * ratio;\n const center = {\n x: inner.x + inner.width / 2,\n y: inner.y + inner.height / 2\n };\n\n if (count === 1) {\n const angle = degreeToRadian((startAngle + endAngle) / 2);\n return [{ x: center.x + Math.cos(angle) * rx, y: center.y + Math.sin(angle) * ry }];\n }\n\n return Array.from({ length: count }, (_, index) => {\n const t = index / (count - 1);\n const angle = degreeToRadian(startAngle + angleDelta(startAngle, endAngle) * t);\n return {\n x: center.x + Math.cos(angle) * rx,\n y: center.y + Math.sin(angle) * ry\n };\n });\n};\n\nconst angleDelta = (startAngle: number, endAngle: number) => {\n const delta = endAngle - startAngle;\n return Math.abs(delta) >= 360 ? 360 : delta;\n};\n\nconst degreeToRadian = (degree: number) => (degree / 180) * Math.PI;\n\nconst computeLinks = (blocks: StorylineBlockPosition[], distance: number): StorylineLinkPosition[] => {\n const links: StorylineLinkPosition[] = [];\n for (let i = 0; i < blocks.length - 1; i++) {\n const from = blocks[i];\n const to = blocks[i + 1];\n const start = pointOnBlockEdge(from, to.center, distance);\n const end = pointOnBlockEdge(to, from.center, distance);\n links.push({\n from,\n to,\n start,\n end,\n points: [start, end]\n });\n }\n return links;\n};\n\nconst pointOnBlockEdge = (block: StorylineBlockPosition, toward: StorylinePoint, distance: number): StorylinePoint => {\n const dx = toward.x - block.center.x;\n const dy = toward.y - block.center.y;\n if (dx === 0 && dy === 0) {\n return { x: block.center.x, y: block.center.y };\n }\n const scaleX = dx === 0 ? Number.POSITIVE_INFINITY : block.width / 2 / Math.abs(dx);\n const scaleY = dy === 0 ? Number.POSITIVE_INFINITY : block.height / 2 / Math.abs(dy);\n const scale = Math.min(scaleX, scaleY);\n const length = Math.sqrt(dx * dx + dy * dy) || 1;\n return {\n x: block.center.x + dx * scale + (dx / length) * distance,\n y: block.center.y + dy * scale + (dy / length) * distance\n };\n};\n"]}
1
+ {"version":3,"sources":["../src/charts/storyline/layout.ts"],"names":[],"mappings":";;;AAsDA,MAAM,cAAc,GAAwB,WAAW,CAAC;AACxD,MAAM,eAAe,GAAG,E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AAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACpF,MAAM,MAAM,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACrF,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IACjD,OAAO;QACL,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,QAAQ;QACzD,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,QAAQ;KAC1D,CAAC;AACJ,CAAC,CAAC","file":"layout.js","sourcesContent":["import type { IStorylineBlock, IStorylineLayoutOptions, StorylineLayoutType } from './interface';\n\nexport interface StorylineSize {\n width: number;\n height: number;\n}\n\nexport interface StorylinePadding {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\nexport interface StorylinePoint {\n x: number;\n y: number;\n}\n\nexport interface StorylineBlockPosition extends StorylinePoint, StorylineSize {\n id: string | number;\n index: number;\n datum: IStorylineBlock;\n center: StorylinePoint;\n}\n\nexport interface StorylineLinkPosition {\n from: StorylineBlockPosition;\n to: StorylineBlockPosition;\n start: StorylinePoint;\n end: StorylinePoint;\n points: StorylinePoint[];\n}\n\nexport interface StorylineCircleGuide {\n center: StorylinePoint;\n radius: number;\n}\n\nexport interface StorylineLayoutResult {\n blocks: StorylineBlockPosition[];\n links: StorylineLinkPosition[];\n circleGuide?: StorylineCircleGuide;\n}\n\nexport interface StorylineComputeOptions {\n layout: StorylineLayoutType | IStorylineLayoutOptions | undefined;\n viewBox: StorylineSize;\n block: StorylineSize;\n gap?: number;\n padding?: number | [number, number, number, number];\n lineDistance?: number;\n}\n\nconst DEFAULT_LAYOUT: StorylineLayoutType = 'landscape';\nconst DEFAULT_PADDING = 24;\n\nexport const normalizePadding = (padding?: number | [number, number, number, number]): StorylinePadding => {\n if (Array.isArray(padding)) {\n return {\n top: padding[0] ?? 0,\n right: padding[1] ?? 0,\n bottom: padding[2] ?? 0,\n left: padding[3] ?? 0\n };\n }\n const value = padding ?? DEFAULT_PADDING;\n return { top: value, right: value, bottom: value, left: value };\n};\n\nexport const normalizeLayout = (layout?: StorylineLayoutType | IStorylineLayoutOptions): IStorylineLayoutOptions => {\n if (!layout) {\n return { type: DEFAULT_LAYOUT };\n }\n if (typeof layout === 'string') {\n return { type: layout };\n }\n return layout;\n};\n\nexport const computeStorylineLayout = (\n data: IStorylineBlock[],\n options: StorylineComputeOptions\n): StorylineLayoutResult => {\n const layout = normalizeLayout(options.layout);\n const padding = normalizePadding(layout.padding ?? options.padding);\n const gap = options.gap ?? 40;\n const lineDistance = options.lineDistance ?? 8;\n const blocks = computeBlockPositions(data, layout, options.viewBox, options.block, padding, gap);\n const circleGuide =\n layout.type === 'clock' ? computeClockCircleGuide(options.viewBox, options.block, padding, layout) : undefined;\n return {\n blocks,\n links: computeLinks(blocks, lineDistance),\n circleGuide\n };\n};\n\nconst computeBlockPositions = (\n data: IStorylineBlock[],\n layout: IStorylineLayoutOptions,\n viewBox: StorylineSize,\n block: StorylineSize,\n padding: StorylinePadding,\n gap: number\n): StorylineBlockPosition[] => {\n const count = data.length;\n if (!count) {\n return [];\n }\n\n const inner = {\n x: padding.left,\n y: padding.top,\n width: Math.max(viewBox.width - padding.left - padding.right, block.width),\n height: Math.max(viewBox.height - padding.top - padding.bottom, block.height)\n };\n const center = {\n x: inner.x + inner.width / 2,\n y: inner.y + inner.height / 2\n };\n\n let centers: StorylinePoint[];\n switch (layout.type) {\n case 'portrait':\n centers = lineCenters(\n count,\n center.x,\n inner.y + block.height / 2,\n center.x,\n inner.y + inner.height - block.height / 2\n );\n break;\n case 'ladder': {\n // 沿对角线均匀采样 anchor 点,偶/奇 index 沿对角线\"法向\"做左/右偏移。\n // direction = 'up' (默认):左下 → 右上;direction = 'down':左上 → 右下。\n const isDown = layout.direction === 'down';\n const x0 = inner.x + block.width / 2;\n const x1 = inner.x + inner.width - block.width / 2;\n const yTop = inner.y + block.height / 2;\n const yBot = inner.y + inner.height - block.height / 2;\n const y0 = isDown ? yTop : yBot;\n const y1 = isDown ? yBot : yTop;\n const anchors = lineCenters(count, x0, y0, x1, y1);\n // 对角线方向向量\n const dx = x1 - x0;\n const dy = y1 - y0;\n const len = Math.hypot(dx, dy) || 1;\n // 法向单位向量\n const nx = -dy / len;\n const ny = dx / len;\n // 偏移量:与 headline fontSize 联动 —— 与 ladder.ts 中保持同一公式\n // headline fontSize = clamp(innerHeight * 0.42, 80, 240)\n // 偏移量 = headline fontSize * 1.2,让 block 与 headline 大字之间留出充足留白\n const headlineFontSize = Math.max(80, Math.min(240, Math.round(inner.height * 0.42)));\n const offset = headlineFontSize * 1.2;\n centers = anchors.map((p, i) => {\n // 偶数 index → 法向 +;奇数 index → 法向 -\n const sign = i % 2 === 0 ? 1 : -1;\n return {\n x: p.x + nx * offset * sign,\n y: p.y + ny * offset * sign\n };\n });\n break;\n }\n case 'spiral':\n centers = alternatingVerticalCenters(count, inner, block, gap);\n break;\n case 'clock':\n centers = circularCenters(count, viewBox, block, padding, layout);\n break;\n case 'arc': {\n // arc 布局:通过 direction 控制 dome(穹顶)/ bowl(碗形)方向\n // - 'up'(默认):弧线在上方(穹顶),等同原 dome\n // - 'down':弧线在下方(碗形),等同原 bowl\n const isDown = layout.direction === 'down';\n const [s, e] = isDown ? [20, 160] : [200, 340];\n centers = arcCenters(count, inner, block, layout, s, e);\n break;\n }\n case 'wing': {\n const direction = layout.direction === 'right' ? 'right' : 'left';\n const [s, e] = direction === 'right' ? [110, 250] : [-70, 70];\n centers = arcCenters(count, inner, block, layout, s, e);\n break;\n }\n case 'landscape':\n default:\n centers = lineCenters(\n count,\n inner.x + block.width / 2,\n center.y,\n inner.x + inner.width - block.width / 2,\n center.y\n );\n break;\n }\n\n return centers.map((point, index) => ({\n id: data[index]?.id ?? index,\n index,\n datum: data[index],\n width: block.width,\n height: block.height,\n x: point.x - block.width / 2,\n y: point.y - block.height / 2,\n center: point\n }));\n};\n\nconst lineCenters = (count: number, x0: number, y0: number, x1: number, y1: number): StorylinePoint[] => {\n if (count === 1) {\n return [{ x: (x0 + x1) / 2, y: (y0 + y1) / 2 }];\n }\n return Array.from({ length: count }, (_, index) => {\n const t = index / (count - 1);\n return {\n x: x0 + (x1 - x0) * t,\n y: y0 + (y1 - y0) * t\n };\n });\n};\n\nconst alternatingVerticalCenters = (\n count: number,\n inner: { x: number; y: number; width: number; height: number },\n block: StorylineSize,\n gap: number\n) => {\n const baseX = inner.x + inner.width / 2;\n const offset = Math.min(Math.max(block.width * 0.65 + gap / 2, 0), Math.max((inner.width - block.width) / 2, 0));\n const points = lineCenters(\n count,\n baseX,\n inner.y + block.height / 2,\n baseX,\n inner.y + inner.height - block.height / 2\n );\n return points.map((point, index) => ({\n x: point.x + (index % 2 === 0 ? -offset : offset),\n y: point.y\n }));\n};\n\nconst circularCenters = (\n count: number,\n viewBox: StorylineSize,\n block: StorylineSize,\n padding: StorylinePadding,\n layout: IStorylineLayoutOptions\n) => {\n const guide = computeClockCircleGuide(viewBox, block, padding, layout);\n const startAngle = layout.startAngle ?? -90;\n const delta = 360;\n\n if (count === 1) {\n const angle = degreeToRadian(startAngle);\n return [\n {\n x: guide.center.x + Math.cos(angle) * guide.radius,\n y: guide.center.y + Math.sin(angle) * guide.radius\n }\n ];\n }\n\n return Array.from({ length: count }, (_, index) => {\n const angle = degreeToRadian(startAngle + (delta * index) / count);\n return {\n x: guide.center.x + Math.cos(angle) * guide.radius,\n y: guide.center.y + Math.sin(angle) * guide.radius\n };\n });\n};\n\nconst computeClockCircleGuide = (\n viewBox: StorylineSize,\n block: StorylineSize,\n padding: StorylinePadding,\n layout: IStorylineLayoutOptions\n): StorylineCircleGuide => {\n const innerWidth = Math.max(viewBox.width - padding.left - padding.right, 1);\n const innerHeight = Math.max(viewBox.height - padding.top - padding.bottom, 1);\n const center = {\n x: padding.left + innerWidth / 2,\n y: padding.top + innerHeight / 2\n };\n const ratio = layout.radiusRatio ?? 0.7;\n const maxRadius = Math.max(Math.min(innerWidth - block.width, innerHeight - block.height) / 2, 1);\n\n return {\n center,\n radius: Math.max(1, maxRadius * ratio)\n };\n};\n\nconst arcCenters = (\n count: number,\n inner: { x: number; y: number; width: number; height: number },\n block: StorylineSize,\n layout: IStorylineLayoutOptions,\n fallbackStartAngle?: number,\n fallbackEndAngle?: number,\n defaultRatio = 0.88\n) => {\n const startAngle = layout.startAngle ?? fallbackStartAngle ?? -90;\n const endAngle = layout.endAngle ?? fallbackEndAngle ?? 270;\n const ratio = layout.radiusRatio ?? defaultRatio;\n const rx = Math.max((inner.width - block.width) / 2, 1) * ratio;\n const ry = Math.max((inner.height - block.height) / 2, 1) * ratio;\n const center = {\n x: inner.x + inner.width / 2,\n y: inner.y + inner.height / 2\n };\n\n if (count === 1) {\n const angle = degreeToRadian((startAngle + endAngle) / 2);\n return [{ x: center.x + Math.cos(angle) * rx, y: center.y + Math.sin(angle) * ry }];\n }\n\n return Array.from({ length: count }, (_, index) => {\n const t = index / (count - 1);\n const angle = degreeToRadian(startAngle + angleDelta(startAngle, endAngle) * t);\n return {\n x: center.x + Math.cos(angle) * rx,\n y: center.y + Math.sin(angle) * ry\n };\n });\n};\n\nconst angleDelta = (startAngle: number, endAngle: number) => {\n const delta = endAngle - startAngle;\n return Math.abs(delta) >= 360 ? 360 : delta;\n};\n\nconst degreeToRadian = (degree: number) => (degree / 180) * Math.PI;\n\nconst computeLinks = (blocks: StorylineBlockPosition[], distance: number): StorylineLinkPosition[] => {\n const links: StorylineLinkPosition[] = [];\n for (let i = 0; i < blocks.length - 1; i++) {\n const from = blocks[i];\n const to = blocks[i + 1];\n const start = pointOnBlockEdge(from, to.center, distance);\n const end = pointOnBlockEdge(to, from.center, distance);\n links.push({\n from,\n to,\n start,\n end,\n points: [start, end]\n });\n }\n return links;\n};\n\nconst pointOnBlockEdge = (block: StorylineBlockPosition, toward: StorylinePoint, distance: number): StorylinePoint => {\n const dx = toward.x - block.center.x;\n const dy = toward.y - block.center.y;\n if (dx === 0 && dy === 0) {\n return { x: block.center.x, y: block.center.y };\n }\n const scaleX = dx === 0 ? Number.POSITIVE_INFINITY : block.width / 2 / Math.abs(dx);\n const scaleY = dy === 0 ? Number.POSITIVE_INFINITY : block.height / 2 / Math.abs(dy);\n const scale = Math.min(scaleX, scaleY);\n const length = Math.sqrt(dx * dx + dy * dy) || 1;\n return {\n x: block.center.x + dx * scale + (dx / length) * distance,\n y: block.center.y + dy * scale + (dy / length) * distance\n };\n};\n"]}
@@ -0,0 +1,5 @@
1
+ import type { IExtensionGroupMarkSpec } from '@visactor/vchart';
2
+ import type { IStorylineBlock, IStorylineSpec } from '../interface';
3
+ export declare const buildArcMark: (spec: IStorylineSpec) => IExtensionGroupMarkSpec | null;
4
+ export declare const buildArcCenterImageMark: (spec: IStorylineSpec) => IExtensionGroupMarkSpec | null;
5
+ export declare const buildArcBlockMark: (spec: IStorylineSpec, block: IStorylineBlock, index: number) => IExtensionGroupMarkSpec;