@gravity-ui/charts 1.23.0 → 1.24.1

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 (315) hide show
  1. package/dist/cjs/components/AxisX/AxisX.d.ts +3 -3
  2. package/dist/cjs/components/ChartInner/index.js +95 -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 +22 -11
  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.js +3 -2
  17. package/dist/cjs/components/Tooltip/index.d.ts +3 -3
  18. package/dist/cjs/constants/chart-types.d.ts +3 -1
  19. package/dist/cjs/constants/chart-types.js +2 -1
  20. package/dist/cjs/constants/defaults/brush.d.ts +2 -0
  21. package/dist/cjs/constants/defaults/brush.js +15 -0
  22. package/dist/cjs/constants/defaults/index.d.ts +1 -0
  23. package/dist/cjs/constants/defaults/index.js +1 -0
  24. package/dist/cjs/constants/defaults/series-options.d.ts +2 -1
  25. package/dist/cjs/constants/defaults/series-options.js +11 -0
  26. package/dist/cjs/hooks/index.d.ts +5 -0
  27. package/dist/cjs/hooks/index.js +5 -0
  28. package/dist/cjs/hooks/useAxis/index.d.ts +4 -3
  29. package/dist/cjs/hooks/useAxis/index.js +2 -2
  30. package/dist/cjs/hooks/useAxis/range-slider.d.ts +5 -0
  31. package/dist/cjs/hooks/useAxis/range-slider.js +16 -0
  32. package/dist/cjs/hooks/useAxis/types.d.ts +66 -0
  33. package/dist/cjs/hooks/useAxis/types.js +1 -0
  34. package/dist/cjs/hooks/{useChartOptions → useAxis}/utils.d.ts +1 -2
  35. package/dist/cjs/hooks/useAxis/utils.js +9 -0
  36. package/dist/{esm/hooks/useChartOptions → cjs/hooks/useAxis}/x-axis.d.ts +2 -2
  37. package/dist/{esm/hooks/useChartOptions → cjs/hooks/useAxis}/x-axis.js +5 -3
  38. package/dist/cjs/hooks/{useChartOptions → useAxis}/y-axis.d.ts +2 -2
  39. package/dist/cjs/hooks/{useChartOptions → useAxis}/y-axis.js +3 -3
  40. package/dist/cjs/hooks/useAxisScales/index.d.ts +6 -6
  41. package/dist/cjs/hooks/useAxisScales/index.js +107 -34
  42. package/dist/cjs/hooks/useAxisScales/utils.d.ts +19 -0
  43. package/dist/cjs/hooks/useAxisScales/utils.js +34 -0
  44. package/dist/cjs/hooks/useBrush/index.js +89 -27
  45. package/dist/cjs/hooks/useBrush/styles.css +1 -0
  46. package/dist/cjs/hooks/useBrush/types.d.ts +6 -6
  47. package/dist/cjs/hooks/useBrush/utils.d.ts +19 -0
  48. package/dist/cjs/hooks/useBrush/utils.js +172 -0
  49. package/dist/cjs/hooks/useChartDimensions/index.d.ts +4 -4
  50. package/dist/cjs/hooks/useChartDimensions/index.js +14 -4
  51. package/dist/cjs/hooks/useChartDimensions/utils.d.ts +4 -4
  52. package/dist/cjs/hooks/useChartOptions/index.d.ts +9 -3
  53. package/dist/cjs/hooks/useChartOptions/tooltip.js +1 -1
  54. package/dist/cjs/hooks/useChartOptions/types.d.ts +4 -64
  55. package/dist/cjs/hooks/useChartOptions/zoom.js +24 -21
  56. package/dist/cjs/hooks/useCrosshair/index.d.ts +3 -3
  57. package/dist/cjs/hooks/useNormalizedOriginalData/index.d.ts +1 -0
  58. package/dist/cjs/hooks/useNormalizedOriginalData/index.js +1 -2
  59. package/dist/cjs/hooks/useRangeSlider/index.d.ts +4 -0
  60. package/dist/cjs/hooks/useRangeSlider/index.js +130 -0
  61. package/dist/cjs/hooks/useRangeSlider/types.d.ts +44 -0
  62. package/dist/cjs/hooks/useRangeSlider/types.js +1 -0
  63. package/dist/cjs/hooks/useRangeSlider/utils.d.ts +16 -0
  64. package/dist/cjs/hooks/useRangeSlider/utils.js +19 -0
  65. package/dist/cjs/hooks/useSeries/prepare-area.js +2 -1
  66. package/dist/cjs/hooks/useSeries/prepare-bar-x.js +8 -8
  67. package/dist/cjs/hooks/useSeries/prepare-bar-y.d.ts +1 -0
  68. package/dist/cjs/hooks/useSeries/prepare-bar-y.js +7 -6
  69. package/dist/cjs/hooks/useSeries/prepare-funnel.d.ts +10 -0
  70. package/dist/cjs/hooks/useSeries/prepare-funnel.js +50 -0
  71. package/dist/cjs/hooks/useSeries/prepare-legend.js +4 -1
  72. package/dist/cjs/hooks/useSeries/prepare-line.js +2 -1
  73. package/dist/cjs/hooks/useSeries/prepare-pie.js +3 -2
  74. package/dist/cjs/hooks/useSeries/prepare-scatter.js +2 -0
  75. package/dist/cjs/hooks/useSeries/prepareSeries.js +9 -0
  76. package/dist/cjs/hooks/useSeries/types.d.ts +22 -6
  77. package/dist/cjs/hooks/useShapes/area/index.d.ts +3 -3
  78. package/dist/cjs/hooks/useShapes/area/index.js +2 -2
  79. package/dist/cjs/hooks/useShapes/area/prepare-data.d.ts +5 -3
  80. package/dist/cjs/hooks/useShapes/area/prepare-data.js +158 -157
  81. package/dist/cjs/hooks/useShapes/bar-x/index.d.ts +3 -3
  82. package/dist/cjs/hooks/useShapes/bar-x/index.js +2 -2
  83. package/dist/cjs/hooks/useShapes/bar-x/prepare-data.d.ts +5 -3
  84. package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +102 -82
  85. package/dist/cjs/hooks/useShapes/bar-y/index.d.ts +3 -3
  86. package/dist/cjs/hooks/useShapes/bar-y/index.js +2 -2
  87. package/dist/cjs/hooks/useShapes/bar-y/prepare-data.d.ts +3 -3
  88. package/dist/cjs/hooks/useShapes/bar-y/prepare-data.js +2 -3
  89. package/dist/cjs/hooks/useShapes/funnel/index.d.ts +13 -0
  90. package/dist/cjs/hooks/useShapes/funnel/index.js +95 -0
  91. package/dist/cjs/hooks/useShapes/funnel/prepare-data.d.ts +9 -0
  92. package/dist/cjs/hooks/useShapes/funnel/prepare-data.js +120 -0
  93. package/dist/cjs/hooks/useShapes/funnel/types.d.ts +32 -0
  94. package/dist/cjs/hooks/useShapes/funnel/types.js +1 -0
  95. package/dist/cjs/hooks/useShapes/heatmap/index.d.ts +2 -2
  96. package/dist/cjs/hooks/useShapes/heatmap/index.js +2 -2
  97. package/dist/cjs/hooks/useShapes/heatmap/prepare-data.d.ts +3 -3
  98. package/dist/cjs/hooks/useShapes/index.d.ts +15 -10
  99. package/dist/cjs/hooks/useShapes/index.js +49 -25
  100. package/dist/cjs/hooks/useShapes/line/index.d.ts +3 -3
  101. package/dist/cjs/hooks/useShapes/line/index.js +2 -2
  102. package/dist/cjs/hooks/useShapes/line/prepare-data.d.ts +3 -3
  103. package/dist/cjs/hooks/useShapes/line/prepare-data.js +23 -34
  104. package/dist/cjs/hooks/useShapes/pie/index.d.ts +2 -2
  105. package/dist/cjs/hooks/useShapes/pie/index.js +2 -2
  106. package/dist/cjs/hooks/useShapes/radar/index.d.ts +2 -2
  107. package/dist/cjs/hooks/useShapes/radar/index.js +2 -2
  108. package/dist/cjs/hooks/useShapes/sankey/index.d.ts +2 -2
  109. package/dist/cjs/hooks/useShapes/sankey/index.js +2 -2
  110. package/dist/cjs/hooks/useShapes/scatter/index.d.ts +3 -2
  111. package/dist/cjs/hooks/useShapes/scatter/index.js +4 -4
  112. package/dist/cjs/hooks/useShapes/scatter/prepare-data.d.ts +3 -3
  113. package/dist/cjs/hooks/useShapes/styles.css +8 -8
  114. package/dist/cjs/hooks/useShapes/treemap/index.d.ts +2 -2
  115. package/dist/cjs/hooks/useShapes/treemap/index.js +2 -2
  116. package/dist/cjs/hooks/useShapes/utils.d.ts +3 -3
  117. package/dist/cjs/hooks/useShapes/waterfall/index.d.ts +3 -3
  118. package/dist/cjs/hooks/useShapes/waterfall/index.js +2 -2
  119. package/dist/cjs/hooks/useShapes/waterfall/prepare-data.d.ts +3 -3
  120. package/dist/cjs/hooks/useZoom/index.d.ts +4 -3
  121. package/dist/cjs/hooks/useZoom/utils.d.ts +3 -3
  122. package/dist/cjs/hooks/utils/bar-x.d.ts +2 -2
  123. package/dist/cjs/hooks/utils/bar-y.d.ts +2 -2
  124. package/dist/cjs/types/chart/area.d.ts +7 -2
  125. package/dist/cjs/types/chart/axis.d.ts +45 -0
  126. package/dist/cjs/types/chart/bar-x.d.ts +7 -3
  127. package/dist/cjs/types/chart/bar-y.d.ts +2 -2
  128. package/dist/cjs/types/chart/base.d.ts +26 -25
  129. package/dist/cjs/types/chart/brush.d.ts +22 -0
  130. package/dist/cjs/types/chart/brush.js +1 -0
  131. package/dist/cjs/types/chart/funnel.d.ts +46 -0
  132. package/dist/cjs/types/chart/funnel.js +1 -0
  133. package/dist/cjs/types/chart/heatmap.d.ts +2 -2
  134. package/dist/cjs/types/chart/legend.d.ts +6 -0
  135. package/dist/cjs/types/chart/line.d.ts +7 -2
  136. package/dist/cjs/types/chart/pie.d.ts +2 -2
  137. package/dist/cjs/types/chart/radar.d.ts +2 -2
  138. package/dist/cjs/types/chart/sankey.d.ts +2 -2
  139. package/dist/cjs/types/chart/scatter.d.ts +7 -2
  140. package/dist/cjs/types/chart/series.d.ts +17 -2
  141. package/dist/cjs/types/chart/tooltip.d.ts +10 -2
  142. package/dist/cjs/types/chart/treemap.d.ts +2 -2
  143. package/dist/cjs/types/chart/waterfall.d.ts +2 -2
  144. package/dist/cjs/types/chart/zoom.d.ts +2 -5
  145. package/dist/cjs/types/index.d.ts +2 -0
  146. package/dist/cjs/types/index.js +2 -0
  147. package/dist/cjs/types/misc.d.ts +6 -0
  148. package/dist/cjs/utils/chart/axis.d.ts +5 -2
  149. package/dist/cjs/utils/chart/axis.js +47 -1
  150. package/dist/cjs/utils/chart/color.js +2 -1
  151. package/dist/cjs/utils/chart/get-closest-data.js +18 -1
  152. package/dist/cjs/utils/chart/index.js +4 -4
  153. package/dist/cjs/utils/chart/series/sorting.js +3 -3
  154. package/dist/cjs/utils/chart/zoom.d.ts +3 -3
  155. package/dist/cjs/utils/chart/zoom.js +2 -2
  156. package/dist/cjs/validation/index.js +3 -3
  157. package/dist/esm/components/AxisX/AxisX.d.ts +3 -3
  158. package/dist/esm/components/ChartInner/index.js +95 -27
  159. package/dist/esm/components/ChartInner/useChartInnerHandlers.d.ts +3 -3
  160. package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +41 -20
  161. package/dist/esm/components/ChartInner/useChartInnerProps.js +22 -11
  162. package/dist/esm/components/ChartInner/useChartInnerState.d.ts +6 -1
  163. package/dist/esm/components/ChartInner/useChartInnerState.js +17 -1
  164. package/dist/esm/components/ChartInner/utils.d.ts +5 -2
  165. package/dist/esm/components/ChartInner/utils.js +13 -0
  166. package/dist/esm/components/RangeSlider/index.d.ts +6 -0
  167. package/dist/esm/components/RangeSlider/index.js +41 -0
  168. package/dist/esm/components/RangeSlider/styles.css +6 -0
  169. package/dist/esm/components/RangeSlider/utils.d.ts +5 -0
  170. package/dist/esm/components/RangeSlider/utils.js +18 -0
  171. package/dist/esm/components/Tooltip/DefaultTooltipContent/index.js +2 -1
  172. package/dist/esm/components/Tooltip/DefaultTooltipContent/utils.js +3 -2
  173. package/dist/esm/components/Tooltip/index.d.ts +3 -3
  174. package/dist/esm/constants/chart-types.d.ts +3 -1
  175. package/dist/esm/constants/chart-types.js +2 -1
  176. package/dist/esm/constants/defaults/brush.d.ts +2 -0
  177. package/dist/esm/constants/defaults/brush.js +15 -0
  178. package/dist/esm/constants/defaults/index.d.ts +1 -0
  179. package/dist/esm/constants/defaults/index.js +1 -0
  180. package/dist/esm/constants/defaults/series-options.d.ts +2 -1
  181. package/dist/esm/constants/defaults/series-options.js +11 -0
  182. package/dist/esm/hooks/index.d.ts +5 -0
  183. package/dist/esm/hooks/index.js +5 -0
  184. package/dist/esm/hooks/useAxis/index.d.ts +4 -3
  185. package/dist/esm/hooks/useAxis/index.js +2 -2
  186. package/dist/esm/hooks/useAxis/range-slider.d.ts +5 -0
  187. package/dist/esm/hooks/useAxis/range-slider.js +16 -0
  188. package/dist/esm/hooks/useAxis/types.d.ts +66 -0
  189. package/dist/esm/hooks/useAxis/types.js +1 -0
  190. package/dist/esm/hooks/{useChartOptions → useAxis}/utils.d.ts +1 -2
  191. package/dist/esm/hooks/useAxis/utils.js +9 -0
  192. package/dist/{cjs/hooks/useChartOptions → esm/hooks/useAxis}/x-axis.d.ts +2 -2
  193. package/dist/{cjs/hooks/useChartOptions → esm/hooks/useAxis}/x-axis.js +5 -3
  194. package/dist/esm/hooks/{useChartOptions → useAxis}/y-axis.d.ts +2 -2
  195. package/dist/esm/hooks/{useChartOptions → useAxis}/y-axis.js +3 -3
  196. package/dist/esm/hooks/useAxisScales/index.d.ts +6 -6
  197. package/dist/esm/hooks/useAxisScales/index.js +107 -34
  198. package/dist/esm/hooks/useAxisScales/utils.d.ts +19 -0
  199. package/dist/esm/hooks/useAxisScales/utils.js +34 -0
  200. package/dist/esm/hooks/useBrush/index.js +89 -27
  201. package/dist/esm/hooks/useBrush/styles.css +1 -0
  202. package/dist/esm/hooks/useBrush/types.d.ts +6 -6
  203. package/dist/esm/hooks/useBrush/utils.d.ts +19 -0
  204. package/dist/esm/hooks/useBrush/utils.js +172 -0
  205. package/dist/esm/hooks/useChartDimensions/index.d.ts +4 -4
  206. package/dist/esm/hooks/useChartDimensions/index.js +14 -4
  207. package/dist/esm/hooks/useChartDimensions/utils.d.ts +4 -4
  208. package/dist/esm/hooks/useChartOptions/index.d.ts +9 -3
  209. package/dist/esm/hooks/useChartOptions/tooltip.js +1 -1
  210. package/dist/esm/hooks/useChartOptions/types.d.ts +4 -64
  211. package/dist/esm/hooks/useChartOptions/zoom.js +24 -21
  212. package/dist/esm/hooks/useCrosshair/index.d.ts +3 -3
  213. package/dist/esm/hooks/useNormalizedOriginalData/index.d.ts +1 -0
  214. package/dist/esm/hooks/useNormalizedOriginalData/index.js +1 -2
  215. package/dist/esm/hooks/useRangeSlider/index.d.ts +4 -0
  216. package/dist/esm/hooks/useRangeSlider/index.js +130 -0
  217. package/dist/esm/hooks/useRangeSlider/types.d.ts +44 -0
  218. package/dist/esm/hooks/useRangeSlider/types.js +1 -0
  219. package/dist/esm/hooks/useRangeSlider/utils.d.ts +16 -0
  220. package/dist/esm/hooks/useRangeSlider/utils.js +19 -0
  221. package/dist/esm/hooks/useSeries/prepare-area.js +2 -1
  222. package/dist/esm/hooks/useSeries/prepare-bar-x.js +8 -8
  223. package/dist/esm/hooks/useSeries/prepare-bar-y.d.ts +1 -0
  224. package/dist/esm/hooks/useSeries/prepare-bar-y.js +7 -6
  225. package/dist/esm/hooks/useSeries/prepare-funnel.d.ts +10 -0
  226. package/dist/esm/hooks/useSeries/prepare-funnel.js +50 -0
  227. package/dist/esm/hooks/useSeries/prepare-legend.js +4 -1
  228. package/dist/esm/hooks/useSeries/prepare-line.js +2 -1
  229. package/dist/esm/hooks/useSeries/prepare-pie.js +3 -2
  230. package/dist/esm/hooks/useSeries/prepare-scatter.js +2 -0
  231. package/dist/esm/hooks/useSeries/prepareSeries.js +9 -0
  232. package/dist/esm/hooks/useSeries/types.d.ts +22 -6
  233. package/dist/esm/hooks/useShapes/area/index.d.ts +3 -3
  234. package/dist/esm/hooks/useShapes/area/index.js +2 -2
  235. package/dist/esm/hooks/useShapes/area/prepare-data.d.ts +5 -3
  236. package/dist/esm/hooks/useShapes/area/prepare-data.js +158 -157
  237. package/dist/esm/hooks/useShapes/bar-x/index.d.ts +3 -3
  238. package/dist/esm/hooks/useShapes/bar-x/index.js +2 -2
  239. package/dist/esm/hooks/useShapes/bar-x/prepare-data.d.ts +5 -3
  240. package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +102 -82
  241. package/dist/esm/hooks/useShapes/bar-y/index.d.ts +3 -3
  242. package/dist/esm/hooks/useShapes/bar-y/index.js +2 -2
  243. package/dist/esm/hooks/useShapes/bar-y/prepare-data.d.ts +3 -3
  244. package/dist/esm/hooks/useShapes/bar-y/prepare-data.js +2 -3
  245. package/dist/esm/hooks/useShapes/funnel/index.d.ts +13 -0
  246. package/dist/esm/hooks/useShapes/funnel/index.js +95 -0
  247. package/dist/esm/hooks/useShapes/funnel/prepare-data.d.ts +9 -0
  248. package/dist/esm/hooks/useShapes/funnel/prepare-data.js +120 -0
  249. package/dist/esm/hooks/useShapes/funnel/types.d.ts +32 -0
  250. package/dist/esm/hooks/useShapes/funnel/types.js +1 -0
  251. package/dist/esm/hooks/useShapes/heatmap/index.d.ts +2 -2
  252. package/dist/esm/hooks/useShapes/heatmap/index.js +2 -2
  253. package/dist/esm/hooks/useShapes/heatmap/prepare-data.d.ts +3 -3
  254. package/dist/esm/hooks/useShapes/index.d.ts +15 -10
  255. package/dist/esm/hooks/useShapes/index.js +49 -25
  256. package/dist/esm/hooks/useShapes/line/index.d.ts +3 -3
  257. package/dist/esm/hooks/useShapes/line/index.js +2 -2
  258. package/dist/esm/hooks/useShapes/line/prepare-data.d.ts +3 -3
  259. package/dist/esm/hooks/useShapes/line/prepare-data.js +23 -34
  260. package/dist/esm/hooks/useShapes/pie/index.d.ts +2 -2
  261. package/dist/esm/hooks/useShapes/pie/index.js +2 -2
  262. package/dist/esm/hooks/useShapes/radar/index.d.ts +2 -2
  263. package/dist/esm/hooks/useShapes/radar/index.js +2 -2
  264. package/dist/esm/hooks/useShapes/sankey/index.d.ts +2 -2
  265. package/dist/esm/hooks/useShapes/sankey/index.js +2 -2
  266. package/dist/esm/hooks/useShapes/scatter/index.d.ts +3 -2
  267. package/dist/esm/hooks/useShapes/scatter/index.js +4 -4
  268. package/dist/esm/hooks/useShapes/scatter/prepare-data.d.ts +3 -3
  269. package/dist/esm/hooks/useShapes/styles.css +8 -8
  270. package/dist/esm/hooks/useShapes/treemap/index.d.ts +2 -2
  271. package/dist/esm/hooks/useShapes/treemap/index.js +2 -2
  272. package/dist/esm/hooks/useShapes/utils.d.ts +3 -3
  273. package/dist/esm/hooks/useShapes/waterfall/index.d.ts +3 -3
  274. package/dist/esm/hooks/useShapes/waterfall/index.js +2 -2
  275. package/dist/esm/hooks/useShapes/waterfall/prepare-data.d.ts +3 -3
  276. package/dist/esm/hooks/useZoom/index.d.ts +4 -3
  277. package/dist/esm/hooks/useZoom/utils.d.ts +3 -3
  278. package/dist/esm/hooks/utils/bar-x.d.ts +2 -2
  279. package/dist/esm/hooks/utils/bar-y.d.ts +2 -2
  280. package/dist/esm/types/chart/area.d.ts +7 -2
  281. package/dist/esm/types/chart/axis.d.ts +45 -0
  282. package/dist/esm/types/chart/bar-x.d.ts +7 -3
  283. package/dist/esm/types/chart/bar-y.d.ts +2 -2
  284. package/dist/esm/types/chart/base.d.ts +26 -25
  285. package/dist/esm/types/chart/brush.d.ts +22 -0
  286. package/dist/esm/types/chart/brush.js +1 -0
  287. package/dist/esm/types/chart/funnel.d.ts +46 -0
  288. package/dist/esm/types/chart/funnel.js +1 -0
  289. package/dist/esm/types/chart/heatmap.d.ts +2 -2
  290. package/dist/esm/types/chart/legend.d.ts +6 -0
  291. package/dist/esm/types/chart/line.d.ts +7 -2
  292. package/dist/esm/types/chart/pie.d.ts +2 -2
  293. package/dist/esm/types/chart/radar.d.ts +2 -2
  294. package/dist/esm/types/chart/sankey.d.ts +2 -2
  295. package/dist/esm/types/chart/scatter.d.ts +7 -2
  296. package/dist/esm/types/chart/series.d.ts +17 -2
  297. package/dist/esm/types/chart/tooltip.d.ts +10 -2
  298. package/dist/esm/types/chart/treemap.d.ts +2 -2
  299. package/dist/esm/types/chart/waterfall.d.ts +2 -2
  300. package/dist/esm/types/chart/zoom.d.ts +2 -5
  301. package/dist/esm/types/index.d.ts +2 -0
  302. package/dist/esm/types/index.js +2 -0
  303. package/dist/esm/types/misc.d.ts +6 -0
  304. package/dist/esm/utils/chart/axis.d.ts +5 -2
  305. package/dist/esm/utils/chart/axis.js +47 -1
  306. package/dist/esm/utils/chart/color.js +2 -1
  307. package/dist/esm/utils/chart/get-closest-data.js +18 -1
  308. package/dist/esm/utils/chart/index.js +4 -4
  309. package/dist/esm/utils/chart/series/sorting.js +3 -3
  310. package/dist/esm/utils/chart/zoom.d.ts +3 -3
  311. package/dist/esm/utils/chart/zoom.js +2 -2
  312. package/dist/esm/validation/index.js +3 -3
  313. package/package.json +1 -1
  314. package/dist/cjs/hooks/useChartOptions/utils.js +0 -49
  315. package/dist/esm/hooks/useChartOptions/utils.js +0 -49
