@orbcharts/plugins-basic 3.0.0-alpha.79 → 3.0.0-beta.10

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 (216) hide show
  1. package/LICENSE +200 -200
  2. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBars.d.ts +2 -2
  3. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBarsTriangle.d.ts +2 -2
  4. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseDots.d.ts +2 -2
  5. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseGroupAxis.d.ts +2 -2
  6. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLegend.d.ts +1 -1
  7. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLineAreas.d.ts +3 -3
  8. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLines.d.ts +3 -3
  9. package/dist/{src/base/BaseBarStack.d.ts → orbcharts-plugins-basic/src/base/BaseStackedBar.d.ts} +6 -6
  10. package/dist/orbcharts-plugins-basic/src/base/BaseTooltip.d.ts +14 -0
  11. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseValueAxis.d.ts +3 -2
  12. package/dist/{src → orbcharts-plugins-basic/src}/grid/defaults.d.ts +6 -5
  13. package/dist/{src → orbcharts-plugins-basic/src}/grid/gridObservables.d.ts +5 -5
  14. package/dist/{src → orbcharts-plugins-basic/src}/grid/index.d.ts +4 -3
  15. package/dist/orbcharts-plugins-basic/src/grid/plugins/GridTooltip.d.ts +1 -0
  16. package/dist/orbcharts-plugins-basic/src/grid/plugins/GridZoom.d.ts +1 -0
  17. package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedBar.d.ts +1 -0
  18. package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedValueAxis.d.ts +1 -0
  19. package/dist/orbcharts-plugins-basic/src/index.d.ts +7 -0
  20. package/dist/orbcharts-plugins-basic/src/multiGrid/defaults.d.ts +15 -0
  21. package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/index.d.ts +4 -3
  22. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiGridTooltip.d.ts +1 -0
  23. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedBar.d.ts +1 -0
  24. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedValueAxis.d.ts +1 -0
  25. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/OverlappingStackedValueAxes.d.ts +1 -0
  26. package/dist/orbcharts-plugins-basic/src/multiValue/defaults.d.ts +9 -0
  27. package/dist/orbcharts-plugins-basic/src/multiValue/index.d.ts +8 -0
  28. package/dist/orbcharts-plugins-basic/src/multiValue/multiValueObservables.d.ts +33 -0
  29. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueLegend.d.ts +1 -0
  30. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueTooltip.d.ts +1 -0
  31. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/Scatter.d.ts +3 -0
  32. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/ScatterBubbles.d.ts +3 -0
  33. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAux.d.ts +3 -0
  34. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAxes.d.ts +3 -0
  35. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYZoom.d.ts +1 -0
  36. package/dist/orbcharts-plugins-basic/src/noneData/index.d.ts +1 -0
  37. package/dist/orbcharts-plugins-basic/src/relationship/defaults.d.ts +6 -0
  38. package/dist/orbcharts-plugins-basic/src/relationship/index.d.ts +5 -0
  39. package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirected.d.ts +3 -0
  40. package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirectedBubbles.d.ts +3 -0
  41. package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipLegend.d.ts +1 -0
  42. package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipTooltip.d.ts +1 -0
  43. package/dist/orbcharts-plugins-basic/src/relationship/relationshipObservables.d.ts +1 -0
  44. package/dist/{src → orbcharts-plugins-basic/src}/series/defaults.d.ts +2 -1
  45. package/dist/{src → orbcharts-plugins-basic/src}/series/index.d.ts +1 -0
  46. package/dist/orbcharts-plugins-basic/src/series/plugins/SeriesTooltip.d.ts +1 -0
  47. package/dist/{src → orbcharts-plugins-basic/src}/series/seriesObservables.d.ts +3 -3
  48. package/dist/orbcharts-plugins-basic/src/tree/defaults.d.ts +5 -0
  49. package/dist/{src → orbcharts-plugins-basic/src}/tree/index.d.ts +1 -0
  50. package/dist/orbcharts-plugins-basic/src/tree/plugins/TreeTooltip.d.ts +1 -0
  51. package/dist/{src → orbcharts-plugins-basic/src}/utils/commonUtils.d.ts +1 -1
  52. package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Utils.d.ts +2 -2
  53. package/dist/{src → orbcharts-plugins-basic/src}/utils/observables.d.ts +1 -1
  54. package/dist/{src → orbcharts-plugins-basic/src}/utils/orbchartsUtils.d.ts +3 -3
  55. package/dist/orbcharts-plugins-basic.es.js +13490 -10057
  56. package/dist/orbcharts-plugins-basic.umd.js +179 -24
  57. package/dist/src/index.d.ts +1 -5
  58. package/lib/core-types.ts +7 -7
  59. package/lib/core.ts +6 -6
  60. package/lib/plugins-basic-types.ts +6 -6
  61. package/package.json +44 -44
  62. package/src/base/BaseBars.ts +765 -765
  63. package/src/base/BaseBarsTriangle.ts +676 -674
  64. package/src/base/BaseDots.ts +464 -515
  65. package/src/base/BaseGroupAxis.ts +679 -679
  66. package/src/base/BaseLegend.ts +684 -644
  67. package/src/base/BaseLineAreas.ts +629 -629
  68. package/src/base/BaseLines.ts +706 -706
  69. package/src/base/{BaseBarStack.ts → BaseStackedBar.ts} +782 -780
  70. package/src/base/BaseTooltip.ts +386 -0
  71. package/src/base/BaseValueAxis.ts +583 -580
  72. package/src/base/types.ts +2 -2
  73. package/src/const.ts +30 -30
  74. package/src/grid/defaults.ts +247 -128
  75. package/src/grid/gridObservables.ts +554 -545
  76. package/src/grid/index.ts +16 -15
  77. package/src/grid/plugins/Bars.ts +69 -69
  78. package/src/grid/plugins/BarsPN.ts +66 -66
  79. package/src/grid/plugins/BarsTriangle.ts +73 -73
  80. package/src/grid/plugins/Dots.ts +68 -68
  81. package/src/grid/plugins/GridLegend.ts +107 -96
  82. package/src/grid/plugins/GridTooltip.ts +66 -0
  83. package/src/grid/plugins/{ScalingArea.ts → GridZoom.ts} +218 -218
  84. package/src/grid/plugins/GroupAux.ts +1103 -1098
  85. package/src/grid/plugins/GroupAxis.ts +97 -97
  86. package/src/grid/plugins/LineAreas.ts +65 -65
  87. package/src/grid/plugins/Lines.ts +59 -59
  88. package/src/grid/plugins/{BarStack.ts → StackedBar.ts} +64 -64
  89. package/src/grid/plugins/{ValueStackAxis.ts → StackedValueAxis.ts} +96 -95
  90. package/src/grid/plugins/ValueAxis.ts +94 -93
  91. package/src/index.ts +6 -9
  92. package/src/multiGrid/defaults.ts +225 -159
  93. package/src/multiGrid/index.ts +15 -14
  94. package/src/multiGrid/multiGridObservables.ts +49 -49
  95. package/src/multiGrid/plugins/MultiBars.ts +108 -108
  96. package/src/multiGrid/plugins/MultiBarsTriangle.ts +114 -114
  97. package/src/multiGrid/plugins/MultiDots.ts +102 -102
  98. package/src/multiGrid/plugins/MultiGridLegend.ts +159 -148
  99. package/src/multiGrid/plugins/MultiGridTooltip.ts +66 -0
  100. package/src/multiGrid/plugins/MultiGroupAxis.ts +137 -137
  101. package/src/multiGrid/plugins/MultiLineAreas.ts +107 -107
  102. package/src/multiGrid/plugins/MultiLines.ts +101 -101
  103. package/src/multiGrid/plugins/{MultiBarStack.ts → MultiStackedBar.ts} +106 -106
  104. package/src/multiGrid/plugins/{MultiValueStackAxis.ts → MultiStackedValueAxis.ts} +134 -133
  105. package/src/multiGrid/plugins/MultiValueAxis.ts +134 -133
  106. package/src/multiGrid/plugins/{OverlappingValueStackAxes.ts → OverlappingStackedValueAxes.ts} +299 -298
  107. package/src/multiGrid/plugins/OverlappingValueAxes.ts +300 -299
  108. package/src/multiValue/defaults.ts +167 -0
  109. package/src/multiValue/index.ts +9 -0
  110. package/src/multiValue/multiValueObservables.ts +297 -0
  111. package/src/multiValue/plugins/MultiValueLegend.ts +107 -0
  112. package/src/multiValue/plugins/MultiValueTooltip.ts +66 -0
  113. package/src/multiValue/plugins/Scatter.ts +426 -0
  114. package/src/multiValue/plugins/ScatterBubbles.ts +554 -0
  115. package/src/multiValue/plugins/XYAux.ts +682 -0
  116. package/src/multiValue/plugins/XYAxes.ts +685 -0
  117. package/src/multiValue/plugins/XYZoom.ts +300 -0
  118. package/src/noneData/defaults.ts +102 -102
  119. package/src/noneData/index.ts +4 -4
  120. package/src/noneData/plugins/Container.ts +28 -28
  121. package/src/noneData/plugins/Tooltip.ts +374 -374
  122. package/src/relationship/defaults.ts +196 -0
  123. package/src/relationship/index.ts +5 -0
  124. package/src/relationship/plugins/ForceDirected.ts +1167 -0
  125. package/src/relationship/plugins/ForceDirectedBubbles.ts +1391 -0
  126. package/src/relationship/plugins/RelationshipLegend.ts +100 -0
  127. package/src/relationship/plugins/RelationshipTooltip.ts +66 -0
  128. package/src/relationship/relationshipObservables.ts +50 -0
  129. package/src/series/defaults.ts +207 -149
  130. package/src/series/index.ts +10 -9
  131. package/src/series/plugins/Bubbles.ts +606 -603
  132. package/src/series/plugins/Pie.ts +623 -623
  133. package/src/series/plugins/PieEventTexts.ts +284 -283
  134. package/src/series/plugins/PieLabels.ts +640 -640
  135. package/src/series/plugins/Rose.ts +516 -516
  136. package/src/series/plugins/RoseLabels.ts +600 -600
  137. package/src/series/plugins/SeriesLegend.ts +107 -96
  138. package/src/series/plugins/SeriesTooltip.ts +66 -0
  139. package/src/series/seriesObservables.ts +145 -145
  140. package/src/series/seriesUtils.ts +51 -51
  141. package/src/tree/defaults.ts +79 -23
  142. package/src/tree/index.ts +5 -4
  143. package/src/tree/plugins/TreeLegend.ts +100 -96
  144. package/src/tree/plugins/TreeMap.ts +333 -333
  145. package/src/tree/plugins/TreeTooltip.ts +66 -0
  146. package/src/utils/commonUtils.ts +21 -21
  147. package/src/utils/d3Graphics.ts +174 -174
  148. package/src/utils/d3Utils.ts +74 -73
  149. package/src/utils/observables.ts +14 -14
  150. package/src/utils/orbchartsUtils.ts +116 -100
  151. package/tsconfig.base.json +13 -13
  152. package/tsconfig.json +2 -2
  153. package/vite.config.js +22 -22
  154. package/dist/src/grid/plugins/BarStack.d.ts +0 -1
  155. package/dist/src/grid/plugins/ScalingArea.d.ts +0 -1
  156. package/dist/src/grid/plugins/ValueStackAxis.d.ts +0 -1
  157. package/dist/src/multiGrid/defaults.d.ts +0 -14
  158. package/dist/src/multiGrid/plugins/MultiBarStack.d.ts +0 -1
  159. package/dist/src/multiGrid/plugins/MultiValueStackAxis.d.ts +0 -1
  160. package/dist/src/multiGrid/plugins/OverlappingValueStackAxes.d.ts +0 -1
  161. package/dist/src/multiValue/plugins/Scatter.d.ts +0 -0
  162. package/dist/src/multiValue/plugins/ScatterAxes.d.ts +0 -0
  163. package/dist/src/noneData/index.d.ts +0 -2
  164. package/dist/src/noneData/plugins/Container.d.ts +0 -1
  165. package/dist/src/noneData/plugins/Tooltip.d.ts +0 -3
  166. package/dist/src/relationship/index.d.ts +0 -0
  167. package/dist/src/relationship/plugins/Relationship.d.ts +0 -0
  168. package/dist/src/tree/defaults.d.ts +0 -4
  169. package/src/base/BaseGroupArea.ts +0 -0
  170. package/src/multiValue/plugins/ScatterAxes.ts +0 -0
  171. package/src/relationship/plugins/Relationship.ts +0 -0
  172. /package/dist/{lib → orbcharts-plugins-basic/lib}/core-types.d.ts +0 -0
  173. /package/dist/{lib → orbcharts-plugins-basic/lib}/core.d.ts +0 -0
  174. /package/dist/{lib → orbcharts-plugins-basic/lib}/plugins-basic-types.d.ts +0 -0
  175. /package/dist/{src → orbcharts-plugins-basic/src}/base/types.d.ts +0 -0
  176. /package/dist/{src → orbcharts-plugins-basic/src}/const.d.ts +0 -0
  177. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Bars.d.ts +0 -0
  178. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsPN.d.ts +0 -0
  179. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsTriangle.d.ts +0 -0
  180. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Dots.d.ts +0 -0
  181. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridLegend.d.ts +0 -0
  182. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAux.d.ts +0 -0
  183. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAxis.d.ts +0 -0
  184. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/LineAreas.d.ts +0 -0
  185. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Lines.d.ts +0 -0
  186. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ValueAxis.d.ts +0 -0
  187. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/multiGridObservables.d.ts +0 -0
  188. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBars.d.ts +0 -0
  189. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBarsTriangle.d.ts +0 -0
  190. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiDots.d.ts +0 -0
  191. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridLegend.d.ts +0 -0
  192. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGroupAxis.d.ts +0 -0
  193. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLineAreas.d.ts +0 -0
  194. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLines.d.ts +0 -0
  195. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiValueAxis.d.ts +0 -0
  196. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueAxes.d.ts +0 -0
  197. /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/Ranking.d.ts +0 -0
  198. /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/RankingAxis.d.ts +0 -0
  199. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/defaults.d.ts +0 -0
  200. /package/dist/{src/base/BaseGroupArea.d.ts → orbcharts-plugins-basic/src/noneData/plugins/Container.d.ts} +0 -0
  201. /package/dist/{src/multiValue/index.d.ts → orbcharts-plugins-basic/src/noneData/plugins/Tooltip.d.ts} +0 -0
  202. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Bubbles.d.ts +0 -0
  203. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Pie.d.ts +0 -0
  204. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieEventTexts.d.ts +0 -0
  205. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieLabels.d.ts +0 -0
  206. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Rose.d.ts +0 -0
  207. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/RoseLabels.d.ts +0 -0
  208. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesLegend.d.ts +0 -0
  209. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Waffle.d.ts +0 -0
  210. /package/dist/{src → orbcharts-plugins-basic/src}/series/seriesUtils.d.ts +0 -0
  211. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeLegend.d.ts +0 -0
  212. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeMap.d.ts +0 -0
  213. /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Graphics.d.ts +0 -0
  214. /package/dist/{vite.config.d.ts → orbcharts-plugins-basic/vite.config.d.ts} +0 -0
  215. /package/src/{grid → multiValue}/plugins/Ranking.ts +0 -0
  216. /package/src/{grid → multiValue}/plugins/RankingAxis.ts +0 -0
