@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
@@ -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;
@@ -1,32 +1,6 @@
1
- import { getLabelsSize, getLeftPosition } from '../../../utils';
1
+ import { getLabelsSize, getTextSizeFn } from '../../../utils';
2
2
  import { getFormattedValue } from '../../../utils/chart/format';
3
3
  import { getXValue, getYValue } from '../utils';
4
- async function getLabelData(point, series, xMax) {
5
- const text = getFormattedValue(Object.assign({ value: point.data.label || point.data.y }, series.dataLabels));
6
- const style = series.dataLabels.style;
7
- const size = await getLabelsSize({ labels: [text], style });
8
- const labelData = {
9
- text,
10
- x: point.x,
11
- y: point.y - series.dataLabels.padding,
12
- style,
13
- size: { width: size.maxWidth, height: size.maxHeight },
14
- textAnchor: 'middle',
15
- series: series,
16
- active: true,
17
- };
18
- const left = getLeftPosition(labelData);
19
- if (left < 0) {
20
- labelData.x = labelData.x + Math.abs(left);
21
- }
22
- else {
23
- const right = left + labelData.size.width;
24
- if (right > xMax) {
25
- labelData.x = labelData.x - xMax - right;
26
- }
27
- }
28
- return labelData;
29
- }
30
4
  async function getHtmlLabel(point, series, xMax) {
31
5
  const content = String(point.data.label || point.data.y);
32
6
  const size = await getLabelsSize({ labels: [content], html: true });
@@ -69,7 +43,7 @@ export const prepareLineData = async (args) => {
69
43
  };
70
44
  });
71
45
  const htmlElements = [];
