@gravity-ui/charts 1.22.0 → 1.24.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 (361) hide show
  1. package/dist/cjs/components/AxisX/AxisX.d.ts +3 -3
  2. package/dist/cjs/components/ChartInner/index.js +94 -27
  3. package/dist/cjs/components/ChartInner/useChartInnerHandlers.d.ts +3 -3
  4. package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +41 -20
  5. package/dist/cjs/components/ChartInner/useChartInnerProps.js +21 -9
  6. package/dist/cjs/components/ChartInner/useChartInnerState.d.ts +6 -1
  7. package/dist/cjs/components/ChartInner/useChartInnerState.js +17 -1
  8. package/dist/cjs/components/ChartInner/utils.d.ts +5 -2
  9. package/dist/cjs/components/ChartInner/utils.js +13 -0
  10. package/dist/cjs/components/RangeSlider/index.d.ts +6 -0
  11. package/dist/cjs/components/RangeSlider/index.js +41 -0
  12. package/dist/cjs/components/RangeSlider/styles.css +6 -0
  13. package/dist/cjs/components/RangeSlider/utils.d.ts +5 -0
  14. package/dist/cjs/components/RangeSlider/utils.js +18 -0
  15. package/dist/cjs/components/Tooltip/DefaultTooltipContent/index.js +2 -1
  16. package/dist/cjs/components/Tooltip/DefaultTooltipContent/utils.d.ts +2 -2
  17. package/dist/cjs/components/Tooltip/DefaultTooltipContent/utils.js +3 -2
  18. package/dist/cjs/components/Tooltip/index.d.ts +3 -3
  19. package/dist/cjs/constants/chart-types.d.ts +3 -1
  20. package/dist/cjs/constants/chart-types.js +2 -1
  21. package/dist/cjs/constants/defaults/brush.d.ts +2 -0
  22. package/dist/cjs/constants/defaults/brush.js +15 -0
  23. package/dist/cjs/constants/defaults/index.d.ts +1 -0
  24. package/dist/cjs/constants/defaults/index.js +1 -0
  25. package/dist/cjs/constants/defaults/series-options.d.ts +2 -1
  26. package/dist/cjs/constants/defaults/series-options.js +11 -0
  27. package/dist/cjs/constants/index.d.ts +1 -0
  28. package/dist/cjs/constants/index.js +1 -0
  29. package/dist/cjs/constants/zoom.d.ts +6 -0
  30. package/dist/cjs/constants/zoom.js +5 -0
  31. package/dist/cjs/hooks/index.d.ts +5 -0
  32. package/dist/cjs/hooks/index.js +5 -0
  33. package/dist/cjs/hooks/useAxis/index.d.ts +4 -3
  34. package/dist/cjs/hooks/useAxis/index.js +2 -2
  35. package/dist/cjs/hooks/useAxis/range-slider.d.ts +5 -0
  36. package/dist/cjs/hooks/useAxis/range-slider.js +16 -0
  37. package/dist/cjs/hooks/useAxis/types.d.ts +66 -0
  38. package/dist/cjs/hooks/useAxis/types.js +1 -0
  39. package/dist/cjs/hooks/{useChartOptions → useAxis}/utils.d.ts +1 -2
  40. package/dist/cjs/hooks/useAxis/utils.js +9 -0
  41. package/dist/{esm/hooks/useChartOptions → cjs/hooks/useAxis}/x-axis.d.ts +2 -2
  42. package/dist/{esm/hooks/useChartOptions → cjs/hooks/useAxis}/x-axis.js +5 -3
  43. package/dist/cjs/hooks/{useChartOptions → useAxis}/y-axis.d.ts +2 -2
  44. package/dist/cjs/hooks/{useChartOptions → useAxis}/y-axis.js +3 -3
  45. package/dist/cjs/hooks/useAxisScales/index.d.ts +3 -3
  46. package/dist/cjs/hooks/useAxisScales/index.js +41 -15
  47. package/dist/cjs/hooks/useBrush/index.js +87 -24
  48. package/dist/cjs/hooks/useBrush/styles.css +1 -0
  49. package/dist/cjs/hooks/useBrush/types.d.ts +8 -7
  50. package/dist/cjs/hooks/useBrush/utils.d.ts +19 -0
  51. package/dist/cjs/hooks/useBrush/utils.js +172 -0
  52. package/dist/cjs/hooks/useChartDimensions/index.d.ts +4 -4
  53. package/dist/cjs/hooks/useChartDimensions/index.js +14 -4
  54. package/dist/cjs/hooks/useChartDimensions/utils.d.ts +4 -4
  55. package/dist/cjs/hooks/useChartOptions/chart.js +1 -82
  56. package/dist/cjs/hooks/useChartOptions/index.d.ts +9 -3
  57. package/dist/cjs/hooks/useChartOptions/tooltip.js +1 -1
  58. package/dist/cjs/hooks/useChartOptions/types.d.ts +4 -64
  59. package/dist/cjs/hooks/useChartOptions/zoom.d.ts +11 -0
  60. package/dist/cjs/hooks/useChartOptions/zoom.js +91 -0
  61. package/dist/cjs/hooks/useCrosshair/index.d.ts +3 -3
  62. package/dist/cjs/hooks/useNormalizedOriginalData/index.d.ts +1 -0
  63. package/dist/cjs/hooks/useNormalizedOriginalData/index.js +1 -2
  64. package/dist/cjs/hooks/useRangeSlider/index.d.ts +4 -0
  65. package/dist/cjs/hooks/useRangeSlider/index.js +129 -0
  66. package/dist/cjs/hooks/useRangeSlider/types.d.ts +42 -0
  67. package/dist/cjs/hooks/useRangeSlider/types.js +1 -0
  68. package/dist/cjs/hooks/useRangeSlider/utils.d.ts +16 -0
  69. package/dist/cjs/hooks/useRangeSlider/utils.js +19 -0
  70. package/dist/cjs/hooks/useSeries/prepare-area.js +17 -2
  71. package/dist/cjs/hooks/useSeries/prepare-bar-x.js +21 -9
  72. package/dist/cjs/hooks/useSeries/prepare-bar-y.d.ts +3 -2
  73. package/dist/cjs/hooks/useSeries/prepare-bar-y.js +20 -7
  74. package/dist/cjs/hooks/useSeries/prepare-funnel.d.ts +10 -0
  75. package/dist/cjs/hooks/useSeries/prepare-funnel.js +50 -0
  76. package/dist/cjs/hooks/useSeries/prepare-heatmap.js +13 -1
  77. package/dist/cjs/hooks/useSeries/prepare-legend.js +5 -2
  78. package/dist/cjs/hooks/useSeries/prepare-line.js +17 -2
  79. package/dist/cjs/hooks/useSeries/prepare-pie.js +17 -3
  80. package/dist/cjs/hooks/useSeries/prepare-scatter.js +18 -1
  81. package/dist/cjs/hooks/useSeries/prepare-waterfall.js +18 -2
  82. package/dist/cjs/hooks/useSeries/prepareSeries.js +9 -0
  83. package/dist/cjs/hooks/useSeries/types.d.ts +22 -6
  84. package/dist/cjs/hooks/useShapes/area/index.d.ts +3 -3
  85. package/dist/cjs/hooks/useShapes/area/index.js +4 -2
  86. package/dist/cjs/hooks/useShapes/area/prepare-data.d.ts +3 -3
  87. package/dist/cjs/hooks/useShapes/area/prepare-data.js +37 -22
  88. package/dist/cjs/hooks/useShapes/area/types.d.ts +5 -2
  89. package/dist/cjs/hooks/useShapes/bar-x/index.d.ts +3 -3
  90. package/dist/cjs/hooks/useShapes/bar-x/index.js +2 -2
  91. package/dist/cjs/hooks/useShapes/bar-x/prepare-data.d.ts +3 -3
  92. package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +26 -15
  93. package/dist/cjs/hooks/useShapes/bar-y/index.d.ts +4 -4
  94. package/dist/cjs/hooks/useShapes/bar-y/index.js +21 -24
  95. package/dist/cjs/hooks/useShapes/bar-y/prepare-data.d.ts +3 -3
  96. package/dist/cjs/hooks/useShapes/bar-y/prepare-data.js +26 -8
  97. package/dist/cjs/hooks/useShapes/bar-y/types.d.ts +2 -2
  98. package/dist/cjs/hooks/useShapes/bar-y/utils.d.ts +3 -0
  99. package/dist/cjs/hooks/useShapes/bar-y/utils.js +44 -0
  100. package/dist/cjs/hooks/useShapes/funnel/index.d.ts +13 -0
  101. package/dist/cjs/hooks/useShapes/funnel/index.js +95 -0
  102. package/dist/cjs/hooks/useShapes/funnel/prepare-data.d.ts +9 -0
  103. package/dist/cjs/hooks/useShapes/funnel/prepare-data.js +120 -0
  104. package/dist/cjs/hooks/useShapes/funnel/types.d.ts +32 -0
  105. package/dist/cjs/hooks/useShapes/funnel/types.js +1 -0
  106. package/dist/cjs/hooks/useShapes/heatmap/index.d.ts +2 -2
  107. package/dist/cjs/hooks/useShapes/heatmap/index.js +2 -2
  108. package/dist/cjs/hooks/useShapes/heatmap/prepare-data.d.ts +3 -3
  109. package/dist/cjs/hooks/useShapes/heatmap/prepare-data.js +7 -3
  110. package/dist/cjs/hooks/useShapes/index.d.ts +15 -10
  111. package/dist/cjs/hooks/useShapes/index.js +47 -25
  112. package/dist/cjs/hooks/useShapes/line/index.d.ts +3 -3
  113. package/dist/cjs/hooks/useShapes/line/index.js +3 -2
  114. package/dist/cjs/hooks/useShapes/line/prepare-data.d.ts +3 -3
  115. package/dist/cjs/hooks/useShapes/line/prepare-data.js +58 -44
  116. package/dist/cjs/hooks/useShapes/line/types.d.ts +7 -3
  117. package/dist/cjs/hooks/useShapes/pie/index.d.ts +2 -2
  118. package/dist/cjs/hooks/useShapes/pie/index.js +2 -2
  119. package/dist/cjs/hooks/useShapes/pie/prepare-data.js +8 -4
  120. package/dist/cjs/hooks/useShapes/radar/index.d.ts +2 -2
  121. package/dist/cjs/hooks/useShapes/radar/index.js +2 -2
  122. package/dist/cjs/hooks/useShapes/sankey/index.d.ts +2 -2
  123. package/dist/cjs/hooks/useShapes/sankey/index.js +2 -2
  124. package/dist/cjs/hooks/useShapes/scatter/index.d.ts +3 -2
  125. package/dist/cjs/hooks/useShapes/scatter/index.js +4 -4
  126. package/dist/cjs/hooks/useShapes/scatter/prepare-data.d.ts +3 -3
  127. package/dist/cjs/hooks/useShapes/scatter/prepare-data.js +1 -1
  128. package/dist/cjs/hooks/useShapes/styles.css +8 -0
  129. package/dist/cjs/hooks/useShapes/treemap/index.d.ts +2 -2
  130. package/dist/cjs/hooks/useShapes/treemap/index.js +2 -2
  131. package/dist/cjs/hooks/useShapes/utils.d.ts +17 -9
  132. package/dist/cjs/hooks/useShapes/utils.js +66 -18
  133. package/dist/cjs/hooks/useShapes/waterfall/index.d.ts +3 -3
  134. package/dist/cjs/hooks/useShapes/waterfall/index.js +2 -2
  135. package/dist/cjs/hooks/useShapes/waterfall/prepare-data.d.ts +3 -3
  136. package/dist/cjs/hooks/useShapes/waterfall/prepare-data.js +18 -8
  137. package/dist/cjs/hooks/useTooltip/index.js +8 -4
  138. package/dist/cjs/hooks/useZoom/index.d.ts +4 -3
  139. package/dist/cjs/hooks/useZoom/index.js +2 -0
  140. package/dist/cjs/hooks/useZoom/utils.d.ts +5 -4
  141. package/dist/cjs/hooks/useZoom/utils.js +4 -3
  142. package/dist/cjs/hooks/utils/bar-x.d.ts +2 -2
  143. package/dist/cjs/hooks/utils/bar-y.d.ts +10 -3
  144. package/dist/cjs/hooks/utils/bar-y.js +4 -0
  145. package/dist/cjs/i18n/keysets/en.json +2 -2
  146. package/dist/cjs/i18n/keysets/ru.json +2 -2
  147. package/dist/cjs/types/chart/area.d.ts +18 -3
  148. package/dist/cjs/types/chart/axis.d.ts +45 -0
  149. package/dist/cjs/types/chart/bar-x.d.ts +17 -4
  150. package/dist/cjs/types/chart/bar-y.d.ts +12 -3
  151. package/dist/cjs/types/chart/base.d.ts +26 -25
  152. package/dist/cjs/types/chart/brush.d.ts +22 -0
  153. package/dist/cjs/types/chart/brush.js +1 -0
  154. package/dist/cjs/types/chart/funnel.d.ts +46 -0
  155. package/dist/cjs/types/chart/funnel.js +1 -0
  156. package/dist/cjs/types/chart/heatmap.d.ts +12 -3
  157. package/dist/cjs/types/chart/legend.d.ts +6 -0
  158. package/dist/cjs/types/chart/line.d.ts +18 -3
  159. package/dist/cjs/types/chart/pie.d.ts +12 -3
  160. package/dist/cjs/types/chart/radar.d.ts +2 -2
  161. package/dist/cjs/types/chart/sankey.d.ts +2 -2
  162. package/dist/cjs/types/chart/scatter.d.ts +18 -4
  163. package/dist/cjs/types/chart/series.d.ts +17 -2
  164. package/dist/cjs/types/chart/tooltip.d.ts +10 -2
  165. package/dist/cjs/types/chart/treemap.d.ts +2 -2
  166. package/dist/cjs/types/chart/waterfall.d.ts +12 -3
  167. package/dist/cjs/types/chart/zoom.d.ts +4 -6
  168. package/dist/cjs/types/index.d.ts +2 -0
  169. package/dist/cjs/types/index.js +2 -0
  170. package/dist/cjs/types/misc.d.ts +6 -0
  171. package/dist/cjs/utils/chart/axis.d.ts +5 -2
  172. package/dist/cjs/utils/chart/axis.js +47 -1
  173. package/dist/cjs/utils/chart/color.js +2 -1
  174. package/dist/cjs/utils/chart/get-closest-data.js +30 -8
  175. package/dist/cjs/utils/chart/index.js +3 -3
  176. package/dist/cjs/utils/chart/series/sorting.js +20 -7
  177. package/dist/cjs/utils/chart/zoom.d.ts +3 -3
  178. package/dist/cjs/utils/chart/zoom.js +6 -4
  179. package/dist/cjs/validation/index.js +6 -6
  180. package/dist/esm/components/AxisX/AxisX.d.ts +3 -3
  181. package/dist/esm/components/ChartInner/index.js +94 -27
  182. package/dist/esm/components/ChartInner/useChartInnerHandlers.d.ts +3 -3
  183. package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +41 -20
  184. package/dist/esm/components/ChartInner/useChartInnerProps.js +21 -9
  185. package/dist/esm/components/ChartInner/useChartInnerState.d.ts +6 -1
  186. package/dist/esm/components/ChartInner/useChartInnerState.js +17 -1
  187. package/dist/esm/components/ChartInner/utils.d.ts +5 -2
  188. package/dist/esm/components/ChartInner/utils.js +13 -0
  189. package/dist/esm/components/RangeSlider/index.d.ts +6 -0
  190. package/dist/esm/components/RangeSlider/index.js +41 -0
  191. package/dist/esm/components/RangeSlider/styles.css +6 -0
  192. package/dist/esm/components/RangeSlider/utils.d.ts +5 -0
  193. package/dist/esm/components/RangeSlider/utils.js +18 -0
  194. package/dist/esm/components/Tooltip/DefaultTooltipContent/index.js +2 -1
  195. package/dist/esm/components/Tooltip/DefaultTooltipContent/utils.d.ts +2 -2
  196. package/dist/esm/components/Tooltip/DefaultTooltipContent/utils.js +3 -2
  197. package/dist/esm/components/Tooltip/index.d.ts +3 -3
  198. package/dist/esm/constants/chart-types.d.ts +3 -1
  199. package/dist/esm/constants/chart-types.js +2 -1
  200. package/dist/esm/constants/defaults/brush.d.ts +2 -0
  201. package/dist/esm/constants/defaults/brush.js +15 -0
  202. package/dist/esm/constants/defaults/index.d.ts +1 -0
  203. package/dist/esm/constants/defaults/index.js +1 -0
  204. package/dist/esm/constants/defaults/series-options.d.ts +2 -1
  205. package/dist/esm/constants/defaults/series-options.js +11 -0
  206. package/dist/esm/constants/index.d.ts +1 -0
  207. package/dist/esm/constants/index.js +1 -0
  208. package/dist/esm/constants/zoom.d.ts +6 -0
  209. package/dist/esm/constants/zoom.js +5 -0
  210. package/dist/esm/hooks/index.d.ts +5 -0
  211. package/dist/esm/hooks/index.js +5 -0
  212. package/dist/esm/hooks/useAxis/index.d.ts +4 -3
  213. package/dist/esm/hooks/useAxis/index.js +2 -2
  214. package/dist/esm/hooks/useAxis/range-slider.d.ts +5 -0
  215. package/dist/esm/hooks/useAxis/range-slider.js +16 -0
  216. package/dist/esm/hooks/useAxis/types.d.ts +66 -0
  217. package/dist/esm/hooks/useAxis/types.js +1 -0
  218. package/dist/esm/hooks/{useChartOptions → useAxis}/utils.d.ts +1 -2
  219. package/dist/esm/hooks/useAxis/utils.js +9 -0
  220. package/dist/{cjs/hooks/useChartOptions → esm/hooks/useAxis}/x-axis.d.ts +2 -2
  221. package/dist/{cjs/hooks/useChartOptions → esm/hooks/useAxis}/x-axis.js +5 -3
  222. package/dist/esm/hooks/{useChartOptions → useAxis}/y-axis.d.ts +2 -2
  223. package/dist/esm/hooks/{useChartOptions → useAxis}/y-axis.js +3 -3
  224. package/dist/esm/hooks/useAxisScales/index.d.ts +3 -3
  225. package/dist/esm/hooks/useAxisScales/index.js +41 -15
  226. package/dist/esm/hooks/useBrush/index.js +87 -24
  227. package/dist/esm/hooks/useBrush/styles.css +1 -0
  228. package/dist/esm/hooks/useBrush/types.d.ts +8 -7
  229. package/dist/esm/hooks/useBrush/utils.d.ts +19 -0
  230. package/dist/esm/hooks/useBrush/utils.js +172 -0
  231. package/dist/esm/hooks/useChartDimensions/index.d.ts +4 -4
  232. package/dist/esm/hooks/useChartDimensions/index.js +14 -4
  233. package/dist/esm/hooks/useChartDimensions/utils.d.ts +4 -4
  234. package/dist/esm/hooks/useChartOptions/chart.js +1 -82
  235. package/dist/esm/hooks/useChartOptions/index.d.ts +9 -3
  236. package/dist/esm/hooks/useChartOptions/tooltip.js +1 -1
  237. package/dist/esm/hooks/useChartOptions/types.d.ts +4 -64
  238. package/dist/esm/hooks/useChartOptions/zoom.d.ts +11 -0
  239. package/dist/esm/hooks/useChartOptions/zoom.js +91 -0
  240. package/dist/esm/hooks/useCrosshair/index.d.ts +3 -3
  241. package/dist/esm/hooks/useNormalizedOriginalData/index.d.ts +1 -0
  242. package/dist/esm/hooks/useNormalizedOriginalData/index.js +1 -2
  243. package/dist/esm/hooks/useRangeSlider/index.d.ts +4 -0
  244. package/dist/esm/hooks/useRangeSlider/index.js +129 -0
  245. package/dist/esm/hooks/useRangeSlider/types.d.ts +42 -0
  246. package/dist/esm/hooks/useRangeSlider/types.js +1 -0
  247. package/dist/esm/hooks/useRangeSlider/utils.d.ts +16 -0
  248. package/dist/esm/hooks/useRangeSlider/utils.js +19 -0
  249. package/dist/esm/hooks/useSeries/prepare-area.js +17 -2
  250. package/dist/esm/hooks/useSeries/prepare-bar-x.js +21 -9
  251. package/dist/esm/hooks/useSeries/prepare-bar-y.d.ts +3 -2
  252. package/dist/esm/hooks/useSeries/prepare-bar-y.js +20 -7
  253. package/dist/esm/hooks/useSeries/prepare-funnel.d.ts +10 -0
  254. package/dist/esm/hooks/useSeries/prepare-funnel.js +50 -0
  255. package/dist/esm/hooks/useSeries/prepare-heatmap.js +13 -1
  256. package/dist/esm/hooks/useSeries/prepare-legend.js +5 -2
  257. package/dist/esm/hooks/useSeries/prepare-line.js +17 -2
  258. package/dist/esm/hooks/useSeries/prepare-pie.js +17 -3
  259. package/dist/esm/hooks/useSeries/prepare-scatter.js +18 -1
  260. package/dist/esm/hooks/useSeries/prepare-waterfall.js +18 -2
  261. package/dist/esm/hooks/useSeries/prepareSeries.js +9 -0
  262. package/dist/esm/hooks/useSeries/types.d.ts +22 -6
  263. package/dist/esm/hooks/useShapes/area/index.d.ts +3 -3
  264. package/dist/esm/hooks/useShapes/area/index.js +4 -2
  265. package/dist/esm/hooks/useShapes/area/prepare-data.d.ts +3 -3
  266. package/dist/esm/hooks/useShapes/area/prepare-data.js +37 -22
  267. package/dist/esm/hooks/useShapes/area/types.d.ts +5 -2
  268. package/dist/esm/hooks/useShapes/bar-x/index.d.ts +3 -3
  269. package/dist/esm/hooks/useShapes/bar-x/index.js +2 -2
  270. package/dist/esm/hooks/useShapes/bar-x/prepare-data.d.ts +3 -3
  271. package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +26 -15
  272. package/dist/esm/hooks/useShapes/bar-y/index.d.ts +4 -4
  273. package/dist/esm/hooks/useShapes/bar-y/index.js +21 -24
  274. package/dist/esm/hooks/useShapes/bar-y/prepare-data.d.ts +3 -3
  275. package/dist/esm/hooks/useShapes/bar-y/prepare-data.js +26 -8
  276. package/dist/esm/hooks/useShapes/bar-y/types.d.ts +2 -2
  277. package/dist/esm/hooks/useShapes/bar-y/utils.d.ts +3 -0
  278. package/dist/esm/hooks/useShapes/bar-y/utils.js +44 -0
  279. package/dist/esm/hooks/useShapes/funnel/index.d.ts +13 -0
  280. package/dist/esm/hooks/useShapes/funnel/index.js +95 -0
  281. package/dist/esm/hooks/useShapes/funnel/prepare-data.d.ts +9 -0
  282. package/dist/esm/hooks/useShapes/funnel/prepare-data.js +120 -0
  283. package/dist/esm/hooks/useShapes/funnel/types.d.ts +32 -0
  284. package/dist/esm/hooks/useShapes/funnel/types.js +1 -0
  285. package/dist/esm/hooks/useShapes/heatmap/index.d.ts +2 -2
  286. package/dist/esm/hooks/useShapes/heatmap/index.js +2 -2
  287. package/dist/esm/hooks/useShapes/heatmap/prepare-data.d.ts +3 -3
  288. package/dist/esm/hooks/useShapes/heatmap/prepare-data.js +7 -3
  289. package/dist/esm/hooks/useShapes/index.d.ts +15 -10
  290. package/dist/esm/hooks/useShapes/index.js +47 -25
  291. package/dist/esm/hooks/useShapes/line/index.d.ts +3 -3
  292. package/dist/esm/hooks/useShapes/line/index.js +3 -2
  293. package/dist/esm/hooks/useShapes/line/prepare-data.d.ts +3 -3
  294. package/dist/esm/hooks/useShapes/line/prepare-data.js +58 -44
  295. package/dist/esm/hooks/useShapes/line/types.d.ts +7 -3
  296. package/dist/esm/hooks/useShapes/pie/index.d.ts +2 -2
  297. package/dist/esm/hooks/useShapes/pie/index.js +2 -2
  298. package/dist/esm/hooks/useShapes/pie/prepare-data.js +8 -4
  299. package/dist/esm/hooks/useShapes/radar/index.d.ts +2 -2
  300. package/dist/esm/hooks/useShapes/radar/index.js +2 -2
  301. package/dist/esm/hooks/useShapes/sankey/index.d.ts +2 -2
  302. package/dist/esm/hooks/useShapes/sankey/index.js +2 -2
  303. package/dist/esm/hooks/useShapes/scatter/index.d.ts +3 -2
  304. package/dist/esm/hooks/useShapes/scatter/index.js +4 -4
  305. package/dist/esm/hooks/useShapes/scatter/prepare-data.d.ts +3 -3
  306. package/dist/esm/hooks/useShapes/scatter/prepare-data.js +1 -1
  307. package/dist/esm/hooks/useShapes/styles.css +8 -0
  308. package/dist/esm/hooks/useShapes/treemap/index.d.ts +2 -2
  309. package/dist/esm/hooks/useShapes/treemap/index.js +2 -2
  310. package/dist/esm/hooks/useShapes/utils.d.ts +17 -9
  311. package/dist/esm/hooks/useShapes/utils.js +66 -18
  312. package/dist/esm/hooks/useShapes/waterfall/index.d.ts +3 -3
  313. package/dist/esm/hooks/useShapes/waterfall/index.js +2 -2
  314. package/dist/esm/hooks/useShapes/waterfall/prepare-data.d.ts +3 -3
  315. package/dist/esm/hooks/useShapes/waterfall/prepare-data.js +18 -8
  316. package/dist/esm/hooks/useTooltip/index.js +8 -4
  317. package/dist/esm/hooks/useZoom/index.d.ts +4 -3
  318. package/dist/esm/hooks/useZoom/index.js +2 -0
  319. package/dist/esm/hooks/useZoom/utils.d.ts +5 -4
  320. package/dist/esm/hooks/useZoom/utils.js +4 -3
  321. package/dist/esm/hooks/utils/bar-x.d.ts +2 -2
  322. package/dist/esm/hooks/utils/bar-y.d.ts +10 -3
  323. package/dist/esm/hooks/utils/bar-y.js +4 -0
  324. package/dist/esm/i18n/keysets/en.json +2 -2
  325. package/dist/esm/i18n/keysets/ru.json +2 -2
  326. package/dist/esm/types/chart/area.d.ts +18 -3
  327. package/dist/esm/types/chart/axis.d.ts +45 -0
  328. package/dist/esm/types/chart/bar-x.d.ts +17 -4
  329. package/dist/esm/types/chart/bar-y.d.ts +12 -3
  330. package/dist/esm/types/chart/base.d.ts +26 -25
  331. package/dist/esm/types/chart/brush.d.ts +22 -0
  332. package/dist/esm/types/chart/brush.js +1 -0
  333. package/dist/esm/types/chart/funnel.d.ts +46 -0
  334. package/dist/esm/types/chart/funnel.js +1 -0
  335. package/dist/esm/types/chart/heatmap.d.ts +12 -3
  336. package/dist/esm/types/chart/legend.d.ts +6 -0
  337. package/dist/esm/types/chart/line.d.ts +18 -3
  338. package/dist/esm/types/chart/pie.d.ts +12 -3
  339. package/dist/esm/types/chart/radar.d.ts +2 -2
  340. package/dist/esm/types/chart/sankey.d.ts +2 -2
  341. package/dist/esm/types/chart/scatter.d.ts +18 -4
  342. package/dist/esm/types/chart/series.d.ts +17 -2
  343. package/dist/esm/types/chart/tooltip.d.ts +10 -2
  344. package/dist/esm/types/chart/treemap.d.ts +2 -2
  345. package/dist/esm/types/chart/waterfall.d.ts +12 -3
  346. package/dist/esm/types/chart/zoom.d.ts +4 -6
  347. package/dist/esm/types/index.d.ts +2 -0
  348. package/dist/esm/types/index.js +2 -0
  349. package/dist/esm/types/misc.d.ts +6 -0
  350. package/dist/esm/utils/chart/axis.d.ts +5 -2
  351. package/dist/esm/utils/chart/axis.js +47 -1
  352. package/dist/esm/utils/chart/color.js +2 -1
  353. package/dist/esm/utils/chart/get-closest-data.js +30 -8
  354. package/dist/esm/utils/chart/index.js +3 -3
  355. package/dist/esm/utils/chart/series/sorting.js +20 -7
  356. package/dist/esm/utils/chart/zoom.d.ts +3 -3
  357. package/dist/esm/utils/chart/zoom.js +6 -4
  358. package/dist/esm/validation/index.js +6 -6
  359. package/package.json +1 -1
  360. package/dist/cjs/hooks/useChartOptions/utils.js +0 -49
  361. package/dist/esm/hooks/useChartOptions/utils.js +0 -49
