@gravity-ui/charts 1.45.0 → 1.46.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 (371) hide show
  1. package/dist/cjs/components/ChartInner/index.js +2 -2
  2. package/dist/cjs/components/ChartInner/styles.css +2 -2
  3. package/dist/cjs/components/ChartInner/useChartInnerProps.js +2 -2
  4. package/dist/cjs/components/ChartInner/utils/title.d.ts +2 -1
  5. package/dist/cjs/components/ChartInner/utils/title.js +51 -14
  6. package/dist/cjs/components/Legend/index.js +13 -14
  7. package/dist/cjs/components/Title/index.d.ts +4 -2
  8. package/dist/cjs/components/Title/index.js +9 -2
  9. package/dist/cjs/components/Tooltip/index.js +22 -1
  10. package/dist/cjs/core/axes/x-axis.js +1 -1
  11. package/dist/cjs/core/axes/y-axis.js +1 -1
  12. package/dist/cjs/core/scales/utils.d.ts +1 -1
  13. package/dist/cjs/core/scales/utils.js +1 -1
  14. package/dist/cjs/core/scales/x-scale.js +2 -2
  15. package/dist/cjs/core/scales/y-scale.js +48 -4
  16. package/dist/cjs/core/series/prepare-area.js +1 -1
  17. package/dist/cjs/core/series/prepare-bar-x.js +1 -1
  18. package/dist/cjs/core/series/prepare-bar-y.js +1 -1
  19. package/dist/cjs/core/series/prepare-funnel.js +1 -1
  20. package/dist/cjs/core/series/prepare-heatmap.js +1 -1
  21. package/dist/cjs/core/series/prepare-legend.js +2 -2
  22. package/dist/cjs/core/series/prepare-line.js +1 -1
  23. package/dist/cjs/core/series/prepare-pie.js +1 -1
  24. package/dist/cjs/core/series/prepare-radar.js +1 -1
  25. package/dist/cjs/core/series/prepare-sankey.js +1 -1
  26. package/dist/cjs/core/series/prepare-scatter.js +1 -1
  27. package/dist/cjs/core/series/prepare-treemap.js +1 -1
  28. package/dist/cjs/core/series/prepare-waterfall.js +1 -1
  29. package/dist/cjs/core/series/prepare-x-range.js +1 -1
  30. package/dist/cjs/core/series/prepareSeries.d.ts +7 -1
  31. package/dist/cjs/core/series/prepareSeries.js +31 -0
  32. package/dist/cjs/core/series/types.d.ts +5 -0
  33. package/dist/cjs/core/series/utils.d.ts +4 -0
  34. package/dist/cjs/core/series/utils.js +9 -1
  35. package/dist/cjs/{hooks/useShapes/annotation/index.d.ts → core/shapes/annotation.d.ts} +1 -7
  36. package/dist/cjs/{hooks/useShapes/annotation/index.js → core/shapes/annotation.js} +2 -2
  37. package/dist/cjs/{hooks/useShapes → core/shapes}/area/prepare-data.d.ts +4 -4
  38. package/dist/cjs/{hooks/useShapes → core/shapes}/area/prepare-data.js +4 -4
  39. package/dist/cjs/core/shapes/area/renderer.d.ts +11 -0
  40. package/dist/cjs/core/shapes/area/renderer.js +181 -0
  41. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/area/types.d.ts +1 -3
  42. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/bar-x/prepare-data.d.ts +4 -4
  43. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/bar-x/prepare-data.js +6 -6
  44. package/dist/cjs/core/shapes/bar-x/renderer.d.ts +9 -0
  45. package/dist/cjs/core/shapes/bar-x/renderer.js +110 -0
  46. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/bar-x/types.d.ts +1 -2
  47. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/bar-y/prepare-data.d.ts +3 -3
  48. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/bar-y/prepare-data.js +3 -3
  49. package/dist/cjs/core/shapes/bar-y/renderer.d.ts +6 -0
  50. package/dist/cjs/core/shapes/bar-y/renderer.js +80 -0
  51. package/dist/cjs/{hooks/useShapes → core/shapes}/bar-y/types.d.ts +1 -1
  52. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/bar-y/utils.js +1 -1
  53. package/dist/cjs/{hooks/useShapes → core/shapes}/funnel/prepare-data.d.ts +1 -1
  54. package/dist/cjs/{hooks/useShapes → core/shapes}/funnel/prepare-data.js +1 -1
  55. package/dist/cjs/core/shapes/funnel/renderer.d.ts +6 -0
  56. package/dist/cjs/core/shapes/funnel/renderer.js +79 -0
  57. package/dist/cjs/{hooks/useShapes → core/shapes}/funnel/types.d.ts +2 -2
  58. package/dist/cjs/{hooks/useShapes → core/shapes}/heatmap/prepare-data.d.ts +3 -3
  59. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/heatmap/prepare-data.js +2 -2
  60. package/dist/cjs/core/shapes/heatmap/renderer.d.ts +6 -0
  61. package/dist/cjs/core/shapes/heatmap/renderer.js +55 -0
  62. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/heatmap/types.d.ts +1 -1
  63. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/line/prepare-data.d.ts +4 -4
  64. package/dist/cjs/{hooks/useShapes → core/shapes}/line/prepare-data.js +3 -3
  65. package/dist/cjs/core/shapes/line/renderer.d.ts +11 -0
  66. package/dist/cjs/core/shapes/line/renderer.js +167 -0
  67. package/dist/cjs/{hooks/useShapes → core/shapes}/line/types.d.ts +2 -4
  68. package/dist/cjs/core/shapes/marker.d.ts +45 -0
  69. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/marker.js +2 -2
  70. package/dist/cjs/{hooks/useShapes → core/shapes}/pie/prepare-data.d.ts +1 -1
  71. package/dist/cjs/{hooks/useShapes → core/shapes}/pie/prepare-data.js +3 -3
  72. package/dist/cjs/core/shapes/pie/renderer.d.ts +8 -0
  73. package/dist/cjs/core/shapes/pie/renderer.js +160 -0
  74. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/pie/types.d.ts +1 -1
  75. package/dist/cjs/{hooks/useShapes → core/shapes}/radar/prepare-data.d.ts +1 -1
  76. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/radar/prepare-data.js +2 -2
  77. package/dist/cjs/core/shapes/radar/renderer.d.ts +6 -0
  78. package/dist/cjs/core/shapes/radar/renderer.js +126 -0
  79. package/dist/cjs/{hooks/useShapes → core/shapes}/radar/types.d.ts +1 -1
  80. package/dist/cjs/{hooks/useShapes → core/shapes}/sankey/prepare-data.d.ts +1 -1
  81. package/dist/cjs/{hooks/useShapes → core/shapes}/sankey/prepare-data.js +1 -1
  82. package/dist/cjs/core/shapes/sankey/renderer.d.ts +6 -0
  83. package/dist/cjs/core/shapes/sankey/renderer.js +50 -0
  84. package/dist/cjs/{hooks/useShapes → core/shapes}/sankey/types.d.ts +1 -1
  85. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/scatter/prepare-data.d.ts +3 -3
  86. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/scatter/prepare-data.js +2 -2
  87. package/dist/cjs/core/shapes/scatter/renderer.d.ts +6 -0
  88. package/dist/cjs/core/shapes/scatter/renderer.js +52 -0
  89. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/scatter/types.d.ts +1 -1
  90. package/dist/cjs/{hooks/useShapes → core/shapes}/treemap/prepare-data.d.ts +1 -1
  91. package/dist/cjs/{hooks/useShapes → core/shapes}/treemap/prepare-data.js +3 -3
  92. package/dist/cjs/core/shapes/treemap/renderer.d.ts +6 -0
  93. package/dist/cjs/core/shapes/treemap/renderer.js +88 -0
  94. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/treemap/types.d.ts +1 -1
  95. package/dist/cjs/core/shapes/utils.d.ts +52 -0
  96. package/dist/cjs/core/shapes/utils.js +138 -0
  97. package/dist/cjs/{hooks/useShapes → core/shapes}/waterfall/prepare-data.d.ts +3 -3
  98. package/dist/cjs/{hooks/useShapes → core/shapes}/waterfall/prepare-data.js +4 -4
  99. package/dist/cjs/core/shapes/waterfall/renderer.d.ts +6 -0
  100. package/dist/cjs/core/shapes/waterfall/renderer.js +115 -0
  101. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/waterfall/types.d.ts +1 -1
  102. package/dist/cjs/{hooks/useShapes → core/shapes}/x-range/prepare-data.d.ts +3 -3
  103. package/dist/cjs/{hooks/useShapes → core/shapes}/x-range/prepare-data.js +4 -4
  104. package/dist/cjs/core/shapes/x-range/renderer.d.ts +6 -0
  105. package/dist/cjs/core/shapes/x-range/renderer.js +94 -0
  106. package/dist/{esm/hooks/useShapes → cjs/core/shapes}/x-range/types.d.ts +1 -1
  107. package/dist/cjs/core/types/chart/area.d.ts +0 -1
  108. package/dist/cjs/core/types/chart/axis.d.ts +0 -1
  109. package/dist/cjs/core/types/chart/base.d.ts +1 -4
  110. package/dist/cjs/core/types/chart/title.d.ts +18 -0
  111. package/dist/cjs/{hooks/utils/get-band-size.js → core/utils/band-size.js} +1 -1
  112. package/dist/{esm/hooks → cjs/core}/utils/bar-y.d.ts +3 -3
  113. package/dist/cjs/{hooks → core}/utils/bar-y.js +4 -4
  114. package/dist/cjs/core/utils/get-closest-data.d.ts +1 -1
  115. package/dist/cjs/core/utils/series/sorting.js +1 -1
  116. package/dist/cjs/core/utils/text.d.ts +0 -1
  117. package/dist/cjs/core/utils/text.js +0 -1
  118. package/dist/cjs/hooks/index.d.ts +1 -1
  119. package/dist/cjs/hooks/index.js +1 -1
  120. package/dist/cjs/hooks/types.d.ts +6 -3
  121. package/dist/cjs/hooks/useRangeSlider/types.d.ts +1 -1
  122. package/dist/cjs/hooks/useRangeSlider/utils.d.ts +1 -1
  123. package/dist/cjs/hooks/useShapes/HtmlLayer.js +4 -3
  124. package/dist/cjs/hooks/useShapes/area/index.d.ts +2 -2
  125. package/dist/cjs/hooks/useShapes/area/index.js +13 -185
  126. package/dist/cjs/hooks/useShapes/bar-x/index.d.ts +4 -4
  127. package/dist/cjs/hooks/useShapes/bar-x/index.js +10 -119
  128. package/dist/cjs/hooks/useShapes/bar-y/index.d.ts +3 -3
  129. package/dist/cjs/hooks/useShapes/bar-y/index.js +5 -84
  130. package/dist/cjs/hooks/useShapes/funnel/index.d.ts +4 -4
  131. package/dist/cjs/hooks/useShapes/funnel/index.js +4 -83
  132. package/dist/cjs/hooks/useShapes/heatmap/index.d.ts +4 -4
  133. package/dist/cjs/hooks/useShapes/heatmap/index.js +4 -59
  134. package/dist/cjs/hooks/useShapes/index.d.ts +14 -15
  135. package/dist/cjs/hooks/useShapes/index.js +13 -13
  136. package/dist/cjs/hooks/useShapes/line/index.d.ts +2 -2
  137. package/dist/cjs/hooks/useShapes/line/index.js +14 -172
  138. package/dist/cjs/hooks/useShapes/pie/index.d.ts +3 -5
  139. package/dist/cjs/hooks/useShapes/pie/index.js +3 -158
  140. package/dist/cjs/hooks/useShapes/radar/index.d.ts +2 -2
  141. package/dist/cjs/hooks/useShapes/radar/index.js +2 -121
  142. package/dist/cjs/hooks/useShapes/sankey/index.d.ts +2 -2
  143. package/dist/cjs/hooks/useShapes/sankey/index.js +2 -51
  144. package/dist/cjs/hooks/useShapes/scatter/index.d.ts +3 -3
  145. package/dist/cjs/hooks/useShapes/scatter/index.js +3 -58
  146. package/dist/cjs/hooks/useShapes/treemap/index.d.ts +2 -2
  147. package/dist/cjs/hooks/useShapes/treemap/index.js +2 -88
  148. package/dist/cjs/hooks/useShapes/utils.d.ts +2 -52
  149. package/dist/cjs/hooks/useShapes/utils.js +3 -140
  150. package/dist/cjs/hooks/useShapes/waterfall/index.d.ts +4 -4
  151. package/dist/cjs/hooks/useShapes/waterfall/index.js +6 -119
  152. package/dist/cjs/hooks/useShapes/x-range/index.d.ts +4 -4
  153. package/dist/cjs/hooks/useShapes/x-range/index.js +3 -98
  154. package/dist/cjs/setup-jsdom.js +7 -0
  155. package/dist/cjs/types/chart-ui.d.ts +2 -0
  156. package/dist/esm/components/ChartInner/index.js +2 -2
  157. package/dist/esm/components/ChartInner/styles.css +2 -2
  158. package/dist/esm/components/ChartInner/useChartInnerProps.js +2 -2
  159. package/dist/esm/components/ChartInner/utils/title.d.ts +2 -1
  160. package/dist/esm/components/ChartInner/utils/title.js +51 -14
  161. package/dist/esm/components/Legend/index.js +13 -14
  162. package/dist/esm/components/Title/index.d.ts +4 -2
  163. package/dist/esm/components/Title/index.js +9 -2
  164. package/dist/esm/components/Tooltip/index.js +22 -1
  165. package/dist/esm/core/axes/x-axis.js +1 -1
  166. package/dist/esm/core/axes/y-axis.js +1 -1
  167. package/dist/esm/core/scales/utils.d.ts +1 -1
  168. package/dist/esm/core/scales/utils.js +1 -1
  169. package/dist/esm/core/scales/x-scale.js +2 -2
  170. package/dist/esm/core/scales/y-scale.js +48 -4
  171. package/dist/esm/core/series/prepare-area.js +1 -1
  172. package/dist/esm/core/series/prepare-bar-x.js +1 -1
  173. package/dist/esm/core/series/prepare-bar-y.js +1 -1
  174. package/dist/esm/core/series/prepare-funnel.js +1 -1
  175. package/dist/esm/core/series/prepare-heatmap.js +1 -1
  176. package/dist/esm/core/series/prepare-legend.js +2 -2
  177. package/dist/esm/core/series/prepare-line.js +1 -1
  178. package/dist/esm/core/series/prepare-pie.js +1 -1
  179. package/dist/esm/core/series/prepare-radar.js +1 -1
  180. package/dist/esm/core/series/prepare-sankey.js +1 -1
  181. package/dist/esm/core/series/prepare-scatter.js +1 -1
  182. package/dist/esm/core/series/prepare-treemap.js +1 -1
  183. package/dist/esm/core/series/prepare-waterfall.js +1 -1
  184. package/dist/esm/core/series/prepare-x-range.js +1 -1
  185. package/dist/esm/core/series/prepareSeries.d.ts +7 -1
  186. package/dist/esm/core/series/prepareSeries.js +31 -0
  187. package/dist/esm/core/series/types.d.ts +5 -0
  188. package/dist/esm/core/series/utils.d.ts +4 -0
  189. package/dist/esm/core/series/utils.js +9 -1
  190. package/dist/esm/{hooks/useShapes/annotation/index.d.ts → core/shapes/annotation.d.ts} +1 -7
  191. package/dist/esm/{hooks/useShapes/annotation/index.js → core/shapes/annotation.js} +2 -2
  192. package/dist/esm/{hooks/useShapes → core/shapes}/area/prepare-data.d.ts +4 -4
  193. package/dist/esm/{hooks/useShapes → core/shapes}/area/prepare-data.js +4 -4
  194. package/dist/esm/core/shapes/area/renderer.d.ts +11 -0
  195. package/dist/esm/core/shapes/area/renderer.js +181 -0
  196. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/area/types.d.ts +1 -3
  197. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/bar-x/prepare-data.d.ts +4 -4
  198. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/bar-x/prepare-data.js +6 -6
  199. package/dist/esm/core/shapes/bar-x/renderer.d.ts +9 -0
  200. package/dist/esm/core/shapes/bar-x/renderer.js +110 -0
  201. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/bar-x/types.d.ts +1 -2
  202. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/bar-y/prepare-data.d.ts +3 -3
  203. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/bar-y/prepare-data.js +3 -3
  204. package/dist/esm/core/shapes/bar-y/renderer.d.ts +6 -0
  205. package/dist/esm/core/shapes/bar-y/renderer.js +80 -0
  206. package/dist/esm/{hooks/useShapes → core/shapes}/bar-y/types.d.ts +1 -1
  207. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/bar-y/utils.js +1 -1
  208. package/dist/esm/{hooks/useShapes → core/shapes}/funnel/prepare-data.d.ts +1 -1
  209. package/dist/esm/{hooks/useShapes → core/shapes}/funnel/prepare-data.js +1 -1
  210. package/dist/esm/core/shapes/funnel/renderer.d.ts +6 -0
  211. package/dist/esm/core/shapes/funnel/renderer.js +79 -0
  212. package/dist/esm/{hooks/useShapes → core/shapes}/funnel/types.d.ts +2 -2
  213. package/dist/esm/{hooks/useShapes → core/shapes}/heatmap/prepare-data.d.ts +3 -3
  214. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/heatmap/prepare-data.js +2 -2
  215. package/dist/esm/core/shapes/heatmap/renderer.d.ts +6 -0
  216. package/dist/esm/core/shapes/heatmap/renderer.js +55 -0
  217. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/heatmap/types.d.ts +1 -1
  218. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/line/prepare-data.d.ts +4 -4
  219. package/dist/esm/{hooks/useShapes → core/shapes}/line/prepare-data.js +3 -3
  220. package/dist/esm/core/shapes/line/renderer.d.ts +11 -0
  221. package/dist/esm/core/shapes/line/renderer.js +167 -0
  222. package/dist/esm/{hooks/useShapes → core/shapes}/line/types.d.ts +2 -4
  223. package/dist/esm/core/shapes/marker.d.ts +45 -0
  224. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/marker.js +2 -2
  225. package/dist/esm/{hooks/useShapes → core/shapes}/pie/prepare-data.d.ts +1 -1
  226. package/dist/esm/{hooks/useShapes → core/shapes}/pie/prepare-data.js +3 -3
  227. package/dist/esm/core/shapes/pie/renderer.d.ts +8 -0
  228. package/dist/esm/core/shapes/pie/renderer.js +160 -0
  229. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/pie/types.d.ts +1 -1
  230. package/dist/esm/{hooks/useShapes → core/shapes}/radar/prepare-data.d.ts +1 -1
  231. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/radar/prepare-data.js +2 -2
  232. package/dist/esm/core/shapes/radar/renderer.d.ts +6 -0
  233. package/dist/esm/core/shapes/radar/renderer.js +126 -0
  234. package/dist/esm/{hooks/useShapes → core/shapes}/radar/types.d.ts +1 -1
  235. package/dist/esm/{hooks/useShapes → core/shapes}/sankey/prepare-data.d.ts +1 -1
  236. package/dist/esm/{hooks/useShapes → core/shapes}/sankey/prepare-data.js +1 -1
  237. package/dist/esm/core/shapes/sankey/renderer.d.ts +6 -0
  238. package/dist/esm/core/shapes/sankey/renderer.js +50 -0
  239. package/dist/esm/{hooks/useShapes → core/shapes}/sankey/types.d.ts +1 -1
  240. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/scatter/prepare-data.d.ts +3 -3
  241. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/scatter/prepare-data.js +2 -2
  242. package/dist/esm/core/shapes/scatter/renderer.d.ts +6 -0
  243. package/dist/esm/core/shapes/scatter/renderer.js +52 -0
  244. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/scatter/types.d.ts +1 -1
  245. package/dist/esm/{hooks/useShapes → core/shapes}/treemap/prepare-data.d.ts +1 -1
  246. package/dist/esm/{hooks/useShapes → core/shapes}/treemap/prepare-data.js +3 -3
  247. package/dist/esm/core/shapes/treemap/renderer.d.ts +6 -0
  248. package/dist/esm/core/shapes/treemap/renderer.js +88 -0
  249. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/treemap/types.d.ts +1 -1
  250. package/dist/esm/core/shapes/utils.d.ts +52 -0
  251. package/dist/esm/core/shapes/utils.js +138 -0
  252. package/dist/esm/{hooks/useShapes → core/shapes}/waterfall/prepare-data.d.ts +3 -3
  253. package/dist/esm/{hooks/useShapes → core/shapes}/waterfall/prepare-data.js +4 -4
  254. package/dist/esm/core/shapes/waterfall/renderer.d.ts +6 -0
  255. package/dist/esm/core/shapes/waterfall/renderer.js +115 -0
  256. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/waterfall/types.d.ts +1 -1
  257. package/dist/esm/{hooks/useShapes → core/shapes}/x-range/prepare-data.d.ts +3 -3
  258. package/dist/esm/{hooks/useShapes → core/shapes}/x-range/prepare-data.js +4 -4
  259. package/dist/esm/core/shapes/x-range/renderer.d.ts +6 -0
  260. package/dist/esm/core/shapes/x-range/renderer.js +94 -0
  261. package/dist/{cjs/hooks/useShapes → esm/core/shapes}/x-range/types.d.ts +1 -1
  262. package/dist/esm/core/types/chart/area.d.ts +0 -1
  263. package/dist/esm/core/types/chart/axis.d.ts +0 -1
  264. package/dist/esm/core/types/chart/base.d.ts +1 -4
  265. package/dist/esm/core/types/chart/title.d.ts +18 -0
  266. package/dist/esm/{hooks/utils/get-band-size.js → core/utils/band-size.js} +1 -1
  267. package/dist/{cjs/hooks → esm/core}/utils/bar-y.d.ts +3 -3
  268. package/dist/esm/{hooks → core}/utils/bar-y.js +4 -4
  269. package/dist/esm/core/utils/get-closest-data.d.ts +1 -1
  270. package/dist/esm/core/utils/series/sorting.js +1 -1
  271. package/dist/esm/core/utils/text.d.ts +0 -1
  272. package/dist/esm/core/utils/text.js +0 -1
  273. package/dist/esm/hooks/index.d.ts +1 -1
  274. package/dist/esm/hooks/index.js +1 -1
  275. package/dist/esm/hooks/types.d.ts +6 -3
  276. package/dist/esm/hooks/useRangeSlider/types.d.ts +1 -1
  277. package/dist/esm/hooks/useRangeSlider/utils.d.ts +1 -1
  278. package/dist/esm/hooks/useShapes/HtmlLayer.js +4 -3
  279. package/dist/esm/hooks/useShapes/area/index.d.ts +2 -2
  280. package/dist/esm/hooks/useShapes/area/index.js +13 -185
  281. package/dist/esm/hooks/useShapes/bar-x/index.d.ts +4 -4
  282. package/dist/esm/hooks/useShapes/bar-x/index.js +10 -119
  283. package/dist/esm/hooks/useShapes/bar-y/index.d.ts +3 -3
  284. package/dist/esm/hooks/useShapes/bar-y/index.js +5 -84
  285. package/dist/esm/hooks/useShapes/funnel/index.d.ts +4 -4
  286. package/dist/esm/hooks/useShapes/funnel/index.js +4 -83
  287. package/dist/esm/hooks/useShapes/heatmap/index.d.ts +4 -4
  288. package/dist/esm/hooks/useShapes/heatmap/index.js +4 -59
  289. package/dist/esm/hooks/useShapes/index.d.ts +14 -15
  290. package/dist/esm/hooks/useShapes/index.js +13 -13
  291. package/dist/esm/hooks/useShapes/line/index.d.ts +2 -2
  292. package/dist/esm/hooks/useShapes/line/index.js +14 -172
  293. package/dist/esm/hooks/useShapes/pie/index.d.ts +3 -5
  294. package/dist/esm/hooks/useShapes/pie/index.js +3 -158
  295. package/dist/esm/hooks/useShapes/radar/index.d.ts +2 -2
  296. package/dist/esm/hooks/useShapes/radar/index.js +2 -121
  297. package/dist/esm/hooks/useShapes/sankey/index.d.ts +2 -2
  298. package/dist/esm/hooks/useShapes/sankey/index.js +2 -51
  299. package/dist/esm/hooks/useShapes/scatter/index.d.ts +3 -3
  300. package/dist/esm/hooks/useShapes/scatter/index.js +3 -58
  301. package/dist/esm/hooks/useShapes/treemap/index.d.ts +2 -2
  302. package/dist/esm/hooks/useShapes/treemap/index.js +2 -88
  303. package/dist/esm/hooks/useShapes/utils.d.ts +2 -52
  304. package/dist/esm/hooks/useShapes/utils.js +3 -140
  305. package/dist/esm/hooks/useShapes/waterfall/index.d.ts +4 -4
  306. package/dist/esm/hooks/useShapes/waterfall/index.js +6 -119
  307. package/dist/esm/hooks/useShapes/x-range/index.d.ts +4 -4
  308. package/dist/esm/hooks/useShapes/x-range/index.js +3 -98
  309. package/dist/esm/setup-jsdom.js +7 -0
  310. package/dist/esm/types/chart-ui.d.ts +2 -0
  311. package/package.json +5 -2
  312. package/dist/cjs/hooks/useSeries/index.d.ts +0 -12
  313. package/dist/cjs/hooks/useSeries/index.js +0 -40
  314. package/dist/cjs/hooks/useSeries/types.d.ts +0 -1
  315. package/dist/cjs/hooks/useSeries/types.js +0 -1
  316. package/dist/cjs/hooks/useSeries/utils.d.ts +0 -1
  317. package/dist/cjs/hooks/useSeries/utils.js +0 -1
  318. package/dist/cjs/hooks/useShapes/marker.d.ts +0 -15
  319. package/dist/cjs/hooks/utils/index.d.ts +0 -1
  320. package/dist/cjs/hooks/utils/index.js +0 -1
  321. package/dist/esm/hooks/useSeries/index.d.ts +0 -12
  322. package/dist/esm/hooks/useSeries/index.js +0 -40
  323. package/dist/esm/hooks/useSeries/types.d.ts +0 -1
  324. package/dist/esm/hooks/useSeries/types.js +0 -1
  325. package/dist/esm/hooks/useSeries/utils.d.ts +0 -1
  326. package/dist/esm/hooks/useSeries/utils.js +0 -1
  327. package/dist/esm/hooks/useShapes/marker.d.ts +0 -15
  328. package/dist/esm/hooks/utils/index.d.ts +0 -1
  329. package/dist/esm/hooks/utils/index.js +0 -1
  330. /package/dist/cjs/{hooks/useShapes → core/shapes}/area/types.js +0 -0
  331. /package/dist/cjs/{hooks/constants.d.ts → core/shapes/bar-constants.d.ts} +0 -0
  332. /package/dist/cjs/{hooks/constants.js → core/shapes/bar-constants.js} +0 -0
  333. /package/dist/cjs/{hooks/useShapes → core/shapes}/bar-x/types.js +0 -0
  334. /package/dist/cjs/{hooks/useShapes → core/shapes}/bar-y/types.js +0 -0
  335. /package/dist/cjs/{hooks/useShapes → core/shapes}/bar-y/utils.d.ts +0 -0
  336. /package/dist/cjs/{hooks/useShapes → core/shapes}/funnel/types.js +0 -0
  337. /package/dist/cjs/{hooks/useShapes → core/shapes}/heatmap/types.js +0 -0
  338. /package/dist/cjs/{hooks/useShapes → core/shapes}/line/types.js +0 -0
  339. /package/dist/cjs/{hooks/useShapes → core/shapes}/pie/types.js +0 -0
  340. /package/dist/cjs/{hooks/useShapes → core/shapes}/pie/utils.d.ts +0 -0
  341. /package/dist/cjs/{hooks/useShapes → core/shapes}/pie/utils.js +0 -0
  342. /package/dist/cjs/{hooks/useShapes → core/shapes}/radar/types.js +0 -0
  343. /package/dist/cjs/{hooks/useShapes → core/shapes}/sankey/sankey-layout.d.ts +0 -0
  344. /package/dist/cjs/{hooks/useShapes → core/shapes}/sankey/sankey-layout.js +0 -0
  345. /package/dist/cjs/{hooks/useShapes → core/shapes}/sankey/types.js +0 -0
  346. /package/dist/cjs/{hooks/useShapes → core/shapes}/scatter/types.js +0 -0
  347. /package/dist/cjs/{hooks/useShapes → core/shapes}/treemap/types.js +0 -0
  348. /package/dist/cjs/{hooks/useShapes → core/shapes}/waterfall/types.js +0 -0
  349. /package/dist/cjs/{hooks/useShapes → core/shapes}/x-range/types.js +0 -0
  350. /package/dist/cjs/{hooks/utils/get-band-size.d.ts → core/utils/band-size.d.ts} +0 -0
  351. /package/dist/esm/{hooks/useShapes → core/shapes}/area/types.js +0 -0
  352. /package/dist/esm/{hooks/constants.d.ts → core/shapes/bar-constants.d.ts} +0 -0
  353. /package/dist/esm/{hooks/constants.js → core/shapes/bar-constants.js} +0 -0
  354. /package/dist/esm/{hooks/useShapes → core/shapes}/bar-x/types.js +0 -0
  355. /package/dist/esm/{hooks/useShapes → core/shapes}/bar-y/types.js +0 -0
  356. /package/dist/esm/{hooks/useShapes → core/shapes}/bar-y/utils.d.ts +0 -0
  357. /package/dist/esm/{hooks/useShapes → core/shapes}/funnel/types.js +0 -0
  358. /package/dist/esm/{hooks/useShapes → core/shapes}/heatmap/types.js +0 -0
  359. /package/dist/esm/{hooks/useShapes → core/shapes}/line/types.js +0 -0
  360. /package/dist/esm/{hooks/useShapes → core/shapes}/pie/types.js +0 -0
  361. /package/dist/esm/{hooks/useShapes → core/shapes}/pie/utils.d.ts +0 -0
  362. /package/dist/esm/{hooks/useShapes → core/shapes}/pie/utils.js +0 -0
  363. /package/dist/esm/{hooks/useShapes → core/shapes}/radar/types.js +0 -0
  364. /package/dist/esm/{hooks/useShapes → core/shapes}/sankey/sankey-layout.d.ts +0 -0
  365. /package/dist/esm/{hooks/useShapes → core/shapes}/sankey/sankey-layout.js +0 -0
  366. /package/dist/esm/{hooks/useShapes → core/shapes}/sankey/types.js +0 -0
  367. /package/dist/esm/{hooks/useShapes → core/shapes}/scatter/types.js +0 -0
  368. /package/dist/esm/{hooks/useShapes → core/shapes}/treemap/types.js +0 -0
  369. /package/dist/esm/{hooks/useShapes → core/shapes}/waterfall/types.js +0 -0
  370. /package/dist/esm/{hooks/useShapes → core/shapes}/x-range/types.js +0 -0
  371. /package/dist/esm/{hooks/utils/get-band-size.d.ts → core/utils/band-size.d.ts} +0 -0