@@ -0,0 +1,22 @@
1
+ export interface ChartBrush {
2
+ borderColor?: string;
3
+ borderWidth?: number;
4
+ handles?: {
5
+ borderColor?: string;
6
+ borderWidth?: number;
7
+ enabled?: boolean;
8
+ /**
9
+ * Height of the handles in pixels.
10
+ * @default 15
11
+ */
12
+ height?: number;
13
+ /**
14
+ * Width of the handles in pixels.
15
+ * @default 8
16
+ */
17
+ width?: number;
18
+ };
19
+ style?: {
20
+ fillOpacity?: number;
21
+ };
22
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,46 @@
1
+ import type { DashStyle, SERIES_TYPE } from '../../constants';
2
+ import type { MeaningfulAny } from '../misc';
3
+ import type { BaseDataLabels, BaseSeries, BaseSeriesData } from './base';
4
+ import type { ChartLegend, RectLegendSymbolOptions } from './legend';
5
+ export interface FunnelSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
6
+ /** The value of the funnel segment. */
7
+ value: number;
8
+ /** The name of the funnel segment (used in legend, tooltip etc). */
9
+ name: string;
10
+ /** Initial data label of the funnel segment. If not specified, the value is used. */
11
+ label?: string;
12
+ }
13
+ export interface FunnelSeries<T = MeaningfulAny> extends Omit<BaseSeries, 'dataLabels'> {
14
+ type: typeof SERIES_TYPE.Funnel;
15
+ data: FunnelSeriesData<T>[];
16
+ /** The name of the funnel series. */
17
+ name?: string;
18
+ /** The color of the funnel series. */
19
+ color?: string;
20
+ /** Individual series legend options. Has higher priority than legend options in widget data */
21
+ legend?: ChartLegend & {
22
+ symbol?: RectLegendSymbolOptions;
23
+ };
24
+ /** Lines or areas connecting the funnel segments. */
25
+ connectors?: {
26
+ enabled?: boolean;
27
+ /** The height of the connector area relative to the funnel segment. */
28
+ height?: string | number;
29
+ /** Option for line stroke style */
30
+ lineDashStyle?: DashStyle;
31
+ /** Opacity for the connector line. */
32
+ lineOpacity?: number;
33
+ /** Connector line color. */
34
+ lineColor?: string;
35
+ /** Connector line width in pixels. */
36
+ lineWidth?: number;
37
+ /** Connector area color. */
38
+ areaColor?: string;
39
+ /** Opacity for the connector area. */
40
+ areaOpacity?: number;
41
+ };
42
+ dataLabels?: Omit<BaseDataLabels, 'html' | 'allowOverlap'> & {
43
+ /** Horizontal alignment of the data labels. */
44
+ align?: 'left' | 'center' | 'right';
45
+ };
46
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import type { SeriesType } from '../../constants';
1
+ import type { SERIES_TYPE } from '../../constants';
2
2
  import type { MeaningfulAny } from '../misc';
3
3
  import type { BaseSeries, BaseSeriesData } from './base';
4
4
  import type { ChartLegend, RectLegendSymbolOptions } from './legend';
@@ -23,7 +23,7 @@ export interface HeatmapSeriesData<T = MeaningfulAny> extends BaseSeriesData<T>
23
23
  label?: string;
24
24
  }