@@ -0,0 +1,9 @@
1
+ import type { PreparedFunnelSeries } from '../../useSeries/types';
2
+ import type { PreparedFunnelData } from './types';
3
+ type Args = {
4
+ series: PreparedFunnelSeries[];
5
+ boundsWidth: number;
6
+ boundsHeight: number;
7
+ };
8
+ export declare function prepareFunnelData(args: Args): Promise<PreparedFunnelData>;
9
+ export {};
@@ -0,0 +1,120 @@
1
+ import { path } from 'd3';
2
+ import { calculateNumericProperty, getFormattedValue, getTextSizeFn } from '../../../utils';
3
+ function getLineConnectorPaths(args) {
4
+ const { points } = args;
5
+ const leftPath = path();
6
+ leftPath.moveTo(...points[0]);
7
+ leftPath.lineTo(...points[3]);
8
+ const rightPath = path();
9
+ rightPath.moveTo(...points[1]);
10
+ rightPath.lineTo(...points[2]);
11
+ return [leftPath, rightPath];
12
+ }
13
+ function getAreaConnectorPath(args) {
14
+ const { points } = args;
15
+ const p = path();
16
+ p.moveTo(...points[points.length - 1]);
17
+ points.forEach((point) => p.lineTo(...point));
18
+ p.closePath();
19
+ return p;
20
+ }
21
+ export async function prepareFunnelData(args) {
22
+ var _a, _b, _c, _d;
23
+ const { series, boundsWidth, boundsHeight } = args;
24
+ const items = [];
25
+ const svgLabels = [];
26
+ const connectors = [];
27
+ const maxValue = Math.max(...series.map((s) => s.data.value));
28
+ const itemBandSpace = boundsHeight / series.length;
29
+ const connectorHeight = (_b = calculateNumericProperty({
30
+ value: (_a = series[0].connectors) === null || _a === void 0 ? void 0 : _a.height,
31
+ base: itemBandSpace,
32
+ })) !== null && _b !== void 0 ? _b : 0;
33
+ const itemHeight = (boundsHeight - connectorHeight * (series.length - 1)) / series.length;
34
+ const getTextSize = getTextSizeFn({ style: series[0].dataLabels.style });
35
+ const getSegmentY = (index) => {
36
+ return index * (itemHeight + connectorHeight);
37
+ };
38
+ let segmentLeftOffset = 0;
39
+ let segmentRightOffset = 0;
40
+ for (let index = 0; index < series.length; index++) {
41
+ const s = series[index];
42
+ if (s.dataLabels.enabled) {
43
+ const d = s.data;
44
+ const labelContent = (_c = d.label) !== null && _c !== void 0 ? _c : getFormattedValue({ value: d.value, format: s.dataLabels.format });
45
+ const labelSize = await getTextSize(labelContent);
46
+ let x;
47
+ switch (s.dataLabels.align) {
48
+ case 'left': {
49
+ x = 0;
50
+ segmentLeftOffset = Math.max(segmentLeftOffset, labelSize.width);
51
+ break;
52
+ }
53
+ case 'right': {
54
+ x = boundsWidth - labelSize.width;
55
+ segmentRightOffset = Math.max(segmentRightOffset, labelSize.width);
56
+ break;
57
+ }
58
+ case 'center': {
59
+ x = boundsWidth / 2 - labelSize.width / 2;
60
+ break;
61
+ }
62
+ }
63
+ svgLabels.push({
64
+ x,
65
+ y: getSegmentY(index) + itemHeight / 2 - labelSize.height / 2,
66
+ text: labelContent,
67
+ style: s.dataLabels.style,
68
+ size: labelSize,
69
+ textAnchor: 'start',
70
+ series: s,
71
+ });
72
+ }
73
+ }
74
+ const segmentMaxWidth = boundsWidth - segmentLeftOffset - segmentRightOffset;
75
+ for (let index = 0; index < series.length; index++) {
76
+ const s = series[index];
77
+ const d = s.data;
78
+ const itemWidth = (segmentMaxWidth * d.value) / maxValue;
79
+ const funnelSegment = {
80
+ x: segmentLeftOffset + segmentMaxWidth / 2 - itemWidth / 2,
81
+ y: getSegmentY(index),
82
+ width: itemWidth,
83
+ height: itemHeight,
84
+ color: s.color,
85
+ series: s,
86
+ data: d,
87
+ borderColor: '',
88
+ borderWidth: 0,
89
+ cursor: s.cursor,
90
+ };
91
+ items.push(funnelSegment);
92
+ const prevSeries = series[index - 1];
93
+ const prevItem = items[index - 1];
94
+ if (prevSeries && prevItem && ((_d = prevSeries.connectors) === null || _d === void 0 ? void 0 : _d.enabled)) {
95
+ const connectorPoints = [
96
+ [prevItem.x, prevItem.y + prevItem.height],
97
+ [prevItem.x + prevItem.width, prevItem.y + prevItem.height],
98
+ [funnelSegment.x + funnelSegment.width, funnelSegment.y],
99
+ [funnelSegment.x, funnelSegment.y],
100
+ ];
101
+ connectors.push({
102
+ linePath: getLineConnectorPaths({ points: connectorPoints }),
103
+ areaPath: getAreaConnectorPath({ points: connectorPoints }),
104
+ lineWidth: prevSeries.connectors.lineWidth,
105
+ lineColor: prevSeries.connectors.lineColor,
106
+ lineOpacity: prevSeries.connectors.lineOpacity,
107
+ areaColor: prevSeries.connectors.areaColor,
108
+ areaOpacity: prevSeries.connectors.areaOpacity,
109
+ dashStyle: prevSeries.connectors.lineDashStyle,
110
+ });
111
+ }
112
+ }
113
+ const data = {
114
+ type: 'funnel',
115
+ items,
116
+ svgLabels,
117
+ connectors,
118
+ };
119
+ return data;
120
+ }
@@ -0,0 +1,32 @@
1
+ import type { Path } from 'd3';
2
+ import type { DashStyle } from 'src/constants';
3
+ import type { FunnelSeriesData, LabelData } from '../../../types';
4
+ import type { PreparedFunnelSeries } from '../../useSeries/types';
5
+ export type FunnelItemData = {
6
+ x: number;
7
+ y: number;
8
+ width: number;
9
+ height: number;
10
+ color: string;
11
+ series: PreparedFunnelSeries;
12
+ data: FunnelSeriesData;
13
+ borderColor: string;
14
+ borderWidth: number;
15
+ cursor: string | null;
16
+ };
17
+ export type FunnelConnectorData = {
18
+ linePath: Path[];
19
+ areaPath: Path;
20
+ lineWidth: number;
21
+ lineColor: string;
22
+ lineOpacity: number;
23
+ areaColor: string;
24
+ areaOpacity: number;
25
+ dashStyle: DashStyle;
26
+ };
27
+ export type PreparedFunnelData = {
28
+ type: 'funnel';
29
+ items: FunnelItemData[];
30
+ connectors: FunnelConnectorData[];
31
+ svgLabels: LabelData[];
32
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -5,9 +5,9 @@ import type { PreparedHeatmapData } from './types';
5
5
  export { prepareHeatmapData } from './prepare-data';
6
6
  export * from './types';
7
7
  type Args = {
8
- dispatcher: Dispatch<object>;
8
+ htmlLayout: HTMLElement | null;
9
9
  preparedData: PreparedHeatmapData;
10
10
  seriesOptions: PreparedSeriesOptions;
11
- htmlLayout: HTMLElement | null;
11
+ dispatcher?: Dispatch<object>;
12
12
  };
13
13
  export declare const HeatmapSeriesShapes: (args: Args) => React.JSX.Element;
@@ -63,9 +63,9 @@ export const HeatmapSeriesShapes = (args) => {
63
63
  if (hoveredDataRef.current !== null) {
64
64
  handleShapeHover(hoveredDataRef.current);
65
65
  }
66
- dispatcher.on('hover-shape.heatmap', handleShapeHover);
66
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.heatmap', handleShapeHover);
67
67
  return () => {
68
- dispatcher.on('hover-shape.heatmap', null);
68
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.heatmap', null);
69
69
  };
70
70
  }, [dispatcher, preparedData, seriesOptions]);