@@ -0,0 +1,6 @@
1
+ import type { Dispatch } from 'd3-dispatch';
2
+ import type { PreparedSeriesOptions } from '../../series/types';
3
+ import type { PreparedXRangeData } from './types';
4
+ export declare function renderXRange(elements: {
5
+ plot: SVGGElement;
6
+ }, preparedData: PreparedXRangeData[], seriesOptions: PreparedSeriesOptions, dispatcher?: Dispatch<object>): () => void;
@@ -0,0 +1,94 @@
1
+ import { color } from 'd3-color';
2
+ import { select } from 'd3-selection';
3
+ import get from 'lodash/get';
4
+ import { block } from '../../../utils';
5
+ import { getRectPath } from '../../shapes/utils';
6
+ import { getLineDashArray } from '../../utils';
7
+ const b = block('x-range');
8
+ export function renderXRange(elements, preparedData, seriesOptions, dispatcher) {
9
+ const svgElement = select(elements.plot);
10
+ svgElement.selectAll('*').remove();
11
+ const segmentSelection = svgElement
12
+ .selectAll(`path.${b('segment')}`)
13
+ .data(preparedData)
14
+ .join('path')
15
+ .attr('d', (d) => {
16
+ const borderRadius = Math.min(d.height / 2, d.width / 2, d.series.borderRadius);
17
+ return getRectPath({
18
+ x: d.x,
19
+ y: d.y,
20
+ width: d.width,
21
+ height: d.height,
22
+ borderRadius,
23
+ }).toString();
24
+ })
25
+ .attr('class', b('segment'))
26
+ .attr('fill', (d) => d.color)
27
+ .attr('opacity', (d) => { var _a; return (_a = d.data.opacity) !== null && _a !== void 0 ? _a : d.series.opacity; })
28
+ .attr('cursor', (d) => d.series.cursor);
29
+ svgElement
30
+ .selectAll(`path.${b('segment-border')}`)
31
+ .data(preparedData.filter((d) => d.series.borderWidth > 0))
32
+ .join('path')
33
+ .attr('d', (d) => {
34
+ const borderRadius = Math.min(d.height / 2, d.width / 2, d.series.borderRadius);
35
+ return getRectPath({
36
+ x: d.x,
37
+ y: d.y,
38
+ width: d.width,
39
+ height: d.height,
40
+ borderRadius,
41
+ }).toString();
42
+ })
43
+ .attr('class', b('segment-border'))
44
+ .attr('fill', 'none')
45
+ .attr('stroke', (d) => d.series.borderColor)
46
+ .attr('stroke-width', (d) => d.series.borderWidth)
47
+ .attr('stroke-dasharray', (d) => getLineDashArray(d.series.borderDashStyle, d.series.borderWidth))
48
+ .attr('opacity', (d) => { var _a; return (_a = d.data.opacity) !== null && _a !== void 0 ? _a : d.series.opacity; })
49
+ .attr('pointer-events', 'none');
50
+ const svgLabels = preparedData.flatMap((d) => d.svgLabels);
51
+ svgElement
52
+ .selectAll(`text.${b('label')}`)
53
+ .data(svgLabels)
54
+ .join('text')
55
+ .attr('class', b('label'))
56
+ .attr('x', (d) => d.x)
57
+ .attr('y', (d) => d.y)
58
+ .attr('text-anchor', (d) => d.textAnchor)
59
+ .attr('dominant-baseline', 'central')
60
+ .attr('pointer-events', 'none')
61
+ .style('font-size', (d) => d.style.fontSize)
62
+ .style('font-weight', (d) => d.style.fontWeight || null)
63
+ .style('fill', (d) => d.style.fontColor || null)
64
+ .html((d) => d.text);
65
+ const hoverOptions = get(seriesOptions, 'x-range.states.hover');
66
+ const inactiveOptions = get(seriesOptions, 'x-range.states.inactive');
67
+ function handleShapeHover(data) {
68
+ if (hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled) {
69
+ const hoveredSet = new Set(data === null || data === void 0 ? void 0 : data.map((d) => d.data));
70
+ segmentSelection.attr('fill', (d) => {
71
+ var _a;
72
+ const fillColor = d.color;
73
+ if (hoveredSet.has(d.data)) {
74
+ return (((_a = color(fillColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions.brightness).toString()) || fillColor);
75
+ }
76
+ return fillColor;
77
+ });
78
+ }
79
+ if (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled) {
80
+ const hoveredSeries = data === null || data === void 0 ? void 0 : data.map((d) => d.series.id);
81
+ segmentSelection.attr('opacity', (d) => {
82
+ var _a, _b;
83
+ if ((hoveredSeries === null || hoveredSeries === void 0 ? void 0 : hoveredSeries.length) && !hoveredSeries.includes(d.series.id)) {
84
+ return inactiveOptions.opacity || null;
85
+ }
86
+ return (_b = (_a = d.data.opacity) !== null && _a !== void 0 ? _a : d.series.opacity) !== null && _b !== void 0 ? _b : null;
87
+ });
88
+ }
89
+ }
90
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.x-range', handleShapeHover);
91
+ return () => {
92
+ dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.x-range', null);
93
+ };
94
+ }
@@ -1,5 +1,5 @@
1
1
  import type { HtmlItem, LabelData, TooltipDataChunkXRange } from '../../../types';
2
- import type { PreparedXRangeSeries } from '../../useSeries/types';
2
+ import type { PreparedXRangeSeries } from '../../series/types';
3
3
  export type PreparedXRangeData = Omit<TooltipDataChunkXRange, 'series'> & {
4
4
  x: number;
5
5
  y: number;
@@ -87,7 +87,6 @@ export interface AreaSeries<T = MeaningfulAny> extends BaseSeries {
87
87
  * - `'connect'`: Connect points across null values (skip nulls in rendering). **Not supported with `stacking`.**
88
88
  * - `'zero'`: Treat null values as zero
89
89
  * - `'skip'`: Omit the data point (creates gap in area)
90
- *
91
90
  * @default 'skip'
92
91
  */
93
92
  nullMode?: 'connect' | 'zero' | 'skip';
@@ -298,7 +298,6 @@ export interface AxisPlotShape extends AxisPlot {
298
298
  * Called with the pixel coordinates of the shape and the plot area dimensions.
299
299
  * Must return a string of valid SVG markup that will be inserted inside a `<g>` container
300
300
  * positioned at the shape's axis value.
301
- *
302
301
  * @example
303
302
  * ```
304
303
  * renderer: ({plotHeight}) =>
@@ -19,17 +19,14 @@ export type CustomFormat = {
19
19
  * Specifies how a value should be formatted for display.
20
20
  *
21
21
  * - `{ type: 'number' }` — numeric formatting with optional precision, units, percent display, etc.
22
- * See [FormatNumberOptions](https://gravity-ui.github.io/charts/pages/api/Utilities/interfaces/FormatNumberOptions.html) for all available options.
22
+ * See [FormatNumberOptions](https://gravity-ui.github.io/charts/pages/api/Utilities/interfaces/FormatNumberOptions.html) for all available options.
23
23
  * - `{ type: 'date' }` — date/time formatting
24
- *
25
24
  * @example
26
25
  * // Two decimal places, shown as percent
27
26
  * { type: 'number', precision: 2, format: 'percent' }
28
- *
29
27
  * @example
30
28
  * // Compact thousands: 1 500 000 → "1.5M"
31
29
  * { type: 'number', unit: 'auto', precision: 1 }
32
- *
33
30
  * @example
34
31
  * // Date value (Unix ms) formatted as "17 October 2025"
35
32
  * { type: 'date', format: 'DD MMMM YYYY' }
@@ -5,6 +5,7 @@ export interface ChartTitle {
5
5
  /**
6
6
  * Maximum number of text rows. If the text exceeds this limit, it is truncated with an ellipsis.
7
7
  * Default: 1
8
+ * Not applicable when `html: true` — HTML content manages its own layout.
8
9
  */
9
10
  maxRowCount?: number;
10
11
  /**
@@ -17,4 +18,21 @@ export interface ChartTitle {
17
18
  * It is assigned as a data-qa attribute to an element.
18
19
  */
19
20
  qa?: string;
21
+ /**
22
+ * Enables HTML rendering for the chart title.
23
+ * When true, the title is rendered as an HTML element on top of the SVG
24
+ * instead of an SVG text node. This allows using arbitrary HTML tags
25
+ * (e.g. links, styled spans) that cannot be embedded in SVG.
26
+ * The element will be displayed outside the box of the SVG element.
27
+ */
28
+ html?: boolean;
29
+ /**
30
+ * Maximum height of the title area. Accepts a pixel value (`number` or `"100px"`)
31
+ * or a percentage string (`"50%"`) relative to the full chart height.
32
+ * When the title content exceeds this height, it is clipped.
33
+ * Only applicable when `html: true`.
34
+ *
35
+ * Default: 50%
36
+ */
37
+ maxHeight?: string | number;
20
38
  }
@@ -1,4 +1,4 @@
1
- import { isBandScale } from '../../core/utils';
1
+ import { isBandScale } from '../utils';
2
2
  export function getBandSize({ domain, scale, }) {
3
3
  if (!scale || !domain.length) {
4
4
  return 0;
@@ -1,7 +1,7 @@
1
- import type { ChartScale } from '../../core/scales/types';
2
1
  import type { BarYSeries, BarYSeriesData } from '../../types';
3
- import type { PreparedYAxis } from '../useAxis/types';
4
- import type { PreparedBarYSeries, PreparedSeriesOptions } from '../useSeries/types';
2
+ import type { PreparedYAxis } from '../axes/types';
3
+ import type { ChartScale } from '../scales/types';
4
+ import type { PreparedBarYSeries, PreparedSeriesOptions } from '../series/types';
5
5
  /**
6
6
  * BarY always filters out data with null or replace null by zero.
7
7
  */
@@ -1,9 +1,9 @@
1
1
  import { max } from 'd3-array';
2
2
  import get from 'lodash/get';
3
- import { getDataCategoryValue } from '../../core/utils';
4
- import { MIN_BAR_GAP, MIN_BAR_GROUP_GAP, MIN_BAR_WIDTH } from '../constants';
5
- import { getSeriesStackId } from '../useSeries/utils';
6
- import { getBandSize } from './get-band-size';
3
+ import { getSeriesStackId } from '../series/utils';
4
+ import { MIN_BAR_GAP, MIN_BAR_GROUP_GAP, MIN_BAR_WIDTH } from '../shapes/bar-constants';
5
+ import { getDataCategoryValue } from '../utils';
6
+ import { getBandSize } from './band-size';
7
7
  const isSeriesDataValid = (d) => d.x !== null;
8
8
  export function groupBarYDataByYValue(series, yAxis) {
9
9
  const data = {};
@@ -1,4 +1,4 @@
1
- import type { ShapeData } from '../../hooks';
1
+ import type { ShapeData } from '../../hooks/useShapes';
2
2
  import type { ChartSeries, ChartSeriesData, TooltipDataChunk } from '../../types';
3
3
  type GetClosestPointsArgs = {
4
4
  position: [number, number];
@@ -1,8 +1,8 @@
1
1
  import { sort } from 'd3-array';
2
2
  import { isEmpty } from 'lodash';
3
3
  import get from 'lodash/get';
4
- import { getAxisCategories } from '../../utils';
5
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 : [];
@@ -4,7 +4,6 @@ import type { BaseTextStyle, MeaningfulAny } from '../../types';
4
4
  * Approximate ratio of descenders relative to the full font em height.
5
5
  * Based on the Chromium hanging baseline algorithm where hanging offset ≈ ascent × 0.2.
6
6
  * This means ascent ≈ 80% of em height, descenders ≈ 20%.
7
- *
8
7
  * @see https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/canvas/text_metrics.cc;l=32
9
8
  */
10
9
  export declare const DESCENDER_RATIO = 0.2;
@@ -5,7 +5,6 @@ const b = block('chart');
5
5
  * Approximate ratio of descenders relative to the full font em height.
6
6
  * Based on the Chromium hanging baseline algorithm where hanging offset ≈ ascent × 0.2.
7
7
  * This means ascent ≈ 80% of em height, descenders ≈ 20%.
8
- *
9
8
  * @see https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/html/canvas/text_metrics.cc;l=32
10
9
  */
11
10
  export const DESCENDER_RATIO = 0.2;
@@ -8,7 +8,7 @@ export * from './useCrosshair';
8
8
  export * from './usePrevious';
9
9
  export * from './useRangeSlider';
10
10
  export * from './useRangeSlider/types';
11
- export * from './useSeries';
11
+ export { getPreparedSeries, getVisibleSeries } from '../core/series';
12
12
  export * from '../core/series/types';
13
13
  export * from './useShapes';
14
14
  export * from '../core/layout/split';
@@ -8,7 +8,7 @@ export * from './useCrosshair';
8
8
  export * from './usePrevious';
9
9
  export * from './useRangeSlider';
10
10
  export * from './useRangeSlider/types';
11
- export * from './useSeries';
11
+ export { getPreparedSeries, getVisibleSeries } from '../core/series';
12
12
  export * from '../core/series/types';
13
13
  export * from './useShapes';
14
14
  export * from '../core/layout/split';
@@ -1,5 +1,6 @@
1
1
  import type { TextRowData } from '../components/types';
2
- import type { ChartBrush, ChartData, ChartMargin, ChartTitle, ChartZoom, DeepRequired } from '../types';
2
+ import type { BaseTextStyle, ChartBrush, ChartData, ChartMargin, ChartTitle, ChartZoom, DeepRequired } from '../types';
3
+ import type { HtmlItem } from '../types/chart-ui';
3
4
  export type PreparedZoom = DeepRequired<Omit<ChartZoom, 'enabled' | 'brush'>> & DeepRequired<{
4
5
  brush: ChartBrush;
5
6
  }>;
@@ -7,10 +8,12 @@ export type PreparedChart = {
7
8
  margin: ChartMargin;
8
9
  zoom: PreparedZoom | null;
9
10
  };
10
- export type PreparedTitle = Omit<ChartTitle, 'margin'> & {
11
+ export type PreparedTitle = Omit<ChartTitle, 'margin' | 'style'> & {
11
12
  height: number;
12
13
  margin: number;
13
- contentRows: TextRowData[];
14
+ style: BaseTextStyle;
15
+ contentRows?: TextRowData[];
16
+ htmlElements?: HtmlItem[];
14
17
  };
15
18
  export type PreparedTooltip = ChartData['tooltip'] & {
16
19
  enabled: boolean;
@@ -1,9 +1,9 @@
1
1
  import type { ChartScale } from '../../core/scales/types';
2
+ import type { PreparedLegend, PreparedSeries, PreparedSeriesOptions } from '../../core/series/types';
2
3
  import type { ChartXAxis, ChartYAxis, LegendConfig } from '../../types';
3
4
  import type { PreparedChart } from '../types';
4
5
  import type { PreparedRangeSlider, PreparedXAxis, PreparedYAxis } from '../useAxis/types';
5
6
  import type { BrushSelection, UseBrushProps } from '../useBrush/types';
6
- import type { PreparedLegend, PreparedSeries, PreparedSeriesOptions } from '../useSeries/types';
7
7
  export type RangeSliderState = {
8
8
  max: number;
9
9
  min: number;
@@ -1,8 +1,8 @@
1
1
  import type { ChartScale } from '../../core/scales/types';
2
+ import type { PreparedLegend } from '../../core/series/types';
2
3
  import type { PreparedChart } from '../types';
3
4
  import type { PreparedRangeSlider } from '../useAxis/types';
4
5
  import type { BrushSelection } from '../useBrush/types';
5
- import type { PreparedLegend } from '../useSeries/types';
6
6
  import type { RangeSliderState } from './types';
7
7
  export declare function getRangeSliderOffsetTop(args: {
8
8
  height: number;
@@ -19,8 +19,9 @@ export const HtmlLayer = (props) => {
19
19
  return null;
20
20
  }
21
21
  return (React.createElement(Portal, { container: htmlLayout }, items.map((item, index) => {
22
- var _a, _b, _c;
23
- const style = Object.assign(Object.assign({}, item.style), { color: (_b = (_a = item.style) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : (_c = item.style) === null || _c === void 0 ? void 0 : _c.fontColor, position: 'absolute', left: item.x, top: item.y });
24
- return (React.createElement("div", { className: b('html-layer-item'), key: index, dangerouslySetInnerHTML: { __html: item.content }, style: style }));
22
+ var _a, _b, _c, _d;
23
+ const scope = (_a = item.scope) !== null && _a !== void 0 ? _a : 'plot';
24
+ const style = Object.assign(Object.assign({}, item.style), { color: (_c = (_b = item.style) === null || _b === void 0 ? void 0 : _b.color) !== null && _c !== void 0 ? _c : (_d = item.style) === null || _d === void 0 ? void 0 : _d.fontColor, position: 'absolute', left: item.x, top: item.y });
25
+ return (React.createElement("div", { className: b('html-layer-item', { plot: scope === 'plot' }), key: index, dangerouslySetInnerHTML: { __html: item.content }, style: style }));
25
26
  })));
26
27
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../useSeries/types';
4
- import type { PreparedAreaData } from './types';
3
+ import type { PreparedSeriesOptions } from '../../../core/series/types';
4
+ import type { PreparedAreaData } from '../../../core/shapes/area/types';
5
5
  type Args = {
6
6
  boundsHeight: number;
7
7
  boundsWidth: number;
@@ -1,18 +1,11 @@
1
1
  import React from 'react';
2
- import { color } from 'd3-color';
3
- import { select } from 'd3-selection';
4
- import { area as areaGenerator, line as lineGenerator } from 'd3-shape';
5
- import get from 'lodash/get';
2
+ import { renderArea } from '../../../core/shapes/area/renderer';
6
3
  import { filterOverlappingLabels } from '../../../core/utils';
7
4
  import { block } from '../../../utils';
8
5
  import { HtmlLayer } from '../HtmlLayer';
9
- import { renderAnnotations } from '../annotation';
10
- import { getMarkerHaloVisibility, getMarkerVisibility, renderMarker, selectMarkerHalo, selectMarkerSymbol, setMarker, } from '../marker';
11
- import { setActiveState } from '../utils';
12
6
  const b = block('area');
13
7
  export const AreaSeriesShapes = (args) => {
14
8
  const { boundsHeight, boundsWidth, dispatcher, preparedData, seriesOptions, htmlLayout, clipPathId, } = args;
15
- const hoveredDataRef = React.useRef(null);
16
9
  const plotRef = React.useRef(null);
17
10
  const markersRef = React.useRef(null);
18
11
  const hoverMarkersRef = React.useRef(null);
@@ -21,185 +14,20 @@ export const AreaSeriesShapes = (args) => {
21
14
  return preparedData.some((d) => d === null || d === void 0 ? void 0 : d.series.dataLabels.allowOverlap);
22
15
  }, [preparedData]);
23
16
  React.useEffect(() => {
24
- if (!plotRef.current || !markersRef.current) {
17
+ if (!plotRef.current ||
18
+ !markersRef.current ||
19
+ !hoverMarkersRef.current ||
20
+ !annotationsRef.current) {
25
21
  return () => { };
26
22
  }
27
- const plotSvgElement = select(plotRef.current);
28
- const markersSvgElement = select(markersRef.current);
29
- const hoverMarkersSvgElement = select(hoverMarkersRef.current);
30
- const hoverOptions = get(seriesOptions, 'area.states.hover');
31
- const inactiveOptions = get(seriesOptions, 'area.states.inactive');
32
- const line = lineGenerator()
33
- .x((d) => d.x)
34
- .defined((d) => d.y !== null)
35
- .y((d) => d.y);
36
- plotSvgElement.selectAll('*').remove();
37
- markersSvgElement.selectAll('*').remove();
38
- const shapeSelection = plotSvgElement
39
- .selectAll('shape')
40
- .data(preparedData)
41
- .join('g')
42
- .attr('class', b('series'))
43
- .attr('cursor', (d) => d.series.cursor);
44
- shapeSelection
45
- .append('path')
46
- .attr('class', b('line'))
47
- .attr('d', (d) => line(d.points))
48
- .attr('fill', 'none')
49
- .attr('stroke', (d) => d.color)
50
- .attr('stroke-width', (d) => d.width)
51
- .attr('stroke-linejoin', 'round')
52
- .attr('stroke-linecap', 'round');
53
- const area = areaGenerator()
54
- .defined((d) => d.y !== null)
55
- .x((d) => d.x)
56
- .y0((d) => d.y0)
57
- .y1((d) => d.y);
58
- shapeSelection
59
- .append('path')
60
- .attr('class', b('region'))
61
- .attr('d', (d) => area(d.points))
62
- .attr('fill', (d) => d.color)
63
- .attr('opacity', (d) => d.opacity);
64
- let dataLabels = preparedData.reduce((acc, d) => {
65
- return acc.concat(d.svgLabels);
66
- }, []);
67
- if (!allowOverlapDataLabels) {
68
- dataLabels = filterOverlappingLabels(dataLabels);
69
- }
70
- const labelsSelection = plotSvgElement
71
- .selectAll('text')
72
- .data(dataLabels)
73
- .join('text')
74
- .html((d) => d.text)
75
- .attr('class', b('label'))
76
- .attr('x', (d) => d.x)
77
- .attr('y', (d) => d.y)
78
- .attr('text-anchor', (d) => d.textAnchor)
79
- .style('font-size', (d) => d.style.fontSize)
80
- .style('font-weight', (d) => d.style.fontWeight || null)
81
- .style('fill', (d) => d.style.fontColor || null);
82
- const markers = preparedData.reduce((acc, d) => acc.concat(d.markers), []);
83
- const markerSelection = markersSvgElement
84
- .selectAll('marker')
85
- .data(markers)
86
- .join('g')
87
- .call(renderMarker);
88
- if (annotationsRef.current) {
89
- const anchors = preparedData.flatMap((d) => d.annotations);
90
- renderAnnotations({
91
- anchors,
92
- container: select(annotationsRef.current),
93
- plotHeight: boundsHeight,
94
- plotWidth: boundsWidth,
95
- });
96
- }
97
- const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
98
- const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
99
- function handleShapeHover(data) {
100
- hoveredDataRef.current = data;
101
- const selected = (data === null || data === void 0 ? void 0 : data.filter((d) => d.series.type === 'area')) || [];
102
- const selectedDataItems = selected.map((d) => d.data);
103
- const selectedSeriesIds = selected.map((d) => { var _a; return (_a = d.series) === null || _a === void 0 ? void 0 : _a.id; });
104
- shapeSelection.datum((d, index, list) => {
105
- var _a;
106
- const elementSelection = select(list[index]);
107
- const hovered = Boolean(hoverEnabled && selectedSeriesIds.includes(d.id));
108
- if (d.hovered !== hovered) {
109
- d.hovered = hovered;
110
- let strokeColor = d.color || '';
111
- if (d.hovered) {
112
- strokeColor =
113
- ((_a = color(strokeColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.brightness).toString()) ||
114
- strokeColor;
115
- }
116
- elementSelection.selectAll(`.${b('line')}`).attr('stroke', strokeColor);
117
- elementSelection.selectAll(`.${b('region')}`).attr('fill', strokeColor);
118
- }
119
- return setActiveState({
120
- element: list[index],
121
- state: inactiveOptions,
122
- active: Boolean(!inactiveEnabled ||
123
- !selectedSeriesIds.length ||
124
- selectedSeriesIds.includes(d.id)),
125
- datum: d,
126
- });
127
- });
128
- labelsSelection.datum((d, index, list) => {
129
- return setActiveState({
130
- element: list[index],
131
- state: inactiveOptions,
132
- active: Boolean(!inactiveEnabled ||
133
- !selectedSeriesIds.length ||
134
- selectedSeriesIds.includes(d.series.id)),
135
- datum: d,
136
- });
137
- });
138
- markerSelection.datum((d, index, list) => {
139
- const elementSelection = select(list[index]);
140
- const hovered = Boolean(hoverEnabled && selectedDataItems.includes(d.point.data));
141
- if (d.hovered !== hovered) {
142
- d.hovered = hovered;
143
- elementSelection.attr('visibility', getMarkerVisibility(d));
144
- selectMarkerHalo(elementSelection).attr('visibility', getMarkerHaloVisibility);
145
- selectMarkerSymbol(elementSelection).call(setMarker, hovered ? 'hover' : 'normal');
146
- }
147
- if (d.point.series.marker.states.normal.enabled) {
148
- const isActive = Boolean(!inactiveEnabled ||
149
- !selectedSeriesIds.length ||
150
- selectedSeriesIds.includes(d.point.series.id));
151
- setActiveState({
152
- element: list[index],
153
- state: inactiveOptions,
154
- active: isActive,
155
- datum: d,
156
- });
157
- }
158
- return d;
159
- });
160
- hoverMarkersSvgElement.selectAll('*').remove();
161
- if (hoverEnabled && selected.length > 0) {
162
- const hoverOnlyMarkers = [];
163
- for (const chunk of selected) {
164
- const seriesData = preparedData.find((pd) => pd.id === chunk.series.id);
165
- if (!seriesData) {
166
- continue;
167
- }
168
- const { series } = seriesData;
169
- if (series.marker.states.normal.enabled ||
170
- !series.marker.states.hover.enabled) {
171
- continue;
172
- }
173
- const point = seriesData.points.find((p) => p.data === chunk.data);
174
- if (!point || point.y === null) {
175
- continue;
176
- }
177
- hoverOnlyMarkers.push({
178
- point: point,
179
- active: true,
180
- hovered: true,
181
- clipped: false,
182
- });
183
- }
184
- if (hoverOnlyMarkers.length > 0) {
185
- hoverMarkersSvgElement
186
- .selectAll('g')
187
- .data(hoverOnlyMarkers)
188
- .join('g')
189
- .call(renderMarker)
190
- .each((_d, i, nodes) => {
191
- selectMarkerSymbol(select(nodes[i])).call(setMarker, 'hover');
192
- });
193
- }
194
- }
195
- }
196
- if (hoveredDataRef.current !== null) {
197
- handleShapeHover(hoveredDataRef.current);
198
- }
199
- dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.area', handleShapeHover);
200
- return () => {
201
- dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.on('hover-shape.area', null);
202
- };
23
+ return renderArea({
24
+ plot: plotRef.current,
25
+ markers: markersRef.current,
26
+ hoverMarkers: hoverMarkersRef.current,
27
+ annotations: annotationsRef.current,
28
+ boundsWidth,
29
+ boundsHeight,
30
+ }, preparedData, seriesOptions, allowOverlapDataLabels, dispatcher);
203
31
  }, [
204
32
  allowOverlapDataLabels,
205
33
  boundsHeight,
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { Dispatch } from 'd3-dispatch';
3
- import type { PreparedSeriesOptions } from '../../useSeries/types';
4
- import type { PreparedBarXData } from './types';
5
- export { prepareBarXData } from './prepare-data';
6
- export * from './types';
3
+ import type { PreparedSeriesOptions } from '../../../core/series/types';
4
+ import type { PreparedBarXData } from '../../../core/shapes/bar-x/types';
5
+ export { prepareBarXData } from '../../../core/shapes/bar-x/prepare-data';
6
+ export * from '../../../core/shapes/bar-x/types';
7
7
  type Args = {
8
8
  boundsHeight: number;
9
9
  boundsWidth: number;