72
- let labels = [];
46
+ const labels = [];
73
47
  if (s.dataLabels.enabled) {
74
48
  if (s.dataLabels.html) {
75
49
  const list = await Promise.all(points.reduce((result, p) => {
@@ -82,13 +56,28 @@ export const prepareLineData = async (args) => {
82
56
  htmlElements.push(...list);
83
57
  }
84
58
  else {
85
- labels = await Promise.all(points.reduce((result, p) => {
86
- if (p.y === null) {
87
- return result;
59
+ const getTextSize = getTextSizeFn({ style: s.dataLabels.style });
60
+ for (let index = 0; index < points.length; index++) {
61
+ const point = points[index];
62
+ if (point.y !== null && point.x !== null) {
63
+ const text = getFormattedValue(Object.assign({ value: point.data.label || point.data.y }, s.dataLabels));
64
+ const labelSize = await getTextSize(text);
65
+ const style = s.dataLabels.style;
66
+ const y = Math.max(yAxisTop, point.y - s.dataLabels.padding - labelSize.height);
67
+ const x = Math.min(xMax - labelSize.width, Math.max(0, point.x - labelSize.width / 2));
68
+ const labelData = {
69
+ text,
70
+ x,
71
+ y,
72
+ style,
73
+ size: labelSize,
74
+ textAnchor: 'start',
75
+ series: s,
76
+ active: true,
77
+ };
78
+ labels.push(labelData);
88
79
  }
89
- result.push(getLabelData(p, s, xMax));
90
- return result;
91
- }, []));
80
+ }
92
81
  }
93
82
  }
94
83
  let markers = [];
@@ -3,10 +3,10 @@ import type { Dispatch, PieArcDatum } from 'd3';
3
3
  import type { PreparedSeriesOptions } from '../../useSeries/types';
4
4
  import type { PreparedPieData, SegmentData } from './types';
5
5
  type PreparePieSeriesArgs = {
6
- dispatcher: Dispatch<object>;
6
+ htmlLayout: HTMLElement | null;
7
7
  preparedData: PreparedPieData[];
8
8
  seriesOptions: PreparedSeriesOptions;
9
- htmlLayout: HTMLElement | null;
9
+ dispatcher?: Dispatch<object>;
10
10
  };
11
11
  export declare function getHaloVisibility(d: PieArcDatum<SegmentData>): "" | "hidden";
12
12
  export declare function PieSeriesShapes(args: PreparePieSeriesArgs): React.JSX.Element;
@@ -112,7 +112,7 @@ export function PieSeriesShapes(args) {
112
112
  const eventName = `hover-shape.pie`;
113
113
  const hoverOptions = get(seriesOptions, 'pie.states.hover');
114
114
  const inactiveOptions = get(seriesOptions, 'pie.states.inactive');
115
- dispatcher.on(eventName, (data) => {
115
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, (data) => {
116
116
  var _a, _b;
117
117
  const selectedSeriesId = (_b = (_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.series) === null || _b === void 0 ? void 0 : _b.id;
118
118
  const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
@@ -162,7 +162,7 @@ export function PieSeriesShapes(args) {
162
162
  });
163
163
  });
164
164
  return () => {
165
- dispatcher.on(eventName, null);
165
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, null);
166
166
  };
167
167
  }, [dispatcher, preparedData, seriesOptions]);
168
168
  const htmlElements = preparedData.map((d) => d.htmlLabels).flat();
@@ -3,10 +3,10 @@ import type { Dispatch } from 'd3';
3
3
  import type { PreparedSeriesOptions } from '../../useSeries/types';
4
4
  import type { PreparedRadarData } from './types';
5
5
  type PrepareRadarSeriesArgs = {
6
- dispatcher: Dispatch<object>;
6
+ htmlLayout: HTMLElement | null;
7
7
  series: PreparedRadarData[];
8
8
  seriesOptions: PreparedSeriesOptions;
9
- htmlLayout: HTMLElement | null;
9
+ dispatcher?: Dispatch<object>;
10
10
  };
11
11
  export declare function RadarSeriesShapes(args: PrepareRadarSeriesArgs): React.JSX.Element;
12
12
  export {};
@@ -81,7 +81,7 @@ export function RadarSeriesShapes(args) {
81
81
  const eventName = `hover-shape.radar`;
82
82
  const hoverOptions = get(seriesOptions, 'radar.states.hover');
83
83
  const inactiveOptions = get(seriesOptions, 'radar.states.inactive');
84
- dispatcher.on(eventName, (data) => {
84
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, (data) => {
85
85
  const closest = data === null || data === void 0 ? void 0 : data.find((d) => d.closest);
86
86
  const selectedSeries = closest === null || closest === void 0 ? void 0 : closest.series;
87
87
  const selectedSeriesData = closest === null || closest === void 0 ? void 0 : closest.data;
@@ -126,7 +126,7 @@ export function RadarSeriesShapes(args) {
126
126
  });
127
127
  });
128
128
  return () => {
129
- dispatcher.on(eventName, null);
129
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, null);
130
130
  };
131
131
  }, [dispatcher, preparedData, seriesOptions]);
132
132
  const htmlElements = preparedData.map((d) => d.htmlLabels).flat();
@@ -3,10 +3,10 @@ import type { Dispatch } from 'd3';
3
3
  import type { PreparedSeriesOptions } from '../../useSeries/types';
4
4
  import type { PreparedSankeyData } from './types';
5
5
  type ShapeProps = {
6
- dispatcher: Dispatch<object>;
6
+ htmlLayout: HTMLElement | null;
7
7
  preparedData: PreparedSankeyData;
8
8
  seriesOptions: PreparedSeriesOptions;
9
- htmlLayout: HTMLElement | null;
9
+ dispatcher?: Dispatch<object>;
10
10
  };
11
11
  export declare const SankeySeriesShape: (props: ShapeProps) => React.JSX.Element;
12
12
  export {};
@@ -56,9 +56,9 @@ export const SankeySeriesShape = (props) => {
56
56
  if (hoveredDataRef.current !== null) {
57
57
  handleShapeHover(hoveredDataRef.current);
58
58
  }
59
- dispatcher.on(eventName, handleShapeHover);
59
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, handleShapeHover);
60
60
  return () => {
61
- dispatcher.on(eventName, null);
61
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, null);
62
62
  };
63
63
  }, [dispatcher, preparedData, seriesOptions]);