71
71
  return (React.createElement(React.Fragment, null,
@@ -1,11 +1,11 @@
1
+ import type { PreparedXAxis, PreparedYAxis } from '../../../hooks/useAxis/types';
1
2
  import type { ChartScale } from '../../../hooks/useAxisScales';
2
- import type { PreparedAxis } from '../../../hooks/useChartOptions/types';
3
3
  import type { PreparedHeatmapSeries } from '../../useSeries/types';
4
4
  import type { PreparedHeatmapData } from './types';
5
5
  type PrepareHeatmapDataArgs = {
6
6
  series: PreparedHeatmapSeries;
7
- xAxis: PreparedAxis;
8
- yAxis: PreparedAxis;
7
+ xAxis: PreparedXAxis;
8
+ yAxis: PreparedYAxis;
9
9
  xScale: ChartScale;
10
10
  yScale: ChartScale;
11
11
  };
@@ -8,8 +8,11 @@ export async function prepareHeatmapData({ series, xAxis, xScale, yAxis, yScale,
8
8
  const xDomainData = getDomainDataXBySeries([series]);
9
9
  const bandWidth = getBandSize({ domain: xDomainData, scale: xScale });
10
10
  const xAxisCategories = (_b = xAxis.categories) !== null && _b !== void 0 ? _b : [];
11
- const heatmapItems = series.data.map((d) => {
11
+ const heatmapItems = series.data.reduce((items, d) => {
12
12
  var _a, _b, _c;
13
+ if (d.value === null) {
14
+ return items;
15
+ }
13
16
  let x = 0;
14
17
  if (isBandScale(xScale)) {
15
18
  x = (_a = xScale(xAxisCategories[d.x])) !== null && _a !== void 0 ? _a : 0;
@@ -36,8 +39,9 @@ export async function prepareHeatmapData({ series, xAxis, xScale, yAxis, yScale,
36
39
  borderWidth: series.borderWidth,
37
40
  data: d,
38
41
  };
39
- return item;
40
- });
42
+ items.push(item);
43
+ return items;
44
+ }, []);
41
45
  const svgDataLabels = [];
42
46
  const htmlDataLabels = [];
43
47
  if (series.dataLabels.enabled) {
@@ -1,11 +1,14 @@
1
1
  import React from 'react';
2
2
  import type { Dispatch } from 'd3';
3
- import type { PreparedSeries, PreparedSeriesOptions, PreparedSplit } from '../';
3
+ import type { SeriesType } from '../../constants';
4
+ import type { PreparedXAxis, PreparedYAxis } from '../useAxis/types';
4
5
  import type { ChartScale } from '../useAxisScales';
5
- import type { PreparedAxis } from '../useChartOptions/types';
6
+ import type { PreparedSeries, PreparedSeriesOptions } from '../useSeries/types';
7
+ import type { PreparedSplit } from '../useSplit/types';
6
8
  import type { PreparedAreaData } from './area/types';
7
9
  import type { PreparedBarXData } from './bar-x';
8
10
  import type { PreparedBarYData } from './bar-y/types';
11
+ import type { PreparedFunnelData } from './funnel';
9
12
  import type { PreparedHeatmapData } from './heatmap';
10
13
  import type { PreparedLineData } from './line/types';
11
14
  import type { PreparedPieData } from './pie/types';
@@ -16,21 +19,23 @@ export type { PreparedBarXData } from './bar-x';
16
19
  export type { PreparedScatterData } from './scatter/types';
17
20
  import type { PreparedWaterfallData } from './waterfall';
18
21
  import './styles.css';
19
- export type ShapeData = PreparedBarXData | PreparedBarYData | PreparedScatterData | PreparedLineData | PreparedPieData | PreparedAreaData | PreparedWaterfallData | PreparedSankeyData | PreparedRadarData | PreparedHeatmapData;
22
+ export type ShapeData = PreparedBarXData | PreparedBarYData | PreparedScatterData | PreparedLineData | PreparedPieData | PreparedAreaData | PreparedWaterfallData | PreparedSankeyData | PreparedRadarData | PreparedHeatmapData | PreparedFunnelData;
23
+ export type ClipPathBySeriesType = Partial<Record<SeriesType, boolean>>;
20
24
  type Args = {
21
25
  boundsWidth: number;
22
26
  boundsHeight: number;
23
- dispatcher: Dispatch<object>;
27
+ clipPathId: string;
28
+ htmlLayout: HTMLElement | null;
24
29
  series: PreparedSeries[];
25
30
  seriesOptions: PreparedSeriesOptions;
26
- xAxis: PreparedAxis | null;
27
- yAxis: PreparedAxis[];
31
+ split: PreparedSplit;
32
+ xAxis: PreparedXAxis | null;
33
+ yAxis: PreparedYAxis[];
34
+ clipPathBySeriesType?: ClipPathBySeriesType;
35
+ dispatcher?: Dispatch<object>;
36
+ isOutsideBounds?: (x: number, y: number) => boolean;
28
37
  xScale?: ChartScale;
29
38
  yScale?: (ChartScale | undefined)[];
30
- split: PreparedSplit;
31
- htmlLayout: HTMLElement | null;
32
- clipPathId: string;
33
- isOutsideBounds: (x: number, y: number) => boolean;
34
39
  };
35
40
  export declare const useShapes: (args: Args) => {
36
41
  shapes: React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
2
  import { group } from 'd3';
3
+ import { SERIES_TYPE } from '../../constants';
3
4
  import { ChartError } from '../../libs';
4
5
  import { getOnlyVisibleSeries } from '../../utils';
5
6
  import { AreaSeriesShapes } from './area';
6
7
  import { prepareAreaData } from './area/prepare-data';
7
8
  import { BarXSeriesShapes, prepareBarXData } from './bar-x';
8
9
  import { BarYSeriesShapes, prepareBarYData } from './bar-y';
10
+ import { FunnelSeriesShapes, prepareFunnelData } from './funnel';
9
11
  import { HeatmapSeriesShapes, prepareHeatmapData } from './heatmap';
10
12
  import { LineSeriesShapes } from './line';
11
13
  import { prepareLineData } from './line/prepare-data';
@@ -20,8 +22,15 @@ import { TreemapSeriesShape } from './treemap';
20
22
  import { prepareTreemapData } from './treemap/prepare-data';
21
23
  import { WaterfallSeriesShapes, prepareWaterfallData } from './waterfall';
22
24
  import './styles.css';
25
+ function IS_OUTSIDE_BOUNDS() {
26
+ return false;
27
+ }
28
+ function shouldUseClipPathId(seriesType, clipPathBySeriesType) {
29
+ var _a;
30
+ return (_a = clipPathBySeriesType === null || clipPathBySeriesType === void 0 ? void 0 : clipPathBySeriesType[seriesType]) !== null && _a !== void 0 ? _a : true;
31
+ }
23
32
  export const useShapes = (args) => {
24
- const { boundsWidth, boundsHeight, dispatcher, series, seriesOptions, xAxis, xScale, yAxis, yScale, split, htmlLayout, clipPathId, isOutsideBounds, } = args;
33
+ const { boundsWidth, boundsHeight, clipPathId, clipPathBySeriesType, dispatcher, htmlLayout, isOutsideBounds = IS_OUTSIDE_BOUNDS, series, seriesOptions, split, xAxis, xScale, yAxis, yScale, } = args;
25
34
  const [shapesElemens, setShapesElements] = React.useState([]);
26
35
  const [shapesElemensData, setShapesElemensData] = React.useState([]);
27
36
  const countedRef = React.useRef(0);
@@ -38,7 +47,7 @@ export const useShapes = (args) => {
38
47
  Array.from(groupedSeries).map(async (item) => {
39
48
  const [seriesType, chartSeries] = item;
40
49
  switch (seriesType) {
41
- case 'bar-x': {
50
+ case SERIES_TYPE.BarX: {
42
51
  if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
43
52
  const preparedData = await prepareBarXData({
44
53
  series: chartSeries,
@@ -49,12 +58,12 @@ export const useShapes = (args) => {
49
58
  yScale,
50
59
  boundsHeight,
51
60
  });
52
- shapes.push(React.createElement(BarXSeriesShapes, { key: "bar-x", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: clipPathId }));
61
+ shapes.push(React.createElement(BarXSeriesShapes, { key: SERIES_TYPE.BarX, dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: clipPathId }));
53
62
  shapesData.push(...preparedData);
54
63
  }
55
64
  break;
56
65
  }
57
- case 'bar-y': {
66
+ case SERIES_TYPE.BarY: {
58
67
  if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
59
68
  const preparedData = await prepareBarYData({
60
69
  boundsHeight,
@@ -66,12 +75,12 @@ export const useShapes = (args) => {
66
75
  yAxis,
67
76
  yScale,
68
77
  });
69
- shapes.push(React.createElement(BarYSeriesShapes, { key: "bar-y", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: clipPathId }));
78
+ shapes.push(React.createElement(BarYSeriesShapes, { key: SERIES_TYPE.BarY, dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: clipPathId }));
70
79
  shapesData.push(...preparedData.shapes);
71
80
  }
72
81
  break;
73
82
  }
74
- case 'waterfall': {
83
+ case SERIES_TYPE.Waterfall: {
75
84
  if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
76
85
  const preparedData = await prepareWaterfallData({
77
86
  series: chartSeries,
@@ -81,12 +90,12 @@ export const useShapes = (args) => {
81
90
  yAxis,
82
91
  yScale,
83
92
  });
84
- shapes.push(React.createElement(WaterfallSeriesShapes, { key: "waterfall", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: clipPathId }));
93
+ shapes.push(React.createElement(WaterfallSeriesShapes, { key: SERIES_TYPE.Waterfall, dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: clipPathId }));
85
94
  shapesData.push(...preparedData);
86
95
  }
87
96
  break;
88
97
  }
89
- case 'line': {
98
+ case SERIES_TYPE.Line: {
90
99
  if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
91
100
  const preparedData = await prepareLineData({
92
101
  series: chartSeries,
@@ -97,12 +106,12 @@ export const useShapes = (args) => {
97
106
  split,
98
107
  isOutsideBounds,
99
108
  });
100
- shapes.push(React.createElement(LineSeriesShapes, { key: "line", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: clipPathId }));
109
+ shapes.push(React.createElement(LineSeriesShapes, { key: SERIES_TYPE.Line, dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: clipPathId }));
101
110
  shapesData.push(...preparedData);
102
111
  }
103
112
  break;
104
113
  }
105
- case 'area': {
114
+ case SERIES_TYPE.Area: {
106
115
  if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
107
116
  const preparedData = await prepareAreaData({
108
117
  series: chartSeries,
@@ -113,12 +122,12 @@ export const useShapes = (args) => {
113
122
  boundsHeight,
114
123
  isOutsideBounds,
115
124
  });
116
- shapes.push(React.createElement(AreaSeriesShapes, { key: "area", dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: clipPathId }));
125
+ shapes.push(React.createElement(AreaSeriesShapes, { key: SERIES_TYPE.Area, dispatcher: dispatcher, seriesOptions: seriesOptions, preparedData: preparedData, htmlLayout: htmlLayout, clipPathId: clipPathId }));
117
126
  shapesData.push(...preparedData);
118
127
  }
119
128
  break;
120
129
  }
121
- case 'scatter': {
130
+ case SERIES_TYPE.Scatter: {
122
131
  if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
123
132
  const preparedData = prepareScatterData({
124
133
  series: chartSeries,
@@ -128,22 +137,24 @@ export const useShapes = (args) => {
128
137
  yScale,
129
138
  isOutsideBounds,
130
139
  });
131
- shapes.push(React.createElement(ScatterSeriesShape, { key: "scatter", dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
140
+ shapes.push(React.createElement(ScatterSeriesShape, { key: SERIES_TYPE.Scatter, clipPathId: shouldUseClipPathId(SERIES_TYPE.Scatter, clipPathBySeriesType)
141
+ ? clipPathId
142
+ : undefined, dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
132
143
  shapesData.push(...preparedData);
133
144
  }
134
145
  break;
135
146
  }
136
- case 'pie': {
147
+ case SERIES_TYPE.Pie: {
137
148
  const preparedData = await preparePieData({
138
149
  series: chartSeries,
139
150
  boundsWidth,
140
151
  boundsHeight,
141
152
  });
142
- shapes.push(React.createElement(PieSeriesShapes, { key: "pie", dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
153
+ shapes.push(React.createElement(PieSeriesShapes, { key: SERIES_TYPE.Pie, dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
143
154
  shapesData.push(...preparedData);
144
155
  break;
145
156
  }
146
- case 'treemap': {
157
+ case SERIES_TYPE.Treemap: {
147
158
  const preparedData = await prepareTreemapData({
148
159
  // We should have exactly one series with "treemap" type
149
160
  // Otherwise data validation should emit an error
@@ -151,31 +162,31 @@ export const useShapes = (args) => {
151
162
  width: boundsWidth,
152
163
  height: boundsHeight,
153
164
  });
154
- shapes.push(React.createElement(TreemapSeriesShape, { key: "treemap", dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
165
+ shapes.push(React.createElement(TreemapSeriesShape, { key: SERIES_TYPE.Treemap, dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
155
166
  shapesData.push(preparedData);
156
167
  break;
157
168
  }
158
- case 'sankey': {
169
+ case SERIES_TYPE.Sankey: {
159
170
  const preparedData = prepareSankeyData({
160
171
  series: chartSeries[0],
161
172
  width: boundsWidth,
162
173
  height: boundsHeight,
163
174
  });
164
- shapes.push(React.createElement(SankeySeriesShape, { key: "sankey", dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
175
+ shapes.push(React.createElement(SankeySeriesShape, { key: SERIES_TYPE.Sankey, dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
165
176
  shapesData.push(preparedData);
166
177
  break;
167
178
  }
168
- case 'radar': {
179
+ case SERIES_TYPE.Radar: {
169
180
  const preparedData = await prepareRadarData({
170
181
  series: chartSeries,
171
182
  boundsWidth,
172
183
  boundsHeight,
173
184
  });
174
- shapes.push(React.createElement(RadarSeriesShapes, { key: "radar", dispatcher: dispatcher, series: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
185
+ shapes.push(React.createElement(RadarSeriesShapes, { key: SERIES_TYPE.Radar, dispatcher: dispatcher, series: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
175
186
  shapesData.push(...preparedData);
176
187
  break;
177
188
  }
178
- case 'heatmap': {
189
+ case SERIES_TYPE.Heatmap: {
179
190
  if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale[0])) {
180
191
  const preparedData = await prepareHeatmapData({
181
192
  series: chartSeries[0],
@@ -184,11 +195,21 @@ export const useShapes = (args) => {
184
195
  yAxis: yAxis[0],
185
196
  yScale: yScale[0],
186
197
  });
187
- shapes.push(React.createElement(HeatmapSeriesShapes, { key: "heatmap", dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
198
+ shapes.push(React.createElement(HeatmapSeriesShapes, { key: SERIES_TYPE.Heatmap, dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
188
199
  shapesData.push(preparedData);
189
200
  }
190
201
  break;
191
202
  }
203
+ case 'funnel': {
204
+ const preparedData = await prepareFunnelData({
205
+ series: chartSeries,
206
+ boundsWidth,
207
+ boundsHeight,
208
+ });
209
+ shapes.push(React.createElement(FunnelSeriesShapes, { key: "funnel", dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
210
+ shapesData.push(preparedData);
211
+ break;
212
+ }
192
213
  default: {
193
214
  throw new ChartError({
194
215
  message: `The display method is not defined for a series with type "${seriesType}"`,
@@ -204,8 +225,11 @@ export const useShapes = (args) => {
204
225
  }, [
205
226
  boundsHeight,
206
227
  boundsWidth,
228
+ clipPathId,
229
+ clipPathBySeriesType,
207
230
  dispatcher,
208
231
  htmlLayout,
232
+ isOutsideBounds,
209
233
  series,
210
234
  seriesOptions,
211
235
  split,
@@ -213,8 +237,6 @@ export const useShapes = (args) => {
213
237
  xScale,
214
238
  yAxis,
215
239
  yScale,
216
- clipPathId,
217
- isOutsideBounds,
218
240
  ]);
219
241
  return { shapes: shapesElemens, shapesData: shapesElemensData };
220
242
  };
@@ -3,11 +3,11 @@ import type { Dispatch } from 'd3';
3
3
  import type { PreparedSeriesOptions } from '../../useSeries/types';
4
4
  import type { PreparedLineData } from './types';
5
5
  type Args = {
6
- dispatcher: Dispatch<object>;
6
+ clipPathId: string;
7
+ htmlLayout: HTMLElement | null;
7
8
  preparedData: PreparedLineData[];
8
9
  seriesOptions: PreparedSeriesOptions;
9
- htmlLayout: HTMLElement | null;
10
- clipPathId: string;
10
+ dispatcher?: Dispatch<object>;
11
11
  };
12
12
  export declare const LineSeriesShapes: (args: Args) => React.JSX.Element;
13
13
  export {};
@@ -21,6 +21,7 @@ export const LineSeriesShapes = (args) => {
21
21
  const hoverOptions = get(seriesOptions, 'line.states.hover');
22
22
  const inactiveOptions = get(seriesOptions, 'line.states.inactive');
23
23
  const line = lineGenerator()
24
+ .defined((d) => d.y !== null && d.x !== null)
24
25
  .x((d) => d.x)
25
26
  .y((d) => d.y);
26
27
  plotSvgElement.selectAll('*').remove();
@@ -128,9 +129,9 @@ export const LineSeriesShapes = (args) => {
128
129
  if (hoveredDataRef.current !== null) {
129
130
  handleShapeHover(hoveredDataRef.current);
130
131
  }
131
- dispatcher.on('hover-shape.line', handleShapeHover);
132
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.line', handleShapeHover);
132
133
  return () => {
133
- dispatcher.on('hover-shape.line', null);
134
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.line', null);
134
135
  };
135
136
  }, [dispatcher, preparedData, seriesOptions]);
136
137
  return (React.createElement(React.Fragment, null,
@@ -1,13 +1,13 @@
1
+ import type { PreparedXAxis, PreparedYAxis } from '../../useAxis/types';
1
2
  import type { ChartScale } from '../../useAxisScales';
2
- import type { PreparedAxis } from '../../useChartOptions/types';
3
3
  import type { PreparedLineSeries } from '../../useSeries/types';
4
4
  import type { PreparedSplit } from '../../useSplit/types';
5
5
  import type { PreparedLineData } from './types';
6
6
  export declare const prepareLineData: (args: {
7
7
  series: PreparedLineSeries[];
8
- xAxis: PreparedAxis;
8
+ xAxis: PreparedXAxis;
9
9
  xScale: ChartScale;
10
- yAxis: PreparedAxis[];
10
+ yAxis: PreparedYAxis[];
11
11
  yScale: (ChartScale | undefined)[];
12
12
  split: PreparedSplit;
13
13
  isOutsideBounds: (x: number, y: number) => boolean;