@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,133 +0,0 @@
1
- import get from 'lodash/get';
2
- import sortBy from 'lodash/sortBy';
3
- import { getLabelsSize } from '../../../utils';
4
- import { MIN_BAR_GAP, MIN_BAR_WIDTH } from '../constants';
5
- import { getXValue, getYValue } from '../utils';
6
- function getLabelData(d, plotHeight) {
7
- if (!d.series.dataLabels.enabled) {
8
- return undefined;
9
- }
10
- const text = String(d.data.label || d.subTotal);
11
- const style = d.series.dataLabels.style;
12
- const { maxHeight: height, maxWidth: width } = getLabelsSize({ labels: [text], style });
13
- let y;
14
- if (Number(d.data.y) > 0 || d.data.total) {
15
- y = Math.max(height, d.y - d.series.dataLabels.padding);
16
- }
17
- else {
18
- y = Math.min(plotHeight - d.series.dataLabels.padding, d.y + d.height + d.series.dataLabels.padding + height);
19
- }
20
- return {
21
- text,
22
- x: d.x + d.width / 2,
23
- y,
24
- style,
25
- size: { width, height },
26
- textAnchor: 'middle',
27
- series: d.series,
28
- };
29
- }
30
- function getBandWidth(args) {
31
- const { series, xAxis, xScale } = args;
32
- if (xAxis.type === 'category') {
33
- const xBandScale = xScale;
34
- return xBandScale.bandwidth();
35
- }
36
- const xLinearScale = xScale;
37
- const xValues = series.reduce((acc, s) => {
38
- s.data.forEach((dataItem) => acc.push(Number(dataItem.x)));
39
- return acc;
40
- }, []);
41
- let bandWidth = Infinity;
42
- xValues.sort().forEach((xValue, index) => {
43
- if (index > 0 && xValue !== xValues[index - 1]) {
44
- const dist = xLinearScale(xValue) - xLinearScale(xValues[index - 1]);
45
- if (dist < bandWidth) {
46
- bandWidth = dist;
47
- }
48
- }
49
- });
50
- return bandWidth;
51
- }
52
- export const prepareWaterfallData = (args) => {
53
- const { series, seriesOptions, xAxis, xScale, yAxis: [yAxis], yScale: [yScale], } = args;
54
- const yLinearScale = yScale;
55
- const plotHeight = yLinearScale(yLinearScale.domain()[0]);
56
- const barMaxWidth = get(seriesOptions, 'waterfall.barMaxWidth');
57
- const barPadding = get(seriesOptions, 'waterfall.barPadding');
58
- const flattenData = series.reduce((acc, s) => {
59
- acc.push(...s.data.map((d) => ({ data: d, series: s })));
60
- return acc;
61
- }, []);
62
- const data = sortBy(flattenData, (d) => d.data.x);
63
- const bandWidth = getBandWidth({
64
- series,
65
- xAxis,
66
- xScale,
67
- });
68
- const rectGap = Math.max(bandWidth * barPadding, MIN_BAR_GAP);
69
- const rectWidth = Math.max(MIN_BAR_WIDTH, Math.min(bandWidth - rectGap, barMaxWidth));
70
- const yZero = getYValue({
71
- point: { y: 0 },
72
- yScale,
73
- yAxis,
74
- });
75
- let totalValue = 0;
76
- const result = [];
77
- data.forEach((item, _index) => {
78
- if (typeof item.data.y !== 'number' && !item.data.total) {
79
- return;
80
- }
81
- if (!item.data.total) {
82
- totalValue += Number(item.data.y);
83
- }
84
- const prevPoint = result[result.length - 1];
85
- const xCenter = getXValue({ point: item.data, xAxis, xScale });
86
- const x = xCenter - rectWidth / 2;
87
- const yValue = Number(item.data.total ? totalValue : item.data.y);
88
- const height = yZero -
89
- getYValue({
90
- point: { y: Math.abs(yValue) },
91
- yScale,
92
- yAxis,
93
- });
94
- let y;
95
- if (!prevPoint || item.data.total) {
96
- y = getYValue({
97
- point: {
98
- y: yValue > 0 ? yValue : 0,
99
- },
100
- yScale,
101
- yAxis,
102
- });
103
- }
104
- else if (Number(prevPoint.data.y) < 0) {
105
- if (Number(item.data.y) > 0) {
106
- y = prevPoint.y + prevPoint.height - height;
107
- }
108
- else {
109
- y = prevPoint.y + prevPoint.height;
110
- }
111
- }
112
- else if (Number(item.data.y) < 0) {
113
- y = prevPoint.y;
114
- }
115
- else {
116
- y = prevPoint.y - height;
117
- }
118
- const preparedData = {
119
- x,
120
- y,
121
- width: rectWidth,
122
- height,
123
- opacity: get(item.data, 'opacity', null),
124
- data: item.data,
125
- series: item.series,
126
- subTotal: totalValue,
127
- htmlElements: [],
128
- };
129
- preparedData.label = getLabelData(preparedData, plotHeight);
130
- result.push(preparedData);
131
- });
132
- return result;
133
- };
@@ -1,15 +0,0 @@
1
- import { WaterfallSeriesData } from '../../../../../../types';
2
- import { HtmlItem, LabelData } from '../../../types';
3
- import { PreparedWaterfallSeries } from '../../useSeries/types';
4
- export type PreparedWaterfallData = {
5
- x: number;
6
- y: number;
7
- width: number;
8
- height: number;
9
- opacity: number | null;
10
- series: PreparedWaterfallSeries;
11
- data: WaterfallSeriesData;
12
- label?: LabelData;
13
- subTotal: number;
14
- htmlElements: HtmlItem[];
15
- };
@@ -1,14 +0,0 @@
1
- import type { ChartKitWidgetSplit } from '../../../../../types';
2
- import type { PreparedSplit } from './types';
3
- type UseSplitArgs = {
4
- split?: ChartKitWidgetSplit;
5
- boundsHeight: number;
6
- chartWidth: number;
7
- };
8
- export declare function getPlotHeight(args: {
9
- split: ChartKitWidgetSplit | undefined;
10
- boundsHeight: number;
11
- gap: number;
12
- }): number;
13
- export declare const useSplit: (args: UseSplitArgs) => PreparedSplit;
14
- export {};
@@ -1,57 +0,0 @@
1
- import get from 'lodash/get';
2
- import { calculateNumericProperty, getHorisontalSvgTextHeight } from '../../utils';
3
- const DEFAULT_TITLE_FONT_SIZE = '15px';
4
- const TITLE_TOP_BOTTOM_PADDING = 8;
5
- function preparePlotTitle(args) {
6
- const { title, plotIndex, plotHeight, chartWidth, gap } = args;
7
- const titleText = (title === null || title === void 0 ? void 0 : title.text) || '';
8
- const titleStyle = {
9
- fontSize: get(title, 'style.fontSize', DEFAULT_TITLE_FONT_SIZE),
10
- fontWeight: get(title, 'style.fontWeight'),
11
- };
12
- const titleHeight = titleText
13
- ? getHorisontalSvgTextHeight({ text: titleText, style: titleStyle }) +
14
- TITLE_TOP_BOTTOM_PADDING * 2
15
- : 0;
16
- const top = plotIndex * (plotHeight + gap);
17
- return {
18
- text: titleText,
19
- x: chartWidth / 2,
20
- y: top + titleHeight / 2,
21
- style: titleStyle,
22
- height: titleHeight,
23
- };
24
- }
25
- export function getPlotHeight(args) {
26
- const { split, boundsHeight, gap } = args;
27
- const plots = (split === null || split === void 0 ? void 0 : split.plots) || [];
28
- if (plots.length > 1) {
29
- return (boundsHeight - gap * (plots.length - 1)) / plots.length;
30
- }
31
- return boundsHeight;
32
- }
33
- export const useSplit = (args) => {
34
- var _a;
35
- const { split, boundsHeight, chartWidth } = args;
36
- const splitGap = (_a = calculateNumericProperty({ value: split === null || split === void 0 ? void 0 : split.gap, base: boundsHeight })) !== null && _a !== void 0 ? _a : 0;
37
- const plotHeight = getPlotHeight({ split: split, boundsHeight, gap: splitGap });
38
- const plots = (split === null || split === void 0 ? void 0 : split.plots) || [];
39
- return {
40
- plots: plots.map((p, index) => {
41
- const title = preparePlotTitle({
42
- title: p.title,
43
- plotIndex: index,
44
- gap: splitGap,
45
- plotHeight,
46
- chartWidth,
47
- });
48
- const top = index * (plotHeight + splitGap);
49
- return {
50
- top: top + title.height,
51
- height: plotHeight - title.height,
52
- title,
53
- };
54
- }),
55
- gap: splitGap,
56
- };
57
- };
@@ -1,17 +0,0 @@
1
- import type { BaseTextStyle } from '../../../../../types';
2
- export type PreparedSplit = {
3
- plots: PreparedPlot[];
4
- gap: number;
5
- };
6
- export type PreparedPlot = {
7
- title: PreparedPlotTitle;
8
- top: number;
9
- height: number;
10
- };
11
- export type PreparedPlotTitle = {
12
- x: number;
13
- y: number;
14
- text: string;
15
- style?: Partial<BaseTextStyle>;
16
- height: number;
17
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,13 +0,0 @@
1
- import type { Dispatch } from 'd3';
2
- import type { TooltipDataChunk } from '../../../../../types/widget-data';
3
- import { PreparedTooltip } from '../useChartOptions/types';
4
- import type { PointerPosition } from './types';
5
- type Args = {
6
- dispatcher: Dispatch<object>;
7
- tooltip: PreparedTooltip;
8
- };
9
- export declare const useTooltip: ({ dispatcher, tooltip }: Args) => {
10
- hovered: TooltipDataChunk[] | undefined;
11
- pointerPosition: PointerPosition | undefined;
12
- };
13
- export {};
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- export const useTooltip = ({ dispatcher, tooltip }) => {
3
- const [{ hovered, pointerPosition }, setTooltipState] = React.useState({});
4
- React.useEffect(() => {
5
- if (tooltip === null || tooltip === void 0 ? void 0 : tooltip.enabled) {
6
- dispatcher.on('hover-shape.tooltip', (nextHovered, nextPointerPosition) => {
7
- setTooltipState({ hovered: nextHovered, pointerPosition: nextPointerPosition });
8
- });
9
- }
10
- return () => {
11
- if (tooltip === null || tooltip === void 0 ? void 0 : tooltip.enabled) {
12
- dispatcher.on('hover-shape.tooltip', null);
13
- }
14
- };
15
- }, [dispatcher, tooltip]);
16
- return { hovered, pointerPosition };
17
- };
@@ -1 +0,0 @@
1
- export type PointerPosition = [number, number];
@@ -1 +0,0 @@
1
- export {};
@@ -1,24 +0,0 @@
1
- import { BaseTextStyle } from '../../../../types';
2
- export type LabelData = {
3
- text: string;
4
- x: number;
5
- y: number;
6
- style: BaseTextStyle;
7
- size: {
8
- width: number;
9
- height: number;
10
- };
11
- textAnchor: 'start' | 'end' | 'middle';
12
- series: {
13
- id: string;
14
- };
15
- active?: boolean;
16
- };
17
- export type HtmlItem = {
18
- x: number;
19
- y: number;
20
- content: string;
21
- };
22
- export type ShapeDataWithHtmlItems = {
23
- htmlElements: HtmlItem[];
24
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,24 +0,0 @@
1
- import type { AxisDomain, AxisScale, Selection } from 'd3';
2
- import { BaseTextStyle } from '../../../../../types';
3
- type AxisBottomArgs = {
4
- scale: AxisScale<AxisDomain>;
5
- ticks: {
6
- count?: number;
7
- maxTickCount?: number;
8
- labelFormat?: (value: any) => string;
9
- labelsPaddings?: number;
10
- labelsMargin?: number;
11
- labelsStyle?: BaseTextStyle;
12
- labelsMaxWidth?: number;
13
- labelsLineHeight: number;
14
- items?: [number, number][];
15
- rotation?: number;
16
- tickColor?: string;
17
- };
18
- domain: {
19
- size: number;
20
- color?: string;
21
- };
22
- };
23
- export declare function axisBottom(args: AxisBottomArgs): (selection: Selection<SVGGElement, unknown, null, undefined>) => void;
24
- export {};
@@ -1,126 +0,0 @@
1
- import { path, select } from 'd3';
2
- import { getXAxisItems, getXAxisOffset, getXTickPosition } from '../axis';
3
- import { calculateCos, calculateSin } from '../math';
4
- import { getLabelsSize, setEllipsisForOverflowText } from '../text';
5
- function addDomain(selection, options) {
6
- const { size, color } = options;
7
- const domainPath = selection
8
- .selectAll('.domain')
9
- .data([null])
10
- .enter()
11
- .insert('path', '.tick')
12
- .attr('class', 'domain')
13
- .attr('d', `M0,0V0H${size}`);
14
- if (color) {
15
- domainPath.style('stroke', color);
16
- }
17
- }
18
- export function axisBottom(args) {
19
- const { scale, ticks: { labelFormat = (value) => String(value), labelsPaddings = 0, labelsMargin = 0, labelsMaxWidth = Infinity, labelsStyle, labelsLineHeight, items: tickItems, count: ticksCount, maxTickCount, rotation = 0, tickColor, }, domain, } = args;
20
- const offset = getXAxisOffset();
21
- const position = getXTickPosition({ scale, offset });
22
- const values = getXAxisItems({ scale, count: ticksCount, maxCount: maxTickCount });
23
- const labelHeight = getLabelsSize({
24
- labels: values,
25
- style: labelsStyle,
26
- }).maxHeight;
27
- return function (selection) {
28
- var _a, _b, _c;
29
- const rect = (_a = selection.node()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
30
- const x = (rect === null || rect === void 0 ? void 0 : rect.x) || 0;
31
- const right = x + domain.size;
32
- const top = -((_c = (_b = tickItems === null || tickItems === void 0 ? void 0 : tickItems[0]) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : 0);
33
- let transform = `translate(0, ${labelHeight + labelsMargin - top}px)`;
34
- if (rotation) {
35
- const labelsOffsetTop = labelHeight * calculateCos(rotation) + labelsMargin - top;
36
- let labelsOffsetLeft = calculateSin(rotation) * labelHeight;
37
- if (Math.abs(rotation) % 360 === 90) {
38
- labelsOffsetLeft += ((rotation > 0 ? -1 : 1) * labelHeight) / 2;
39
- }
40
- transform = `translate(${-labelsOffsetLeft}px, ${labelsOffsetTop}px) rotate(${rotation}deg)`;
41
- }
42
- const tickPath = path();
43
- tickItems === null || tickItems === void 0 ? void 0 : tickItems.forEach(([start, end]) => {
44
- tickPath.moveTo(0, start);
45
- tickPath.lineTo(0, end);
46
- });
47
- selection
48
- .selectAll('.tick')
49
- .data(values)
50
- .order()
51
- .join((el) => {
52
- const tick = el.append('g').attr('class', 'tick');
53
- tick.append('path')
54
- .attr('d', tickPath.toString())
55
- .attr('stroke', tickColor !== null && tickColor !== void 0 ? tickColor : 'currentColor');
56
- tick.append('text')
57
- .text(labelFormat)
58
- .attr('fill', 'currentColor')
59
- .attr('text-anchor', () => {
60
- if (rotation) {
61
- return rotation > 0 ? 'start' : 'end';
62
- }
63
- return 'middle';
64
- })
65
- .style('transform', transform)
66
- .style('alignment-baseline', 'after-edge');
67
- return tick;
68
- })
69
- .attr('transform', function (d) {
70
- return `translate(${position(d) + offset}, ${top})`;
71
- });
72
- // Remove tick that has the same x coordinate like domain
73
- selection
74
- .select('.tick')
75
- .filter((d) => {
76
- return position(d) === 0;
77
- })
78
- .select('line')
79
- .remove();
80
- const labels = selection.selectAll('.tick text');
81
- // FIXME: handle rotated overlapping labels (with a smarter approach)
82
- if (rotation) {
83
- const maxWidth = labelsMaxWidth * calculateCos(rotation) + labelsLineHeight * calculateSin(rotation);
84
- labels.each(function () {
85
- setEllipsisForOverflowText(select(this), maxWidth);
86
- });
87
- }
88
- else {
89
- // remove overlapping labels
90
- let elementX = 0;
91
- selection
92
- .selectAll('.tick')
93
- .filter(function () {
94
- const node = this;
95
- const r = node.getBoundingClientRect();
96
- if (r.left < elementX) {
97
- return true;
98
- }
99
- elementX = r.right + labelsPaddings;
100
- return false;
101
- })
102
- .remove();
103
- // add an ellipsis to the labels that go beyond the boundaries of the chart
104
- labels.each(function (_d, i, nodes) {
105
- if (i === nodes.length - 1) {
106
- const currentElement = this;
107
- const prevElement = nodes[i - 1];
108
- const text = select(currentElement);
109
- const currentElementPosition = currentElement.getBoundingClientRect();
110
- const prevElementPosition = prevElement === null || prevElement === void 0 ? void 0 : prevElement.getBoundingClientRect();
111
- const lackingSpace = Math.max(0, currentElementPosition.right - right);
112
- if (lackingSpace) {
113
- const remainSpace = right - ((prevElementPosition === null || prevElementPosition === void 0 ? void 0 : prevElementPosition.right) || 0) - labelsPaddings;
114
- const translateX = currentElementPosition.width / 2 - lackingSpace;
115
- text.attr('text-anchor', 'end').attr('transform', `translate(${translateX},0)`);
116
- setEllipsisForOverflowText(text, remainSpace);
117
- }
118
- }
119
- });
120
- }
121
- const { size: domainSize, color: domainColor } = domain;
122
- selection
123
- .call(addDomain, { size: domainSize, color: domainColor })
124
- .style('font-size', (labelsStyle === null || labelsStyle === void 0 ? void 0 : labelsStyle.fontSize) || '');
125
- };
126
- }
@@ -1 +0,0 @@
1
- export * from './bottom';
@@ -1 +0,0 @@
1
- export * from './bottom';
@@ -1,31 +0,0 @@
1
- import type { AxisDomain, AxisScale, ScaleBand } from 'd3';
2
- import type { PreparedAxis, PreparedSplit } from '../hooks';
3
- import type { TextRow } from './text';
4
- export declare function getTicksCount({ axis, range }: {
5
- axis: PreparedAxis;
6
- range: number;
7
- }): number | undefined;
8
- export declare function isBandScale(scale: AxisScale<AxisDomain>): scale is ScaleBand<AxisDomain>;
9
- export declare function getScaleTicks(scale: AxisScale<AxisDomain>, ticksCount?: number): any;
10
- export declare function getXAxisOffset(): 0 | 0.5;
11
- export declare function getXTickPosition({ scale, offset }: {
12
- scale: AxisScale<AxisDomain>;
13
- offset: number;
14
- }): (d: AxisDomain) => number;
15
- export declare function getXAxisItems({ scale, count, maxCount, }: {
16
- scale: AxisScale<AxisDomain>;
17
- count?: number;
18
- maxCount?: number;
19
- }): any;
20
- export declare function getMaxTickCount({ axis, width }: {
21
- axis: PreparedAxis;
22
- width: number;
23
- }): number;
24
- export declare function getAxisHeight(args: {
25
- split: PreparedSplit;
26
- boundsHeight: number;
27
- }): number;
28
- export declare function getAxisTitleRows(args: {
29
- axis: PreparedAxis;
30
- textMaxWidth: number;
31
- }): TextRow[];
@@ -1,71 +0,0 @@
1
- import { wrapText } from './text';
2
- export function getTicksCount({ axis, range }) {
3
- let ticksCount;
4
- if (axis.ticks.pixelInterval) {
5
- ticksCount = Math.ceil(range / axis.ticks.pixelInterval);
6
- }
7
- return ticksCount;
8
- }
9
- export function isBandScale(scale) {
10
- return 'bandwidth' in scale && typeof scale.bandwidth === 'function';
11
- }
12
- export function getScaleTicks(scale, ticksCount) {
13
- return 'ticks' in scale && typeof scale.ticks === 'function'
14
- ? scale.ticks(ticksCount)
15
- : scale.domain();
16
- }
17
- export function getXAxisOffset() {
18
- return typeof window !== 'undefined' && window.devicePixelRatio > 1 ? 0 : 0.5;
19
- }
20
- function number(scale) {
21
- return (d) => Number(scale(d));
22
- }
23
- function center(scale, offset) {
24
- offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
25
- if (scale.round()) {
26
- offset = Math.round(offset);
27
- }
28
- return (d) => Number(scale(d)) + offset;
29
- }
30
- export function getXTickPosition({ scale, offset }) {
31
- return isBandScale(scale) ? center(scale.copy(), offset) : number(scale.copy());
32
- }
33
- export function getXAxisItems({ scale, count, maxCount, }) {
34
- let values = getScaleTicks(scale, count);
35
- if (maxCount && values.length > maxCount) {
36
- const step = Math.ceil(values.length / maxCount);
37
- values = values.filter((_, i) => i % step === 0);
38
- }
39
- return values;
40
- }
41
- export function getMaxTickCount({ axis, width }) {
42
- const minTickWidth = parseInt(axis.labels.style.fontSize) + axis.labels.padding;
43
- return Math.floor(width / minTickWidth);
44
- }
45
- export function getAxisHeight(args) {
46
- const { split, boundsHeight } = args;
47
- if (split.plots.length > 1) {
48
- return split.plots[0].height;
49
- }
50
- return boundsHeight;
51
- }
52
- export function getAxisTitleRows(args) {
53
- const { axis, textMaxWidth } = args;
54
- if (axis.title.maxRowCount < 1) {
55
- return [];
56
- }
57
- const textRows = wrapText({
58
- text: axis.title.text,
59
- style: axis.title.style,
60
- width: textMaxWidth,
61
- });
62
- return textRows.reduce((acc, row, index) => {
63
- if (index < axis.title.maxRowCount) {
64
- acc.push(row);
65
- }
66
- else {
67
- acc[axis.title.maxRowCount - 1].text += row.text;
68
- }
69
- return acc;
70
- }, []);
71
- }
@@ -1,10 +0,0 @@
1
- import { ChartKitWidgetData } from '../../../../types';
2
- export declare function getDomainForContinuousColorScale(args: {
3
- series: ChartKitWidgetData['series']['data'];
4
- }): number[];
5
- export declare function getDefaultColorStops(size: number): number[];
6
- export declare function getContinuesColorFn(args: {
7
- values: number[];
8
- colors: string[];
9
- stops?: number[];
10
- }): (value: number) => string;
@@ -1,43 +0,0 @@
1
- import { range, scaleLinear } from 'd3';
2
- export function getDomainForContinuousColorScale(args) {
3
- const { series } = args;
4
- const values = series.reduce((acc, s) => {
5
- switch (s.type) {
6
- case 'pie': {
7
- acc.push(...s.data.map((d) => d.value));
8
- break;
9
- }
10
- case 'bar-y': {
11
- acc.push(...s.data.map((d) => Number(d.x)));
12
- break;
13
- }
14
- case 'scatter':
15
- case 'bar-x':
16
- case 'waterfall':
17
- case 'line':
18
- case 'area': {
19
- acc.push(...s.data.map((d) => Number(d.y)));
20
- break;
21
- }
22
- default: {
23
- throw Error(`The method for calculation a domain for a continuous color scale for the "${s.type}" series is not defined`);
24
- }
25
- }
26
- return acc;
27
- }, []);
28
- return [Math.min(...values), Math.max(...values)];
29
- }
30
- export function getDefaultColorStops(size) {
31
- return range(size).map((d) => d / size);
32
- }
33
- export function getContinuesColorFn(args) {
34
- const { values, colors, stops: customStops } = args;
35
- const min = Math.min(...values);
36
- const max = Math.max(...values);
37
- const stops = customStops !== null && customStops !== void 0 ? customStops : getDefaultColorStops(colors.length);
38
- const color = scaleLinear(stops, colors);
39
- return (value) => {
40
- const colorValue = (value - min) / (max - min);
41
- return color(colorValue);
42
- };
43
- }
@@ -1,15 +0,0 @@
1
- import type { ChartKitWidgetSeries, ChartKitWidgetSeriesData, TooltipDataChunk } from '../../../../types';
2
- import type { ShapeData } from '../hooks';
3
- type GetClosestPointsArgs = {
4
- position: [number, number];
5
- shapesData: ShapeData[];
6
- };
7
- export type ShapePoint = {
8
- x: number;
9
- y0: number;
10
- y1: number;
11
- data: ChartKitWidgetSeriesData;
12
- series: ChartKitWidgetSeries;
13
- };
14
- export declare function getClosestPoints(args: GetClosestPointsArgs): TooltipDataChunk[];
15
- export {};