25
25
  export interface HeatmapSeries<T = MeaningfulAny> extends BaseSeries {
26
- type: typeof SeriesType.Heatmap;
26
+ type: typeof SERIES_TYPE.Heatmap;
27
27
  data: HeatmapSeriesData<T>[];
28
28
  /** The name of the series (used in legend, tooltip etc) */
29
29
  name: string;
@@ -59,6 +59,12 @@ export interface ChartLegend {
59
59
  * @default false
60
60
  * */
61
61
  html?: boolean;
62
+ /**
63
+ * The position of the legend box within the chart area.
64
+ *
65
+ * @default 'bottom'
66
+ * */
67
+ position?: 'top' | 'bottom';
62
68
  }
63
69
  export interface BaseLegendSymbol {
64
70
  /**
@@ -1,8 +1,9 @@
1
- import type { DashStyle, LineCap, SeriesType } from '../../constants';
1
+ import type { DashStyle, LineCap, SERIES_TYPE } from '../../constants';
2
2
  import type { MeaningfulAny } from '../misc';
3
3
  import type { BaseSeries, BaseSeriesData } from './base';
4
4
  import type { ChartLegend, RectLegendSymbolOptions } from './legend';
5
5
  import type { PointMarkerOptions } from './marker';
6
+ import type { ChartSeriesRangeSliderOptions } from './series';
6
7
  export interface LineSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
7
8
  /**
8
9
  * The `x` value of the point. Depending on the context , it may represents:
@@ -29,7 +30,7 @@ export interface LineSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
29
30
  };
30
31
  }
31
32
  export interface LineSeries<T = MeaningfulAny> extends BaseSeries {
32
- type: typeof SeriesType.Line;
33
+ type: typeof SERIES_TYPE.Line;
33
34
  data: LineSeriesData<T>[];
34
35
  /** The name of the series (used in legend, tooltip etc) */
35
36
  name: string;
@@ -64,4 +65,8 @@ export interface LineSeries<T = MeaningfulAny> extends BaseSeries {
64
65
  * @default 'skip'
65
66
  */
66
67
  nullMode?: 'connect' | 'zero' | 'skip';
68
+ /**
69
+ * Options to configure how this series appears and behaves in the Range Slider component.
70
+ */
71
+ rangeSlider?: ChartSeriesRangeSliderOptions;
67
72
  }
@@ -1,5 +1,5 @@
1
1
  import type { BaseType } from 'd3';
2
- import type { SeriesType } from '../../constants';
2
+ import type { SERIES_TYPE } from '../../constants';
3
3
  import type { MeaningfulAny } from '../misc';
4
4
  import type { BaseSeries, BaseSeriesData } from './base';
5
5
  import type { ChartLegend, RectLegendSymbolOptions } from './legend';
@@ -20,7 +20,7 @@ export interface PieSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
20
20
  export type ConnectorShape = 'straight-line' | 'polyline';
21
21
  export type ConnectorCurve = 'linear' | 'basic';
22
22
  export interface PieSeries<T = MeaningfulAny> extends BaseSeries {
23
- type: typeof SeriesType.Pie;
23
+ type: typeof SERIES_TYPE.Pie;
24
24
  data: PieSeriesData<T>[];
25
25
  /**
26
26
  * The color of the border surrounding each segment.
@@ -1,4 +1,4 @@
1
- import type { SeriesType } from '../../constants';
1
+ import type { SERIES_TYPE } from '../../constants';
2
2
  import type { MeaningfulAny } from '../misc';
3
3
  import type { BaseSeries, BaseSeriesData } from './base';
4
4
  import type { ChartLegend, RectLegendSymbolOptions } from './legend';
@@ -18,7 +18,7 @@ export interface RadarMarkerOptions extends PointMarkerOptions {
18
18
  symbol?: RadarMarkerSymbol;
19
19
  }
20
20
  export interface RadarSeries<T = MeaningfulAny> extends BaseSeries {
21
- type: typeof SeriesType.Radar;
21
+ type: typeof SERIES_TYPE.Radar;
22
22
  /** The categories for the radar chart. */
23
23
  categories?: RadarSeriesCategory[];
24
24
  data: RadarSeriesData<T>[];
@@ -1,4 +1,4 @@
1
- import type { SeriesType } from '../../constants';
1
+ import type { SERIES_TYPE } from '../../constants';
2
2
  import type { MeaningfulAny } from '../misc';
3
3
  import type { BaseSeries, BaseSeriesData } from './base';
4
4
  import type { ChartLegend, RectLegendSymbolOptions } from './legend';
@@ -11,7 +11,7 @@ export interface SankeySeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
11
11
  }[];
12
12
  }
13
13
  export interface SankeySeries<T = MeaningfulAny> extends BaseSeries {
14
- type: typeof SeriesType.Sankey;
14
+ type: typeof SERIES_TYPE.Sankey;
15
15
  /** The name of the series (used in legend, tooltip etc). */
16
16
  name: string;
17
17
  data: SankeySeriesData<T>[];
@@ -1,7 +1,8 @@
1
- import type { SeriesType, SymbolType } from '../../constants';
1
+ import type { SERIES_TYPE, SymbolType } from '../../constants';
2
2
  import type { MeaningfulAny } from '../misc';
3
3
  import type { BaseSeries, BaseSeriesData } from './base';
4
4
  import type { ChartLegend, RectLegendSymbolOptions } from './legend';
5
+ import type { ChartSeriesRangeSliderOptions } from './series';
5
6
  export interface ScatterSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
6
7
  /**
7
8
  * The `x` value of the point. Depending on the context , it may represents:
@@ -29,7 +30,7 @@ export interface ScatterSeriesData<T = MeaningfulAny> extends BaseSeriesData<T>
29
30
  opacity?: number;
30
31
  }
31
32
  export interface ScatterSeries<T = MeaningfulAny> extends BaseSeries {
32
- type: typeof SeriesType.Scatter;
33
+ type: typeof SERIES_TYPE.Scatter;
33
34
  data: ScatterSeriesData<T>[];
34
35
  /** The name of the series (used in legend, tooltip etc) */
35
36
  name: string;
@@ -52,4 +53,8 @@ export interface ScatterSeries<T = MeaningfulAny> extends BaseSeries {
52
53
  * @default 'skip'
53
54
  */
54
55
  nullMode?: 'zero' | 'skip';
56
+ /**
57
+ * Options to configure how this series appears and behaves in the Range Slider component.
58
+ */
59
+ rangeSlider?: ChartSeriesRangeSliderOptions;
55
60
  }
@@ -4,6 +4,7 @@ import type { MeaningfulAny } from '../misc';
4
4
  import type { AreaSeries, AreaSeriesData } from './area';
5
5
  import type { BarXSeries, BarXSeriesData } from './bar-x';
6
6
  import type { BarYSeries, BarYSeriesData } from './bar-y';
7
+ import type { FunnelSeries, FunnelSeriesData } from './funnel';
7
8
  import type { Halo } from './halo';
8
9
  import type { HeatmapSeries, HeatmapSeriesData } from './heatmap';
9
10
  import type { LineSeries, LineSeriesData } from './line';
@@ -14,8 +15,8 @@ import type { SankeySeries, SankeySeriesData } from './sankey';
14
15
  import type { ScatterSeries, ScatterSeriesData } from './scatter';
15
16
  import type { TreemapSeries, TreemapSeriesData } from './treemap';
16
17
  import type { WaterfallSeries, WaterfallSeriesData } from './waterfall';
17
- export type ChartSeries<T = MeaningfulAny> = ScatterSeries<T> | PieSeries<T> | BarXSeries<T> | BarYSeries<T> | LineSeries<T> | AreaSeries<T> | TreemapSeries<T> | WaterfallSeries<T> | SankeySeries<T> | RadarSeries<T> | HeatmapSeries<T>;
18
- export type ChartSeriesData<T = MeaningfulAny> = ScatterSeriesData<T> | PieSeriesData<T> | BarXSeriesData<T> | BarYSeriesData<T> | LineSeriesData<T> | AreaSeriesData<T> | TreemapSeriesData<T> | WaterfallSeriesData<T> | SankeySeriesData<T> | RadarSeriesData<T> | HeatmapSeriesData<T>;
18
+ export type ChartSeries<T = MeaningfulAny> = ScatterSeries<T> | PieSeries<T> | BarXSeries<T> | BarYSeries<T> | LineSeries<T> | AreaSeries<T> | TreemapSeries<T> | WaterfallSeries<T> | SankeySeries<T> | RadarSeries<T> | HeatmapSeries<T> | FunnelSeries<T>;
19
+ export type ChartSeriesData<T = MeaningfulAny> = ScatterSeriesData<T> | PieSeriesData<T> | BarXSeriesData<T> | BarYSeriesData<T> | LineSeriesData<T> | AreaSeriesData<T> | TreemapSeriesData<T> | WaterfallSeriesData<T> | SankeySeriesData<T> | RadarSeriesData<T> | HeatmapSeriesData<T> | FunnelSeriesData<T>;
19
20
  export interface DataLabelRendererData<T = MeaningfulAny> {
20
21
  data: ChartSeriesData<T>;
21
22
  }
@@ -285,4 +286,18 @@ export interface ChartSeriesOptions {
285
286
  */
286
287
  borderColor?: string;
287
288
  };
289
+ funnel?: {
290
+ /** Options for the series states that provide additional styling information to the series. */
291
+ states?: {
292
+ hover?: BasicHoverState;
293
+ };
294
+ };
288
295
  }
296
+ export type ChartSeriesRangeSliderOptions = {
297
+ /**
298
+ * Enable or disable the visibility of this series in the Range Slider.
299
+ *
300
+ * @default true
301
+ */
302
+ visible?: boolean;
303
+ };
@@ -5,6 +5,7 @@ import type { ChartXAxis, ChartYAxis } from './axis';
5
5
  import type { BarXSeries, BarXSeriesData } from './bar-x';
6
6
  import type { BarYSeries, BarYSeriesData } from './bar-y';
7
7
  import type { CustomFormat, ValueFormat } from './base';
8
+ import type { FunnelSeries, FunnelSeriesData } from './funnel';
8
9
  import type { HeatmapSeries, HeatmapSeriesData } from './heatmap';
9
10
  import type { LineSeries, LineSeriesData } from './line';
10
11
  import type { PieSeries, PieSeriesData } from './pie';
@@ -76,9 +77,16 @@ export interface TooltipDataChunkRadar<T = MeaningfulAny> {
76
77
  export interface TooltipDataChunkHeatmap<T = MeaningfulAny> {
77
78
  data: HeatmapSeriesData<T>;
78
79
  series: HeatmapSeries<T>;
79
- closest: boolean;
80
80
  }
81
- export type TooltipDataChunk<T = MeaningfulAny> = (TooltipDataChunkBarX<T> | TooltipDataChunkBarY<T> | TooltipDataChunkPie<T> | TooltipDataChunkScatter<T> | TooltipDataChunkLine<T> | TooltipDataChunkArea<T> | TooltipDataChunkTreemap<T> | TooltipDataChunkSankey<T> | TooltipDataChunkWaterfall<T> | TooltipDataChunkRadar<T> | TooltipDataChunkHeatmap<T>) & {
81
+ export interface TooltipDataChunkFunnel<T = MeaningfulAny> {
82
+ data: FunnelSeriesData<T>;
83
+ series: {
84
+ type: FunnelSeries['type'];
85
+ id: string;
86
+ name: string;
87
+ };
88
+ }
89
+ export type TooltipDataChunk<T = MeaningfulAny> = (TooltipDataChunkBarX<T> | TooltipDataChunkBarY<T> | TooltipDataChunkPie<T> | TooltipDataChunkScatter<T> | TooltipDataChunkLine<T> | TooltipDataChunkArea<T> | TooltipDataChunkTreemap<T> | TooltipDataChunkSankey<T> | TooltipDataChunkWaterfall<T> | TooltipDataChunkRadar<T> | TooltipDataChunkHeatmap<T> | TooltipDataChunkFunnel<T>) & {
82
90
  closest?: boolean;
83
91
  };
84
92
  export interface ChartTooltipRendererArgs<T = MeaningfulAny> {
@@ -1,4 +1,4 @@
1
- import type { LayoutAlgorithm, SeriesType } from '../../constants';
1
+ import type { LayoutAlgorithm, SERIES_TYPE } from '../../constants';
2
2
  import type { MeaningfulAny } from '../misc';
3
3
  import type { BaseSeries, BaseSeriesData } from './base';
4
4
  import type { ChartLegend, RectLegendSymbolOptions } from './legend';
@@ -16,7 +16,7 @@ export interface TreemapSeriesData<T = MeaningfulAny> extends BaseSeriesData<T>
16
16
  parentId?: string;
17
17
  }
18
18
  export interface TreemapSeries<T = MeaningfulAny> extends BaseSeries {
19
- type: typeof SeriesType.Treemap;
19
+ type: typeof SERIES_TYPE.Treemap;
20
20
  data: TreemapSeriesData<T>[];
21
21
  /** The name of the series (used in legend, tooltip etc). */
22
22
  name: string;
@@ -1,4 +1,4 @@
1
- import type { SeriesType } from '../../constants';
1
+ import type { SERIES_TYPE } from '../../constants';
2
2
  import type { MeaningfulAny } from '../misc';
3
3
  import type { BaseSeries, BaseSeriesData } from './base';
4
4
  import type { ChartLegend, RectLegendSymbolOptions } from './legend';
@@ -23,7 +23,7 @@ export interface WaterfallSeriesData<T = MeaningfulAny> extends BaseSeriesData<T
23
23
  total?: boolean;
24
24
  }
25
25
  export interface WaterfallSeries<T = MeaningfulAny> extends BaseSeries {
26
- type: typeof SeriesType.Waterfall;
26
+ type: typeof SERIES_TYPE.Waterfall;
27
27
  data: WaterfallSeriesData<T>[];
28
28
  /** The name of the series (used in legend, tooltip etc). */
29
29
  name: string;
@@ -1,4 +1,5 @@
1
1
  import type { ZoomType } from '../../constants';
2
+ import type { ChartBrush } from './brush';
2
3
  /**
3
4
  * Configuration options for chart zooming functionality using area selection.
4
5
  * Working with only axis related series.
@@ -29,11 +30,7 @@ export interface ChartZoom {
29
30
  /**
30
31
  * Zoom brush configuration.
31
32
  */
32
- brush?: {
33
- style?: {
34
- fillOpacity?: number;
35
- };
36
- };
33
+ brush?: Omit<ChartBrush, 'handles'>;
37
34
  /**
38
35
  * Reset zoom button configuration.
39
36
  * The button appears only after the zoom has been applied.
@@ -29,6 +29,8 @@ export * from './chart/waterfall';
29
29
  export * from './chart/sankey';
30
30
  export * from './chart/radar';
31
31
  export * from './chart/heatmap';
32
+ export * from './chart/funnel';
33
+ export * from './chart/brush';
32
34
  export interface ChartData<T = MeaningfulAny> {
33
35
  /**
34
36
  * General options for the chart.
@@ -21,3 +21,5 @@ export * from './chart/waterfall';
21
21
  export * from './chart/sankey';
22
22
  export * from './chart/radar';
23
23
  export * from './chart/heatmap';
24
+ export * from './chart/funnel';
25
+ export * from './chart/brush';
@@ -10,3 +10,9 @@ export type PointPosition = [number, number];
10
10
  export type DeepRequired<T> = Required<{
11
11
  [K in keyof T]: T[K] extends Required<T[K]> ? T[K] : DeepRequired<T[K]>;
12
12
  }>;
13
+ /**
14
+ * Makes all properties in T optional, including nested objects.
15
+ */
16
+ export type DeepPartial<T> = {
17
+ [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
18
+ };
@@ -1,5 +1,6 @@
1
- import type { AxisDomain, AxisScale, ScaleBand } from 'd3';
1
+ import type { AxisDomain, AxisScale, ScaleBand, ScaleTime } from 'd3';
2
2
  import type { ChartScale, PreparedAxis, PreparedAxisPlotBand, PreparedSplit } from '../../hooks';
3
+ import type { ChartAxis } from '../../types';
3
4
  import type { TextRow } from './text';
4
5
  import type { AxisDirection } from './types';
5
6
  type Ticks = number[] | string[] | Date[];
@@ -7,7 +8,8 @@ export declare function getTicksCount({ axis, range }: {
7
8
  axis: PreparedAxis;
8
9
  range: number;
9
10
  }): number | undefined;
10
- export declare function isBandScale(scale: ChartScale | AxisScale<AxisDomain>): scale is ScaleBand<string>;
11
+ export declare function isBandScale(scale?: ChartScale | AxisScale<AxisDomain>): scale is ScaleBand<string>;
12
+ export declare function isTimeScale(scale?: ChartScale | AxisScale<AxisDomain>): scale is ScaleTime<number, number>;
11
13
  export declare function getScaleTicks(scale: ChartScale | AxisScale<AxisDomain>, ticksCount?: number): Ticks;
12
14
  export declare function getXAxisOffset(): 0 | 0.5;
13
15
  export declare function getXTickPosition({ scale, offset }: {
@@ -46,4 +48,5 @@ export declare function getLabelFormatter({ axis, scale }: {
46
48
  axis: PreparedAxis;
47
49
  scale: ChartScale;
48
50
  }): (value: AxisDomain) => string;
51
+ export declare function getAxisCategories({ categories: originalCategories, max, min, order, }?: Partial<ChartAxis>): string[] | undefined;
49
52
  export {};
@@ -1,3 +1,4 @@
1
+ import { ascending, descending, reverse, sort } from 'd3';
1
2
  import clamp from 'lodash/clamp';
2
3
  import { formatAxisTickLabel } from './format';
3
4
  import { wrapText } from './text';
@@ -9,7 +10,13 @@ export function getTicksCount({ axis, range }) {
9
10
  return ticksCount;
10
11
  }
11
12
  export function isBandScale(scale) {
12
- return 'bandwidth' in scale && typeof scale.bandwidth === 'function';
13
+ return Boolean(scale && 'bandwidth' in scale && typeof scale.bandwidth === 'function');
14
+ }
15
+ export function isTimeScale(scale) {
16
+ if (!scale) {
17
+ return false;
18
+ }
19
+ return scale.domain()[0] instanceof Date;
13
20
  }
14
21
  export function getScaleTicks(scale, ticksCount) {
15
22
  if ('ticks' in scale && typeof scale.ticks === 'function') {
@@ -137,3 +144,42 @@ export function getLabelFormatter({ axis, scale }) {
137
144
  });
138
145
  };
139
146
  }
147
+ function getNormalizedIndexMinMax(args) {
148
+ const { max, min } = args;
149
+ if (typeof min === 'number' && typeof max === 'number') {
150
+ return min > max ? [max, min] : [min, max];
151
+ }
152
+ return [min, max];
153
+ }
154
+ function getNormalizedStartEnd(args) {
155
+ const { length, max, min } = args;
156
+ const [normalizedMin, normalizedMax] = getNormalizedIndexMinMax({ max, min });
157
+ const start = typeof normalizedMin === 'number' && normalizedMin >= 0 ? normalizedMin : 0;
158
+ const end = typeof normalizedMax === 'number' && normalizedMax <= length ? normalizedMax + 1 : length;
159
+ return [start, end];
160
+ }
161
+ export function getAxisCategories({ categories: originalCategories, max, min, order, } = {}) {
162
+ if (originalCategories) {
163
+ let categories = originalCategories;
164
+ switch (order) {
165
+ case 'reverse': {
166
+ categories = reverse(originalCategories);
167
+ break;
168
+ }
169
+ case 'sortAsc': {
170
+ categories = sort(originalCategories, (a, b) => ascending(a, b));
171
+ break;
172
+ }
173
+ case 'sortDesc': {
174
+ categories = sort(originalCategories, (a, b) => descending(a, b));
175
+ break;
176
+ }
177
+ }
178
+ if (typeof min === 'number' || typeof max === 'number') {
179
+ const [start, end] = getNormalizedStartEnd({ length: categories.length, max, min });
180
+ categories = categories.slice(start, end);
181
+ }
182
+ return categories;
183
+ }
184
+ return originalCategories;
185
+ }
@@ -4,7 +4,8 @@ export function getDomainForContinuousColorScale(args) {
4
4
  const values = series.reduce((acc, s) => {
5
5
  switch (s.type) {
6
6
  case 'pie':
7
- case 'heatmap': {
7
+ case 'heatmap':
8
+ case 'funnel': {
8
9
  acc.push(...s.data.map((d) => Number(d.value)));
9
10
  break;
10
11
  }
@@ -49,7 +49,7 @@ export function getClosestPoints(args) {
49
49
  const groups = groupBy(shapesData, getSeriesType);
50
50
  // eslint-disable-next-line complexity
51
51
  Object.entries(groups).forEach(([seriesType, list]) => {
52
- var _a, _b, _c, _d;
52
+ var _a, _b, _c, _d, _e;
53
53
  switch (seriesType) {
54
54
  case 'bar-x': {
55
55
  const points = list.map((d) => ({
@@ -248,6 +248,23 @@ export function getClosestPoints(args) {
248
248
  }
249
249
  break;
250
250
  }
251
+ case 'funnel': {
252
+ const data = list;
253
+ const closestPoint = (_e = data[0]) === null || _e === void 0 ? void 0 : _e.items.find((item) => {
254
+ return (pointerX >= item.x &&
255
+ pointerX <= item.x + item.width &&
256
+ pointerY >= item.y &&
257
+ pointerY <= item.y + item.height);
258
+ });
259
+ if (closestPoint) {
260
+ result.push({
261
+ data: closestPoint.data,
262
+ series: closestPoint.series,
263
+ closest: true,
264
+ });
265
+ }
266
+ break;
267
+ }
251
268
  }
252
269
  });
253
270
  return result;
@@ -2,7 +2,7 @@ import { group, select } from 'd3';
2
2
  import get from 'lodash/get';
3
3
  import isNil from 'lodash/isNil';
4
4
  import sortBy from 'lodash/sortBy';
5
- import { DEFAULT_AXIS_LABEL_FONT_SIZE, SeriesType } from '../../constants';
5
+ import { DEFAULT_AXIS_LABEL_FONT_SIZE, SERIES_TYPE } from '../../constants';
6
6
  import { getSeriesStackId } from '../../hooks/useSeries/utils';
7
7
  import { getWaterfallPointSubtotal } from './series/waterfall';
8
8
  export * from './axis';
@@ -17,7 +17,7 @@ export * from './symbol';
17
17
  export * from './text';
18
18
  export * from './time';
19
19
  export * from './zoom';
20
- const CHARTS_WITHOUT_AXIS = ['pie', 'treemap', 'sankey', 'radar'];
20
+ const CHARTS_WITHOUT_AXIS = ['pie', 'treemap', 'sankey', 'radar', 'funnel'];
21
21
  export const CHART_SERIES_WITH_VOLUME_ON_Y_AXIS = [
22
22
  'bar-x',
23
23
  'area',
@@ -109,7 +109,7 @@ export function getDefaultMinXAxisValue(series) {
109
109
  }
110
110
  export function getDefaultMinYAxisValue(series) {
111
111
  if (series === null || series === void 0 ? void 0 : series.some((s) => CHART_SERIES_WITH_VOLUME_ON_Y_AXIS.includes(s.type))) {
112
- if (series.some((s) => s.type === SeriesType.Waterfall)) {
112
+ if (series.some((s) => s.type === SERIES_TYPE.Waterfall)) {
113
113
  const seriesData = series.map((s) => s.data).flat();
114
114
  const minSubTotal = seriesData.reduce((res, d) => Math.min(res, getWaterfallPointSubtotal(d, seriesData) || 0), 0);
115
115
  return Math.min(0, minSubTotal);
@@ -129,7 +129,7 @@ export const getDomainDataYBySeries = (series) => {
129
129
  switch (type) {
130
130
  case 'area':
131
131
  case 'bar-x': {
132
- acc.push(...getDomainDataForStackedSeries(seriesList));
132
+ acc.push(0, ...getDomainDataForStackedSeries(seriesList));
133
133
  break;
134
134
  }
135
135
  case 'waterfall': {
@@ -1,8 +1,8 @@
1
1
  import { sort } from 'd3';
2
2
  import { isEmpty } from 'lodash';
3
3
  import get from 'lodash/get';
4
- import { SeriesType } from '../../../constants';
5
- import { getAxisCategories } from '../../../hooks/useChartOptions/utils';
4
+ import { SERIES_TYPE } from '../../../constants';
5
+ import { getAxisCategories } from '../../../utils';
6
6
  function applyAxisCategoriesOrder({ series, axis, key, }) {
7
7
  var _a, _b;
8
8
  const originalCategories = (_a = axis === null || axis === void 0 ? void 0 : axis.categories) !== null && _a !== void 0 ? _a : [];
@@ -40,7 +40,7 @@ export function getSortedSeriesData({ seriesData, xAxis, yAxis, }) {
40
40
  sortedSeries = applyAxisCategoriesOrder({ series: sortedSeries, axis: yAxisItem, key: 'y' });
41
41
  sortedSeries = applyAxisCategoriesOrder({ series: sortedSeries, axis: xAxis, key: 'x' });
42
42
  switch (sortedSeries.type) {
43
- case SeriesType.Area: {
43
+ case SERIES_TYPE.Area: {
44
44
  sortedSeries = Object.assign(Object.assign({}, sortedSeries), { data: sort(sortedSeries.data, (d) => d.x) });
45
45
  break;
46
46
  }
@@ -1,11 +1,11 @@
1
- import type { PreparedAxis, PreparedSeries } from '../../hooks';
1
+ import type { PreparedSeries, PreparedXAxis, PreparedYAxis } from '../../hooks';
2
2
  import type { ZoomState } from '../../hooks/useZoom/types';
3
3
  import type { ChartXAxis, ChartYAxis } from '../../types';
4
4
  export declare function getZoomedSeriesData(args: {
5
5
  seriesData: PreparedSeries[];
6
6
  zoomState: Partial<ZoomState>;
7
- xAxis?: ChartXAxis | PreparedAxis | null;
8
- yAxis?: ChartYAxis[] | PreparedAxis[] | null;
7
+ xAxis?: ChartXAxis | PreparedXAxis | null;
8
+ yAxis?: ChartYAxis[] | PreparedYAxis[] | null;
9
9
  }): {
10
10
  preparedSeries: PreparedSeries[];
11
11
  preparedShapesSeries: PreparedSeries[];
@@ -1,5 +1,5 @@
1
- import { SeriesType } from '../../constants';
2
- const SERIES_TYPE_WITH_HIDDEN_POINTS = [SeriesType.Area, SeriesType.Line];
1
+ import { SERIES_TYPE } from '../../constants';
2
+ const SERIES_TYPE_WITH_HIDDEN_POINTS = [SERIES_TYPE.Area, SERIES_TYPE.Line];
3
3
  // eslint-disable-next-line complexity
4
4
  function isValueInRange(args) {
5
5
  const { axis, max, min, value } = args;
@@ -1,13 +1,13 @@
1
1
  import get from 'lodash/get';
2
2
  import isEmpty from 'lodash/isEmpty';
3
- import { DEFAULT_AXIS_TYPE, SeriesType, TOOLTIP_TOTALS_BUILT_IN_AGGREGATION } from '../constants';
3
+ import { DEFAULT_AXIS_TYPE, SERIES_TYPE, TOOLTIP_TOTALS_BUILT_IN_AGGREGATION } from '../constants';
4
4
  import { i18n } from '../i18n';
5
5
  import { CHART_ERROR_CODE, ChartError } from '../libs';
6
6
  import { validateAxes } from './validate-axes';
7
7
  function getTypeOf(value) {
8
8
  return typeof value;
9
9
  }
10
- const AVAILABLE_SERIES_TYPES = Object.values(SeriesType);
10
+ const AVAILABLE_SERIES_TYPES = Object.values(SERIES_TYPE);
11
11
  const AVAILABLE_TOOLTIP_TOTALS_BUILT_IN_AGGREGATIONS = Object.values(TOOLTIP_TOTALS_BUILT_IN_AGGREGATION);
12
12
  const AVAILABLE_TOOLTIP_TOTALS_AGGREGATION_TYPES = ['function', 'string'];
13
13
  function validateXYSeries(args) {
@@ -387,7 +387,7 @@ export function validateData(data) {
387
387
  }
388
388
  const treemapSeriesCount = countSeriesByType({
389
389
  series: data.series.data,
390
- type: SeriesType.Treemap,
390
+ type: SERIES_TYPE.Treemap,
391
391
  });
392
392
  if (treemapSeriesCount > 1) {
393
393
  throw new ChartError({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/charts",
3
- "version": "1.23.0",
3
+ "version": "1.24.1",
4
4
  "description": "React component used to render charts",
5
5
  "license": "MIT",
6
6
  "main": "dist/cjs/index.js",