@gravity-ui/chartkit 5.17.1 → 5.18.0

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 (298) hide show
  1. package/build/components/ChartKit.css +0 -1
  2. package/build/components/SplitPane/Pane.d.ts +14 -0
  3. package/build/components/SplitPane/Pane.js +26 -0
  4. package/build/components/SplitPane/Resizer.d.ts +18 -0
  5. package/build/components/SplitPane/Resizer.js +26 -0
  6. package/build/components/SplitPane/SplitPane.d.ts +59 -0
  7. package/build/components/SplitPane/SplitPane.js +235 -0
  8. package/build/{plugins/highcharts/renderer/components/StyledSplitPane → components/SplitPane}/StyledSplitPane.css +0 -1
  9. package/build/{plugins/highcharts/renderer/components/StyledSplitPane → components/SplitPane}/StyledSplitPane.d.ts +1 -1
  10. package/build/{plugins/highcharts/renderer/components/StyledSplitPane → components/SplitPane}/StyledSplitPane.js +3 -3
  11. package/build/components/SplitPane/constants.d.ts +4 -0
  12. package/build/components/SplitPane/constants.js +4 -0
  13. package/build/components/SplitPane/index.d.ts +8 -0
  14. package/build/components/SplitPane/index.js +18 -0
  15. package/build/components/SplitPane/types.d.ts +2 -0
  16. package/build/constants/index.d.ts +1 -0
  17. package/build/constants/index.js +1 -0
  18. package/build/constants/misc.d.ts +10 -0
  19. package/build/constants/misc.js +19 -0
  20. package/build/hooks/index.d.ts +1 -0
  21. package/build/hooks/index.js +1 -0
  22. package/build/hooks/misc.d.ts +1 -0
  23. package/build/hooks/misc.js +8 -0
  24. package/build/plugins/d3/index.d.ts +1 -1
  25. package/build/plugins/d3/index.js +2 -1
  26. package/build/plugins/d3/renderer/D3Widget.d.ts +5 -1
  27. package/build/plugins/d3/renderer/D3Widget.js +31 -66
  28. package/build/plugins/d3/renderer/withSplitPane/TooltipContent.d.ts +8 -0
  29. package/build/plugins/d3/renderer/withSplitPane/TooltipContent.js +12 -0
  30. package/build/plugins/d3/renderer/withSplitPane/useWithSplitPaneState.d.ts +19 -0
  31. package/build/plugins/d3/renderer/withSplitPane/useWithSplitPaneState.js +46 -0
  32. package/build/plugins/d3/renderer/withSplitPane/withSplitPane.d.ts +4 -0
  33. package/build/plugins/d3/renderer/withSplitPane/withSplitPane.js +100 -0
  34. package/build/plugins/d3/types.d.ts +2 -2
  35. package/build/plugins/highcharts/renderer/HighchartsWidget.d.ts +2 -2
  36. package/build/plugins/highcharts/renderer/components/withSplitPane/withSplitPane.js +1 -1
  37. package/build/types/index.js +1 -0
  38. package/build/types/widget-data/pie.d.ts +1 -1
  39. package/build/types/widget.d.ts +6 -3
  40. package/build/utils/index.d.ts +1 -0
  41. package/build/utils/index.js +1 -0
  42. package/build/utils/misc.d.ts +2 -0
  43. package/build/utils/misc.js +7 -0
  44. package/package.json +4 -4
  45. package/build/plugins/d3/examples/ExampleWrapper.d.ts +0 -7
  46. package/build/plugins/d3/examples/ExampleWrapper.js +0 -5
  47. package/build/plugins/d3/examples/area/Basic.d.ts +0 -2
  48. package/build/plugins/d3/examples/area/Basic.js +0 -34
  49. package/build/plugins/d3/examples/area/NegativeValues.d.ts +0 -2
  50. package/build/plugins/d3/examples/area/NegativeValues.js +0 -24
  51. package/build/plugins/d3/examples/area/PercentStacking.d.ts +0 -2
  52. package/build/plugins/d3/examples/area/PercentStacking.js +0 -47
  53. package/build/plugins/d3/examples/area/StackedArea.d.ts +0 -2
  54. package/build/plugins/d3/examples/area/StackedArea.js +0 -47
  55. package/build/plugins/d3/examples/area/TwoYAxis.d.ts +0 -2
  56. package/build/plugins/d3/examples/area/TwoYAxis.js +0 -58
  57. package/build/plugins/d3/examples/bar-x/Basic.d.ts +0 -4
  58. package/build/plugins/d3/examples/bar-x/Basic.js +0 -88
  59. package/build/plugins/d3/examples/bar-x/DataLabels.d.ts +0 -2
  60. package/build/plugins/d3/examples/bar-x/DataLabels.js +0 -48
  61. package/build/plugins/d3/examples/bar-x/GroupedColumns.d.ts +0 -2
  62. package/build/plugins/d3/examples/bar-x/GroupedColumns.js +0 -48
  63. package/build/plugins/d3/examples/bar-x/NegativeValues.d.ts +0 -2
  64. package/build/plugins/d3/examples/bar-x/NegativeValues.js +0 -41
  65. package/build/plugins/d3/examples/bar-x/PercentStack.d.ts +0 -2
  66. package/build/plugins/d3/examples/bar-x/PercentStack.js +0 -47
  67. package/build/plugins/d3/examples/bar-x/StackedColumns.d.ts +0 -2
  68. package/build/plugins/d3/examples/bar-x/StackedColumns.js +0 -47
  69. package/build/plugins/d3/examples/bar-x/TwoYAxis.d.ts +0 -2
  70. package/build/plugins/d3/examples/bar-x/TwoYAxis.js +0 -58
  71. package/build/plugins/d3/examples/bar-y/Basic.d.ts +0 -2
  72. package/build/plugins/d3/examples/bar-y/Basic.js +0 -45
  73. package/build/plugins/d3/examples/bar-y/GroupedColumns.d.ts +0 -2
  74. package/build/plugins/d3/examples/bar-y/GroupedColumns.js +0 -50
  75. package/build/plugins/d3/examples/bar-y/NegativeValues.d.ts +0 -2
  76. package/build/plugins/d3/examples/bar-y/NegativeValues.js +0 -40
  77. package/build/plugins/d3/examples/bar-y/PercentStacking.d.ts +0 -2
  78. package/build/plugins/d3/examples/bar-y/PercentStacking.js +0 -49
  79. package/build/plugins/d3/examples/bar-y/StackedColumns.d.ts +0 -2
  80. package/build/plugins/d3/examples/bar-y/StackedColumns.js +0 -49
  81. package/build/plugins/d3/examples/combined/LineAndBarX.d.ts +0 -2
  82. package/build/plugins/d3/examples/combined/LineAndBarX.js +0 -63
  83. package/build/plugins/d3/examples/line/Basic.d.ts +0 -2
  84. package/build/plugins/d3/examples/line/Basic.js +0 -68
  85. package/build/plugins/d3/examples/line/DataLabels.d.ts +0 -2
  86. package/build/plugins/d3/examples/line/DataLabels.js +0 -91
  87. package/build/plugins/d3/examples/line/LineWithMarkers.d.ts +0 -2
  88. package/build/plugins/d3/examples/line/LineWithMarkers.js +0 -69
  89. package/build/plugins/d3/examples/line/LogarithmicAxis.d.ts +0 -2
  90. package/build/plugins/d3/examples/line/LogarithmicAxis.js +0 -38
  91. package/build/plugins/d3/examples/line/Shapes.d.ts +0 -2
  92. package/build/plugins/d3/examples/line/Shapes.js +0 -93
  93. package/build/plugins/d3/examples/line/TwoYAxis.d.ts +0 -2
  94. package/build/plugins/d3/examples/line/TwoYAxis.js +0 -58
  95. package/build/plugins/d3/examples/mars-weather.d.ts +0 -13
  96. package/build/plugins/d3/examples/mars-weather.js +0 -1203
  97. package/build/plugins/d3/examples/nintendoGames.d.ts +0 -92
  98. package/build/plugins/d3/examples/nintendoGames.js +0 -12264
  99. package/build/plugins/d3/examples/pie/Basic.d.ts +0 -2
  100. package/build/plugins/d3/examples/pie/Basic.js +0 -32
  101. package/build/plugins/d3/examples/pie/Donut.d.ts +0 -2
  102. package/build/plugins/d3/examples/pie/Donut.js +0 -33
  103. package/build/plugins/d3/examples/pie/DonutWithTotals.d.ts +0 -2
  104. package/build/plugins/d3/examples/pie/DonutWithTotals.js +0 -36
  105. package/build/plugins/d3/examples/scatter/Basic.d.ts +0 -2
  106. package/build/plugins/d3/examples/scatter/Basic.js +0 -47
  107. package/build/plugins/d3/examples/scatter/TwoYAxis.d.ts +0 -2
  108. package/build/plugins/d3/examples/scatter/TwoYAxis.js +0 -58
  109. package/build/plugins/d3/renderer/components/AxisX.d.ts +0 -19
  110. package/build/plugins/d3/renderer/components/AxisX.js +0 -108
  111. package/build/plugins/d3/renderer/components/AxisY.d.ts +0 -11
  112. package/build/plugins/d3/renderer/components/AxisY.js +0 -199
  113. package/build/plugins/d3/renderer/components/Chart.d.ts +0 -10
  114. package/build/plugins/d3/renderer/components/Chart.js +0 -145
  115. package/build/plugins/d3/renderer/components/Legend.d.ts +0 -12
  116. package/build/plugins/d3/renderer/components/Legend.js +0 -278
  117. package/build/plugins/d3/renderer/components/PlotTitle.d.ts +0 -7
  118. package/build/plugins/d3/renderer/components/PlotTitle.js +0 -12
  119. package/build/plugins/d3/renderer/components/Title.d.ts +0 -7
  120. package/build/plugins/d3/renderer/components/Title.js +0 -8
  121. package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.d.ts +0 -10
  122. package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.js +0 -102
  123. package/build/plugins/d3/renderer/components/Tooltip/index.d.ts +0 -12
  124. package/build/plugins/d3/renderer/components/Tooltip/index.js +0 -28
  125. package/build/plugins/d3/renderer/components/index.d.ts +0 -1
  126. package/build/plugins/d3/renderer/components/index.js +0 -1
  127. package/build/plugins/d3/renderer/components/styles.css +0 -140
  128. package/build/plugins/d3/renderer/constants/defaults/axis.d.ts +0 -14
  129. package/build/plugins/d3/renderer/constants/defaults/axis.js +0 -18
  130. package/build/plugins/d3/renderer/constants/defaults/index.d.ts +0 -3
  131. package/build/plugins/d3/renderer/constants/defaults/index.js +0 -3
  132. package/build/plugins/d3/renderer/constants/defaults/legend.d.ts +0 -12
  133. package/build/plugins/d3/renderer/constants/defaults/legend.js +0 -12
  134. package/build/plugins/d3/renderer/constants/defaults/series-options.d.ts +0 -24
  135. package/build/plugins/d3/renderer/constants/defaults/series-options.js +0 -106
  136. package/build/plugins/d3/renderer/constants/index.d.ts +0 -3
  137. package/build/plugins/d3/renderer/constants/index.js +0 -24
  138. package/build/plugins/d3/renderer/d3-dispatcher.d.ts +0 -1
  139. package/build/plugins/d3/renderer/d3-dispatcher.js +0 -4
  140. package/build/plugins/d3/renderer/hooks/index.d.ts +0 -10
  141. package/build/plugins/d3/renderer/hooks/index.js +0 -10
  142. package/build/plugins/d3/renderer/hooks/useAxisScales/index.d.ts +0 -25
  143. package/build/plugins/d3/renderer/hooks/useAxisScales/index.js +0 -183
  144. package/build/plugins/d3/renderer/hooks/useChartDimensions/index.d.ts +0 -16
  145. package/build/plugins/d3/renderer/hooks/useChartDimensions/index.js +0 -34
  146. package/build/plugins/d3/renderer/hooks/useChartDimensions/utils.d.ts +0 -10
  147. package/build/plugins/d3/renderer/hooks/useChartDimensions/utils.js +0 -32
  148. package/build/plugins/d3/renderer/hooks/useChartOptions/chart.d.ts +0 -6
  149. package/build/plugins/d3/renderer/hooks/useChartOptions/chart.js +0 -28
  150. package/build/plugins/d3/renderer/hooks/useChartOptions/index.d.ts +0 -7
  151. package/build/plugins/d3/renderer/hooks/useChartOptions/index.js +0 -21
  152. package/build/plugins/d3/renderer/hooks/useChartOptions/title.d.ts +0 -5
  153. package/build/plugins/d3/renderer/hooks/useChartOptions/title.js +0 -18
  154. package/build/plugins/d3/renderer/hooks/useChartOptions/tooltip.d.ts +0 -5
  155. package/build/plugins/d3/renderer/hooks/useChartOptions/tooltip.js +0 -5
  156. package/build/plugins/d3/renderer/hooks/useChartOptions/types.d.ts +0 -47
  157. package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.d.ts +0 -7
  158. package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.js +0 -114
  159. package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.d.ts +0 -7
  160. package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.js +0 -116
  161. package/build/plugins/d3/renderer/hooks/useSeries/constants.d.ts +0 -8
  162. package/build/plugins/d3/renderer/hooks/useSeries/constants.js +0 -19
  163. package/build/plugins/d3/renderer/hooks/useSeries/index.d.ts +0 -29
  164. package/build/plugins/d3/renderer/hooks/useSeries/index.js +0 -82
  165. package/build/plugins/d3/renderer/hooks/useSeries/prepare-area.d.ts +0 -19
  166. package/build/plugins/d3/renderer/hooks/useSeries/prepare-area.js +0 -63
  167. package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-x.d.ts +0 -10
  168. package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-x.js +0 -38
  169. package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-y.d.ts +0 -10
  170. package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-y.js +0 -49
  171. package/build/plugins/d3/renderer/hooks/useSeries/prepare-legend.d.ts +0 -27
  172. package/build/plugins/d3/renderer/hooks/useSeries/prepare-legend.js +0 -144
  173. package/build/plugins/d3/renderer/hooks/useSeries/prepare-line.d.ts +0 -22
  174. package/build/plugins/d3/renderer/hooks/useSeries/prepare-line.js +0 -82
  175. package/build/plugins/d3/renderer/hooks/useSeries/prepare-options.d.ts +0 -3
  176. package/build/plugins/d3/renderer/hooks/useSeries/prepare-options.js +0 -5
  177. package/build/plugins/d3/renderer/hooks/useSeries/prepare-pie.d.ts +0 -9
  178. package/build/plugins/d3/renderer/hooks/useSeries/prepare-pie.js +0 -62
  179. package/build/plugins/d3/renderer/hooks/useSeries/prepare-scatter.d.ts +0 -11
  180. package/build/plugins/d3/renderer/hooks/useSeries/prepare-scatter.js +0 -47
  181. package/build/plugins/d3/renderer/hooks/useSeries/prepare-treemap.d.ts +0 -11
  182. package/build/plugins/d3/renderer/hooks/useSeries/prepare-treemap.js +0 -38
  183. package/build/plugins/d3/renderer/hooks/useSeries/prepare-waterfall.d.ts +0 -10
  184. package/build/plugins/d3/renderer/hooks/useSeries/prepare-waterfall.js +0 -37
  185. package/build/plugins/d3/renderer/hooks/useSeries/prepareSeries.d.ts +0 -10
  186. package/build/plugins/d3/renderer/hooks/useSeries/prepareSeries.js +0 -65
  187. package/build/plugins/d3/renderer/hooks/useSeries/types.d.ts +0 -254
  188. package/build/plugins/d3/renderer/hooks/useSeries/types.js +0 -1
  189. package/build/plugins/d3/renderer/hooks/useSeries/utils.d.ts +0 -7
  190. package/build/plugins/d3/renderer/hooks/useSeries/utils.js +0 -33
  191. package/build/plugins/d3/renderer/hooks/useShapes/HtmlLayer.d.ts +0 -8
  192. package/build/plugins/d3/renderer/hooks/useShapes/HtmlLayer.js +0 -22
  193. package/build/plugins/d3/renderer/hooks/useShapes/area/index.d.ts +0 -12
  194. package/build/plugins/d3/renderer/hooks/useShapes/area/index.js +0 -144
  195. package/build/plugins/d3/renderer/hooks/useShapes/area/prepare-data.d.ts +0 -12
  196. package/build/plugins/d3/renderer/hooks/useShapes/area/prepare-data.js +0 -158
  197. package/build/plugins/d3/renderer/hooks/useShapes/area/types.d.ts +0 -28
  198. package/build/plugins/d3/renderer/hooks/useShapes/area/types.js +0 -1
  199. package/build/plugins/d3/renderer/hooks/useShapes/bar-x/index.d.ts +0 -13
  200. package/build/plugins/d3/renderer/hooks/useShapes/bar-x/index.js +0 -96
  201. package/build/plugins/d3/renderer/hooks/useShapes/bar-x/prepare-data.d.ts +0 -13
  202. package/build/plugins/d3/renderer/hooks/useShapes/bar-x/prepare-data.js +0 -160
  203. package/build/plugins/d3/renderer/hooks/useShapes/bar-x/types.d.ts +0 -13
  204. package/build/plugins/d3/renderer/hooks/useShapes/bar-x/types.js +0 -1
  205. package/build/plugins/d3/renderer/hooks/useShapes/bar-y/index.d.ts +0 -12
  206. package/build/plugins/d3/renderer/hooks/useShapes/bar-y/index.js +0 -84
  207. package/build/plugins/d3/renderer/hooks/useShapes/bar-y/prepare-data.d.ts +0 -12
  208. package/build/plugins/d3/renderer/hooks/useShapes/bar-y/prepare-data.js +0 -169
  209. package/build/plugins/d3/renderer/hooks/useShapes/bar-y/types.d.ts +0 -14
  210. package/build/plugins/d3/renderer/hooks/useShapes/bar-y/types.js +0 -1
  211. package/build/plugins/d3/renderer/hooks/useShapes/constants.d.ts +0 -3
  212. package/build/plugins/d3/renderer/hooks/useShapes/constants.js +0 -3
  213. package/build/plugins/d3/renderer/hooks/useShapes/index.d.ts +0 -33
  214. package/build/plugins/d3/renderer/hooks/useShapes/index.js +0 -153
  215. package/build/plugins/d3/renderer/hooks/useShapes/line/index.d.ts +0 -12
  216. package/build/plugins/d3/renderer/hooks/useShapes/line/index.js +0 -131
  217. package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.d.ts +0 -13
  218. package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.js +0 -91
  219. package/build/plugins/d3/renderer/hooks/useShapes/line/types.d.ts +0 -30
  220. package/build/plugins/d3/renderer/hooks/useShapes/line/types.js +0 -1
  221. package/build/plugins/d3/renderer/hooks/useShapes/marker.d.ts +0 -13
  222. package/build/plugins/d3/renderer/hooks/useShapes/marker.js +0 -76
  223. package/build/plugins/d3/renderer/hooks/useShapes/pie/index.d.ts +0 -13
  224. package/build/plugins/d3/renderer/hooks/useShapes/pie/index.js +0 -172
  225. package/build/plugins/d3/renderer/hooks/useShapes/pie/prepare-data.d.ts +0 -9
  226. package/build/plugins/d3/renderer/hooks/useShapes/pie/prepare-data.js +0 -186
  227. package/build/plugins/d3/renderer/hooks/useShapes/pie/types.d.ts +0 -42
  228. package/build/plugins/d3/renderer/hooks/useShapes/pie/types.js +0 -1
  229. package/build/plugins/d3/renderer/hooks/useShapes/pie/utils.d.ts +0 -4
  230. package/build/plugins/d3/renderer/hooks/useShapes/pie/utils.js +0 -15
  231. package/build/plugins/d3/renderer/hooks/useShapes/scatter/index.d.ts +0 -12
  232. package/build/plugins/d3/renderer/hooks/useShapes/scatter/index.js +0 -69
  233. package/build/plugins/d3/renderer/hooks/useShapes/scatter/prepare-data.d.ts +0 -11
  234. package/build/plugins/d3/renderer/hooks/useShapes/scatter/prepare-data.js +0 -31
  235. package/build/plugins/d3/renderer/hooks/useShapes/scatter/types.d.ts +0 -18
  236. package/build/plugins/d3/renderer/hooks/useShapes/scatter/types.js +0 -1
  237. package/build/plugins/d3/renderer/hooks/useShapes/styles.css +0 -36
  238. package/build/plugins/d3/renderer/hooks/useShapes/treemap/index.d.ts +0 -12
  239. package/build/plugins/d3/renderer/hooks/useShapes/treemap/index.js +0 -99
  240. package/build/plugins/d3/renderer/hooks/useShapes/treemap/prepare-data.d.ts +0 -7
  241. package/build/plugins/d3/renderer/hooks/useShapes/treemap/prepare-data.js +0 -114
  242. package/build/plugins/d3/renderer/hooks/useShapes/treemap/types.d.ts +0 -17
  243. package/build/plugins/d3/renderer/hooks/useShapes/treemap/types.js +0 -1
  244. package/build/plugins/d3/renderer/hooks/useShapes/utils.d.ts +0 -29
  245. package/build/plugins/d3/renderer/hooks/useShapes/utils.js +0 -53
  246. package/build/plugins/d3/renderer/hooks/useShapes/waterfall/index.d.ts +0 -13
  247. package/build/plugins/d3/renderer/hooks/useShapes/waterfall/index.js +0 -128
  248. package/build/plugins/d3/renderer/hooks/useShapes/waterfall/prepare-data.d.ts +0 -12
  249. package/build/plugins/d3/renderer/hooks/useShapes/waterfall/prepare-data.js +0 -133
  250. package/build/plugins/d3/renderer/hooks/useShapes/waterfall/types.d.ts +0 -15
  251. package/build/plugins/d3/renderer/hooks/useShapes/waterfall/types.js +0 -1
  252. package/build/plugins/d3/renderer/hooks/useSplit/index.d.ts +0 -14
  253. package/build/plugins/d3/renderer/hooks/useSplit/index.js +0 -57
  254. package/build/plugins/d3/renderer/hooks/useSplit/types.d.ts +0 -17
  255. package/build/plugins/d3/renderer/hooks/useSplit/types.js +0 -1
  256. package/build/plugins/d3/renderer/hooks/useTooltip/index.d.ts +0 -13
  257. package/build/plugins/d3/renderer/hooks/useTooltip/index.js +0 -17
  258. package/build/plugins/d3/renderer/hooks/useTooltip/types.d.ts +0 -1
  259. package/build/plugins/d3/renderer/hooks/useTooltip/types.js +0 -1
  260. package/build/plugins/d3/renderer/types/index.d.ts +0 -24
  261. package/build/plugins/d3/renderer/types/index.js +0 -1
  262. package/build/plugins/d3/renderer/utils/axis-generators/bottom.d.ts +0 -24
  263. package/build/plugins/d3/renderer/utils/axis-generators/bottom.js +0 -126
  264. package/build/plugins/d3/renderer/utils/axis-generators/index.d.ts +0 -1
  265. package/build/plugins/d3/renderer/utils/axis-generators/index.js +0 -1
  266. package/build/plugins/d3/renderer/utils/axis.d.ts +0 -31
  267. package/build/plugins/d3/renderer/utils/axis.js +0 -71
  268. package/build/plugins/d3/renderer/utils/color.d.ts +0 -10
  269. package/build/plugins/d3/renderer/utils/color.js +0 -43
  270. package/build/plugins/d3/renderer/utils/get-closest-data.d.ts +0 -15
  271. package/build/plugins/d3/renderer/utils/get-closest-data.js +0 -172
  272. package/build/plugins/d3/renderer/utils/index.d.ts +0 -78
  273. package/build/plugins/d3/renderer/utils/index.js +0 -211
  274. package/build/plugins/d3/renderer/utils/labels.d.ts +0 -6
  275. package/build/plugins/d3/renderer/utils/labels.js +0 -44
  276. package/build/plugins/d3/renderer/utils/legend.d.ts +0 -8
  277. package/build/plugins/d3/renderer/utils/legend.js +0 -23
  278. package/build/plugins/d3/renderer/utils/math.d.ts +0 -25
  279. package/build/plugins/d3/renderer/utils/math.js +0 -51
  280. package/build/plugins/d3/renderer/utils/series/index.d.ts +0 -1
  281. package/build/plugins/d3/renderer/utils/series/index.js +0 -1
  282. package/build/plugins/d3/renderer/utils/series/waterfall.d.ts +0 -4
  283. package/build/plugins/d3/renderer/utils/series/waterfall.js +0 -25
  284. package/build/plugins/d3/renderer/utils/symbol.d.ts +0 -3
  285. package/build/plugins/d3/renderer/utils/symbol.js +0 -36
  286. package/build/plugins/d3/renderer/utils/text.d.ts +0 -29
  287. package/build/plugins/d3/renderer/utils/text.js +0 -139
  288. package/build/plugins/d3/renderer/utils/time.d.ts +0 -3
  289. package/build/plugins/d3/renderer/utils/time.js +0 -34
  290. package/build/plugins/d3/renderer/validation/__mocks__/index.d.ts +0 -3
  291. package/build/plugins/d3/renderer/validation/__mocks__/index.js +0 -44
  292. package/build/plugins/d3/renderer/validation/index.d.ts +0 -2
  293. package/build/plugins/d3/renderer/validation/index.js +0 -221
  294. package/build/plugins/d3/utils/index.d.ts +0 -4
  295. package/build/plugins/d3/utils/index.js +0 -4
  296. package/build/plugins/d3/utils/pie-center-text.d.ts +0 -7
  297. package/build/plugins/d3/utils/pie-center-text.js +0 -23
  298. /package/build/{plugins/d3/renderer/hooks/useChartOptions → components/SplitPane}/types.js +0 -0
