@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,140 +0,0 @@
1
- .chartkit-d3 {
2
- position: absolute;
3
- }
4
-
5
- .chartkit-d3__html-layer {
6
- display: contents;
7
- }
8
-
9
- .chartkit-d3__html-layer > * {
10
- transform: inherit;
11
- }
12
-
13
- .chartkit-d3-axis .domain {
14
- stroke: var(--g-color-line-generic-active);
15
- }
16
-
17
- .chartkit-d3-axis .tick text {
18
- color: var(--g-color-text-secondary);
19
- alignment-baseline: after-edge;
20
- }
21
-
22
- .chartkit-d3-axis .tick line, .chartkit-d3-axis .tick path {
23
- stroke: var(--g-color-line-generic);
24
- }
25
-
26
- .chartkit-d3-axis__title {
27
- alignment-baseline: after-edge;
28
- fill: var(--g-color-text-secondary);
29
- }
30
-
31
- .chartkit-d3-axis__title tspan {
32
- alignment-baseline: after-edge;
33
- }
34
-
35
- .chartkit-d3-legend {
36
- color: var(--g-color-text-secondary);
37
- }
38
-
39
- .chartkit-d3-legend__title {
40
- fill: var(--g-color-text-secondary);
41
- }
42
-
43
- .chartkit-d3-legend__item {
44
- cursor: pointer;
45
- user-select: none;
46
- }
47
-
48
- .chartkit-d3-legend__item-symbol_shape_rect.chartkit-d3-legend__item-symbol_unselected {
49
- fill: var(--g-color-text-hint);
50
- }
51
-
52
- .chartkit-d3-legend__item-symbol_shape_path.chartkit-d3-legend__item-symbol_unselected {
53
- stroke: var(--g-color-text-hint);
54
- }
55
-
56
- .chartkit-d3-legend__item-symbol_shape_symbol.chartkit-d3-legend__item-symbol_unselected {
57
- fill: var(--g-color-text-hint);
58
- }
59
-
60
- .chartkit-d3-legend__item-text {
61
- fill: var(--g-color-text-secondary);
62
- alignment-baseline: before-edge;
63
- }
64
-
65
- .chartkit-d3-legend__item-text_unselected {
66
- fill: var(--g-color-text-hint);
67
- }
68
-
69
- .chartkit-d3-legend__item-text:hover {
70
- fill: var(--g-color-text-complementary);
71
- }
72
-
73
- .chartkit-d3-legend__pagination {
74
- fill: var(--g-color-text-primary);
75
- user-select: none;
76
- }
77
-
78
- .chartkit-d3-legend__pagination-counter, .chartkit-d3-legend__pagination-arrow {
79
- alignment-baseline: middle;
80
- }
81
-
82
- .chartkit-d3-legend__pagination-arrow {
83
- fill: var(--g-color-text-brand);
84
- cursor: pointer;
85
- }
86
-
87
- .chartkit-d3-legend__pagination-arrow_inactive {
88
- fill: var(--g-color-base-generic-accent-disabled);
89
- cursor: inherit;
90
- }
91
-
92
- .chartkit-d3-legend__pagination-arrow:hover:not(.chartkit-d3-legend__pagination-arrow_inactive) {
93
- fill: var(--g-color-base-brand-hover);
94
- }
95
-
96
- .chartkit-d3-title {
97
- font-size: var(--g-text-subheader-2-font-size);
98
- font-weight: var(--g-text-subheader-font-weight);
99
- fill: var(--g-color-text-primary);
100
- }
101
-
102
- .chartkit-d3-plot-title {
103
- font-size: var(--g-text-subheader-3-font-size);
104
- font-weight: var(--g-text-subheader-font-weight);
105
- fill: var(--g-color-text-secondary);
106
- }
107
-
108
- .chartkit-d3-tooltip[class] {
109
- --g-popup-border-width: 0;
110
- pointer-events: none;
111
- }
112
-
113
- .chartkit-d3-tooltip[class] > div {
114
- animation-duration: unset;
115
- animation-timing-function: unset;
116
- animation-fill-mode: unset;
117
- }
118
-
119
- .chartkit-d3-tooltip__content {
120
- padding: 10px 14px;
121
- background-color: var(--g-color-infographics-tooltip-bg);
122
- border: 1px solid var(--g-color-line-generic);
123
- border-radius: 3px;
124
- box-shadow: 0 2px 12px var(--g-color-sfx-shadow);
125
- text-wrap: nowrap;
126
- }
127
-
128
- .chartkit-d3-tooltip__content-row {
129
- display: flex;
130
- align-items: center;
131
- }
132
-
133
- .chartkit-d3-tooltip__color {
134
- height: 8px;
135
- width: 16px;
136
- display: inline-block;
137
- margin-right: 8px;
138
- border-radius: 2px;
139
- background-color: #dddddd;
140
- }
@@ -1,14 +0,0 @@
1
- import type { BaseTextStyle, ChartKitWidgetAxis, ChartKitWidgetAxisType } from '../../../../../types';
2
- export declare const axisLabelsDefaults: {
3
- margin: number;
4
- padding: number;
5
- fontSize: number;
6
- maxWidth: number;
7
- };
8
- type AxisTitleDefaults = Required<ChartKitWidgetAxis['title']> & {
9
- style: BaseTextStyle;
10
- };
11
- export declare const xAxisTitleDefaults: AxisTitleDefaults;
12
- export declare const yAxisTitleDefaults: AxisTitleDefaults;
13
- export declare const DEFAULT_AXIS_TYPE: ChartKitWidgetAxisType;
14
- export {};
@@ -1,18 +0,0 @@
1
- export const axisLabelsDefaults = {
2
- margin: 10,
3
- padding: 10,
4
- fontSize: 11,
5
- maxWidth: 80,
6
- };
7
- const axisTitleDefaults = {
8
- text: '',
9
- margin: 0,
10
- style: {
11
- fontSize: '14px',
12
- },
13
- align: 'center',
14
- maxRowCount: 1,
15
- };
16
- export const xAxisTitleDefaults = Object.assign(Object.assign({}, axisTitleDefaults), { margin: 4 });
17
- export const yAxisTitleDefaults = Object.assign(Object.assign({}, axisTitleDefaults), { margin: 8 });
18
- export const DEFAULT_AXIS_TYPE = 'linear';
@@ -1,3 +0,0 @@
1
- export * from './axis';
2
- export * from './legend';
3
- export * from './series-options';
@@ -1,3 +0,0 @@
1
- export * from './axis';
2
- export * from './legend';
3
- export * from './series-options';
@@ -1,12 +0,0 @@
1
- export declare const legendDefaults: {
2
- align: "left" | "center" | "right";
3
- itemDistance: number;
4
- margin: number;
5
- itemStyle: {
6
- fontSize: string;
7
- };
8
- };
9
- export declare const CONTINUOUS_LEGEND_SIZE: {
10
- height: number;
11
- width: number;
12
- };
@@ -1,12 +0,0 @@
1
- export const legendDefaults = {
2
- align: 'center',
3
- itemDistance: 20,
4
- margin: 15,
5
- itemStyle: {
6
- fontSize: '12px',
7
- },
8
- };
9
- export const CONTINUOUS_LEGEND_SIZE = {
10
- height: 12,
11
- width: 200,
12
- };
@@ -1,24 +0,0 @@
1
- import type { ChartKitWidgetSeriesOptions } from '../../../../../types';
2
- type DefaultBarXSeriesOptions = Partial<ChartKitWidgetSeriesOptions['bar-x']> & {
3
- 'bar-x': {
4
- barMaxWidth: number;
5
- barPadding: number;
6
- groupPadding: number;
7
- };
8
- };
9
- type DefaultBarYSeriesOptions = Partial<ChartKitWidgetSeriesOptions['bar-x']> & {
10
- 'bar-y': {
11
- barMaxWidth: number;
12
- barPadding: number;
13
- groupPadding: number;
14
- };
15
- };
16
- type DefaultWaterfallSeriesOptions = Partial<ChartKitWidgetSeriesOptions['waterfall']> & {
17
- waterfall: {
18
- barMaxWidth: number;
19
- barPadding: number;
20
- };
21
- };
22
- export type SeriesOptionsDefaults = Partial<ChartKitWidgetSeriesOptions> & DefaultBarXSeriesOptions & DefaultBarYSeriesOptions & DefaultWaterfallSeriesOptions;
23
- export declare const seriesOptionsDefaults: SeriesOptionsDefaults;
24
- export {};
@@ -1,106 +0,0 @@
1
- export const seriesOptionsDefaults = {
2
- 'bar-x': {
3
- barMaxWidth: 50,
4
- barPadding: 0.1,
5
- groupPadding: 0.2,
6
- states: {
7
- hover: {
8
- enabled: true,
9
- brightness: 0.3,
10
- },
11
- inactive: {
12
- enabled: false,
13
- opacity: 0.5,
14
- },
15
- },
16
- },
17
- 'bar-y': {
18
- barMaxWidth: 50,
19
- barPadding: 0.1,
20
- groupPadding: 0.2,
21
- states: {
22
- hover: {
23
- enabled: true,
24
- brightness: 0.3,
25
- },
26
- inactive: {
27
- enabled: false,
28
- opacity: 0.5,
29
- },
30
- },
31
- },
32
- pie: {
33
- states: {
34
- hover: {
35
- enabled: true,
36
- brightness: 0.3,
37
- },
38
- inactive: {
39
- enabled: false,
40
- opacity: 0.5,
41
- },
42
- },
43
- },
44
- scatter: {
45
- states: {
46
- hover: {
47
- enabled: true,
48
- brightness: 0.3,
49
- },
50
- inactive: {
51
- enabled: false,
52
- opacity: 0.5,
53
- },
54
- },
55
- },
56
- line: {
57
- states: {
58
- hover: {
59
- enabled: true,
60
- brightness: 0.3,
61
- },
62
- inactive: {
63
- enabled: false,
64
- opacity: 0.5,
65
- },
66
- },
67
- },
68
- area: {
69
- states: {
70
- hover: {
71
- enabled: true,
72
- brightness: 0.3,
73
- },
74
- inactive: {
75
- enabled: false,
76
- opacity: 0.5,
77
- },
78
- },
79
- },
80
- treemap: {
81
- states: {
82
- hover: {
83
- enabled: true,
84
- brightness: 0.3,
85
- },
86
- inactive: {
87
- enabled: false,
88
- opacity: 0.5,
89
- },
90
- },
91
- },
92
- waterfall: {
93
- barMaxWidth: 50,
94
- barPadding: 0.1,
95
- states: {
96
- hover: {
97
- enabled: true,
98
- brightness: 0.3,
99
- },
100
- inactive: {
101
- enabled: false,
102
- opacity: 0.5,
103
- },
104
- },
105
- },
106
- };
@@ -1,3 +0,0 @@
1
- export * from './defaults';
2
- export declare const DEFAULT_PALETTE: string[];
3
- export declare const DEFAULT_AXIS_LABEL_FONT_SIZE = "11px";
@@ -1,24 +0,0 @@
1
- export * from './defaults';
2
- export const DEFAULT_PALETTE = [
3
- '#4DA2F1',
4
- '#FF3D64',
5
- '#8AD554',
6
- '#FFC636',
7
- '#FFB9DD',
8
- '#84D1EE',
9
- '#FF91A1',
10
- '#54A520',
11
- '#DB9100',
12
- '#BA74B3',
13
- '#1F68A9',
14
- '#ED65A9',
15
- '#0FA08D',
16
- '#FF7E00',
17
- '#E8B0A4',
18
- '#52A6C5',
19
- '#BE2443',
20
- '#70C1AF',
21
- '#FFB46C',
22
- '#DCA3D7',
23
- ];
24
- export const DEFAULT_AXIS_LABEL_FONT_SIZE = '11px';
@@ -1 +0,0 @@
1
- export declare const getD3Dispatcher: () => import("d3-dispatch").Dispatch<object>;
@@ -1,4 +0,0 @@
1
- import { dispatch } from 'd3';
2
- export const getD3Dispatcher = () => {
3
- return dispatch('hover-shape', 'click-chart');
4
- };
@@ -1,10 +0,0 @@
1
- export * from './useChartDimensions';
2
- export * from './useChartOptions';
3
- export * from './useChartOptions/types';
4
- export * from './useAxisScales';
5
- export * from './useSeries';
6
- export * from './useSeries/types';
7
- export * from './useShapes';
8
- export * from './useTooltip';
9
- export * from './useTooltip/types';
10
- export * from './useSplit/types';
@@ -1,10 +0,0 @@
1
- export * from './useChartDimensions';
2
- export * from './useChartOptions';
3
- export * from './useChartOptions/types';
4
- export * from './useAxisScales';
5
- export * from './useSeries';
6
- export * from './useSeries/types';
7
- export * from './useShapes';
8
- export * from './useTooltip';
9
- export * from './useTooltip/types';
10
- export * from './useSplit/types';
@@ -1,25 +0,0 @@
1
- import type { ScaleBand, ScaleLinear, ScaleTime } from 'd3';
2
- import { ChartKitWidgetAxis, ChartKitWidgetSeries } from '../../../../../types';
3
- import type { PreparedAxis } from '../useChartOptions/types';
4
- import type { PreparedSeries } from '../useSeries/types';
5
- import type { PreparedSplit } from '../useSplit/types';
6
- export type ChartScale = ScaleLinear<number, number> | ScaleBand<string> | ScaleTime<number, number>;
7
- type Args = {
8
- boundsWidth: number;
9
- boundsHeight: number;
10
- series: PreparedSeries[];
11
- xAxis: PreparedAxis;
12
- yAxis: PreparedAxis[];
13
- split: PreparedSplit;
14
- };
15
- type ReturnValue = {
16
- xScale?: ChartScale;
17
- yScale?: ChartScale[];
18
- };
19
- export declare function createYScale(axis: PreparedAxis, series: PreparedSeries[], boundsHeight: number): ScaleBand<string> | ScaleLinear<number, number, never> | ScaleTime<number, number, never>;
20
- export declare function createXScale(axis: PreparedAxis | ChartKitWidgetAxis, series: (PreparedSeries | ChartKitWidgetSeries)[], boundsWidth: number): ScaleBand<string> | ScaleLinear<number, number, never> | ScaleTime<number, number, never>;
21
- /**
22
- * Uses to create scales for axis related series
23
- */
24
- export declare const useAxisScales: (args: Args) => ReturnValue;
25
- export {};
@@ -1,183 +0,0 @@
1
- import React from 'react';
2
- import { extent, scaleBand, scaleLinear, scaleLog, scaleUtc } from 'd3';
3
- import get from 'lodash/get';
4
- import { DEFAULT_AXIS_TYPE } from '../../constants';
5
- import { CHART_SERIES_WITH_VOLUME_ON_Y_AXIS, getAxisHeight, getDataCategoryValue, getDefaultMaxXAxisValue, getDomainDataXBySeries, getDomainDataYBySeries, getOnlyVisibleSeries, isAxisRelatedSeries, isSeriesWithCategoryValues, } from '../../utils';
6
- const isNumericalArrayData = (data) => {
7
- return data.every((d) => typeof d === 'number' || d === null);
8
- };
9
- const filterCategoriesByVisibleSeries = (args) => {
10
- const { axisDirection, categories, series } = args;
11
- const visibleCategories = new Set();
12
- series.forEach((s) => {
13
- if (isSeriesWithCategoryValues(s)) {
14
- s.data.forEach((d) => {
15
- visibleCategories.add(getDataCategoryValue({ axisDirection, categories, data: d }));
16
- });
17
- }
18
- });
19
- return categories.filter((c) => visibleCategories.has(c));
20
- };
21
- export function createYScale(axis, series, boundsHeight) {
22
- const yType = get(axis, 'type', DEFAULT_AXIS_TYPE);
23
- const yMin = get(axis, 'min');
24
- const yCategories = get(axis, 'categories');
25
- const yTimestamps = get(axis, 'timestamps');
26
- switch (yType) {
27
- case 'linear':
28
- case 'logarithmic': {
29
- const domain = getDomainDataYBySeries(series);
30
- const range = [boundsHeight, boundsHeight * axis.maxPadding];
31
- if (isNumericalArrayData(domain)) {
32
- const [domainYMin, domainMax] = extent(domain);
33
- const yMinValue = typeof yMin === 'number' ? yMin : domainYMin;
34
- let yMaxValue = domainMax;
35
- if (series.some((s) => CHART_SERIES_WITH_VOLUME_ON_Y_AXIS.includes(s.type))) {
36
- yMaxValue = Math.max(yMaxValue, 0);
37
- }
38
- const scaleFn = yType === 'logarithmic' ? scaleLog : scaleLinear;
39
- return scaleFn().domain([yMinValue, yMaxValue]).range(range).nice();
40
- }
41
- break;
42
- }
43
- case 'category': {
44
- if (yCategories) {
45
- const filteredCategories = filterCategoriesByVisibleSeries({
46
- axisDirection: 'y',
47
- categories: yCategories,
48
- series: series,
49
- });
50
- return scaleBand().domain(filteredCategories).range([boundsHeight, 0]);
51
- }
52
- break;
53
- }
54
- case 'datetime': {
55
- const range = [boundsHeight, boundsHeight * axis.maxPadding];
56
- if (yTimestamps) {
57
- const [yMin, yMax] = extent(yTimestamps);
58
- return scaleUtc().domain([yMin, yMax]).range(range).nice();
59
- }
60
- else {
61
- const domain = getDomainDataYBySeries(series);
62
- if (isNumericalArrayData(domain)) {
63
- const [yMin, yMax] = extent(domain);
64
- return scaleUtc().domain([yMin, yMax]).range(range).nice();
65
- }
66
- }
67
- break;
68
- }
69
- }
70
- throw new Error('Failed to create yScale');
71
- }
72
- function calculateXAxisPadding(series) {
73
- let result = 0;
74
- series.forEach((s) => {
75
- switch (s.type) {
76
- case 'bar-y': {
77
- // Since labels can be located to the right of the bar, need to add an additional space
78
- const inside = get(s, 'dataLabels.inside');
79
- if (!inside) {
80
- const labelsMaxWidth = get(s, 'dataLabels.maxWidth', 0);
81
- result = Math.max(result, labelsMaxWidth);
82
- }
83
- break;
84
- }
85
- }
86
- });
87
- return result;
88
- }
89
- export function createXScale(axis, series, boundsWidth) {
90
- const xMin = get(axis, 'min');
91
- const xMax = getDefaultMaxXAxisValue(series);
92
- const xType = get(axis, 'type', DEFAULT_AXIS_TYPE);
93
- const xCategories = get(axis, 'categories');
94
- const xTimestamps = get(axis, 'timestamps');
95
- const maxPadding = get(axis, 'maxPadding', 0);
96
- const xAxisMinPadding = boundsWidth * maxPadding + calculateXAxisPadding(series);
97
- const xRange = [0, boundsWidth - xAxisMinPadding];
98
- switch (xType) {
99
- case 'linear':
100
- case 'logarithmic': {
101
- const domain = getDomainDataXBySeries(series);
102
- if (isNumericalArrayData(domain)) {
103
- const [domainXMin, domainXMax] = extent(domain);
104
- const xMinValue = typeof xMin === 'number' ? xMin : domainXMin;
105
- const xMaxValue = typeof xMax === 'number' ? Math.max(xMax, domainXMax) : domainXMax;
106
- const scaleFn = xType === 'logarithmic' ? scaleLog : scaleLinear;
107
- return scaleFn().domain([xMinValue, xMaxValue]).range(xRange).nice();
108
- }
109
- break;
110
- }
111
- case 'category': {
112
- if (xCategories) {
113
- const filteredCategories = filterCategoriesByVisibleSeries({
114
- axisDirection: 'x',
115
- categories: xCategories,
116
- series: series,
117
- });
118
- const xScale = scaleBand().domain(filteredCategories).range([0, boundsWidth]);
119
- if (xScale.step() / 2 < xAxisMinPadding) {
120
- xScale.range(xRange);
121
- }
122
- return xScale;
123
- }
124
- break;
125
- }
126
- case 'datetime': {
127
- if (xTimestamps) {
128
- const [xMin, xMax] = extent(xTimestamps);
129
- return scaleUtc().domain([xMin, xMax]).range(xRange).nice();
130
- }
131
- else {
132
- const domain = getDomainDataXBySeries(series);
133
- if (isNumericalArrayData(domain)) {
134
- const [xMin, xMax] = extent(domain);
135
- return scaleUtc().domain([xMin, xMax]).range(xRange).nice();
136
- }
137
- }
138
- break;
139
- }
140
- }
141
- throw new Error('Failed to create xScale');
142
- }
143
- const createScales = (args) => {
144
- const { boundsWidth, boundsHeight, series, xAxis, yAxis, split } = args;
145
- let visibleSeries = getOnlyVisibleSeries(series);
146
- // Reassign to all series in case of all series unselected,
147
- // otherwise we will get an empty space without grid
148
- visibleSeries = visibleSeries.length === 0 ? series : visibleSeries;
149
- return {
150
- xScale: createXScale(xAxis, visibleSeries, boundsWidth),
151
- yScale: yAxis.map((axis, index) => {
152
- const axisSeries = series.filter((s) => {
153
- const seriesAxisIndex = get(s, 'yAxis', 0);
154
- return seriesAxisIndex === index;
155
- });
156
- const visibleAxisSeries = getOnlyVisibleSeries(axisSeries);
157
- const axisHeight = getAxisHeight({ boundsHeight, split });
158
- return createYScale(axis, visibleAxisSeries.length ? visibleAxisSeries : axisSeries, axisHeight);
159
- }),
160
- };
161
- };
162
- /**
163
- * Uses to create scales for axis related series
164
- */
165
- export const useAxisScales = (args) => {
166
- const { boundsWidth, boundsHeight, series, xAxis, yAxis, split } = args;
167
- return React.useMemo(() => {
168
- let xScale;
169
- let yScale;
170
- const hasAxisRelatedSeries = series.some(isAxisRelatedSeries);
171
- if (hasAxisRelatedSeries) {
172
- ({ xScale, yScale } = createScales({
173
- boundsWidth,
174
- boundsHeight,
175
- series,
176
- xAxis,
177
- yAxis,
178
- split,
179
- }));
180
- }
181
- return { xScale, yScale };
182
- }, [boundsWidth, boundsHeight, series, xAxis, yAxis, split]);
183
- };
@@ -1,16 +0,0 @@
1
- import type { ChartMargin } from '../../../../../types';
2
- import type { PreparedAxis, PreparedLegend, PreparedSeries } from '../../hooks';
3
- export { getBoundsWidth } from './utils';
4
- type Args = {
5
- width: number;
6
- height: number;
7
- margin: ChartMargin;
8
- preparedLegend: PreparedLegend;
9
- preparedXAxis: PreparedAxis;
10
- preparedYAxis: PreparedAxis[];
11
- preparedSeries: PreparedSeries[];
12
- };
13
- export declare const useChartDimensions: (args: Args) => {
14
- boundsWidth: number;
15
- boundsHeight: number;
16
- };
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import { isAxisRelatedSeries } from '../../utils';
3
- import { getBoundsWidth } from './utils';
4
- export { getBoundsWidth } from './utils';
5
- const getBottomOffset = (args) => {
6
- const { hasAxisRelatedSeries, preparedLegend, preparedXAxis } = args;
7
- let result = 0;
8
- if (preparedLegend.enabled) {
9
- result += preparedLegend.height + preparedLegend.margin;
10
- }
11
- if (hasAxisRelatedSeries) {
12
- if (preparedXAxis.title.text) {
13
- result += preparedXAxis.title.height + preparedXAxis.title.margin;
14
- }
15
- if (preparedXAxis.labels.enabled) {
16
- result += preparedXAxis.labels.margin + preparedXAxis.labels.height;
17
- }
18
- }
19
- return result;
20
- };
21
- export const useChartDimensions = (args) => {
22
- const { margin, width, height, preparedLegend, preparedXAxis, preparedYAxis, preparedSeries } = args;
23
- return React.useMemo(() => {
24
- const hasAxisRelatedSeries = preparedSeries.some(isAxisRelatedSeries);
25
- const boundsWidth = getBoundsWidth({ chartWidth: width, chartMargin: margin, preparedYAxis });
26
- const bottomOffset = getBottomOffset({
27
- hasAxisRelatedSeries,
28
- preparedLegend,
29
- preparedXAxis,
30
- });
31
- const boundsHeight = height - margin.top - margin.bottom - bottomOffset;
32
- return { boundsWidth, boundsHeight };
33
- }, [margin, width, height, preparedLegend, preparedXAxis, preparedYAxis, preparedSeries]);
34
- };
@@ -1,10 +0,0 @@
1
- import type { PreparedAxis, PreparedChart } from '../../hooks';
2
- export declare const getBoundsWidth: (args: {
3
- chartWidth: number;
4
- chartMargin: PreparedChart['margin'];
5
- preparedYAxis: PreparedAxis[];
6
- }) => number;
7
- export declare function getYAxisWidth(axis: PreparedAxis | undefined): number;
8
- export declare function getWidthOccupiedByYAxis(args: {
9
- preparedAxis: PreparedAxis[];
10
- }): number;