package/src/base/types.ts CHANGED
@@ -1,3 +1,3 @@
1
- export interface BasePluginFn<Context> {
2
- (pluginName: string, context: Context): () => void // return unsubscribe function
1
+ export interface BasePluginFn<Context> {
2
+ (pluginName: string, context: Context): () => void // return unsubscribe function
3
3
  }
package/src/const.ts CHANGED
@@ -1,30 +1,30 @@
1
-
2
- // 圖層索引 - 底層(無圖型)
3
- export const LAYER_INDEX_OF_ROOT = 0
4
-
5
- // 圖層索引 - 背景 *預留
6
- export const LAYER_INDEX_OF_BG = 1
7
-
8
- // 圖層索引 - 圖軸
9
- export const LAYER_INDEX_OF_AXIS = 2
10
-
11
- // 圖層索引 - 輔助線、圖軸的輔助資訊
12
- export const LAYER_INDEX_OF_AUX = 3
13
-
14
- // 圖層索引 - 底層圖型
15
- export const LAYER_INDEX_OF_GRAPHIC_GROUND = 4
16
-
17
- // 圖層索引 - 一般圖型
18
- export const LAYER_INDEX_OF_GRAPHIC = 5
19
-
20
- // 圖層索引 - 覆蓋圖型
21
- export const LAYER_INDEX_OF_GRAPHIC_COVER = 6
22
-
23
- // 圖層索引 - 圖型上的標籤文字
24
- export const LAYER_INDEX_OF_LABEL = 7
25
-
26
- // 圖層索引 - 圖例、圖表上的文字
27
- export const LAYER_INDEX_OF_INFO = 8
28
-
29
- // 圖層索引 - Tooltip、事件觸發的覆蓋圖型
30
- export const LAYER_INDEX_OF_TOOLTIP = 9
1
+
2
+ // 圖層索引 - 底層(無圖型)
3
+ export const LAYER_INDEX_OF_ROOT = 0
4
+
5
+ // 圖層索引 - 背景 *預留
6
+ export const LAYER_INDEX_OF_BG = 1
7
+
8
+ // 圖層索引 - 圖軸
9
+ export const LAYER_INDEX_OF_AXIS = 2
10
+
11
+ // 圖層索引 - 輔助線、圖軸的輔助資訊
12
+ export const LAYER_INDEX_OF_AUX = 3
13
+
14
+ // 圖層索引 - 底層圖型
15
+ export const LAYER_INDEX_OF_GRAPHIC_GROUND = 4
16
+
17
+ // 圖層索引 - 一般圖型
18
+ export const LAYER_INDEX_OF_GRAPHIC = 5
19
+
20
+ // 圖層索引 - 覆蓋圖型
21
+ export const LAYER_INDEX_OF_GRAPHIC_COVER = 6
22
+
23
+ // 圖層索引 - 圖型上的標籤文字
24
+ export const LAYER_INDEX_OF_LABEL = 7
25
+
26
+ // 圖層索引 - 圖例、圖表上的文字
27
+ export const LAYER_INDEX_OF_INFO = 8
28
+
29
+ // 圖層索引 - Tooltip、事件觸發的覆蓋圖型
30
+ export const LAYER_INDEX_OF_TOOLTIP = 9
@@ -1,128 +1,247 @@
1
- import type {
2
- LinesParams,
3
- LineAreasParams,
4
- GroupAuxParams,
5
- DotsParams,
6
- BarsParams,
7
- BarStackParams,
8
- BarsTriangleParams,
9
- GroupAxisParams,
10
- ValueAxisParams,
11
- ValueStackAxisParams,
12
- ScalingAreaParams,
13
- GridLegendParams } from '../../lib/plugins-basic-types'
14
-
15
- export const DEFAULT_LINES_PARAMS: LinesParams = {
16
- lineCurve: 'curveLinear',
17
- lineWidth: 2
18
- }
19
-
20
- export const DEFAULT_LINE_AREAS_PARAMS: LineAreasParams = {
21
- lineCurve: 'curveLinear',
22
- linearGradientOpacity: [1, 0]
23
- }
24
-
25
- export const DEFAULT_DOTS_PARAMS: DotsParams = {
26
- radius: 4,
27
- fillColorType: 'white',
28
- strokeColorType: 'series',
29
- strokeWidth: 2,
30
- // strokeWidthWhileHighlight: 3,
31
- onlyShowHighlighted: false
32
- }
33
-
34
- export const DEFAULT_GROUP_AREA_PARAMS: GroupAuxParams = {
35
- showLine: true,
36
- showLabel: true,
37
- lineDashArray: '3, 3',
38
- lineColorType: 'primary',
39
- labelColorType: 'primary',
40
- labelTextColorType: 'background',
41
- labelTextFormat: text => text,
42
- labelPadding: 20,
43
- labelRotate: 0
44
- }
45
- DEFAULT_GROUP_AREA_PARAMS.labelTextFormat.toString = () => `text => text`
46
-
47
- export const DEFAULT_BARS_PARAMS: BarsParams = {
48
- // barType: 'rect',
49
- barWidth: 0,
50
- barPadding: 1,
51
- barGroupPadding: 40,
52
- barRadius: false,
53
- }
54
-
55
- export const DEFAULT_BARS_DIVERGING_PARAMS: BarsParams = {
56
- ...DEFAULT_BARS_PARAMS
57
- }
58
-
59
- export const DEFAULT_BAR_STACK_PARAMS: BarStackParams = {
60
- barWidth: 0,
61
- barGroupPadding: 10,
62
- barRadius: false,
63
- }
64
-
65
- export const DEFAULT_BARS_TRIANGLE_PARAMS: BarsTriangleParams = {
66
- barWidth: 0,
67
- barPadding: 1,
68
- barGroupPadding: 20,
69
- linearGradientOpacity: [1, 0]
70
- }
71
-
72
- export const DEFAULT_GROUP_AXIS_PARAMS: GroupAxisParams = {
73
- // labelAnchor: 'start',
74
- labelOffset: [0, 0],
75
- labelColorType: 'primary',
76
- axisLineVisible: true,
77
- axisLineColorType: 'primary',
78
- ticks: 'all',
79
- tickFormat: text => text,
80
- tickLineVisible: true,
81
- tickPadding: 20,
82
- tickFullLine: false,
83
- tickFullLineDasharray: 'none',
84
- tickColorType: 'secondary',
85
- tickTextRotate: 0,
86
- tickTextColorType: 'primary',
87
- }
88
- DEFAULT_GROUP_AXIS_PARAMS.tickFormat.toString = () => `text => text`
89
-
90
- export const DEFAULT_VALUE_AXIS_PARAMS: ValueAxisParams = {
91
- // labelAnchor: 'end',
92
- labelOffset: [0, 0],
93
- labelColorType: 'primary',
94
- axisLineVisible: false,
95
- axisLineColorType: 'primary',
96
- ticks: null,
97
- tickFormat: ',.0f',
98
- tickLineVisible: true,
99
- tickPadding: 20,
100
- tickFullLine: true,
101
- tickFullLineDasharray: 'none',
102
- tickColorType: 'secondary',
103
- tickTextRotate: 0,
104
- tickTextColorType: 'primary'
105
- }
106
-
107
- export const DEFAULT_VALUE_STACK_AXIS_PARAMS: ValueStackAxisParams = {
108
- ...DEFAULT_VALUE_AXIS_PARAMS
109
- }
110
-
111
- export const DEFAULT_SCALING_AREA_PARAMS: ScalingAreaParams = {
112
-
113
- }
114
-
115
- export const DEFAULT_GRID_LEGEND_PARAMS: GridLegendParams = {
116
- position: 'right',
117
- justify: 'end',
118
- padding: 28,
119
- // offset: [0, 0],
120
- backgroundFill: 'none',
121
- backgroundStroke: 'none',
122
- gap: 10,
123
- listRectWidth: 14,
124
- listRectHeight: 14,
125
- listRectRadius: 0,
126
- // highlightEvent: false
127
- textColorType: 'primary'
128
- }
1
+ import type {
2
+ LinesParams,
3
+ LineAreasParams,
4
+ GroupAuxParams,
5
+ DotsParams,
6
+ BarsParams,
7
+ StackedBarParams,
8
+ BarsTriangleParams,
9
+ GroupAxisParams,
10
+ ValueAxisParams,
11
+ StackedValueAxisParams,
12
+ GridTooltipParams,
13
+ GridZoomParams,
14
+ GridLegendParams
15
+ } from '../../lib/plugins-basic-types'
16
+ // import { measureTextWidth } from '../utils/commonUtils'
17
+
18
+ export const DEFAULT_LINES_PARAMS: LinesParams = {
19
+ lineCurve: 'curveLinear',
20
+ lineWidth: 2
21
+ }
22
+
23
+ export const DEFAULT_LINE_AREAS_PARAMS: LineAreasParams = {
24
+ lineCurve: 'curveLinear',
25
+ linearGradientOpacity: [1, 0]
26
+ }
27
+
28
+ export const DEFAULT_DOTS_PARAMS: DotsParams = {
29
+ radius: 4,
30
+ fillColorType: 'white',
31
+ strokeColorType: 'label',
32
+ strokeWidth: 2,
33
+ // strokeWidthWhileHighlight: 3,
34
+ onlyShowHighlighted: false
35
+ }
36
+
37
+ export const DEFAULT_GROUP_AUX_PARAMS: GroupAuxParams = {
38
+ showLine: true,
39
+ showLabel: true,
40
+ lineDashArray: '3, 3',
41
+ lineColorType: 'primary',
42
+ labelColorType: 'primary',
43
+ labelTextColorType: 'background',
44
+ labelTextFormat: text => text,
45
+ labelPadding: 20,
46
+ labelRotate: 0
47
+ }
48
+ DEFAULT_GROUP_AUX_PARAMS.labelTextFormat.toString = () => `text => text`
49
+
50
+ export const DEFAULT_BARS_PARAMS: BarsParams = {
51
+ // barType: 'rect',
52
+ barWidth: 0,
53
+ barPadding: 1,
54
+ barGroupPadding: 40,
55
+ barRadius: false,
56
+ }
57
+
58
+ export const DEFAULT_BARS_DIVERGING_PARAMS: BarsParams = {
59
+ ...DEFAULT_BARS_PARAMS
60
+ }
61
+
62
+ export const DEFAULT_STACKED_BAR_PARAMS: StackedBarParams = {
63
+ barWidth: 0,
64
+ barGroupPadding: 10,
65
+ barRadius: false,
66
+ }
67
+
68
+ export const DEFAULT_BARS_TRIANGLE_PARAMS: BarsTriangleParams = {
69
+ barWidth: 0,
70
+ barPadding: 1,
71
+ barGroupPadding: 20,
72
+ linearGradientOpacity: [1, 0]
73
+ }
74
+
75
+ export const DEFAULT_GROUP_AXIS_PARAMS: GroupAxisParams = {
76
+ // labelAnchor: 'start',
77
+ labelOffset: [0, 0],
78
+ labelColorType: 'primary',
79
+ axisLineVisible: true,
80
+ axisLineColorType: 'primary',
81
+ ticks: 'all',
82
+ tickFormat: text => text,
83
+ tickLineVisible: true,
84
+ tickPadding: 20,
85
+ tickFullLine: false,
86
+ tickFullLineDasharray: 'none',
87
+ tickColorType: 'secondary',
88
+ tickTextRotate: 0,
89
+ tickTextColorType: 'primary',
90
+ }
91
+ DEFAULT_GROUP_AXIS_PARAMS.tickFormat.toString = () => `text => text`
92
+
93
+ export const DEFAULT_VALUE_AXIS_PARAMS: ValueAxisParams = {
94
+ // labelAnchor: 'end',
95
+ labelOffset: [0, 0],
96
+ labelColorType: 'primary',
97
+ axisLineVisible: false,
98
+ axisLineColorType: 'primary',
99
+ ticks: null,
100
+ // tickFormat: ',.0f',
101
+ tickFormat: v => v,
102
+ tickLineVisible: true,
103
+ tickPadding: 20,
104
+ tickFullLine: true,
105
+ tickFullLineDasharray: 'none',
106
+ tickColorType: 'secondary',
107
+ tickTextRotate: 0,
108
+ tickTextColorType: 'primary'
109
+ }
110
+ DEFAULT_VALUE_AXIS_PARAMS.tickFormat.toString = () => 'v => v'
111
+
112
+ export const DEFAULT_STACKED_VALUE_AXIS_PARAMS: StackedValueAxisParams = {
113
+ ...DEFAULT_VALUE_AXIS_PARAMS
114
+ }
115
+
116
+ export const DEFAULT_GRID_ZOOM_PARAMS: GridZoomParams = {
117
+
118
+ }
119
+
120
+ export const DEFAULT_GRID_LEGEND_PARAMS: GridLegendParams = {
121
+ // position: 'right',
122
+ // justify: 'end',
123
+ placement: 'bottom',
124
+ padding: 28,
125
+ // offset: [0, 0],
126
+ backgroundFill: 'none',
127
+ backgroundStroke: 'none',
128
+ gap: 10,
129
+ listRectWidth: 14,
130
+ listRectHeight: 14,
131
+ listRectRadius: 0,
132
+ // highlightEvent: false
133
+ textColorType: 'primary'
134
+ }
135
+
136
+ export const DEFAULT_GRID_TOOLTIP_PARAMS: GridTooltipParams = {
137
+ backgroundColorType: 'background',
138
+ strokeColorType: 'primary',
139
+ backgroundOpacity: 0.8,
140
+ textColorType: 'primary',
141
+ offset: [20, 5],
142
+ padding: 10,
143
+ // renderFn: (eventData, { styles }) => {
144
+ // const bulletWidth = styles.textSizePx * 0.7
145
+ // const offset = (styles.textSizePx / 2) - (bulletWidth / 2)
146
+ // if (eventData.highlightTarget === 'group') {
147
+ // const titleSvg = `<g><text dominant-baseline="hanging" font-size="${styles.textSizePx}">${eventData.groupLabel}</text></g>`
148
+ // const maxLengthText = eventData.groups.reduce((acc, group) => {
149
+ // const text = `${group.seriesLabel}${group.value}`
150
+ // return text.length > acc.length ? text : acc
151
+ // }, '')
152
+ // const maxTextWidth = measureTextWidth(maxLengthText, styles.textSizePx)
153
+ // const lineEndX = maxTextWidth + styles.textSizePx * 2
154
+ // const contentSvg = eventData.groups
155
+ // .map((group, i) => {
156
+ // const y = i * styles.textSizePx * 1.5
157
+ // return `<g transform="translate(0, ${styles.textSizePx * 2})">
158
+ // <rect width="${bulletWidth}" height="${bulletWidth}" x="${offset}" y="${y + offset}" rx="${bulletWidth / 2}" fill="${group.color}"></rect>
159
+ // <text x="${styles.textSizePx * 1.5}" y="${y}" font-size="${styles.textSizePx}" dominant-baseline="hanging" fill="${styles.textColor}">
160
+ // <tspan>${group.seriesLabel}</tspan>
161
+ // <tspan font-weight="bold" text-anchor="end" x="${lineEndX}">${group.value}</tspan>
162
+ // </text>
163
+ // </g>`
164
+ // })
165
+ // .join('')
166
+ // return `${titleSvg}
167
+ // ${contentSvg}`
168
+ // } else if (eventData.highlightTarget === 'series') {
169
+ // const titleSvg = `<g><text dominant-baseline="hanging" font-size="${styles.textSizePx}">${eventData.groupLabel}</text></g>`
170
+ // const textWidth = measureTextWidth(`${eventData.seriesLabel}${eventData.datum.value}`, styles.textSizePx)
171
+ // const lineEndX = textWidth + styles.textSizePx * 2
172
+ // const contentSvg = `<g transform="translate(0, ${styles.textSizePx * 2})">
173
+ // <rect width="${bulletWidth}" height="${bulletWidth}" x="${offset}" y="${offset}" rx="${bulletWidth / 2}" fill="${eventData.datum.color}"></rect>
174
+ // <text x="${styles.textSizePx * 1.5}" font-size="${styles.textSizePx}" dominant-baseline="hanging" fill="${styles.textColor}">
175
+ // <tspan>${eventData.seriesLabel}</tspan>
176
+ // <tspan font-weight="bold" text-anchor="end" x="${lineEndX}">${eventData.datum.value}</tspan>
177
+ // </text>
178
+ // </g>`
179
+ // return `${titleSvg}
180
+ // ${contentSvg}`
181
+ // } else {
182
+ // const textWidth = measureTextWidth(`${eventData.datum.label}${eventData.datum.value}`, styles.textSizePx)
183
+ // const lineEndX = textWidth + styles.textSizePx * 2
184
+ // return `<g>
185
+ // <rect width="${bulletWidth}" height="${bulletWidth}" x="${offset}" y="${offset}" rx="${bulletWidth / 2}" fill="${eventData.datum.color}"></rect>
186
+ // <text x="${styles.textSizePx * 1.5}" font-size="${styles.textSizePx}" dominant-baseline="hanging" fill="${styles.textColor}">
187
+ // <tspan>${eventData.datum.label}</tspan>
188
+ // <tspan font-weight="bold" text-anchor="end" x="${lineEndX}">${eventData.datum.value}</tspan>
189
+ // </text>
190
+ // </g>`
191
+ // }
192
+ // },
193
+ renderFn: (eventData, { styles, utils }) => {
194
+ const bulletWidth = styles.textSizePx * 0.7
195
+ const offset = (styles.textSizePx / 2) - (bulletWidth / 2)
196
+
197
+ const titleSvg = `<g><text dominant-baseline="hanging" font-size="${styles.textSizePx}">${eventData.groupLabel}</text></g>`
198
+ const maxLengthText = eventData.groups.reduce((acc, group) => {
199
+ const text = `${group.seriesLabel}${group.value}`
200
+ return text.length > acc.length ? text : acc
201
+ }, '')
202
+ const maxTextWidth = utils.measureTextWidth(maxLengthText, styles.textSizePx)
203
+ const lineEndX = maxTextWidth + styles.textSizePx * 2
204
+ const contentSvg = eventData.groups
205
+ .map((group, i) => {
206
+ const y = i * styles.textSizePx * 1.5
207
+ const isHighlight = group.id === (eventData.datum && eventData.datum.id)
208
+ return `<g transform="translate(0, ${styles.textSizePx * 2})">
209
+ <rect width="${bulletWidth}" height="${bulletWidth}" x="${offset}" y="${y + offset}" rx="${bulletWidth / 2}" fill="${group.color}"></rect>
210
+ <text x="${styles.textSizePx * 1.5}" y="${y}" font-size="${styles.textSizePx}" dominant-baseline="hanging" fill="${styles.textColor}">
211
+ <tspan font-weight="${isHighlight ? 'bold' : ''}">${group.seriesLabel}</tspan>
212
+ <tspan font-weight="bold" text-anchor="end" x="${lineEndX}">${group.value}</tspan>
213
+ </text>
214
+ </g>`
215
+ })
216
+ .join('')
217
+ return `${titleSvg}
218
+ ${contentSvg}`
219
+ }
220
+ }
221
+ DEFAULT_GRID_TOOLTIP_PARAMS.renderFn.toString = () => `(eventData, { styles, utils }) => {
222
+ const bulletWidth = styles.textSizePx * 0.7
223
+ const offset = (styles.textSizePx / 2) - (bulletWidth / 2)
224
+
225
+ const titleSvg = \`<g><text dominant-baseline="hanging" font-size="\${styles.textSizePx}">\${eventData.groupLabel}</text></g>\`
226
+ const maxLengthText = eventData.groups.reduce((acc, group) => {
227
+ const text = \`\${group.seriesLabel}\${group.value}\`
228
+ return text.length > acc.length ? text : acc
229
+ }, '')
230
+ const maxTextWidth = utils.measureTextWidth(maxLengthText, styles.textSizePx)
231
+ const lineEndX = maxTextWidth + styles.textSizePx * 2
232
+ const contentSvg = eventData.groups
233
+ .map((group, i) => {
234
+ const y = i * styles.textSizePx * 1.5
235
+ const isHighlight = group.id === (eventData.datum && eventData.datum.id)
236
+ return \`<g transform="translate(0, \${styles.textSizePx * 2})">
237
+ <rect width="\${bulletWidth}" height="\${bulletWidth}" x="\${offset}" y="\${y + offset}" rx="\${bulletWidth / 2}" fill="\${group.color}"></rect>
238
+ <text x="\${styles.textSizePx * 1.5}" y="\${y}" font-size="\${styles.textSizePx}" dominant-baseline="hanging" fill="\${styles.textColor}">
239
+ <tspan font-weight="\${isHighlight ? 'bold' : ''}">\${group.seriesLabel}</tspan>
240
+ <tspan font-weight="bold" text-anchor="end" x="\${lineEndX}">\${group.value}</tspan>
241
+ </text>
242
+ </g>\`
243
+ })
244
+ .join('')
245
+ return \`\${titleSvg}
246
+ \${contentSvg}\`
247
+ }`