@@ -1,169 +0,0 @@
1
- import { ascending, descending, max, sort } from 'd3';
2
- import get from 'lodash/get';
3
- import { getDataCategoryValue, getLabelsSize } from '../../../utils';
4
- import { MIN_BAR_GAP, MIN_BAR_GROUP_GAP, MIN_BAR_WIDTH } from '../constants';
5
- const DEFAULT_LABEL_PADDING = 7;
6
- function groupByYValue(series, yAxis) {
7
- const data = {};
8
- series.forEach((s) => {
9
- s.data.forEach((d) => {
10
- const axisIndex = get(s, 'yAxis', 0);
11
- const seriesYAxis = yAxis[axisIndex];
12
- const categories = get(seriesYAxis, 'categories', []);
13
- const key = seriesYAxis.type === 'category'
14
- ? getDataCategoryValue({ axisDirection: 'y', categories, data: d })
15
- : d.y;
16
- if (key) {
17
- if (!data[key]) {
18
- data[key] = {};
19
- }
20
- if (!data[key][s.stackId]) {
21
- data[key][s.stackId] = [];
22
- }
23
- data[key][s.stackId].push({ data: d, series: s });
24
- }
25
- });
26
- });
27
- return data;
28
- }
29
- function getBandWidth(series, yAxis, yScale) {
30
- let bandWidth = Infinity;
31
- if (yAxis[0].type === 'category') {
32
- bandWidth = yScale.bandwidth();
33
- }
34
- else {
35
- const scale = yScale;
36
- const axisValues = series.reduce((acc, s) => {
37
- s.data.forEach((dataItem) => acc.push(Number(dataItem.y)));
38
- return acc;
39
- }, []);
40
- axisValues.sort().forEach((value, index) => {
41
- if (index > 0 && value !== axisValues[index - 1]) {
42
- const dist = scale(value) - scale(axisValues[index - 1]);
43
- if (dist < bandWidth) {
44
- bandWidth = dist;
45
- }
46
- }
47
- });
48
- }
49
- return bandWidth;
50
- }
51
- function setLabel(prepared) {
52
- const dataLabels = prepared.series.dataLabels;
53
- if (!dataLabels.enabled) {
54
- return;
55
- }
56
- const data = prepared.data;
57
- const content = String(data.label || data.x);
58
- const { maxHeight: height, maxWidth: width } = getLabelsSize({
59
- labels: [content],
60
- style: dataLabels.style,
61
- html: dataLabels.html,
62
- });
63
- const x = dataLabels.inside
64
- ? prepared.x + prepared.width / 2
65
- : prepared.x + prepared.width + DEFAULT_LABEL_PADDING;
66
- const y = prepared.y + prepared.height / 2;
67
- if (dataLabels.html) {
68
- prepared.htmlElements.push({
69
- x,
70
- y: y - height / 2,
71
- content,
72
- });
73
- }
74
- else {
75
- prepared.label = {
76
- x,
77
- y: y + height / 2,
78
- text: content,
79
- textAnchor: dataLabels.inside ? 'middle' : 'right',
80
- style: dataLabels.style,
81
- series: prepared.series,
82
- size: { width, height },
83
- };
84
- }
85
- }
86
- export const prepareBarYData = (args) => {
87
- const { series, seriesOptions, yAxis, xScale, yScale: [yScale], } = args;
88
- const xLinearScale = xScale;
89
- const plotWidth = xLinearScale(xLinearScale.domain()[1]);
90
- const barMaxWidth = get(seriesOptions, 'bar-y.barMaxWidth');
91
- const barPadding = get(seriesOptions, 'bar-y.barPadding');
92
- const groupPadding = get(seriesOptions, 'bar-y.groupPadding');
93
- const sortingOptions = get(seriesOptions, 'bar-y.dataSorting');
94
- const comparator = (sortingOptions === null || sortingOptions === void 0 ? void 0 : sortingOptions.direction) === 'desc' ? descending : ascending;
95
- const sortKey = (() => {
96
- switch (sortingOptions === null || sortingOptions === void 0 ? void 0 : sortingOptions.key) {
97
- case 'x': {
98
- return 'data.x';
99
- }
100
- case 'name': {
101
- return 'series.name';
102
- }
103
- default: {
104
- return undefined;
105
- }
106
- }
107
- })();
108
- const groupedData = groupByYValue(series, yAxis);
109
- const bandWidth = getBandWidth(series, yAxis, yScale);
110
- const maxGroupSize = max(Object.values(groupedData), (d) => Object.values(d).length) || 1;
111
- const groupGap = Math.max(bandWidth * groupPadding, MIN_BAR_GROUP_GAP);
112
- const groupWidth = bandWidth - groupGap;
113
- const rectGap = Math.max(bandWidth * barPadding, MIN_BAR_GAP);
114
- const barHeight = Math.max(MIN_BAR_WIDTH, Math.min(groupWidth / maxGroupSize - rectGap, barMaxWidth));
115
- const result = [];
116
- Object.entries(groupedData).forEach(([yValue, val]) => {
117
- const stacks = Object.values(val);
118
- const currentBarHeight = barHeight * stacks.length + rectGap * (stacks.length - 1);
119
- stacks.forEach((measureValues, groupItemIndex) => {
120
- const base = xLinearScale(0);
121
- let stackSum = base;
122
- const stackItems = [];
123
- const sortedData = sortKey
124
- ? sort(measureValues, (a, b) => comparator(get(a, sortKey), get(b, sortKey)))
125
- : measureValues;
126
- sortedData.forEach(({ data, series: s }) => {
127
- let center;
128
- if (yAxis[0].type === 'category') {
129
- const bandScale = yScale;
130
- center = (bandScale(yValue) || 0) + bandWidth / 2;
131
- }
132
- else {
133
- const scale = yScale;
134
- center = scale(Number(yValue));
135
- }
136
- const y = center - currentBarHeight / 2 + (barHeight + rectGap) * groupItemIndex;
137
- const xValue = Number(data.x);
138
- const width = xValue > 0 ? xLinearScale(xValue) - base : base - xLinearScale(xValue);
139
- const item = {
140
- x: xValue > 0 ? stackSum : stackSum - width,
141
- y,
142
- width,
143
- height: barHeight,
144
- color: data.color || s.color,
145
- opacity: get(data, 'opacity', null),
146
- data,
147
- series: s,
148
- htmlElements: [],
149
- };
150
- stackItems.push(item);
151
- stackSum += width + 1;
152
- });
153
- if (series.some((s) => s.stacking === 'percent')) {
154
- let acc = 0;
155
- const ratio = plotWidth / (stackSum - stackItems.length);
156
- stackItems.forEach((item) => {
157
- item.width = item.width * ratio;
158
- item.x = acc;
159
- acc += item.width;
160
- });
161
- }
162
- result.push(...stackItems);
163
- });
164
- });
165
- result.forEach((d) => {
166
- setLabel(d);
167
- });
168
- return result;
169
- };
@@ -1,14 +0,0 @@
1
- import { TooltipDataChunkBarX } from '../../../../../../types';
2
- import { HtmlItem, LabelData } from '../../../types';
3
- import { PreparedBarYSeries } from '../../useSeries/types';
4
- export type PreparedBarYData = Omit<TooltipDataChunkBarX, 'series'> & {
5
- x: number;
6
- y: number;
7
- width: number;
8
- height: number;
9
- color: string;
10
- opacity: number | null;
11
- series: PreparedBarYSeries;
12
- label?: LabelData;
13
- htmlElements: HtmlItem[];
14
- };
@@ -1,3 +0,0 @@
1
- export declare const MIN_BAR_WIDTH = 1;
2
- export declare const MIN_BAR_GAP = 1;
3
- export declare const MIN_BAR_GROUP_GAP = 1;
@@ -1,3 +0,0 @@
1
- export const MIN_BAR_WIDTH = 1;
2
- export const MIN_BAR_GAP = 1;
3
- export const MIN_BAR_GROUP_GAP = 1;
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
- import { Dispatch } from 'd3';
3
- import type { PreparedSeries, PreparedSeriesOptions, PreparedSplit } from '../';
4
- import type { ChartScale } from '../useAxisScales';
5
- import type { PreparedAxis } from '../useChartOptions/types';
6
- import type { PreparedAreaData } from './area/types';
7
- import type { PreparedBarXData } from './bar-x';
8
- import type { PreparedBarYData } from './bar-y/types';
9
- import type { PreparedLineData } from './line/types';
10
- import type { PreparedPieData } from './pie/types';
11
- import type { PreparedScatterData } from './scatter/types';
12
- export type { PreparedBarXData } from './bar-x';
13
- export type { PreparedScatterData } from './scatter/types';
14
- import { PreparedWaterfallData } from './waterfall';
15
- import './styles.css';
16
- export type ShapeData = PreparedBarXData | PreparedBarYData | PreparedScatterData | PreparedLineData | PreparedPieData | PreparedAreaData | PreparedWaterfallData;
17
- type Args = {
18
- boundsWidth: number;
19
- boundsHeight: number;
20
- dispatcher: Dispatch<object>;
21
- series: PreparedSeries[];
22
- seriesOptions: PreparedSeriesOptions;
23
- xAxis: PreparedAxis;
24
- yAxis: PreparedAxis[];
25
- xScale?: ChartScale;
26
- yScale?: ChartScale[];
27
- split: PreparedSplit;
28
- htmlLayout: HTMLElement | null;
29
- };
30
- export declare const useShapes: (args: Args) => {
31
- shapes: React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
32
- shapesData: ShapeData[];
33
- };
@@ -1,153 +0,0 @@
1
- import React from 'react';
2
- import { group } from 'd3';
3
- import { getOnlyVisibleSeries } from '../../utils';
4
- import { AreaSeriesShapes } from './area';
5
- import { prepareAreaData } from './area/prepare-data';
6
- import { BarXSeriesShapes, prepareBarXData } from './bar-x';
7
- import { BarYSeriesShapes, prepareBarYData } from './bar-y';
8
- import { LineSeriesShapes } from './line';
9
- import { prepareLineData } from './line/prepare-data';
10
- import { PieSeriesShapes } from './pie';
11
- import { preparePieData } from './pie/prepare-data';
12
- import { ScatterSeriesShape, prepareScatterData } from './scatter';
13
- import { TreemapSeriesShape } from './treemap';
14
- import { prepareTreemapData } from './treemap/prepare-data';
15
- import { WaterfallSeriesShapes, prepareWaterfallData } from './waterfall';
16
- import './styles.css';
17
- export const useShapes = (args) => {
18
- const { boundsWidth, boundsHeight, dispatcher, series, seriesOptions, xAxis, xScale, yAxis, yScale, split, htmlLayout, } = args;
19
- const shapesComponents = React.useMemo(() => {
20
- const visibleSeries = getOnlyVisibleSeries(series);
21
- const groupedSeries = group(visibleSeries, (item) => item.type);
22
- const shapesData = [];
23
- const shapes = Array.from(groupedSeries).reduce((acc, item) => {
24
- const [seriesType, chartSeries] = item;
25
- switch (seriesType) {
26
- case 'bar-x': {
27
- if (xScale && yScale) {
28
- const preparedData = prepareBarXData({
29
- series: chartSeries,
30
- seriesOptions,
31
- xAxis,
32
- xScale,
33
- yAxis,
34
- yScale,
35
- boundsHeight,
36
- });
37
- acc.push(React.createElement(BarXSeriesShapes, { key: "bar-x", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout }));
38
- shapesData.push(...preparedData);
39
- }
40
- break;
41
- }
42
- case 'bar-y': {
43
- if (xScale && yScale) {
44
- const preparedData = prepareBarYData({
45
- series: chartSeries,
46
- seriesOptions,
47
- xAxis,
48
- xScale,
49
- yAxis,
50
- yScale,
51
- });
52
- acc.push(React.createElement(BarYSeriesShapes, { key: "bar-y", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout }));
53
- shapesData.push(...preparedData);
54
- }
55
- break;
56
- }
57
- case 'waterfall': {
58
- if (xScale && yScale) {
59
- const preparedData = prepareWaterfallData({
60
- series: chartSeries,
61
- seriesOptions,
62
- xAxis,
63
- xScale,
64
- yAxis,
65
- yScale,
66
- });
67
- acc.push(React.createElement(WaterfallSeriesShapes, { key: "waterfall", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout }));
68
- shapesData.push(...preparedData);
69
- }
70
- break;
71
- }
72
- case 'line': {
73
- if (xScale && yScale) {
74
- const preparedData = prepareLineData({
75
- series: chartSeries,
76
- xAxis,
77
- xScale,
78
- yAxis,
79
- yScale,
80
- split,
81
- });
82
- acc.push(React.createElement(LineSeriesShapes, { key: "line", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout }));
83
- shapesData.push(...preparedData);
84
- }
85
- break;
86
- }
87
- case 'area': {
88
- if (xScale && yScale) {
89
- const preparedData = prepareAreaData({
90
- series: chartSeries,
91
- xAxis,
92
- xScale,
93
- yAxis,
94
- yScale,
95
- boundsHeight,
96
- });
97
- acc.push(React.createElement(AreaSeriesShapes, { key: "area", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout }));
98
- shapesData.push(...preparedData);
99
- }
100
- break;
101
- }
102
- case 'scatter': {
103
- if (xScale && yScale) {
104
- const preparedData = prepareScatterData({
105
- series: chartSeries,
106
- xAxis,
107
- xScale,
108
- yAxis,
109
- yScale,
110
- });
111
- acc.push(React.createElement(ScatterSeriesShape, { key: "scatter", dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
112
- shapesData.push(...preparedData);
113
- }
114
- break;
115
- }
116
- case 'pie': {
117
- const preparedData = preparePieData({
118
- series: chartSeries,
119
- boundsWidth,
120
- boundsHeight,
121
- });
122
- acc.push(React.createElement(PieSeriesShapes, { key: "pie", dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
123
- shapesData.push(...preparedData);
124
- break;
125
- }
126
- case 'treemap': {
127
- const preparedData = prepareTreemapData({
128
- // We should have exactly one series with "treemap" type
129
- // Otherwise data validation should emit an error
130
- series: chartSeries[0],
131
- width: boundsWidth,
132
- height: boundsHeight,
133
- });
134
- acc.push(React.createElement(TreemapSeriesShape, { key: "treemap", dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
135
- shapesData.push(preparedData);
136
- }
137
- }
138
- return acc;
139
- }, []);
140
- return { shapes, shapesData };
141
- }, [
142
- boundsWidth,
143
- boundsHeight,
144
- dispatcher,
145
- series,
146
- seriesOptions,
147
- xAxis,
148
- xScale,
149
- yAxis,
150
- yScale,
151
- ]);
152
- return { shapes: shapesComponents.shapes, shapesData: shapesComponents.shapesData };
153
- };
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { Dispatch } from 'd3';
3
- import type { PreparedSeriesOptions } from '../../useSeries/types';
4
- import type { PreparedLineData } from './types';
5
- type Args = {
6
- dispatcher: Dispatch<object>;
7
- preparedData: PreparedLineData[];
8
- seriesOptions: PreparedSeriesOptions;
9
- htmlLayout: HTMLElement | null;
10
- };
11
- export declare const LineSeriesShapes: (args: Args) => React.JSX.Element;
12
- export {};
@@ -1,131 +0,0 @@
1
- import React from 'react';
2
- import { color, line as lineGenerator, select } from 'd3';
3
- import get from 'lodash/get';
4
- import { block } from '../../../../../../utils/cn';
5
- import { filterOverlappingLabels } from '../../../utils';
6
- import { HtmlLayer } from '../HtmlLayer';
7
- import { getMarkerHaloVisibility, getMarkerVisibility, renderMarker, selectMarkerHalo, selectMarkerSymbol, setMarker, } from '../marker';
8
- import { getLineDashArray, setActiveState } from '../utils';
9
- const b = block('d3-line');
10
- export const LineSeriesShapes = (args) => {
11
- const { dispatcher, preparedData, seriesOptions, htmlLayout } = args;
12
- const ref = React.useRef(null);
13
- React.useEffect(() => {
14
- var _a;
15
- if (!ref.current) {
16
- return () => { };
17
- }
18
- const svgElement = select(ref.current);
19
- const hoverOptions = get(seriesOptions, 'line.states.hover');
20
- const inactiveOptions = get(seriesOptions, 'line.states.inactive');
21
- const line = lineGenerator()
22
- .x((d) => d.x)
23
- .y((d) => d.y);
24
- svgElement.selectAll('*').remove();
25
- const lineSelection = svgElement
26
- .selectAll('path')
27
- .data(preparedData)
28
- .join('path')
29
- .attr('d', (d) => line(d.points))
30
- .attr('fill', 'none')
31
- .attr('stroke', (d) => d.color)
32
- .attr('stroke-width', (d) => d.width)
33
- .attr('stroke-linejoin', (d) => d.linecap)
34
- .attr('stroke-linecap', (d) => d.linecap)
35
- .attr('stroke-dasharray', (d) => getLineDashArray(d.dashStyle, d.width))
36
- .attr('opacity', (d) => d.opacity)
37
- .attr('cursor', (d) => d.series.cursor);
38
- let dataLabels = preparedData.reduce((acc, d) => {
39
- return acc.concat(d.labels);
40
- }, []);
41
- if (!((_a = preparedData[0]) === null || _a === void 0 ? void 0 : _a.series.dataLabels.allowOverlap)) {
42
- dataLabels = filterOverlappingLabels(dataLabels);
43
- }
44
- const labelsSelection = svgElement
45
- .selectAll('text')
46
- .data(dataLabels)
47
- .join('text')
48
- .text((d) => d.text)
49
- .attr('class', b('label'))
50
- .attr('x', (d) => d.x)
51
- .attr('y', (d) => d.y)
52
- .attr('text-anchor', (d) => d.textAnchor)
53
- .style('font-size', (d) => d.style.fontSize)
54
- .style('font-weight', (d) => d.style.fontWeight || null)
55
- .style('fill', (d) => d.style.fontColor || null);
56
- const markers = preparedData.reduce((acc, d) => acc.concat(d.markers), []);
57
- const markerSelection = svgElement
58
- .selectAll('marker')
59
- .data(markers)
60
- .join('g')
61
- .call(renderMarker);
62
- const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
63
- const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
64
- dispatcher.on('hover-shape.line', (data) => {
65
- const selected = (data === null || data === void 0 ? void 0 : data.filter((d) => d.series.type === 'line')) || [];
66
- const selectedDataItems = selected.map((d) => d.data);
67
- const selectedSeriesIds = selected.map((d) => { var _a; return (_a = d.series) === null || _a === void 0 ? void 0 : _a.id; });
68
- lineSelection.datum((d, index, list) => {
69
- const elementSelection = select(list[index]);
70
- const hovered = Boolean(hoverEnabled && selectedSeriesIds.includes(d.id));
71
- if (d.hovered !== hovered) {
72
- d.hovered = hovered;
73
- elementSelection.attr('stroke', (d) => {
74
- var _a;
75
- const initialColor = d.color || '';
76
- if (d.hovered) {
77
- return (((_a = color(initialColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.brightness).toString()) || initialColor);
78
- }
79
- return initialColor;
80
- });
81
- }
82
- return setActiveState({
83
- element: list[index],
84
- state: inactiveOptions,
85
- active: Boolean(!inactiveEnabled ||
86
- !selectedSeriesIds.length ||
87
- selectedSeriesIds.includes(d.id)),
88
- datum: d,
89
- });
90
- });
91
- labelsSelection.datum((d, index, list) => {
92
- return setActiveState({
93
- element: list[index],
94
- state: inactiveOptions,
95
- active: Boolean(!inactiveEnabled ||
96
- !selectedSeriesIds.length ||
97
- selectedSeriesIds.includes(d.series.id)),
98
- datum: d,
99
- });
100
- });
101
- markerSelection.datum((d, index, list) => {
102
- const elementSelection = select(list[index]);
103
- const hovered = Boolean(hoverEnabled && selectedDataItems.includes(d.point.data));
104
- if (d.hovered !== hovered) {
105
- d.hovered = hovered;
106
- elementSelection.attr('visibility', getMarkerVisibility(d));
107
- selectMarkerHalo(elementSelection).attr('visibility', getMarkerHaloVisibility);
108
- selectMarkerSymbol(elementSelection).call(setMarker, hovered ? 'hover' : 'normal');
109
- }
110
- if (d.point.series.marker.states.normal.enabled) {
111
- const isActive = Boolean(!inactiveEnabled ||
112
- !selectedSeriesIds.length ||
113
- selectedSeriesIds.includes(d.point.series.id));
114
- setActiveState({
115
- element: list[index],
116
- state: inactiveOptions,
117
- active: isActive,
118
- datum: d,
119
- });
120
- }
121
- return d;
122
- });
123
- });
124
- return () => {
125
- dispatcher.on('hover-shape.line', null);
126
- };
127
- }, [dispatcher, preparedData, seriesOptions]);
128
- return (React.createElement(React.Fragment, null,
129
- React.createElement("g", { ref: ref, className: b() }),
130
- React.createElement(HtmlLayer, { preparedData: preparedData, htmlLayout: htmlLayout })));
131
- };
@@ -1,13 +0,0 @@
1
- import type { ChartScale } from '../../useAxisScales';
2
- import type { PreparedAxis } from '../../useChartOptions/types';
3
- import type { PreparedLineSeries } from '../../useSeries/types';
4
- import type { PreparedSplit } from '../../useSplit/types';
5
- import type { PreparedLineData } from './types';
6
- export declare const prepareLineData: (args: {
7
- series: PreparedLineSeries[];
8
- xAxis: PreparedAxis;
9
- xScale: ChartScale;
10
- yAxis: PreparedAxis[];
11
- yScale: ChartScale[];
12
- split: PreparedSplit;
13
- }) => PreparedLineData[];
@@ -1,91 +0,0 @@
1
- import { getLabelsSize, getLeftPosition } from '../../../utils';
2
- import { getXValue, getYValue } from '../utils';
3
- function getLabelData(point, series, xMax) {
4
- const text = String(point.data.label || point.data.y);
5
- const style = series.dataLabels.style;
6
- const size = getLabelsSize({ labels: [text], style });
7
- const labelData = {
8
- text,
9
- x: point.x,
10
- y: point.y - series.dataLabels.padding,
11
- style,
12
- size: { width: size.maxWidth, height: size.maxHeight },
13
- textAnchor: 'middle',
14
- series: series,
15
- active: true,
16
- };
17
- const left = getLeftPosition(labelData);
18
- if (left < 0) {
19
- labelData.x = labelData.x + Math.abs(left);
20
- }
21
- else {
22
- const right = left + labelData.size.width;
23
- if (right > xMax) {
24
- labelData.x = labelData.x - xMax - right;
25
- }
26
- }
27
- return labelData;
28
- }
29
- function getHtmlLabel(point, series, xMax) {
30
- const content = String(point.data.label || point.data.y);
31
- const size = getLabelsSize({ labels: [content], html: true });
32
- return {
33
- x: Math.min(xMax - size.maxWidth, Math.max(0, point.x)),
34
- y: Math.max(0, point.y - series.dataLabels.padding - size.maxHeight),
35
- content,
36
- };
37
- }
38
- export const prepareLineData = (args) => {
39
- const { series, xAxis, yAxis, xScale, yScale, split } = args;
40
- const [_xMin, xRangeMax] = xScale.range();
41
- const xMax = xRangeMax / (1 - xAxis.maxPadding);
42
- return series.reduce((acc, s) => {
43
- var _a;
44
- const yAxisIndex = s.yAxis;
45
- const seriesYAxis = yAxis[yAxisIndex];
46
- const yAxisTop = ((_a = split.plots[seriesYAxis.plotIndex]) === null || _a === void 0 ? void 0 : _a.top) || 0;
47
- const seriesYScale = yScale[s.yAxis];
48
- const points = s.data.map((d) => ({
49
- x: getXValue({ point: d, xAxis, xScale }),
50
- y: yAxisTop + getYValue({ point: d, yAxis: seriesYAxis, yScale: seriesYScale }),
51
- active: true,
52
- data: d,
53
- series: s,
54
- }));
55
- const htmlElements = [];
56
- let labels = [];
57
- if (s.dataLabels.enabled) {
58
- if (s.dataLabels.html) {
59
- htmlElements.push(...points.map((p) => getHtmlLabel(p, s, xMax)));
60
- }
61
- else {
62
- labels = points.map((p) => getLabelData(p, s, xMax));
63
- }
64
- }
65
- let markers = [];
66
- if (s.marker.states.normal.enabled || s.marker.states.hover.enabled) {
67
- markers = points.map((p) => ({
68
- point: p,
69
- active: true,
70
- hovered: false,
71
- }));
72
- }
73
- const result = {
74
- points,
75
- markers,
76
- labels,
77
- color: s.color,
78
- width: s.lineWidth,
79
- series: s,
80
- hovered: false,
81
- active: true,
82
- id: s.id,
83
- dashStyle: s.dashStyle,
84
- linecap: s.linecap,
85
- opacity: s.opacity,
86
- htmlElements,
87
- };
88
- acc.push(result);
89
- return acc;
90
- }, []);
91
- };
@@ -1,30 +0,0 @@
1
- import { DashStyle, LineCap } from '../../../../../../constants';
2
- import { LineSeriesData } from '../../../../../../types';
3
- import { HtmlItem, LabelData } from '../../../types';
4
- import { PreparedLineSeries } from '../../useSeries/types';
5
- export type PointData = {
6
- x: number;
7
- y: number;
8
- data: LineSeriesData;
9
- series: PreparedLineSeries;
10
- };
11
- export type MarkerData = {
12
- point: PointData;
13
- active: boolean;
14
- hovered: boolean;
15
- };
16
- export type PreparedLineData = {
17
- id: string;
18
- points: PointData[];
19
- markers: MarkerData[];
20
- color: string;
21
- width: number;
22
- series: PreparedLineSeries;
23
- hovered: boolean;
24
- active: boolean;
25
- labels: LabelData[];
26
- dashStyle: DashStyle;
27
- linecap: LineCap;
28
- opacity: number | null;
29
- htmlElements: HtmlItem[];
30
- };