64
64
  return (React.createElement(React.Fragment, null,
@@ -4,9 +4,10 @@ import type { PreparedSeriesOptions } from '../../useSeries/types';
4
4
  import type { PreparedScatterData } from './types';
5
5
  export { prepareScatterData } from './prepare-data';
6
6
  type ScatterSeriesShapeProps = {
7
- dispatcher: Dispatch<object>;
7
+ htmlLayout: HTMLElement | null;
8
8
  preparedData: PreparedScatterData[];
9
9
  seriesOptions: PreparedSeriesOptions;
10
- htmlLayout: HTMLElement | null;
10
+ clipPathId?: string;
11
+ dispatcher?: Dispatch<object>;
11
12
  };
12
13
  export declare function ScatterSeriesShape(props: ScatterSeriesShapeProps): React.JSX.Element;
@@ -8,7 +8,7 @@ import { setActiveState, shapeKey } from '../utils';
8
8
  export { prepareScatterData } from './prepare-data';
9
9
  const b = block('scatter');
10
10
  export function ScatterSeriesShape(props) {
11
- const { dispatcher, preparedData, seriesOptions, htmlLayout } = props;
11
+ const { clipPathId, dispatcher, preparedData, seriesOptions, htmlLayout } = props;
12
12
  const hoveredDataRef = React.useRef(null);
13
13
  const ref = React.useRef(null);
14
14
  React.useEffect(() => {
@@ -63,12 +63,12 @@ export function ScatterSeriesShape(props) {
63
63
  if (hoveredDataRef.current !== null) {
64
64
  handleShapeHover(hoveredDataRef.current);
65
65
  }
66
- dispatcher.on('hover-shape.scatter', handleShapeHover);
66
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.scatter', handleShapeHover);
67
67
  return () => {
68
- dispatcher.on('hover-shape.scatter', null);
68
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.scatter', null);
69
69
  };
70
70
  }, [dispatcher, preparedData, seriesOptions]);
71
71
  return (React.createElement(React.Fragment, null,
72
- React.createElement("g", { ref: ref, className: b() }),
72
+ React.createElement("g", { ref: ref, className: b(), clipPath: clipPathId ? `url(#${clipPathId})` : undefined }),
73
73
  React.createElement(HtmlLayer, { preparedData: preparedData, htmlLayout: htmlLayout })));
74
74
  }
@@ -1,12 +1,12 @@
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 { PreparedScatterSeries } from '../../useSeries/types';
4
4
  import type { PreparedScatterData } from './types';
5
5
  export declare function prepareScatterData(args: {
6
6
  series: PreparedScatterSeries[];
7
- xAxis: PreparedAxis;
7
+ xAxis: PreparedXAxis;
8
8
  xScale: ChartScale;
9
- yAxis: PreparedAxis[];
9
+ yAxis: PreparedYAxis[];
10
10
  yScale: (ChartScale | undefined)[];
11
11
  isOutsideBounds: (x: number, y: number) => boolean;
12
12
  }): PreparedScatterData[];
@@ -1,3 +1,11 @@
1
+ .gcharts-line__label,
2
+ .gcharts-area__label,
3
+ .gcharts-radar__label,
4
+ .gcharts-heatmap__label,
5
+ .gcharts-funnel__label {
6
+ dominant-baseline: text-before-edge;
7
+ }
8
+
1
9
  .gcharts-scatter__point {
2
10
  stroke-width: 1px;
3
11
  }
@@ -12,10 +20,6 @@
12
20
  dominant-baseline: text-before-edge;
13
21
  }
14
22
 
15
- .gcharts-radar__label {
16
- dominant-baseline: text-before-edge;
17
- }
18
-
19
23
  .gcharts-bar-x__label {
20
24
  user-select: none;
21
25
  fill: var(--g-color-text-complementary);
@@ -36,8 +40,4 @@
36
40
 
37
41
  .gcharts-waterfall__connector {
38
42
  stroke: var(--g-color-line-generic-active);
39
- }
40
-
41
- .gcharts-heatmap__label {
42
- dominant-baseline: text-before-edge;
43
43
  }
@@ -3,10 +3,10 @@ import type { Dispatch } from 'd3';
3
3
  import type { PreparedSeriesOptions } from '../../useSeries/types';
4
4
  import type { PreparedTreemapData } from './types';
5
5
  type ShapeProps = {
6
- dispatcher: Dispatch<object>;
6
+ htmlLayout: HTMLElement | null;
7
7
  preparedData: PreparedTreemapData;
8
8
  seriesOptions: PreparedSeriesOptions;
9
- htmlLayout: HTMLElement | null;
9
+ dispatcher?: Dispatch<object>;
10
10
  };
11
11
  export declare const TreemapSeriesShape: (props: ShapeProps) => React.JSX.Element;
12
12
  export {};
@@ -92,9 +92,9 @@ export const TreemapSeriesShape = (props) => {
92
92
  if (hoveredDataRef.current !== null) {
93
93
  handleShapeHover(hoveredDataRef.current);
94
94
  }
95
- dispatcher.on(eventName, handleShapeHover);
95
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, handleShapeHover);
96
96
  return () => {
97
- dispatcher.on(eventName, null);
97
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on(eventName, null);
98
98
  };
99
99
  }, [dispatcher, preparedData, seriesOptions]);
100
100
  return (React.createElement(React.Fragment, null,
@@ -1,7 +1,7 @@
1
1
  import type { BaseType } from 'd3';
2
2
  import type { BasicInactiveState } from '../../types';
3
+ import type { PreparedXAxis, PreparedYAxis } from '../useAxis/types';
3
4
  import type { ChartScale } from '../useAxisScales';
4
- import type { PreparedAxis } from '../useChartOptions/types';
5
5
  export declare function getXValue(args: {
6
6
  point: {
7
7
  x?: number | string | null;
@@ -9,7 +9,7 @@ export declare function getXValue(args: {
9
9
  points?: {
10
10
  x?: number | string | null;
11
11
  }[];
12
- xAxis: PreparedAxis;
12
+ xAxis: PreparedXAxis;
13
13
  xScale: ChartScale;
14
14
  }): number | null;
15
15
  export declare function getYValue(args: {
@@ -19,7 +19,7 @@ export declare function getYValue(args: {
19
19
  points?: {
20
20
  y?: number | string | null;
21
21
  }[];
22
- yAxis: PreparedAxis;
22
+ yAxis: PreparedYAxis;
23
23
  yScale: ChartScale;
24
24
  }): number | null;
25
25
  export declare function shapeKey(d: unknown): string | -1;
@@ -5,10 +5,10 @@ import type { PreparedWaterfallData } from './types';
5
5
  export { prepareWaterfallData } from './prepare-data';
6
6
  export * from './types';
7
7
  type Args = {
8
- dispatcher: Dispatch<object>;
8
+ clipPathId: string;
9
+ htmlLayout: HTMLElement | null;
9
10
  preparedData: PreparedWaterfallData[];
10
11
  seriesOptions: PreparedSeriesOptions;
11
- htmlLayout: HTMLElement | null;
12
- clipPathId: string;
12
+ dispatcher?: Dispatch<object>;
13
13
  };
14
14
  export declare const WaterfallSeriesShapes: (args: Args) => React.JSX.Element;
@@ -121,9 +121,9 @@ export const WaterfallSeriesShapes = (args) => {
121
121
  if (hoveredDataRef.current !== null) {
122
122
  handleShapeHover(hoveredDataRef.current);
123
123
  }
124
- dispatcher.on('hover-shape.waterfall', handleShapeHover);
124
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.waterfall', handleShapeHover);
125
125
  return () => {
126
- dispatcher.on('hover-shape.waterfall', null);
126
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.waterfall', null);
127
127
  };
128
128
  }, [connectorSelector, dispatcher, preparedData, seriesOptions]);
129
129
  return (React.createElement(React.Fragment, null,
@@ -1,12 +1,12 @@
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 { PreparedSeriesOptions, PreparedWaterfallSeries } from '../../useSeries/types';
4
4
  import type { PreparedWaterfallData } from './types';
5
5
  export declare const prepareWaterfallData: (args: {
6
6
  series: PreparedWaterfallSeries[];
7
7
  seriesOptions: PreparedSeriesOptions;
8
- xAxis: PreparedAxis;
8
+ xAxis: PreparedXAxis;
9
9
  xScale: ChartScale;
10
- yAxis: PreparedAxis[];
10
+ yAxis: PreparedYAxis[];
11
11
  yScale: (ChartScale | undefined)[];
12
12
  }) => Promise<PreparedWaterfallData[]>;
@@ -1,5 +1,6 @@
1
+ import type { PreparedXAxis, PreparedYAxis } from '../useAxis/types';
1
2
  import type { ChartScale } from '../useAxisScales';
2
- import type { PreparedAxis, PreparedZoom } from '../useChartOptions/types';
3
+ import type { PreparedZoom } from '../useChartOptions/types';
3
4
  import type { PreparedSplit } from '../useSplit/types';
4
5
  import type { ZoomState } from './types';
5
6
  interface UseZoomProps {
@@ -9,9 +10,9 @@ interface UseZoomProps {
9
10
  plotContainerWidth: number;
10
11
  preparedSplit: PreparedSplit;
11
12
  preparedZoom: PreparedZoom | null;
12
- xAxis: PreparedAxis | null;
13
+ xAxis: PreparedXAxis | null;
13
14
  xScale?: ChartScale;
14
- yAxis: PreparedAxis[];
15
+ yAxis: PreparedYAxis[];
15
16
  yScale?: (ChartScale | undefined)[];
16
17
  }
17
18
  export declare function useZoom(props: UseZoomProps): void;
@@ -1,13 +1,13 @@
1
1
  import type { BrushSelection } from 'd3';
2
2
  import type { ZoomType } from '../../constants';
3
+ import type { PreparedXAxis, PreparedYAxis } from '../useAxis/types';
3
4
  import type { ChartScale } from '../useAxisScales';
4
- import type { PreparedAxis } from '../useChartOptions/types';
5
5
  import type { ZoomState } from './types';
6
6
  export declare function selectionToZoomBounds(args: {
7
7
  selection: BrushSelection;
8
- xAxis: PreparedAxis;
8
+ xAxis: PreparedXAxis;
9
9
  xScale: ChartScale;
10
- yAxes: PreparedAxis[];
10
+ yAxes: PreparedYAxis[];
11
11
  yScales: (ChartScale | undefined)[];
12
12
  zoomType: ZoomType;
13
13
  }): Partial<ZoomState>;
@@ -1,7 +1,7 @@
1
1
  import type { BarXSeries, BarXSeriesData } from '../../types';
2
- import type { PreparedAxis } from '../useChartOptions/types';
2
+ import type { PreparedXAxis } from '../useAxis/types';
3
3
  import type { PreparedBarXSeries, PreparedSeriesOptions } from '../useSeries/types';
4
- export declare function groupBarXDataByXValue<T extends BarXSeries | PreparedBarXSeries>(series: T[], xAxis: PreparedAxis): Record<string | number, Record<string, {
4
+ export declare function groupBarXDataByXValue<T extends BarXSeries | PreparedBarXSeries>(series: T[], xAxis: PreparedXAxis): Record<string | number, Record<string, {
5
5
  data: BarXSeriesData;
6
6
  series: T;
7
7
  }[]>>;
@@ -1,6 +1,6 @@
1
1
  import type { BarYSeries, BarYSeriesData } from '../../types';
2
+ import type { PreparedYAxis } from '../useAxis/types';
2
3
  import type { ChartScale } from '../useAxisScales';
3
- import type { PreparedAxis } from '../useChartOptions/types';
4
4
  import type { PreparedBarYSeries, PreparedSeriesOptions } from '../useSeries/types';
5
5
  /**
6
6
  * BarY always filters out data with null or replace null by zero.
@@ -8,7 +8,7 @@ import type { PreparedBarYSeries, PreparedSeriesOptions } from '../useSeries/typ
8
8
  type PreparedBarYSeriesData = BarYSeriesData & {
9
9
  x?: number | string;
10
10
  };
11
- export declare function groupBarYDataByYValue<T extends BarYSeries | PreparedBarYSeries>(series: T[], yAxis: PreparedAxis[]): Record<string | number, Record<string, {
11
+ export declare function groupBarYDataByYValue<T extends BarYSeries | PreparedBarYSeries>(series: T[], yAxis: PreparedYAxis[]): Record<string | number, Record<string, {
12
12
  data: PreparedBarYSeriesData;
13
13
  series: T;
14
14
  }[]>>;
@@ -1,8 +1,9 @@
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';
5
5
  import type { PointMarkerOptions } from './marker';
6
+ import type { ChartSeriesRangeSliderOptions } from './series';
6
7
  export interface AreaSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
7
8
  /**
8
9
  * The `x` value of the point. Depending on the context , it may represents:
@@ -41,7 +42,7 @@ export interface AreaMarkerOptions extends PointMarkerOptions {
41
42
  symbol?: AreaMarkerSymbol;
42
43
  }
43
44
  export interface AreaSeries<T = MeaningfulAny> extends BaseSeries {
44
- type: typeof SeriesType.Area;
45
+ type: typeof SERIES_TYPE.Area;
45
46
  data: AreaSeriesData<T>[];
46
47
  /** The name of the series (used in legend, tooltip etc) */
47
48
  name: string;
@@ -83,4 +84,8 @@ export interface AreaSeries<T = MeaningfulAny> extends BaseSeries {
83
84
  * @default 'skip'
84
85
  */
85
86
  nullMode?: 'connect' | 'zero' | 'skip';
87
+ /**
88
+ * Options to configure how this series appears and behaves in the Range Slider component.
89
+ */
90
+ rangeSlider?: ChartSeriesRangeSliderOptions;
86
91
  }
@@ -1,6 +1,8 @@
1
+ import type { DurationInput } from '@gravity-ui/date-utils';
1
2
  import type { AXIS_TYPE, DashStyle } from '../../constants';
2
3
  import type { FormatNumberOptions } from '../formatter';
3
4
  import type { BaseTextStyle } from './base';
5
+ import type { ChartBrush } from './brush';
4
6
  export type ChartAxisType = (typeof AXIS_TYPE)[keyof typeof AXIS_TYPE];
5
7
  export type ChartAxisTitleAlignment = 'left' | 'center' | 'right';
6
8
  export interface ChartAxisLabels {
@@ -40,6 +42,40 @@ export interface ChartAxisLabels {
40
42
  * */
41
43
  maxWidth?: number | string;
42
44
  }
45
+ export interface ChartAxisRangeSlider {
46
+ /**
47
+ * Range slider brush configuration.
48
+ */
49
+ brush?: ChartBrush;
50
+ /**
51
+ * Configuration for the range slider state after the initial chart render.
52
+ */
53
+ defaultRange?: {
54
+ /**
55
+ * Default size of the range slider.
56
+ *
57
+ * The value type depends on the axis scale:
58
+ * - For `datetime` axes: {@link https://github.com/gravity-ui/date-utils/blob/8d53ff16a4582831140e75f1305dc6a0112a5ad6/src/typings/duration.ts#L7 DurationInput}
59
+ * - For `linear` and `logarithmic` axes: numeric value
60
+ */
61
+ size?: DurationInput | number;
62
+ };
63
+ /**
64
+ * Enable or disable the display of range slider
65
+ * @default false
66
+ */
67
+ enabled?: boolean;
68
+ /**
69
+ * The height of the range slider in pixels.
70
+ * @default 40
71
+ */
72
+ height?: number;
73
+ /**
74
+ * The pixel distance between the range slider and the the X axis or X axis labels.
75
+ * @default 10
76
+ */
77
+ margin?: number;
78
+ }
43
79
  export interface ChartAxis {
44
80
  categories?: string[];
45
81
  /** Configure a crosshair that follows either the mouse pointer or the hovered point. */
@@ -124,6 +160,15 @@ export interface ChartAxis {
124
160
  order?: 'sortAsc' | 'sortDesc' | 'reverse';
125
161
  }
126
162
  export interface ChartXAxis extends ChartAxis {
163
+ /**
164
+ * Configuration options for the chart range slider component.
165
+ *
166
+ * The range slider allows users to select a specific range of data to display
167
+ * on the chart by adjusting the slider handles.
168
+ *
169
+ * Supported only for `linear`, `datetime`, and `logarithmic` axes.
170
+ */
171
+ rangeSlider?: ChartAxisRangeSlider;
127
172
  }
128
173
  export type PlotLayerPlacement = 'before' | 'after';
129
174
  export interface AxisPlot {
@@ -1,8 +1,8 @@
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';
5
- import type { ChartSeriesOptions } from './series';
5
+ import type { ChartSeriesOptions, ChartSeriesRangeSliderOptions } from './series';
6
6
  export interface BarXSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
7
7
  /**
8
8
  * The `x` value of the bar. Depending on the context , it may represents:
@@ -30,7 +30,7 @@ export interface BarXSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
30
30
  opacity?: number;
31
31
  }
32
32
  export interface BarXSeries<T = MeaningfulAny> extends BaseSeries {
33
- type: typeof SeriesType.BarX;
33
+ type: typeof SERIES_TYPE.BarX;
34
34
  data: BarXSeriesData<T>[];
35
35
  /** The name of the series (used in legend, tooltip etc) */
36
36
  name: string;
@@ -78,4 +78,8 @@ export interface BarXSeries<T = MeaningfulAny> extends BaseSeries {
78
78
  * @default 'skip'
79
79
  */
80
80
  nullMode?: 'zero' | 'skip';
81
+ /**
82
+ * Options to configure how this series appears and behaves in the Range Slider component.
83
+ */
84
+ rangeSlider?: ChartSeriesRangeSliderOptions;
81
85
  }
@@ -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 BarYSeriesData<T = MeaningfulAny> extends BaseSeriesData<T> {
23
23
  opacity?: number;
24
24
  }
25
25
  export interface BarYSeries<T = MeaningfulAny> extends BaseSeries {
26
- type: typeof SeriesType.BarY;
26
+ type: typeof SERIES_TYPE.BarY;
27
27
  data: BarYSeriesData<T>[];
28
28
  /** The name of the series (used in legend, tooltip etc) */
29
29
  name: string;
@@ -15,37 +15,38 @@ export type CustomFormat = {
15
15
  }) => string;
16
16
  };
17
17
  export type ValueFormat = NumberFormat | DateFormat;
18
+ export interface BaseDataLabels {
19
+ /**
20
+ * Enable or disable the data labels
21
+ * @default true
22
+ */
23
+ enabled?: boolean;
24
+ style?: Partial<BaseTextStyle>;
25
+ /**
26
+ * @default 5
27
+ * */
28
+ padding?: number;
29
+ /**
30
+ * @default false
31
+ * */
32
+ allowOverlap?: boolean;
33
+ /**
34
+ * Allows to use any html-tags to display the content.
35
+ * The element will be displayed outside the box of the SVG element.
36
+ *
37
+ * @default false
38
+ * */
39
+ html?: boolean;
40
+ /** Formatting settings for labels. */
41
+ format?: ValueFormat;
42
+ }
18
43
  export interface BaseSeries {
19
44
  /** Initial visibility of the series */
20
45
  visible?: boolean;
21
46
  /**
22
47
  * Options for the series data labels, appearing next to each data point.
23
48
  * */
24
- dataLabels?: {
25
- /**
26
- * Enable or disable the data labels
27
- * @default true
28
- */
29
- enabled?: boolean;
30
- style?: Partial<BaseTextStyle>;
31
- /**
32
- * @default 5
33
- * */
34
- padding?: number;
35
- /**
36
- * @default false
37
- * */
38
- allowOverlap?: boolean;
39
- /**
40
- * Allows to use any html-tags to display the content.
41
- * The element will be displayed outside the box of the SVG element.
42
- *
43
- * @default false
44
- * */
45
- html?: boolean;
46
- /** Formatting settings for labels. */
47
- format?: ValueFormat;
48
- };
49
+ dataLabels?: BaseDataLabels;
49
50
  /** You can set the cursor to "pointer" if you have click events attached to the series, to signal to the user that the points and lines can be clicked. */
50
51
  cursor?: string;
51
52
  /**