@tabler/charts 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/README.md +94 -16
  2. package/dist/{annotations-CpCWA29b.cjs → annotations--m-HzMBM.cjs} +86 -10
  3. package/dist/annotations--m-HzMBM.cjs.map +1 -0
  4. package/dist/{annotations-B02GR_KU.d.ts → annotations-CCDUC1lW.d.ts} +16 -30
  5. package/dist/{annotations-CHafaGd4.d.cts → annotations-CqZM1z9R.d.cts} +16 -30
  6. package/dist/{annotations-BQ8l-qHs.js → annotations-DGITy6th.js} +86 -10
  7. package/dist/annotations-DGITy6th.js.map +1 -0
  8. package/dist/annotations.cjs +1 -1
  9. package/dist/annotations.d.cts +1 -1
  10. package/dist/annotations.d.ts +1 -1
  11. package/dist/annotations.js +1 -1
  12. package/dist/{area-WdtfqvhX.js → area-BN0uE9R0.js} +4 -3
  13. package/dist/area-BN0uE9R0.js.map +1 -0
  14. package/dist/{area-h_FvieFb.d.cts → area-D6LNLk3r.d.cts} +2 -2
  15. package/dist/{area-DEFQm_SQ.d.ts → area-DEFL-Yun.d.ts} +2 -2
  16. package/dist/{area-DYdQ_sMV.cjs → area-D_N8b4Ng.cjs} +4 -3
  17. package/dist/area-D_N8b4Ng.cjs.map +1 -0
  18. package/dist/area.cjs +1 -1
  19. package/dist/area.d.cts +1 -1
  20. package/dist/area.d.ts +1 -1
  21. package/dist/area.js +1 -1
  22. package/dist/{axis-YfAerNBA.cjs → axis-BzBkkC5X.cjs} +12 -7
  23. package/dist/axis-BzBkkC5X.cjs.map +1 -0
  24. package/dist/{axis-MMaVoSWB.js → axis-C5obgdJt.js} +12 -7
  25. package/dist/axis-C5obgdJt.js.map +1 -0
  26. package/dist/{bar-CVkOJ7WA.cjs → bar-BrmfXugT.cjs} +5 -4
  27. package/dist/bar-BrmfXugT.cjs.map +1 -0
  28. package/dist/{bar-D9B_arKf.d.ts → bar-Bs_rPqgR.d.ts} +1 -1
  29. package/dist/{bar-DZCQ-kyf.d.cts → bar-CEt8YRxf.d.cts} +2 -2
  30. package/dist/{bar-BOcRcArc.js → bar-D_KKd2fL.js} +5 -4
  31. package/dist/bar-D_KKd2fL.js.map +1 -0
  32. package/dist/bar.cjs +1 -1
  33. package/dist/bar.d.cts +1 -1
  34. package/dist/bar.d.ts +1 -1
  35. package/dist/bar.js +1 -1
  36. package/dist/{calendar-BSvO8nRb.d.cts → calendar-B7843sQu.d.cts} +2 -2
  37. package/dist/{calendar-DAFXjV99.cjs → calendar-BG_q_NC_.cjs} +2 -2
  38. package/dist/{calendar-DAFXjV99.cjs.map → calendar-BG_q_NC_.cjs.map} +1 -1
  39. package/dist/{calendar-BXgIX5H1.js → calendar-CF3gfDQk.js} +2 -2
  40. package/dist/{calendar-BXgIX5H1.js.map → calendar-CF3gfDQk.js.map} +1 -1
  41. package/dist/{calendar-Bq3vFzPl.d.ts → calendar-D10_ki1S.d.ts} +2 -2
  42. package/dist/calendar.cjs +1 -1
  43. package/dist/calendar.d.cts +1 -1
  44. package/dist/calendar.d.ts +1 -1
  45. package/dist/calendar.js +1 -1
  46. package/dist/{candlestick-BtT9glp9.js → candlestick-B1onjo1o.js} +3 -2
  47. package/dist/candlestick-B1onjo1o.js.map +1 -0
  48. package/dist/{candlestick-BcomxeVG.d.cts → candlestick-B7YXUVVh.d.cts} +4 -3
  49. package/dist/{candlestick-CSmRuZ4v.cjs → candlestick-BwrFKak_.cjs} +3 -2
  50. package/dist/candlestick-BwrFKak_.cjs.map +1 -0
  51. package/dist/{candlestick-B3WcLzph.d.ts → candlestick-XpqJvarq.d.ts} +4 -3
  52. package/dist/candlestick.cjs +2 -2
  53. package/dist/candlestick.d.cts +1 -1
  54. package/dist/candlestick.d.ts +1 -1
  55. package/dist/candlestick.js +2 -2
  56. package/dist/{cartesian-DRSXHxWe.cjs → cartesian-B9CrasFJ.cjs} +49 -7
  57. package/dist/cartesian-B9CrasFJ.cjs.map +1 -0
  58. package/dist/{cartesian-BrPqb5Qn.js → cartesian-COglz544.js} +45 -9
  59. package/dist/cartesian-COglz544.js.map +1 -0
  60. package/dist/{chart-B6TTY4Kr.js → chart-B97FBRCd.js} +22 -12
  61. package/dist/chart-B97FBRCd.js.map +1 -0
  62. package/dist/{chart-CYrrUCi3.d.ts → chart-CE9EVbfV.d.ts} +240 -62
  63. package/dist/{chart-CbPzP5Dp.d.cts → chart-Dz4geQZy.d.cts} +240 -62
  64. package/dist/{chart-D_lyOy-M.cjs → chart-GUmmjJ7S.cjs} +27 -11
  65. package/dist/chart-GUmmjJ7S.cjs.map +1 -0
  66. package/dist/{core-CQ0FaJ4G.js → core-7fgM3su0.js} +84 -16
  67. package/dist/core-7fgM3su0.js.map +1 -0
  68. package/dist/{core-C3qEppSm.d.ts → core-BUQzLsRJ.d.ts} +21 -6
  69. package/dist/{core-D2PSked3.cjs → core-BZTrsPxc.cjs} +93 -13
  70. package/dist/core-BZTrsPxc.cjs.map +1 -0
  71. package/dist/{core-9BnLEW4K.d.cts → core-Ck5uHcW8.d.cts} +40 -23
  72. package/dist/core.cjs +20 -16
  73. package/dist/core.d.cts +23 -21
  74. package/dist/core.d.ts +23 -21
  75. package/dist/core.js +18 -17
  76. package/dist/{dates-DerXTb1J.cjs → dates-0YNY49KQ.cjs} +2 -2
  77. package/dist/{dates-DerXTb1J.cjs.map → dates-0YNY49KQ.cjs.map} +1 -1
  78. package/dist/{dates-DLe2Ww64.js → dates-CKDRgpin.js} +2 -2
  79. package/dist/{dates-DLe2Ww64.js.map → dates-CKDRgpin.js.map} +1 -1
  80. package/dist/end-labels-B3oRvjxw.js +114 -0
  81. package/dist/end-labels-B3oRvjxw.js.map +1 -0
  82. package/dist/end-labels-CS-fnpp-.cjs +119 -0
  83. package/dist/end-labels-CS-fnpp-.cjs.map +1 -0
  84. package/dist/end-labels.cjs +11 -0
  85. package/dist/end-labels.cjs.map +1 -0
  86. package/dist/end-labels.d.cts +6 -0
  87. package/dist/end-labels.d.ts +6 -0
  88. package/dist/end-labels.js +11 -0
  89. package/dist/end-labels.js.map +1 -0
  90. package/dist/{export-chart-DoeiAyR2.js → export-chart-BOH_nfcH.js} +76 -4
  91. package/dist/export-chart-BOH_nfcH.js.map +1 -0
  92. package/dist/{export-chart-CPtXmZvi.cjs → export-chart-Be4T9J3m.cjs} +81 -3
  93. package/dist/export-chart-Be4T9J3m.cjs.map +1 -0
  94. package/dist/export.cjs +4 -2
  95. package/dist/export.cjs.map +1 -1
  96. package/dist/export.d.cts +4 -3
  97. package/dist/export.d.ts +4 -3
  98. package/dist/export.js +4 -3
  99. package/dist/export.js.map +1 -1
  100. package/dist/features-B55rwpQC.js.map +1 -1
  101. package/dist/features-DEDP5CEQ.cjs.map +1 -1
  102. package/dist/{funnel-CarOh8w_.d.cts → funnel-B9ridzNx.d.cts} +2 -2
  103. package/dist/{funnel-BdcfUkb5.d.ts → funnel-FogM8flk.d.ts} +2 -2
  104. package/dist/funnel.d.cts +1 -1
  105. package/dist/funnel.d.ts +1 -1
  106. package/dist/{gauge-Ds9k1UV2.d.cts → gauge-BScJ7U6O.d.cts} +2 -2
  107. package/dist/{gauge-Zy25jfps.d.ts → gauge-D78oq1Lx.d.ts} +2 -2
  108. package/dist/gauge.d.cts +1 -1
  109. package/dist/gauge.d.ts +1 -1
  110. package/dist/heat-Bsqq4zw9.js +38 -0
  111. package/dist/heat-Bsqq4zw9.js.map +1 -0
  112. package/dist/heat-DYsivvDq.cjs +49 -0
  113. package/dist/heat-DYsivvDq.cjs.map +1 -0
  114. package/dist/{heatmap-Dcc_bsoQ.cjs → heatmap-Dyzrd4Fd.cjs} +3 -3
  115. package/dist/{heatmap-Dcc_bsoQ.cjs.map → heatmap-Dyzrd4Fd.cjs.map} +1 -1
  116. package/dist/{heatmap-C1v8bwpq.js → heatmap-J7fxG7MM.js} +3 -3
  117. package/dist/{heatmap-C1v8bwpq.js.map → heatmap-J7fxG7MM.js.map} +1 -1
  118. package/dist/{heatmap-CJ-0dfhJ.d.cts → heatmap-Jvwo7iFW.d.cts} +2 -2
  119. package/dist/{heatmap-Jp5sHRTo.d.ts → heatmap-mFCnP6aB.d.ts} +2 -2
  120. package/dist/heatmap.cjs +1 -1
  121. package/dist/heatmap.d.cts +1 -1
  122. package/dist/heatmap.d.ts +1 -1
  123. package/dist/heatmap.js +1 -1
  124. package/dist/index.cjs +37 -26
  125. package/dist/index.cjs.map +1 -1
  126. package/dist/index.d.cts +23 -21
  127. package/dist/index.d.ts +23 -21
  128. package/dist/index.js +34 -27
  129. package/dist/index.js.map +1 -1
  130. package/dist/interaction-DXYSjgnP.cjs.map +1 -1
  131. package/dist/interaction-En1KlwFO.js.map +1 -1
  132. package/dist/layout-CYerDebD.d.cts +29 -0
  133. package/dist/layout-CYerDebD.d.ts +29 -0
  134. package/dist/{line-CxR4tg1Q.js → line-CXH0L10d.js} +43 -8
  135. package/dist/line-CXH0L10d.js.map +1 -0
  136. package/dist/{line-vyWO030v.d.cts → line-Cu9ctpbv.d.cts} +9 -2
  137. package/dist/{line-YiCuhVMI.cjs → line-DHbYCQy4.cjs} +43 -8
  138. package/dist/line-DHbYCQy4.cjs.map +1 -0
  139. package/dist/{line-Bpr5uVLQ.d.ts → line-TkzA7wMK.d.ts} +8 -1
  140. package/dist/line.cjs +1 -1
  141. package/dist/line.d.cts +1 -1
  142. package/dist/line.d.ts +1 -1
  143. package/dist/line.js +1 -1
  144. package/dist/{map-49FcfdmJ.d.cts → map-BirylCmT.d.cts} +2 -2
  145. package/dist/{map-C15NC7kW.js → map-CYp6x-uS.js} +3 -26
  146. package/dist/map-CYp6x-uS.js.map +1 -0
  147. package/dist/{map-BqrZ80vT.cjs → map-ChwSgooH.cjs} +4 -27
  148. package/dist/map-ChwSgooH.cjs.map +1 -0
  149. package/dist/{map-BMC61J-P.d.ts → map-DNqog2Xs.d.ts} +2 -2
  150. package/dist/map.cjs +1 -1
  151. package/dist/map.d.cts +1 -1
  152. package/dist/map.d.ts +1 -1
  153. package/dist/map.js +1 -1
  154. package/dist/maps/world.d.cts +1 -1
  155. package/dist/maps/world.d.ts +1 -1
  156. package/dist/{others-ls5eKtZ4.d.cts → others-CuNdpvjd.d.cts} +1 -1
  157. package/dist/{parliament-Cz9n_DoK.d.ts → parliament-CHdf13XU.d.ts} +2 -2
  158. package/dist/{parliament-C7V8UJj1.d.cts → parliament-CsYgh4N2.d.cts} +2 -2
  159. package/dist/parliament.d.cts +1 -1
  160. package/dist/parliament.d.ts +1 -1
  161. package/dist/{patterns-Dw7OMD_2.cjs → patterns-BPN1c9qe.cjs} +2 -2
  162. package/dist/{patterns-Dw7OMD_2.cjs.map → patterns-BPN1c9qe.cjs.map} +1 -1
  163. package/dist/{patterns-BMUINoka.js → patterns-CVrLrJXg.js} +2 -2
  164. package/dist/{patterns-BMUINoka.js.map → patterns-CVrLrJXg.js.map} +1 -1
  165. package/dist/patterns.cjs +1 -1
  166. package/dist/patterns.d.cts +1 -1
  167. package/dist/patterns.d.ts +1 -1
  168. package/dist/patterns.js +1 -1
  169. package/dist/{percentage-bar-cSeiLdwU.d.ts → percentage-bar-CSAbzDOn.d.ts} +2 -2
  170. package/dist/{percentage-bar-R1--2grK.d.cts → percentage-bar-UZHCRvlK.d.cts} +3 -3
  171. package/dist/percentage-bar.d.cts +1 -1
  172. package/dist/percentage-bar.d.ts +1 -1
  173. package/dist/{pie-vD5-g8je.d.cts → pie-AFedsDcF.d.cts} +12 -3
  174. package/dist/{pie-Bd8wyrtY.js → pie-Ch6Bx0ih.js} +54 -39
  175. package/dist/pie-Ch6Bx0ih.js.map +1 -0
  176. package/dist/{pie-BseZlCgP.cjs → pie-Cll1OrVZ.cjs} +54 -39
  177. package/dist/pie-Cll1OrVZ.cjs.map +1 -0
  178. package/dist/{pie-BQQkvy1N.d.ts → pie-Cn2H3pz8.d.ts} +11 -2
  179. package/dist/pie.cjs +1 -1
  180. package/dist/pie.d.cts +1 -1
  181. package/dist/pie.d.ts +1 -1
  182. package/dist/pie.js +1 -1
  183. package/dist/point-shapes.d.cts +1 -1
  184. package/dist/point-shapes.d.ts +1 -1
  185. package/dist/{radar-D6XqkFWQ.js → radar-Bg-IiIWB.js} +3 -3
  186. package/dist/{radar-D6XqkFWQ.js.map → radar-Bg-IiIWB.js.map} +1 -1
  187. package/dist/{radar-vLxilcr4.d.ts → radar-DEer2jjd.d.ts} +2 -2
  188. package/dist/{radar-7I6hsY_h.d.cts → radar-DxmjXhMc.d.cts} +2 -2
  189. package/dist/{radar-DjISDnSf.cjs → radar-wDyX17S3.cjs} +3 -3
  190. package/dist/{radar-DjISDnSf.cjs.map → radar-wDyX17S3.cjs.map} +1 -1
  191. package/dist/radar.cjs +1 -1
  192. package/dist/radar.d.cts +1 -1
  193. package/dist/radar.d.ts +1 -1
  194. package/dist/radar.js +1 -1
  195. package/dist/range-bar-BnKjJP89.cjs +348 -0
  196. package/dist/range-bar-BnKjJP89.cjs.map +1 -0
  197. package/dist/range-bar-C4cRaaQE.d.ts +123 -0
  198. package/dist/range-bar-D32dIQOY.d.cts +123 -0
  199. package/dist/range-bar-Dx6ce0J1.js +343 -0
  200. package/dist/range-bar-Dx6ce0J1.js.map +1 -0
  201. package/dist/range-bar.cjs +3 -0
  202. package/dist/range-bar.d.cts +3 -0
  203. package/dist/range-bar.d.ts +3 -0
  204. package/dist/range-bar.js +1 -0
  205. package/dist/{sankey-DqiuxUx7.d.cts → sankey-D-8ATwBT.d.cts} +2 -2
  206. package/dist/{sankey-7As41Fo4.d.ts → sankey-DpYJsOI4.d.ts} +2 -2
  207. package/dist/sankey.d.cts +1 -1
  208. package/dist/sankey.d.ts +1 -1
  209. package/dist/{scatter-DCMAtt5L.js → scatter-0Z7K_YUz.js} +65 -19
  210. package/dist/scatter-0Z7K_YUz.js.map +1 -0
  211. package/dist/{scatter-BXkXGgM_.d.ts → scatter-BAL5K9_4.d.ts} +22 -9
  212. package/dist/{scatter-DL0zAV09.d.cts → scatter-BUGbnRzM.d.cts} +22 -9
  213. package/dist/{scatter-Bwkblr4L.cjs → scatter-CZ8do3Up.cjs} +65 -19
  214. package/dist/scatter-CZ8do3Up.cjs.map +1 -0
  215. package/dist/scatter.cjs +1 -1
  216. package/dist/scatter.d.cts +2 -2
  217. package/dist/scatter.d.ts +2 -2
  218. package/dist/scatter.js +1 -1
  219. package/dist/slice-labels-1TBq7p3q.d.cts +28 -0
  220. package/dist/slice-labels-C9ucsBVW.js +88 -0
  221. package/dist/slice-labels-C9ucsBVW.js.map +1 -0
  222. package/dist/slice-labels-CbFiy46l.cjs +93 -0
  223. package/dist/slice-labels-CbFiy46l.cjs.map +1 -0
  224. package/dist/slice-labels-Cm5CyV7B.d.ts +28 -0
  225. package/dist/slice-labels.cjs +11 -0
  226. package/dist/slice-labels.cjs.map +1 -0
  227. package/dist/slice-labels.d.cts +6 -0
  228. package/dist/slice-labels.d.ts +6 -0
  229. package/dist/slice-labels.js +11 -0
  230. package/dist/slice-labels.js.map +1 -0
  231. package/dist/{sparkline-BElUSd0r.d.ts → sparkline-CtoBJe-a.d.ts} +2 -2
  232. package/dist/{sparkline-BMSuEPHP.cjs → sparkline-DjR-V6BI.cjs} +2 -2
  233. package/dist/{sparkline-BMSuEPHP.cjs.map → sparkline-DjR-V6BI.cjs.map} +1 -1
  234. package/dist/{sparkline-RYly7bR0.d.cts → sparkline-DwHJfeZz.d.cts} +2 -2
  235. package/dist/{sparkline-NDmq90kP.js → sparkline-_dxwtdli.js} +2 -2
  236. package/dist/{sparkline-NDmq90kP.js.map → sparkline-_dxwtdli.js.map} +1 -1
  237. package/dist/sparkline.cjs +1 -1
  238. package/dist/sparkline.d.cts +1 -1
  239. package/dist/sparkline.d.ts +1 -1
  240. package/dist/sparkline.js +1 -1
  241. package/dist/{stack-BTWYIwLO.d.cts → stack-CcmyALx0.d.cts} +1 -1
  242. package/dist/{stack-jVKvg2x_.js → stack-CyVlS7Fr.js} +2 -2
  243. package/dist/{stack-jVKvg2x_.js.map → stack-CyVlS7Fr.js.map} +1 -1
  244. package/dist/{stack-BO4624CY.cjs → stack-DBhmYNat.cjs} +2 -2
  245. package/dist/{stack-BO4624CY.cjs.map → stack-DBhmYNat.cjs.map} +1 -1
  246. package/dist/style.css +1 -1
  247. package/dist/{time-axis-B3VekUfX.cjs → time-axis-CVKjQKSS.cjs} +3 -3
  248. package/dist/{time-axis-B3VekUfX.cjs.map → time-axis-CVKjQKSS.cjs.map} +1 -1
  249. package/dist/{time-axis-CLjqOakA.js → time-axis-CkmbAw4Z.js} +3 -3
  250. package/dist/{time-axis-CLjqOakA.js.map → time-axis-CkmbAw4Z.js.map} +1 -1
  251. package/dist/time.cjs +2 -2
  252. package/dist/time.js +2 -2
  253. package/dist/{treemap-25vHO_UK.d.cts → treemap-C2maqerU.d.cts} +26 -4
  254. package/dist/{treemap-BCXUbixd.d.ts → treemap-D_zbubo3.d.ts} +26 -4
  255. package/dist/{treemap-CZk8kKFD.cjs → treemap-PulGXZv0.cjs} +38 -8
  256. package/dist/treemap-PulGXZv0.cjs.map +1 -0
  257. package/dist/{treemap-C4glsx-g.js → treemap-lbYxb-7h.js} +38 -8
  258. package/dist/treemap-lbYxb-7h.js.map +1 -0
  259. package/dist/treemap.cjs +1 -1
  260. package/dist/treemap.d.cts +1 -1
  261. package/dist/treemap.d.ts +1 -1
  262. package/dist/treemap.js +1 -1
  263. package/dist/{value-labels-C7GrhOXJ.js → value-labels-B0VeheyE.js} +5 -4
  264. package/dist/value-labels-B0VeheyE.js.map +1 -0
  265. package/dist/{value-labels-DzaKIWKp.cjs → value-labels-Dcyk3GIY.cjs} +5 -4
  266. package/dist/value-labels-Dcyk3GIY.cjs.map +1 -0
  267. package/dist/value-labels.cjs +1 -1
  268. package/dist/value-labels.d.cts +1 -1
  269. package/dist/value-labels.d.ts +1 -1
  270. package/dist/value-labels.js +1 -1
  271. package/dist/zoom.cjs +810 -0
  272. package/dist/zoom.cjs.map +1 -0
  273. package/dist/zoom.d.cts +34 -0
  274. package/dist/zoom.d.ts +34 -0
  275. package/dist/zoom.js +806 -0
  276. package/dist/zoom.js.map +1 -0
  277. package/package.json +27 -2
  278. package/dist/annotations-BQ8l-qHs.js.map +0 -1
  279. package/dist/annotations-CpCWA29b.cjs.map +0 -1
  280. package/dist/area-DYdQ_sMV.cjs.map +0 -1
  281. package/dist/area-WdtfqvhX.js.map +0 -1
  282. package/dist/axis-MMaVoSWB.js.map +0 -1
  283. package/dist/axis-YfAerNBA.cjs.map +0 -1
  284. package/dist/bar-BOcRcArc.js.map +0 -1
  285. package/dist/bar-CVkOJ7WA.cjs.map +0 -1
  286. package/dist/candlestick-BtT9glp9.js.map +0 -1
  287. package/dist/candlestick-CSmRuZ4v.cjs.map +0 -1
  288. package/dist/cartesian-BrPqb5Qn.js.map +0 -1
  289. package/dist/cartesian-DRSXHxWe.cjs.map +0 -1
  290. package/dist/chart-B6TTY4Kr.js.map +0 -1
  291. package/dist/chart-D_lyOy-M.cjs.map +0 -1
  292. package/dist/core-CQ0FaJ4G.js.map +0 -1
  293. package/dist/core-D2PSked3.cjs.map +0 -1
  294. package/dist/export-chart-CPtXmZvi.cjs.map +0 -1
  295. package/dist/export-chart-DoeiAyR2.js.map +0 -1
  296. package/dist/line-CxR4tg1Q.js.map +0 -1
  297. package/dist/line-YiCuhVMI.cjs.map +0 -1
  298. package/dist/map-BqrZ80vT.cjs.map +0 -1
  299. package/dist/map-C15NC7kW.js.map +0 -1
  300. package/dist/pie-Bd8wyrtY.js.map +0 -1
  301. package/dist/pie-BseZlCgP.cjs.map +0 -1
  302. package/dist/scatter-Bwkblr4L.cjs.map +0 -1
  303. package/dist/scatter-DCMAtt5L.js.map +0 -1
  304. package/dist/treemap-C4glsx-g.js.map +0 -1
  305. package/dist/treemap-CZk8kKFD.cjs.map +0 -1
  306. package/dist/value-labels-C7GrhOXJ.js.map +0 -1
  307. package/dist/value-labels-DzaKIWKp.cjs.map +0 -1
@@ -4,6 +4,7 @@ const require_rect = require("./rect-DPr9QRxl.cjs");
4
4
  const require_vnode = require("./vnode-ClAiw28x.cjs");
5
5
  const require_clean = require("./clean-Die2iCNc.cjs");
6
6
  const require_fit = require("./fit-D4MIIQQz.cjs");
7
+ const require_heat = require("./heat-DYsivvDq.cjs");
7
8
  const require_named = require("./named-BBASc8dW.cjs");
8
9
  // src/charts/treemap.ts
9
10
  /** Levels of nesting read from the data, and the most nodes: enough for any chart, few enough to draw. */
@@ -11,6 +12,8 @@ const MAX_DEPTH = 8;
11
12
  const MAX_NODES = 5e3;
12
13
  /** Space between a tile's edge and its text. */
13
14
  const INSET = 6;
15
+ /** Share of the full color at the minimum, so the smallest tile still reads as a tile. */
16
+ const FLOOR = .08;
14
17
  function sized(nodes) {
15
18
  return nodes.map((node) => {
16
19
  if (node.children?.length) {
@@ -27,12 +30,32 @@ function sized(nodes) {
27
30
  };
28
31
  });
29
32
  }
30
- /** The top-level entries with their sizes and color slots, without the hidden ones. */
33
+ /** The stops of the `colors` scale, when there are enough of them. */
34
+ const stopsOf = (options) => Array.isArray(options.colors) && options.colors.length >= 2 ? options.colors : void 0;
35
+ /** Whether the tiles are colored by their value, not by their group. */
36
+ const byValue = (options) => options.colorBy === "value" || stopsOf(options) !== void 0;
37
+ /** The color scale of a treemap shaded by value, over every tile (hidden ones too, so it stays put). */
38
+ function scale(options) {
39
+ let largest = 0;
40
+ const walk = (items) => {
41
+ for (const item of items) if (item.children) walk(item.children);
42
+ else largest = Math.max(largest, item.value);
43
+ };
44
+ walk(options.sized);
45
+ const { position, paint } = require_heat.heatScale(require_clean.finite(options.min) ?? 0, require_clean.finite(options.max) ?? largest, require_clean.finite(options.mid), stopsOf(options), FLOOR);
46
+ return (v) => paint(position(v));
47
+ }
48
+ /**
49
+ * The top-level entries with their sizes and color slots, without the hidden
50
+ * ones. Shaded by value there is no legend to hide them from, so `hidden` is
51
+ * read from the data.
52
+ */
31
53
  function visible(model, hidden) {
54
+ const fixed = byValue(model);
32
55
  return model.sized.map((entry, index) => ({
33
56
  entry,
34
57
  index
35
- })).filter(({ entry }) => !hidden.has(require_named.keyOf(entry.node)));
58
+ })).filter(({ entry }) => !hidden.has(require_named.keyOf(entry.node)) && !(fixed && entry.node.hidden));
36
59
  }
37
60
  /**
38
61
  * Squarified layout (Bruls, Huizing, van Wijk): `items`, largest first, fill
@@ -131,6 +154,7 @@ function renderTreemap(options, ctx) {
131
154
  0,
132
155
  0
133
156
  ], void 0, entries.map(({ index }) => index));
157
+ const paint = byValue(options) ? scale(options) : void 0;
134
158
  const value = require_format.formatNumber(options.format, locale);
135
159
  const share = require_format.getNumberFormat(locale, {
136
160
  style: "percent",
@@ -146,7 +170,7 @@ function renderTreemap(options, ctx) {
146
170
  x,
147
171
  y: tile.y + tile.height / 2
148
172
  };
149
- const color = tile.node.color ?? options.data[tile.top]?.color;
173
+ const color = paint ? paint(tile.value).color : tile.node.color ?? options.data[tile.top]?.color;
150
174
  if (color) item.color = color;
151
175
  return {
152
176
  index,
@@ -175,13 +199,17 @@ function renderTreemap(options, ctx) {
175
199
  };
176
200
  const groups = entries.map(({ entry, index }) => require_vnode.h("g", require_named.groupAttrs(entry.node, index), tiles.filter((tile) => tile.top === index).map((tile) => require_vnode.h("rect", {
177
201
  key: tile.key,
178
- class: ["tc-tile", tile.trail.length > 0 && tile.node.class],
202
+ class: [
203
+ "tc-tile",
204
+ paint && "tc-tile-shaded",
205
+ tile.trail.length > 0 && tile.node.class
206
+ ],
179
207
  x: require_layout.round(tile.x),
180
208
  y: require_layout.round(tile.y),
181
209
  width: require_layout.round(tile.width),
182
210
  height: require_layout.round(tile.height),
183
211
  rx: require_layout.round(Math.min(radius, tile.width / 2, tile.height / 2)),
184
- style: tile.trail.length > 0 ? { "--tc-series-color": tile.node.color } : void 0
212
+ style: paint ? paint(tile.value).style : tile.trail.length > 0 ? { "--tc-series-color": tile.node.color } : void 0
185
213
  }))));
186
214
  const line = fontSize * 1.3;
187
215
  const labels = options.labels !== false && tiles.flatMap((tile) => {
@@ -265,7 +293,9 @@ function cleanNodes(data, depth = 0, budget = { left: MAX_NODES }) {
265
293
  * Treemap: parts of a whole as tiles, each as large as its value, laid out
266
294
  * as close to squares as they go with the largest in the top left corner.
267
295
  * Entries with `children` are groups: their tiles stay together and share
268
- * the group's color.
296
+ * the group's color. `colorBy: 'value'` shades the tiles in one hue instead
297
+ * (`--tc-heat-color`), lighter as the value drops, and `colors` sets a scale
298
+ * of colors for it.
269
299
  *
270
300
  * ```ts
271
301
  * new Chart('#el', {
@@ -285,7 +315,7 @@ const treemap = {
285
315
  sized: sized(options.data)
286
316
  }),
287
317
  render: renderTreemap,
288
- legend: (options) => require_named.legendItems(options.data),
318
+ legend: (options) => byValue(options) ? [] : require_named.legendItems(options.data),
289
319
  table: treemapTable
290
320
  };
291
321
  Object.defineProperty(exports, "treemap", {
@@ -295,4 +325,4 @@ Object.defineProperty(exports, "treemap", {
295
325
  }
296
326
  });
297
327
 
298
- //# sourceMappingURL=treemap-CZk8kKFD.cjs.map
328
+ //# sourceMappingURL=treemap-PulGXZv0.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"treemap-PulGXZv0.cjs","names":["heatScale","finite","keyOf","innerRect","insets","formatNumber","getNumberFormat","rectPath","h","groupAttrs","round","fit","estimateTextWidth","list","isRecord","named","cleanData","legendItems"],"sources":["../src/charts/treemap.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext, RenderResult, TableContext } from '../chart.ts'\nimport { formatNumber, getNumberFormat, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { estimateTextWidth, type InsetsInput, innerRect, insets, round } from '../layout.ts'\nimport { rectPath } from '../shapes/rect.ts'\nimport { type ClassValue, h } from '../vnode.ts'\nimport { cleanData, finite, isRecord, list, named } from './clean.ts'\nimport { fit } from './fit.ts'\nimport { type HeatScale, heatScale } from './heat.ts'\nimport { groupAttrs, keyOf, legendItems } from './named.ts'\n\n/** A tile of a treemap, or a group of them. */\nexport interface TreemapNode {\n name: string\n /** Size of the tile; a negative value is zero. A group is as large as its `children`. */\n value?: number\n /** Tiles (or groups) inside this one; they share its color. */\n children?: readonly TreemapNode[]\n /** Stable identity for keyed updates and legend toggles. Defaults to `name`. */\n id?: string\n /**\n * Custom color; overrides the palette slot via `--tc-series-color`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n * Not used when the tiles are shaded by value.\n */\n color?: string\n /** Extra classes on the group (top level) or the tile. */\n class?: ClassValue\n /** Start hidden (top level; toggle it back from the legend, which there is none of when shaded by value). */\n hidden?: boolean\n}\n\nexport interface TreemapOptions {\n /** Tiles, or groups of tiles; each top-level entry takes a palette color and a legend entry. */\n data: readonly TreemapNode[]\n /**\n * `'value'` shades every tile in one hue, `--tc-heat-color`, lighter as\n * the value drops (as a heatmap does), with no legend; `'series'` (the\n * default) gives each top-level entry its palette color.\n */\n colorBy?: 'series' | 'value'\n /**\n * A continuous scale through two or more colors (any CSS color, including\n * `var(--tc-…)`), from `min` to `max`; the tiles are then colored by value\n * whatever `colorBy` says. Values that could inject CSS are ignored, as\n * for the colors of the nodes.\n */\n colors?: readonly string[]\n /** Value shown with the lightest shade (or the first color). Defaults to `0`. */\n min?: number\n /** Value shown with the full color (or the last color). Defaults to the largest tile. */\n max?: number\n /** Value placed on the middle color of `colors`. Defaults to halfway. */\n mid?: number\n /** Space between tiles in pixels. Defaults to `2`. */\n gap?: number\n /** Corner radius of the tiles. Defaults to `3`. */\n radius?: number\n /** Names (and values, where they fit) written in the tiles. Defaults to `true`. */\n labels?: boolean\n /** Format of the values (tiles, tooltip, table). */\n format?: NumberFormat\n /** Extra space around the chart, in pixels. */\n padding?: InsetsInput\n}\n\n/** Levels of nesting read from the data, and the most nodes: enough for any chart, few enough to draw. */\nconst MAX_DEPTH = 8\nconst MAX_NODES = 5000\n\n/** Space between a tile's edge and its text. */\nconst INSET = 6\n\n/** Share of the full color at the minimum, so the smallest tile still reads as a tile. */\nconst FLOOR = 0.08\n\n/** A node with its size worked out. */\nexport interface Sized {\n node: TreemapNode\n value: number\n children?: Sized[]\n}\n\ninterface Tile {\n node: TreemapNode\n key: string\n /** Position of the top-level ancestor in `data` (the color slot). */\n top: number\n /** Names of the ancestors, outermost first. */\n trail: readonly string[]\n value: number\n x: number\n y: number\n width: number\n height: number\n}\n\nfunction sized(nodes: readonly TreemapNode[]): Sized[] {\n return nodes.map((node) => {\n if (node.children?.length) {\n const children = sized(node.children)\n return { node, children, value: children.reduce((sum, child) => sum + child.value, 0) }\n }\n return { node, value: Math.max(0, node.value ?? 0) }\n })\n}\n\n/** The chart model of a treemap: its options, with every node's size worked out. */\nexport type TreemapModel = TreemapOptions & { sized: Sized[] }\n\n/** The stops of the `colors` scale, when there are enough of them. */\nconst stopsOf = (options: TreemapOptions): readonly string[] | undefined =>\n Array.isArray(options.colors) && options.colors.length >= 2 ? options.colors : undefined\n\n/** Whether the tiles are colored by their value, not by their group. */\nconst byValue = (options: TreemapOptions): boolean =>\n options.colorBy === 'value' || stopsOf(options) !== undefined\n\n/** The color scale of a treemap shaded by value, over every tile (hidden ones too, so it stays put). */\nfunction scale(options: TreemapModel): (v: number) => ReturnType<HeatScale['paint']> {\n let largest = 0\n const walk = (items: readonly Sized[]) => {\n for (const item of items) {\n if (item.children) walk(item.children)\n else largest = Math.max(largest, item.value)\n }\n }\n walk(options.sized)\n const { position, paint } = heatScale(\n finite(options.min) ?? 0,\n finite(options.max) ?? largest,\n finite(options.mid),\n stopsOf(options),\n FLOOR,\n )\n return (v) => paint(position(v))\n}\n\n/**\n * The top-level entries with their sizes and color slots, without the hidden\n * ones. Shaded by value there is no legend to hide them from, so `hidden` is\n * read from the data.\n */\nfunction visible(model: TreemapModel, hidden: ReadonlySet<string>) {\n const fixed = byValue(model)\n return model.sized\n .map((entry, index) => ({ entry, index }))\n .filter(({ entry }) => !hidden.has(keyOf(entry.node)) && !(fixed && entry.node.hidden))\n}\n\n/**\n * Squarified layout (Bruls, Huizing, van Wijk): `items`, largest first, fill\n * the rectangle in rows along its shorter side, each row closed as soon as\n * another item would make its tiles less square.\n */\nfunction squarify(\n items: readonly Sized[],\n x: number,\n y: number,\n w: number,\n hgt: number,\n place: (item: Sized, x: number, y: number, w: number, hgt: number) => void,\n): void {\n const sorted = items.filter((item) => item.value > 0).sort((a, b) => b.value - a.value)\n let left = sorted.reduce((sum, item) => sum + item.value, 0)\n let i = 0\n while (i < sorted.length && w > 0 && hgt > 0) {\n const short = Math.min(w, hgt)\n // Pixels of area per unit of value in what is left of the rectangle.\n const k = (w * hgt) / left\n const largest = (sorted[i] as Sized).value\n let sum = 0\n let best = Number.POSITIVE_INFINITY\n let j = i\n for (; j < sorted.length; j++) {\n const next = sum + (sorted[j] as Sized).value\n // Thickness of the row squared: its worst tile is the largest or the smallest.\n const t2 = ((next * k) / short) ** 2\n const worst = Math.max(t2 / ((sorted[j] as Sized).value * k), (largest * k) / t2)\n if (worst > best) break\n best = worst\n sum = next\n }\n const thickness = (sum * k) / short\n let offset = 0\n for (; i < j; i++) {\n const item = sorted[i] as Sized\n const length = (item.value * k) / thickness\n if (w >= hgt) place(item, x, y + offset, thickness, length)\n else place(item, x + offset, y, length, thickness)\n offset += length\n }\n if (w >= hgt) {\n x += thickness\n w -= thickness\n } else {\n y += thickness\n hgt -= thickness\n }\n left -= sum\n }\n}\n\n/** Half gaps left around a tile on its left, top, right and bottom side. */\ntype Edges = readonly [number, number, number, number]\n\n/**\n * The tiles of `items` in a rectangle, groups laid out inside their own.\n * The gap is cut from the tiles after they are placed, so it does not change\n * their arrangement: half of it on every side (a whole one between any two\n * neighbors), none at the edge of the chart. `edges` are the half gaps of\n * the rectangle itself.\n */\nfunction layout(\n items: readonly Sized[],\n x: number,\n y: number,\n w: number,\n hgt: number,\n gap: number,\n out: Tile[],\n edges: Edges,\n top?: { index: number; key: string; trail: readonly string[] },\n slots?: readonly number[],\n): void {\n squarify(items, x, y, w, hgt, (item, tx, ty, tw, th) => {\n const index = top?.index ?? (slots?.[items.indexOf(item)] as number)\n const key = top ? `${top.key}/${keyOf(item.node)}` : keyOf(item.node)\n const trail = top?.trail ?? []\n // A side on the border of the rectangle takes its half gap (none at the chart's edge), the others one.\n const near = 0.01\n const sides: Edges = [\n tx - x < near ? edges[0] : 1,\n ty - y < near ? edges[1] : 1,\n x + w - tx - tw < near ? edges[2] : 1,\n y + hgt - ty - th < near ? edges[3] : 1,\n ]\n if (item.children) {\n layout(item.children, tx, ty, tw, th, gap, out, sides, {\n index,\n key,\n trail: [...trail, item.node.name],\n })\n } else {\n const half = gap / 2\n out.push({\n node: item.node,\n key,\n top: index,\n trail,\n value: item.value,\n x: tx + sides[0] * half,\n y: ty + sides[1] * half,\n width: Math.max(0, tw - (sides[0] + sides[2]) * half),\n height: Math.max(0, th - (sides[1] + sides[3]) * half),\n })\n }\n })\n}\n\nfunction renderTreemap(options: TreemapModel, ctx: RenderContext): RenderResult {\n const { width, height, fontSize, locale } = ctx\n const gap = Math.max(0, options.gap ?? 2)\n const radius = Math.max(0, options.radius ?? 3)\n const area = innerRect(width, height, insets(options.padding, 0))\n const entries = visible(options, ctx.hidden)\n const total = entries.reduce((sum, { entry }) => sum + entry.value, 0)\n\n const tiles: Tile[] = []\n layout(\n entries.map(({ entry }) => entry),\n area.x,\n area.y,\n area.width,\n area.height,\n gap,\n tiles,\n [0, 0, 0, 0],\n undefined,\n entries.map(({ index }) => index),\n )\n\n const paint = byValue(options) ? scale(options) : undefined\n const value = formatNumber(options.format, locale)\n const share = getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 })\n const hitFor = (tile: Tile, index: number): Hit => {\n const x = tile.x + tile.width / 2\n const item: HitItem = {\n name: tile.node.name,\n seriesIndex: tile.top,\n value: tile.value,\n text: `${value(tile.value)} (${share.format(total > 0 ? tile.value / total : 0)})`,\n x,\n y: tile.y + tile.height / 2,\n }\n const color = paint\n ? paint(tile.value).color\n : (tile.node.color ?? options.data[tile.top]?.color)\n if (color) item.color = color\n return {\n index,\n label: [...tile.trail, tile.node.name].join(' › '),\n title: tile.trail.join(' › '),\n x,\n area,\n items: [item],\n seriesIndex: tile.top,\n // A ring just inside the hovered tile.\n highlight: {\n kind: 'halo',\n d: rectPath(tile.x + 1, tile.y + 1, tile.width - 2, tile.height - 2, radius - 1),\n },\n }\n }\n\n const interaction: Interaction = {\n count: tiles.length,\n hitIndex: (index) => {\n const tile = tiles[index]\n return tile ? hitFor(tile, index) : null\n },\n hitTest(px, py) {\n const index = tiles.findIndex(\n (tile) =>\n px >= tile.x - gap / 2 &&\n px <= tile.x + tile.width + gap / 2 &&\n py >= tile.y - gap / 2 &&\n py <= tile.y + tile.height + gap / 2,\n )\n return index < 0 ? null : hitFor(tiles[index] as Tile, index)\n },\n }\n\n const groups = entries.map(({ entry, index }) =>\n h(\n 'g',\n groupAttrs(entry.node, index),\n tiles\n .filter((tile) => tile.top === index)\n .map((tile) =>\n h('rect', {\n key: tile.key,\n class: ['tc-tile', paint && 'tc-tile-shaded', tile.trail.length > 0 && tile.node.class],\n x: round(tile.x),\n y: round(tile.y),\n width: round(tile.width),\n height: round(tile.height),\n rx: round(Math.min(radius, tile.width / 2, tile.height / 2)),\n // Shaded by its value, or in its group's color: a tile inside a group may have its own.\n style: paint\n ? paint(tile.value).style\n : tile.trail.length > 0\n ? { '--tc-series-color': tile.node.color }\n : undefined,\n }),\n ),\n ),\n )\n\n // Names where a few letters fit, values below where there is a second line.\n const line = fontSize * 1.3\n const labels =\n options.labels !== false &&\n tiles.flatMap((tile) => {\n const room = tile.width - INSET * 2\n const name = tile.height >= line + INSET ? fit(tile.node.name, room, fontSize) : ''\n if (!name) return []\n const text = value(tile.value)\n const x = round(tile.x + INSET)\n const y = tile.y + INSET + fontSize * 0.85\n return [\n h('text', { key: tile.key, class: 'tc-treemap-label', x, y: round(y) }, name),\n tile.height >= line * 2 + INSET * 1.5 &&\n estimateTextWidth(text, fontSize) <= room &&\n h(\n 'text',\n {\n key: `${tile.key}/value`,\n class: 'tc-treemap-label tc-treemap-value',\n x,\n y: round(y + line),\n },\n text,\n ),\n ]\n })\n\n const content = [\n h('g', { class: 'tc-treemap-tiles' }, groups),\n labels && h('g', { class: 'tc-treemap-labels', 'aria-hidden': 'true' }, labels),\n ]\n return { content, interaction }\n}\n\nfunction treemapTable(options: TreemapModel, ctx: TableContext, limit: number): DataTable {\n const entries = visible(options, ctx.hidden)\n const total = entries.reduce((sum, { entry }) => sum + entry.value, 0)\n const value = formatNumber(options.format, ctx.locale)\n const share = getNumberFormat(ctx.locale, { style: 'percent', maximumFractionDigits: 1 })\n const rows: string[][] = []\n const walk = (items: readonly Sized[], trail: readonly string[]) => {\n for (const item of items) {\n const path = [...trail, item.node.name]\n if (item.children) walk(item.children, path)\n else {\n rows.push([\n path.join(' › '),\n value(item.value),\n share.format(total > 0 ? item.value / total : 0),\n ])\n }\n }\n }\n walk(\n entries.map(({ entry }) => entry),\n [],\n )\n const table: DataTable = { columns: ['', 'Value', 'Share'], rows }\n if (rows.length > limit) {\n table.rows = rows.slice(0, limit)\n table.total = rows.length\n }\n return table\n}\n\n/** Nodes with text for names and finite values, at most `MAX_DEPTH` deep and `MAX_NODES` in all. */\nfunction cleanNodes(data: unknown, depth = 0, budget = { left: MAX_NODES }): TreemapNode[] {\n const nodes: TreemapNode[] = []\n for (const r of list(data)) {\n if (!isRecord(r) || budget.left <= 0) continue\n budget.left--\n const children =\n depth < MAX_DEPTH && Array.isArray(r.children)\n ? cleanNodes(r.children, depth + 1, budget)\n : undefined\n nodes.push({ ...named(r), value: finite(r.value) ?? 0, children } as unknown as TreemapNode)\n }\n return nodes\n}\n\n/**\n * Treemap: parts of a whole as tiles, each as large as its value, laid out\n * as close to squares as they go with the largest in the top left corner.\n * Entries with `children` are groups: their tiles stay together and share\n * the group's color. `colorBy: 'value'` shades the tiles in one hue instead\n * (`--tc-heat-color`), lighter as the value drops, and `colors` sets a scale\n * of colors for it.\n *\n * ```ts\n * new Chart('#el', {\n * type: treemap,\n * data: [\n * { name: 'Search', value: 42 },\n * { name: 'Social', children: [{ name: 'Video', value: 18 }, { name: 'Posts', value: 9 }] },\n * ],\n * })\n * ```\n */\nexport const treemap: ChartType<TreemapOptions, TreemapModel> = {\n name: 'treemap',\n clean: cleanData((data) => cleanNodes(data)),\n prepare: (options) => ({ ...options, sized: sized(options.data) }),\n render: renderTreemap,\n // Shaded by value there is one hue, and nothing for a legend to tell apart.\n legend: (options) => (byValue(options) ? [] : legendItems(options.data)),\n table: treemapTable,\n}\n"],"mappings":";;;;;;;;;;AAoEA,MAAM,YAAY;AAClB,MAAM,YAAY;;AAGlB,MAAM,QAAQ;;AAGd,MAAM,QAAQ;AAuBd,SAAS,MAAM,OAAwC;CACrD,OAAO,MAAM,KAAK,SAAS;EACzB,IAAI,KAAK,UAAU,QAAQ;GACzB,MAAM,WAAW,MAAM,KAAK,QAAQ;GACpC,OAAO;IAAE;IAAM;IAAU,OAAO,SAAS,QAAQ,KAAK,UAAU,MAAM,MAAM,OAAO,CAAC;GAAE;EACxF;EACA,OAAO;GAAE;GAAM,OAAO,KAAK,IAAI,GAAG,KAAK,SAAS,CAAC;EAAE;CACrD,CAAC;AACH;;AAMA,MAAM,WAAW,YACf,MAAM,QAAQ,QAAQ,MAAM,KAAK,QAAQ,OAAO,UAAU,IAAI,QAAQ,SAAS,KAAA;;AAGjF,MAAM,WAAW,YACf,QAAQ,YAAY,WAAW,QAAQ,OAAO,MAAM,KAAA;;AAGtD,SAAS,MAAM,SAAsE;CACnF,IAAI,UAAU;CACd,MAAM,QAAQ,UAA4B;EACxC,KAAK,MAAM,QAAQ,OACjB,IAAI,KAAK,UAAU,KAAK,KAAK,QAAQ;OAChC,UAAU,KAAK,IAAI,SAAS,KAAK,KAAK;CAE/C;CACA,KAAK,QAAQ,KAAK;CAClB,MAAM,EAAE,UAAU,UAAUA,aAAAA,UAC1BC,cAAAA,OAAO,QAAQ,GAAG,KAAK,GACvBA,cAAAA,OAAO,QAAQ,GAAG,KAAK,SACvBA,cAAAA,OAAO,QAAQ,GAAG,GAClB,QAAQ,O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;;;;;;;;;;;;;;AAoBA,MAAa,UAAmD;CAC9D,MAAM;CACN,OAAOe,cAAAA,WAAW,SAAS,WAAW,IAAI,CAAC;CAC3C,UAAU,aAAa;EAAE,GAAG;EAAS,OAAO,MAAM,QAAQ,IAAI;CAAE;CAChE,QAAQ;CAER,SAAS,YAAa,QAAQ,OAAO,IAAI,CAAC,IAAIC,cAAAA,YAAY,QAAQ,IAAI;CACtE,OAAO;AACT"}
@@ -4,6 +4,7 @@ import { t as rectPath } from "./rect-CZTNvMlf.js";
4
4
  import { t as h } from "./vnode-_EMUqysL.js";
5
5
  import { a as isRecord, c as named, i as finite, s as list, t as cleanData } from "./clean-CkoQobGv.js";
6
6
  import { t as fit } from "./fit-BPyPRnsK.js";
7
+ import { n as heatScale } from "./heat-Bsqq4zw9.js";
7
8
  import { n as keyOf, r as legendItems, t as groupAttrs } from "./named-BOiBah6I.js";
8
9
  // src/charts/treemap.ts
9
10
  /** Levels of nesting read from the data, and the most nodes: enough for any chart, few enough to draw. */
@@ -11,6 +12,8 @@ const MAX_DEPTH = 8;
11
12
  const MAX_NODES = 5e3;
12
13
  /** Space between a tile's edge and its text. */
13
14
  const INSET = 6;
15
+ /** Share of the full color at the minimum, so the smallest tile still reads as a tile. */
16
+ const FLOOR = .08;
14
17
  function sized(nodes) {
15
18
  return nodes.map((node) => {
16
19
  if (node.children?.length) {
@@ -27,12 +30,32 @@ function sized(nodes) {
27
30
  };
28
31
  });
29
32
  }
30
- /** The top-level entries with their sizes and color slots, without the hidden ones. */
33
+ /** The stops of the `colors` scale, when there are enough of them. */
34
+ const stopsOf = (options) => Array.isArray(options.colors) && options.colors.length >= 2 ? options.colors : void 0;
35
+ /** Whether the tiles are colored by their value, not by their group. */
36
+ const byValue = (options) => options.colorBy === "value" || stopsOf(options) !== void 0;
37
+ /** The color scale of a treemap shaded by value, over every tile (hidden ones too, so it stays put). */
38
+ function scale(options) {
39
+ let largest = 0;
40
+ const walk = (items) => {
41
+ for (const item of items) if (item.children) walk(item.children);
42
+ else largest = Math.max(largest, item.value);
43
+ };
44
+ walk(options.sized);
45
+ const { position, paint } = heatScale(finite(options.min) ?? 0, finite(options.max) ?? largest, finite(options.mid), stopsOf(options), FLOOR);
46
+ return (v) => paint(position(v));
47
+ }
48
+ /**
49
+ * The top-level entries with their sizes and color slots, without the hidden
50
+ * ones. Shaded by value there is no legend to hide them from, so `hidden` is
51
+ * read from the data.
52
+ */
31
53
  function visible(model, hidden) {
54
+ const fixed = byValue(model);
32
55
  return model.sized.map((entry, index) => ({
33
56
  entry,
34
57
  index
35
- })).filter(({ entry }) => !hidden.has(keyOf(entry.node)));
58
+ })).filter(({ entry }) => !hidden.has(keyOf(entry.node)) && !(fixed && entry.node.hidden));
36
59
  }
37
60
  /**
38
61
  * Squarified layout (Bruls, Huizing, van Wijk): `items`, largest first, fill
@@ -131,6 +154,7 @@ function renderTreemap(options, ctx) {
131
154
  0,
132
155
  0
133
156
  ], void 0, entries.map(({ index }) => index));
157
+ const paint = byValue(options) ? scale(options) : void 0;
134
158
  const value = formatNumber(options.format, locale);
135
159
  const share = getNumberFormat(locale, {
136
160
  style: "percent",
@@ -146,7 +170,7 @@ function renderTreemap(options, ctx) {
146
170
  x,
147
171
  y: tile.y + tile.height / 2
148
172
  };
149
- const color = tile.node.color ?? options.data[tile.top]?.color;
173
+ const color = paint ? paint(tile.value).color : tile.node.color ?? options.data[tile.top]?.color;
150
174
  if (color) item.color = color;
151
175
  return {
152
176
  index,
@@ -175,13 +199,17 @@ function renderTreemap(options, ctx) {
175
199
  };
176
200
  const groups = entries.map(({ entry, index }) => h("g", groupAttrs(entry.node, index), tiles.filter((tile) => tile.top === index).map((tile) => h("rect", {
177
201
  key: tile.key,
178
- class: ["tc-tile", tile.trail.length > 0 && tile.node.class],
202
+ class: [
203
+ "tc-tile",
204
+ paint && "tc-tile-shaded",
205
+ tile.trail.length > 0 && tile.node.class
206
+ ],
179
207
  x: round(tile.x),
180
208
  y: round(tile.y),
181
209
  width: round(tile.width),
182
210
  height: round(tile.height),
183
211
  rx: round(Math.min(radius, tile.width / 2, tile.height / 2)),
184
- style: tile.trail.length > 0 ? { "--tc-series-color": tile.node.color } : void 0
212
+ style: paint ? paint(tile.value).style : tile.trail.length > 0 ? { "--tc-series-color": tile.node.color } : void 0
185
213
  }))));
186
214
  const line = fontSize * 1.3;
187
215
  const labels = options.labels !== false && tiles.flatMap((tile) => {
@@ -265,7 +293,9 @@ function cleanNodes(data, depth = 0, budget = { left: MAX_NODES }) {
265
293
  * Treemap: parts of a whole as tiles, each as large as its value, laid out
266
294
  * as close to squares as they go with the largest in the top left corner.
267
295
  * Entries with `children` are groups: their tiles stay together and share
268
- * the group's color.
296
+ * the group's color. `colorBy: 'value'` shades the tiles in one hue instead
297
+ * (`--tc-heat-color`), lighter as the value drops, and `colors` sets a scale
298
+ * of colors for it.
269
299
  *
270
300
  * ```ts
271
301
  * new Chart('#el', {
@@ -285,9 +315,9 @@ const treemap = {
285
315
  sized: sized(options.data)
286
316
  }),
287
317
  render: renderTreemap,
288
- legend: (options) => legendItems(options.data),
318
+ legend: (options) => byValue(options) ? [] : legendItems(options.data),
289
319
  table: treemapTable
290
320
  };
291
321
  export { treemap as t };
292
322
 
293
- //# sourceMappingURL=treemap-C4glsx-g.js.map
323
+ //# sourceMappingURL=treemap-lbYxb-7h.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"treemap-lbYxb-7h.js","names":[],"sources":["../src/charts/treemap.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext, RenderResult, TableContext } from '../chart.ts'\nimport { formatNumber, getNumberFormat, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { estimateTextWidth, type InsetsInput, innerRect, insets, round } from '../layout.ts'\nimport { rectPath } from '../shapes/rect.ts'\nimport { type ClassValue, h } from '../vnode.ts'\nimport { cleanData, finite, isRecord, list, named } from './clean.ts'\nimport { fit } from './fit.ts'\nimport { type HeatScale, heatScale } from './heat.ts'\nimport { groupAttrs, keyOf, legendItems } from './named.ts'\n\n/** A tile of a treemap, or a group of them. */\nexport interface TreemapNode {\n name: string\n /** Size of the tile; a negative value is zero. A group is as large as its `children`. */\n value?: number\n /** Tiles (or groups) inside this one; they share its color. */\n children?: readonly TreemapNode[]\n /** Stable identity for keyed updates and legend toggles. Defaults to `name`. */\n id?: string\n /**\n * Custom color; overrides the palette slot via `--tc-series-color`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n * Not used when the tiles are shaded by value.\n */\n color?: string\n /** Extra classes on the group (top level) or the tile. */\n class?: ClassValue\n /** Start hidden (top level; toggle it back from the legend, which there is none of when shaded by value). */\n hidden?: boolean\n}\n\nexport interface TreemapOptions {\n /** Tiles, or groups of tiles; each top-level entry takes a palette color and a legend entry. */\n data: readonly TreemapNode[]\n /**\n * `'value'` shades every tile in one hue, `--tc-heat-color`, lighter as\n * the value drops (as a heatmap does), with no legend; `'series'` (the\n * default) gives each top-level entry its palette color.\n */\n colorBy?: 'series' | 'value'\n /**\n * A continuous scale through two or more colors (any CSS color, including\n * `var(--tc-…)`), from `min` to `max`; the tiles are then colored by value\n * whatever `colorBy` says. Values that could inject CSS are ignored, as\n * for the colors of the nodes.\n */\n colors?: readonly string[]\n /** Value shown with the lightest shade (or the first color). Defaults to `0`. */\n min?: number\n /** Value shown with the full color (or the last color). Defaults to the largest tile. */\n max?: number\n /** Value placed on the middle color of `colors`. Defaults to halfway. */\n mid?: number\n /** Space between tiles in pixels. Defaults to `2`. */\n gap?: number\n /** Corner radius of the tiles. Defaults to `3`. */\n radius?: number\n /** Names (and values, where they fit) written in the tiles. Defaults to `true`. */\n labels?: boolean\n /** Format of the values (tiles, tooltip, table). */\n format?: NumberFormat\n /** Extra space around the chart, in pixels. */\n padding?: InsetsInput\n}\n\n/** Levels of nesting read from the data, and the most nodes: enough for any chart, few enough to draw. */\nconst MAX_DEPTH = 8\nconst MAX_NODES = 5000\n\n/** Space between a tile's edge and its text. */\nconst INSET = 6\n\n/** Share of the full color at the minimum, so the smallest tile still reads as a tile. */\nconst FLOOR = 0.08\n\n/** A node with its size worked out. */\nexport interface Sized {\n node: TreemapNode\n value: number\n children?: Sized[]\n}\n\ninterface Tile {\n node: TreemapNode\n key: string\n /** Position of the top-level ancestor in `data` (the color slot). */\n top: number\n /** Names of the ancestors, outermost first. */\n trail: readonly string[]\n value: number\n x: number\n y: number\n width: number\n height: number\n}\n\nfunction sized(nodes: readonly TreemapNode[]): Sized[] {\n return nodes.map((node) => {\n if (node.children?.length) {\n const children = sized(node.children)\n return { node, children, value: children.reduce((sum, child) => sum + child.value, 0) }\n }\n return { node, value: Math.max(0, node.value ?? 0) }\n })\n}\n\n/** The chart model of a treemap: its options, with every node's size worked out. */\nexport type TreemapModel = TreemapOptions & { sized: Sized[] }\n\n/** The stops of the `colors` scale, when there are enough of them. */\nconst stopsOf = (options: TreemapOptions): readonly string[] | undefined =>\n Array.isArray(options.colors) && options.colors.length >= 2 ? options.colors : undefined\n\n/** Whether the tiles are colored by their value, not by their group. */\nconst byValue = (options: TreemapOptions): boolean =>\n options.colorBy === 'value' || stopsOf(options) !== undefined\n\n/** The color scale of a treemap shaded by value, over every tile (hidden ones too, so it stays put). */\nfunction scale(options: TreemapModel): (v: number) => ReturnType<HeatScale['paint']> {\n let largest = 0\n const walk = (items: readonly Sized[]) => {\n for (const item of items) {\n if (item.children) walk(item.children)\n else largest = Math.max(largest, item.value)\n }\n }\n walk(options.sized)\n const { position, paint } = heatScale(\n finite(options.min) ?? 0,\n finite(options.max) ?? largest,\n finite(options.mid),\n stopsOf(options),\n FLOOR,\n )\n return (v) => paint(position(v))\n}\n\n/**\n * The top-level entries with their sizes and color slots, without the hidden\n * ones. Shaded by value there is no legend to hide them from, so `hidden` is\n * read from the data.\n */\nfunction visible(model: TreemapModel, hidden: ReadonlySet<string>) {\n const fixed = byValue(model)\n return model.sized\n .map((entry, index) => ({ entry, index }))\n .filter(({ entry }) => !hidden.has(keyOf(entry.node)) && !(fixed && entry.node.hidden))\n}\n\n/**\n * Squarified layout (Bruls, Huizing, van Wijk): `items`, largest first, fill\n * the rectangle in rows along its shorter side, each row closed as soon as\n * another item would make its tiles less square.\n */\nfunction squarify(\n items: readonly Sized[],\n x: number,\n y: number,\n w: number,\n hgt: number,\n place: (item: Sized, x: number, y: number, w: number, hgt: number) => void,\n): void {\n const sorted = items.filter((item) => item.value > 0).sort((a, b) => b.value - a.value)\n let left = sorted.reduce((sum, item) => sum + item.value, 0)\n let i = 0\n while (i < sorted.length && w > 0 && hgt > 0) {\n const short = Math.min(w, hgt)\n // Pixels of area per unit of value in what is left of the rectangle.\n const k = (w * hgt) / left\n const largest = (sorted[i] as Sized).value\n let sum = 0\n let best = Number.POSITIVE_INFINITY\n let j = i\n for (; j < sorted.length; j++) {\n const next = sum + (sorted[j] as Sized).value\n // Thickness of the row squared: its worst tile is the largest or the smallest.\n const t2 = ((next * k) / short) ** 2\n const worst = Math.max(t2 / ((sorted[j] as Sized).value * k), (largest * k) / t2)\n if (worst > best) break\n best = worst\n sum = next\n }\n const thickness = (sum * k) / short\n let offset = 0\n for (; i < j; i++) {\n const item = sorted[i] as Sized\n const length = (item.value * k) / thickness\n if (w >= hgt) place(item, x, y + offset, thickness, length)\n else place(item, x + offset, y, length, thickness)\n offset += length\n }\n if (w >= hgt) {\n x += thickness\n w -= thickness\n } else {\n y += thickness\n hgt -= thickness\n }\n left -= sum\n }\n}\n\n/** Half gaps left around a tile on its left, top, right and bottom side. */\ntype Edges = readonly [number, number, number, number]\n\n/**\n * The tiles of `items` in a rectangle, groups laid out inside their own.\n * The gap is cut from the tiles after they are placed, so it does not change\n * their arrangement: half of it on every side (a whole one between any two\n * neighbors), none at the edge of the chart. `edges` are the half gaps of\n * the rectangle itself.\n */\nfunction layout(\n items: readonly Sized[],\n x: number,\n y: number,\n w: number,\n hgt: number,\n gap: number,\n out: Tile[],\n edges: Edges,\n top?: { index: number; key: string; trail: readonly string[] },\n slots?: readonly number[],\n): void {\n squarify(items, x, y, w, hgt, (item, tx, ty, tw, th) => {\n const index = top?.index ?? (slots?.[items.indexOf(item)] as number)\n const key = top ? `${top.key}/${keyOf(item.node)}` : keyOf(item.node)\n const trail = top?.trail ?? []\n // A side on the border of the rectangle takes its half gap (none at the chart's edge), the others one.\n const near = 0.01\n const sides: Edges = [\n tx - x < near ? edges[0] : 1,\n ty - y < near ? edges[1] : 1,\n x + w - tx - tw < near ? edges[2] : 1,\n y + hgt - ty - th < near ? edges[3] : 1,\n ]\n if (item.children) {\n layout(item.children, tx, ty, tw, th, gap, out, sides, {\n index,\n key,\n trail: [...trail, item.node.name],\n })\n } else {\n const half = gap / 2\n out.push({\n node: item.node,\n key,\n top: index,\n trail,\n value: item.value,\n x: tx + sides[0] * half,\n y: ty + sides[1] * half,\n width: Math.max(0, tw - (sides[0] + sides[2]) * half),\n height: Math.max(0, th - (sides[1] + sides[3]) * half),\n })\n }\n })\n}\n\nfunction renderTreemap(options: TreemapModel, ctx: RenderContext): RenderResult {\n const { width, height, fontSize, locale } = ctx\n const gap = Math.max(0, options.gap ?? 2)\n const radius = Math.max(0, options.radius ?? 3)\n const area = innerRect(width, height, insets(options.padding, 0))\n const entries = visible(options, ctx.hidden)\n const total = entries.reduce((sum, { entry }) => sum + entry.value, 0)\n\n const tiles: Tile[] = []\n layout(\n entries.map(({ entry }) => entry),\n area.x,\n area.y,\n area.width,\n area.height,\n gap,\n tiles,\n [0, 0, 0, 0],\n undefined,\n entries.map(({ index }) => index),\n )\n\n const paint = byValue(options) ? scale(options) : undefined\n const value = formatNumber(options.format, locale)\n const share = getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 })\n const hitFor = (tile: Tile, index: number): Hit => {\n const x = tile.x + tile.width / 2\n const item: HitItem = {\n name: tile.node.name,\n seriesIndex: tile.top,\n value: tile.value,\n text: `${value(tile.value)} (${share.format(total > 0 ? tile.value / total : 0)})`,\n x,\n y: tile.y + tile.height / 2,\n }\n const color = paint\n ? paint(tile.value).color\n : (tile.node.color ?? options.data[tile.top]?.color)\n if (color) item.color = color\n return {\n index,\n label: [...tile.trail, tile.node.name].join(' › '),\n title: tile.trail.join(' › '),\n x,\n area,\n items: [item],\n seriesIndex: tile.top,\n // A ring just inside the hovered tile.\n highlight: {\n kind: 'halo',\n d: rectPath(tile.x + 1, tile.y + 1, tile.width - 2, tile.height - 2, radius - 1),\n },\n }\n }\n\n const interaction: Interaction = {\n count: tiles.length,\n hitIndex: (index) => {\n const tile = tiles[index]\n return tile ? hitFor(tile, index) : null\n },\n hitTest(px, py) {\n const index = tiles.findIndex(\n (tile) =>\n px >= tile.x - gap / 2 &&\n px <= tile.x + tile.width + gap / 2 &&\n py >= tile.y - gap / 2 &&\n py <= tile.y + tile.height + gap / 2,\n )\n return index < 0 ? null : hitFor(tiles[index] as Tile, index)\n },\n }\n\n const groups = entries.map(({ entry, index }) =>\n h(\n 'g',\n groupAttrs(entry.node, index),\n tiles\n .filter((tile) => tile.top === index)\n .map((tile) =>\n h('rect', {\n key: tile.key,\n class: ['tc-tile', paint && 'tc-tile-shaded', tile.trail.length > 0 && tile.node.class],\n x: round(tile.x),\n y: round(tile.y),\n width: round(tile.width),\n height: round(tile.height),\n rx: round(Math.min(radius, tile.width / 2, tile.height / 2)),\n // Shaded by its value, or in its group's color: a tile inside a group may have its own.\n style: paint\n ? paint(tile.value).style\n : tile.trail.length > 0\n ? { '--tc-series-color': tile.node.color }\n : undefined,\n }),\n ),\n ),\n )\n\n // Names where a few letters fit, values below where there is a second line.\n const line = fontSize * 1.3\n const labels =\n options.labels !== false &&\n tiles.flatMap((tile) => {\n const room = tile.width - INSET * 2\n const name = tile.height >= line + INSET ? fit(tile.node.name, room, fontSize) : ''\n if (!name) return []\n const text = value(tile.value)\n const x = round(tile.x + INSET)\n const y = tile.y + INSET + fontSize * 0.85\n return [\n h('text', { key: tile.key, class: 'tc-treemap-label', x, y: round(y) }, name),\n tile.height >= line * 2 + INSET * 1.5 &&\n estimateTextWidth(text, fontSize) <= room &&\n h(\n 'text',\n {\n key: `${tile.key}/value`,\n class: 'tc-treemap-label tc-treemap-value',\n x,\n y: round(y + line),\n },\n text,\n ),\n ]\n })\n\n const content = [\n h('g', { class: 'tc-treemap-tiles' }, groups),\n labels && h('g', { class: 'tc-treemap-labels', 'aria-hidden': 'true' }, labels),\n ]\n return { content, interaction }\n}\n\nfunction treemapTable(options: TreemapModel, ctx: TableContext, limit: number): DataTable {\n const entries = visible(options, ctx.hidden)\n const total = entries.reduce((sum, { entry }) => sum + entry.value, 0)\n const value = formatNumber(options.format, ctx.locale)\n const share = getNumberFormat(ctx.locale, { style: 'percent', maximumFractionDigits: 1 })\n const rows: string[][] = []\n const walk = (items: readonly Sized[], trail: readonly string[]) => {\n for (const item of items) {\n const path = [...trail, item.node.name]\n if (item.children) walk(item.children, path)\n else {\n rows.push([\n path.join(' › '),\n value(item.value),\n share.format(total > 0 ? item.value / total : 0),\n ])\n }\n }\n }\n walk(\n entries.map(({ entry }) => entry),\n [],\n )\n const table: DataTable = { columns: ['', 'Value', 'Share'], rows }\n if (rows.length > limit) {\n table.rows = rows.slice(0, limit)\n table.total = rows.length\n }\n return table\n}\n\n/** Nodes with text for names and finite values, at most `MAX_DEPTH` deep and `MAX_NODES` in all. */\nfunction cleanNodes(data: unknown, depth = 0, budget = { left: MAX_NODES }): TreemapNode[] {\n const nodes: TreemapNode[] = []\n for (const r of list(data)) {\n if (!isRecord(r) || budget.left <= 0) continue\n budget.left--\n const children =\n depth < MAX_DEPTH && Array.isArray(r.children)\n ? cleanNodes(r.children, depth + 1, budget)\n : undefined\n nodes.push({ ...named(r), value: finite(r.value) ?? 0, children } as unknown as TreemapNode)\n }\n return nodes\n}\n\n/**\n * Treemap: parts of a whole as tiles, each as large as its value, laid out\n * as close to squares as they go with the largest in the top left corner.\n * Entries with `children` are groups: their tiles stay together and share\n * the group's color. `colorBy: 'value'` shades the tiles in one hue instead\n * (`--tc-heat-color`), lighter as the value drops, and `colors` sets a scale\n * of colors for it.\n *\n * ```ts\n * new Chart('#el', {\n * type: treemap,\n * data: [\n * { name: 'Search', value: 42 },\n * { name: 'Social', children: [{ name: 'Video', value: 18 }, { name: 'Posts', value: 9 }] },\n * ],\n * })\n * ```\n */\nexport const treemap: ChartType<TreemapOptions, TreemapModel> = {\n name: 'treemap',\n clean: cleanData((data) => cleanNodes(data)),\n prepare: (options) => ({ ...options, sized: sized(options.data) }),\n render: renderTreemap,\n // Shaded by value there is one hue, and nothing for a legend to tell apart.\n legend: (options) => (byValue(options) ? [] : legendItems(options.data)),\n table: treemapTable,\n}\n"],"mappings":";;;;;;;;;;AAoEA,MAAM,YAAY;AAClB,MAAM,YAAY;;AAGlB,MAAM,QAAQ;;AAGd,MAAM,QAAQ;AAuBd,SAAS,MAAM,OAAwC;CACrD,OAAO,MAAM,KAAK,SAAS;EACzB,IAAI,KAAK,UAAU,QAAQ;GACzB,MAAM,WAAW,MAAM,KAAK,QAAQ;GACpC,OAAO;IAAE;IAAM;IAAU,OAAO,SAAS,QAAQ,KAAK,UAAU,MAAM,MAAM,OAAO,CAAC;GAAE;EACxF;EACA,OAAO;GAAE;GAAM,OAAO,KAAK,IAAI,GAAG,KAAK,SAAS,CAAC;EAAE;CACrD,CAAC;AACH;;AAMA,MAAM,WAAW,YACf,MAAM,QAAQ,QAAQ,MAAM,KAAK,QAAQ,OAAO,UAAU,IAAI,QAAQ,SAAS,KAAA;;AAGjF,MAAM,WAAW,YACf,QAAQ,YAAY,WAAW,QAAQ,OAAO,MAAM,KAAA;;AAGtD,SAAS,MAAM,SAAsE;CACnF,IAAI,UAAU;CACd,MAAM,QAAQ,UAA4B;EACxC,KAAK,MAAM,QAAQ,OACjB,IAAI,KAAK,UAAU,KAAK,KAAK,QAAQ;OAChC,UAAU,KAAK,IAAI,SAAS,KAAK,KAAK;CAE/C;CACA,KAAK,QAAQ,KAAK;CAClB,MAAM,EAAE,UAAU,UAAU,UAC1B,OAAO,Q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AChE,QAAQ;CAER,SAAS,YAAa,QAAQ,OAAO,IAAI,CAAC,IAAI,YAAY,QAAQ,IAAI;CACtE,OAAO;AACT"}
package/dist/treemap.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_treemap = require("./treemap-CZk8kKFD.cjs");
2
+ const require_treemap = require("./treemap-PulGXZv0.cjs");
3
3
  exports.treemap = require_treemap.treemap;
@@ -1,3 +1,3 @@
1
1
  /** Standalone entry: `import { treemap } from '@tabler/charts/treemap'`. */
2
- import { n as TreemapOptions, r as treemap, t as TreemapNode } from "./treemap-25vHO_UK.cjs";
2
+ import { n as TreemapOptions, r as treemap, t as TreemapNode } from "./treemap-C2maqerU.cjs";
3
3
  export { type TreemapNode, type TreemapOptions, treemap };
package/dist/treemap.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Standalone entry: `import { treemap } from '@tabler/charts/treemap'`. */
2
- import { n as TreemapOptions, r as treemap, t as TreemapNode } from "./treemap-BCXUbixd.js";
2
+ import { n as TreemapOptions, r as treemap, t as TreemapNode } from "./treemap-D_zbubo3.js";
3
3
  export { type TreemapNode, type TreemapOptions, treemap };
package/dist/treemap.js CHANGED
@@ -1 +1 @@
1
- export { t as treemap } from "./treemap-C4glsx-g.js";
1
+ export { t as treemap } from "./treemap-lbYxb-7h.js";
@@ -99,12 +99,13 @@ function valueLabels(config, interaction, ctx) {
99
99
  y: 0,
100
100
  height: area.y + area.height
101
101
  };
102
- const fits = (p, slim = {
102
+ const slim = (p) => ({
103
103
  ...p.box,
104
104
  x: p.box.x + 5,
105
105
  width: p.box.width - 10
106
- }) => contains(pie ? area : room, p.box) && (!p.inside || !box || contains(box, p.box)) && (!pie || sliceFits(item, area, share, p.box)) && !placed.some((other) => overlaps(other.box, p.box)) && !marks.some((mark) => mark !== box && overlaps(mark, slim));
107
- const spot = candidates.find((p) => fits(p));
106
+ });
107
+ const fits = (p, over = false) => contains(pie ? area : room, p.box) && (!p.inside || !box || contains(box, p.box)) && (!pie || sliceFits(item, area, share, p.box)) && !placed.some((other) => overlaps(other.box, p.box)) && (over || !marks.some((mark) => mark !== box && overlaps(mark, slim(p))));
108
+ const spot = candidates.find((p) => fits(p)) ?? (options.overMarks && !box && !pie ? candidates.find((p) => fits(p, true)) : void 0);
108
109
  if (spot) placed.push(spot);
109
110
  });
110
111
  if (!placed.length) return null;
@@ -140,4 +141,4 @@ function sliceFits(item, area, share, label) {
140
141
  const labelsStep = (config, content, interaction, ctx) => interaction && wanted(config) ? [content, valueLabels(config, interaction, ctx)] : content;
141
142
  export { valueLabels as n, labelsStep as t };
142
143
 
143
- //# sourceMappingURL=value-labels-C7GrhOXJ.js.map
144
+ //# sourceMappingURL=value-labels-B0VeheyE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-labels-B0VeheyE.js","names":[],"sources":["../src/charts/value-labels.ts"],"sourcesContent":["/**\n * Value labels: the value written on each mark, for charts read at a\n * glance. They are worked out from the chart's interaction, so every type\n * gets them the same way: bars at their end (inside when there is no room\n * outside), stacked segments and heatmap cells in their middle, lines and\n * points above their point (the last one by default), slices in their\n * middle with their share. A label that does not fit its mark or the plot,\n * or that would cover another one, is left out: labels never overlap. One\n * that would cover a mark of another series is left out too, unless\n * `overMarks` lets the labels of points lie over the bars they cross.\n */\nimport type { ChartConfig, RenderContext } from '../chart.ts'\nimport type { PostStep } from '../features.ts'\nimport { formatNumber, getNumberFormat, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { estimateTextWidth, type Rect, round } from '../layout.ts'\nimport { h, type VNode } from '../vnode.ts'\n\nexport interface ValueLabelOptions {\n /** Format of the values. Defaults to the value axis format (slices: their share in percent). */\n format?: NumberFormat\n /** Which points of lines, areas and scatters get a label. Defaults to `'last'`. */\n points?: 'last' | 'all'\n /**\n * Let the label of a point lie over a bar or a cell when it has no free\n * place (a line over bars): every point keeps its label. Labels still\n * never cover each other. Defaults to `false`.\n */\n overMarks?: boolean\n}\n\n/** Space between a mark and its label, and around labels. */\nconst GAP = 4\n\ninterface Placed {\n key: string\n series: number\n text: string\n x: number\n y: number\n inside: boolean\n box: Rect\n}\n\nconst overlaps = (a: Rect, b: Rect): boolean =>\n a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height\n\nconst contains = (outer: Rect, inner: Rect): boolean =>\n inner.x >= outer.x - 1 &&\n inner.y >= outer.y - 1 &&\n inner.x + inner.width <= outer.x + outer.width + 1 &&\n inner.y + inner.height <= outer.y + outer.height + 1\n\n/** The `valueLabels` of each series: `true`, `false`, or anything else for the chart's. */\nconst own = (config: ChartConfig<object>): unknown[] => {\n const series = (config as { data?: { series?: unknown } }).data?.series\n return Array.isArray(series) ? series.map((s) => s?.valueLabels) : []\n}\n\n/** Whether a chart has labels: on the chart, or on one of its series. */\nconst wanted = (config: ChartConfig<object>): boolean =>\n !!config.valueLabels || own(config).includes(true)\n\n/** The labels layer of a chart, or `null` when nothing gets one. */\nexport function valueLabels(\n config: ChartConfig<object>,\n interaction: Interaction,\n ctx: RenderContext,\n): VNode | null {\n const option = config.valueLabels\n const options: ValueLabelOptions = typeof option === 'object' ? option : {}\n const { fontSize, locale } = ctx\n // What the chart type says about its marks (slices, cells) and its number format.\n const spec = config.type.valueLabels\n const pie = spec?.marks === 'slice'\n const cell = spec?.marks === 'cell'\n const stacked = !!(config as { stacked?: unknown }).stacked\n const format = options.format\n ? formatNumber(options.format, locale)\n : pie\n ? (v: number) =>\n getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 }).format(v)\n : spec?.format\n ? formatNumber(spec.format(config), locale)\n : undefined\n // Numbers have no descenders: one em is their height, with room to spare.\n const height = fontSize\n\n // Candidates in order of priority: every hit's items, and for points only the\n // last one of each series unless all are asked for.\n // A series' own `valueLabels` wins over the chart's.\n const series = own(config)\n const isLabelled = (index: number): boolean => {\n const on = series[index]\n return typeof on === 'boolean' ? on : !!option\n }\n const items: [string, HitItem, Hit][] = []\n // Marks a label must not cover: every bar and cell but its own, labelled or not.\n const marks: Rect[] = []\n const last = new Map<number, number>()\n let total = 0\n for (let i = 0; i < interaction.count; i++) {\n const hit = interaction.hitIndex(i)\n for (const item of hit?.items ?? []) {\n if (item.value === null || item.y === null || !hit) continue\n total += Math.abs(item.value)\n if (item.box) marks.push(item.box)\n if (!isLabelled(item.seriesIndex)) continue\n if (!pie && !item.box && options.points !== 'all') last.set(item.seriesIndex, items.length)\n items.push([`${i}-${item.seriesIndex}`, item, hit])\n }\n }\n\n const placed: Placed[] = []\n items.forEach(([key, item, hit], n) => {\n const { area } = hit\n if (!pie && !item.box && options.points !== 'all' && last.get(item.seriesIndex) !== n) return\n const value = item.value as number\n const share = value / (total || 1)\n const text = format ? format(pie ? share : value) : item.text\n const width = estimateTextWidth(text, fontSize)\n const at = (x: number, y: number, inside: boolean): Placed => {\n // A point's label at the plot's edge (the last point) moves in.\n if (!item.box && !pie) {\n x = Math.max(area.x + width / 2 + 2, Math.min(x, area.x + area.width - width / 2 - 2))\n }\n return {\n key,\n series: item.seriesIndex,\n text,\n x,\n y,\n inside,\n box: { x: x - width / 2 - 2, y: y - height / 2, width: width + 4, height },\n }\n }\n const y = item.y as number\n const candidates: Placed[] = []\n const { box } = item\n if (pie) {\n candidates.push(at(item.x, y, true))\n } else if (box) {\n const horizontal = hit.axis === 'y'\n const down = value < 0\n if (!stacked && !cell) {\n // Beyond the bar's end, then just inside it.\n const reach = (horizontal ? width / 2 : height / 2) + GAP\n const sign = down ? 1 : -1\n const along = y + sign * reach\n // Sideways, bars grow to the right, or to the left in a right-to-left chart.\n const side = ctx.rtl ? -sign : sign\n candidates.push(\n horizontal ? at(item.x - side * reach, y, false) : at(item.x, along, false),\n // A label wider than its bar may lean off a taller neighbour.\n ...(horizontal\n ? []\n : [\n at(box.x + width / 2 - 3, along, false),\n at(box.x + box.width - width / 2 + 3, along, false),\n ]),\n horizontal ? at(item.x + side * reach, y, true) : at(item.x, y - sign * reach, true),\n )\n } else {\n candidates.push(at(box.x + box.width / 2, box.y + box.height / 2, true))\n }\n } else {\n // Above the point, below it, or beside it (the end of a line, at the plot's edge).\n const side = width / 2 + GAP + 4\n candidates.push(\n at(item.x, y - height / 2 - GAP - 2, false),\n at(item.x, y + height / 2 + GAP + 2, false),\n at(item.x - side, y, false),\n at(item.x + side, y, false),\n )\n }\n // Labels may rise into the margin above the plot, not over the axes.\n const room = { ...area, y: 0, height: area.y + area.height }\n // Glyphs leave a little room at their sides (`slim`): a label may brush a neighbour.\n const slim = (p: Placed): Rect => ({ ...p.box, x: p.box.x + 5, width: p.box.width - 10 })\n const fits = (p: Placed, over = false) =>\n contains(pie ? area : room, p.box) &&\n (!p.inside || !box || contains(box, p.box)) &&\n (!pie || sliceFits(item, area, share, p.box)) &&\n !placed.some((other) => overlaps(other.box, p.box)) &&\n (over || !marks.some((mark) => mark !== box && overlaps(mark, slim(p))))\n // A free place first; with `overMarks`, a point's label may then lie over a bar.\n const spot =\n candidates.find((p) => fits(p)) ??\n (options.overMarks && !box && !pie ? candidates.find((p) => fits(p, true)) : undefined)\n if (spot) placed.push(spot)\n })\n\n if (!placed.length) return null\n return h(\n 'g',\n { key: 'value-labels', class: 'tc-value-labels', 'aria-hidden': 'true' },\n placed.map((p) =>\n h(\n 'text',\n {\n key: p.key,\n class: [\n 'tc-value-label',\n 'tc-series',\n `tc-series-${p.series + 1}`,\n p.inside && 'tc-value-label-inside',\n ],\n style: `transform:translate(${round(p.x)}px,${round(p.y)}px)`,\n 'text-anchor': 'middle',\n dy: '0.35em',\n },\n p.text,\n ),\n ),\n )\n}\n\n/**\n * Whether a label fits its slice: it sits at the slice's centroid, where the\n * slice is about its share of the circle wide and twice the distance to the\n * outer edge deep.\n */\nfunction sliceFits(item: HitItem, area: Rect, share: number, label: Rect): boolean {\n const outer = area.width / 2\n const radius = Math.hypot(item.x - area.x - outer, (item.y as number) - area.y - outer)\n const depth = 2 * (outer - radius)\n return label.width <= share * 2 * Math.PI * radius && label.height <= depth\n}\n\n/** The step that adds the labels over the content of charts with `valueLabels`. */\nexport const labelsStep: PostStep = (config, content, interaction, ctx) =>\n interaction && wanted(config) ? [content, valueLabels(config, interaction, ctx)] : content\n"],"mappings":";;;;;AAgCA,MAAM,MAAM;AAYZ,MAAM,YAAY,GAAS,MACzB,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE;AAEtF,MAAM,YAAY,OAAa,UAC7B,MAAM,KAAK,MAAM,IAAI,KACrB,MAAM,KAAK,MAAM,IAAI,KACrB,MAAM,IAAI,MAAM,SAAS,MAAM,IAAI,MAAM,QAAQ,KACjD,MAAM,IAAI,MAAM,UAAU,MAAM,IAAI,MAAM,SAAS;;AAGrD,MAAM,OAAO,WAA2C;CACtD,MAAM,SAAU,OAA2C,MAAM;CACjE,OAAO,MAAM,QAAQ,MAAM,IAAI,OAAO,KAAK,MAAM,GAAG,WAAW,IAAI,CAAC;AACtE;;AAGA,MAAM,UAAU,WACd,CAAC,CAAC,OAAO,eAAe,IAAI,MAAM,CAAC,CAAC,SAAS,IAAI;;AAGnD,SAAgB,YACd,QACA,aACA,KACc;CACd,MAAM,SAAS,OAAO;CACtB,MAAM,UAA6B,OAAO,WAAW,WAAW,SAAS,CAAC;CAC1E,MAAM,EAAE,UAAU,WAAW;CAE7B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,MAAM,MAAM,UAAU;CAC5B,MAAM,OAAO,MAAM,UAAU;CAC7B,MAAM,UAAU,CAAC,CAAE,OAAiC;CACpD,MAAM,SAAS,QAAQ,SACnB,aAAa,QAAQ,QAAQ,MAAM,IACnC,OACG,MACC,gBAAgB,QAAQ;EAAE,OAAO;EAAW,uBAAuB;CAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAClF,MAAM,SACJ,aAAa,KA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E,CAAC,EAAE;EACzD,eAAe;EACf,IAAI;CACN,GACA,EAAE,IACJ,CACF,CACF;AACF;;;;;;AAOA,SAAS,UAAU,MAAe,MAAY,OAAe,OAAsB;CACjF,MAAM,QAAQ,KAAK,QAAQ;CAC3B,MAAM,SAAS,KAAK,MAAM,KAAK,IAAI,KAAK,IAAI,OAAQ,KAAK,IAAe,KAAK,IAAI,KAAK;CACtF,MAAM,QAAQ,KAAK,QAAQ;CAC3B,OAAO,MAAM,SAAS,QAAQ,IAAI,KAAK,KAAK,UAAU,MAAM,UAAU;AACxE;;AAGA,MAAa,cAAwB,QAAQ,SAAS,aAAa,QACjE,eAAe,OAAO,MAAM,IAAI,CAAC,SAAS,YAAY,QAAQ,aAAa,GAAG,CAAC,IAAI"}
@@ -99,12 +99,13 @@ function valueLabels(config, interaction, ctx) {
99
99
  y: 0,
100
100
  height: area.y + area.height
101
101
  };
102
- const fits = (p, slim = {
102
+ const slim = (p) => ({
103
103
  ...p.box,
104
104
  x: p.box.x + 5,
105
105
  width: p.box.width - 10
106
- }) => contains(pie ? area : room, p.box) && (!p.inside || !box || contains(box, p.box)) && (!pie || sliceFits(item, area, share, p.box)) && !placed.some((other) => overlaps(other.box, p.box)) && !marks.some((mark) => mark !== box && overlaps(mark, slim));
107
- const spot = candidates.find((p) => fits(p));
106
+ });
107
+ const fits = (p, over = false) => contains(pie ? area : room, p.box) && (!p.inside || !box || contains(box, p.box)) && (!pie || sliceFits(item, area, share, p.box)) && !placed.some((other) => overlaps(other.box, p.box)) && (over || !marks.some((mark) => mark !== box && overlaps(mark, slim(p))));
108
+ const spot = candidates.find((p) => fits(p)) ?? (options.overMarks && !box && !pie ? candidates.find((p) => fits(p, true)) : void 0);
108
109
  if (spot) placed.push(spot);
109
110
  });
110
111
  if (!placed.length) return null;
@@ -151,4 +152,4 @@ Object.defineProperty(exports, "valueLabels", {
151
152
  }
152
153
  });
153
154
 
154
- //# sourceMappingURL=value-labels-DzaKIWKp.cjs.map
155
+ //# sourceMappingURL=value-labels-Dcyk3GIY.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-labels-Dcyk3GIY.cjs","names":["formatNumber","getNumberFormat","estimateTextWidth","h","round"],"sources":["../src/charts/value-labels.ts"],"sourcesContent":["/**\n * Value labels: the value written on each mark, for charts read at a\n * glance. They are worked out from the chart's interaction, so every type\n * gets them the same way: bars at their end (inside when there is no room\n * outside), stacked segments and heatmap cells in their middle, lines and\n * points above their point (the last one by default), slices in their\n * middle with their share. A label that does not fit its mark or the plot,\n * or that would cover another one, is left out: labels never overlap. One\n * that would cover a mark of another series is left out too, unless\n * `overMarks` lets the labels of points lie over the bars they cross.\n */\nimport type { ChartConfig, RenderContext } from '../chart.ts'\nimport type { PostStep } from '../features.ts'\nimport { formatNumber, getNumberFormat, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { estimateTextWidth, type Rect, round } from '../layout.ts'\nimport { h, type VNode } from '../vnode.ts'\n\nexport interface ValueLabelOptions {\n /** Format of the values. Defaults to the value axis format (slices: their share in percent). */\n format?: NumberFormat\n /** Which points of lines, areas and scatters get a label. Defaults to `'last'`. */\n points?: 'last' | 'all'\n /**\n * Let the label of a point lie over a bar or a cell when it has no free\n * place (a line over bars): every point keeps its label. Labels still\n * never cover each other. Defaults to `false`.\n */\n overMarks?: boolean\n}\n\n/** Space between a mark and its label, and around labels. */\nconst GAP = 4\n\ninterface Placed {\n key: string\n series: number\n text: string\n x: number\n y: number\n inside: boolean\n box: Rect\n}\n\nconst overlaps = (a: Rect, b: Rect): boolean =>\n a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height\n\nconst contains = (outer: Rect, inner: Rect): boolean =>\n inner.x >= outer.x - 1 &&\n inner.y >= outer.y - 1 &&\n inner.x + inner.width <= outer.x + outer.width + 1 &&\n inner.y + inner.height <= outer.y + outer.height + 1\n\n/** The `valueLabels` of each series: `true`, `false`, or anything else for the chart's. */\nconst own = (config: ChartConfig<object>): unknown[] => {\n const series = (config as { data?: { series?: unknown } }).data?.series\n return Array.isArray(series) ? series.map((s) => s?.valueLabels) : []\n}\n\n/** Whether a chart has labels: on the chart, or on one of its series. */\nconst wanted = (config: ChartConfig<object>): boolean =>\n !!config.valueLabels || own(config).includes(true)\n\n/** The labels layer of a chart, or `null` when nothing gets one. */\nexport function valueLabels(\n config: ChartConfig<object>,\n interaction: Interaction,\n ctx: RenderContext,\n): VNode | null {\n const option = config.valueLabels\n const options: ValueLabelOptions = typeof option === 'object' ? option : {}\n const { fontSize, locale } = ctx\n // What the chart type says about its marks (slices, cells) and its number format.\n const spec = config.type.valueLabels\n const pie = spec?.marks === 'slice'\n const cell = spec?.marks === 'cell'\n const stacked = !!(config as { stacked?: unknown }).stacked\n const format = options.format\n ? formatNumber(options.format, locale)\n : pie\n ? (v: number) =>\n getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 }).format(v)\n : spec?.format\n ? formatNumber(spec.format(config), locale)\n : undefined\n // Numbers have no descenders: one em is their height, with room to spare.\n const height = fontSize\n\n // Candidates in order of priority: every hit's items, and for points only the\n // last one of each series unless all are asked for.\n // A series' own `valueLabels` wins over the chart's.\n const series = own(config)\n const isLabelled = (index: number): boolean => {\n const on = series[index]\n return typeof on === 'boolean' ? on : !!option\n }\n const items: [string, HitItem, Hit][] = []\n // Marks a label must not cover: every bar and cell but its own, labelled or not.\n const marks: Rect[] = []\n const last = new Map<number, number>()\n let total = 0\n for (let i = 0; i < interaction.count; i++) {\n const hit = interaction.hitIndex(i)\n for (const item of hit?.items ?? []) {\n if (item.value === null || item.y === null || !hit) continue\n total += Math.abs(item.value)\n if (item.box) marks.push(item.box)\n if (!isLabelled(item.seriesIndex)) continue\n if (!pie && !item.box && options.points !== 'all') last.set(item.seriesIndex, items.length)\n items.push([`${i}-${item.seriesIndex}`, item, hit])\n }\n }\n\n const placed: Placed[] = []\n items.forEach(([key, item, hit], n) => {\n const { area } = hit\n if (!pie && !item.box && options.points !== 'all' && last.get(item.seriesIndex) !== n) return\n const value = item.value as number\n const share = value / (total || 1)\n const text = format ? format(pie ? share : value) : item.text\n const width = estimateTextWidth(text, fontSize)\n const at = (x: number, y: number, inside: boolean): Placed => {\n // A point's label at the plot's edge (the last point) moves in.\n if (!item.box && !pie) {\n x = Math.max(area.x + width / 2 + 2, Math.min(x, area.x + area.width - width / 2 - 2))\n }\n return {\n key,\n series: item.seriesIndex,\n text,\n x,\n y,\n inside,\n box: { x: x - width / 2 - 2, y: y - height / 2, width: width + 4, height },\n }\n }\n const y = item.y as number\n const candidates: Placed[] = []\n const { box } = item\n if (pie) {\n candidates.push(at(item.x, y, true))\n } else if (box) {\n const horizontal = hit.axis === 'y'\n const down = value < 0\n if (!stacked && !cell) {\n // Beyond the bar's end, then just inside it.\n const reach = (horizontal ? width / 2 : height / 2) + GAP\n const sign = down ? 1 : -1\n const along = y + sign * reach\n // Sideways, bars grow to the right, or to the left in a right-to-left chart.\n const side = ctx.rtl ? -sign : sign\n candidates.push(\n horizontal ? at(item.x - side * reach, y, false) : at(item.x, along, false),\n // A label wider than its bar may lean off a taller neighbour.\n ...(horizontal\n ? []\n : [\n at(box.x + width / 2 - 3, along, false),\n at(box.x + box.width - width / 2 + 3, along, false),\n ]),\n horizontal ? at(item.x + side * reach, y, true) : at(item.x, y - sign * reach, true),\n )\n } else {\n candidates.push(at(box.x + box.width / 2, box.y + box.height / 2, true))\n }\n } else {\n // Above the point, below it, or beside it (the end of a line, at the plot's edge).\n const side = width / 2 + GAP + 4\n candidates.push(\n at(item.x, y - height / 2 - GAP - 2, false),\n at(item.x, y + height / 2 + GAP + 2, false),\n at(item.x - side, y, false),\n at(item.x + side, y, false),\n )\n }\n // Labels may rise into the margin above the plot, not over the axes.\n const room = { ...area, y: 0, height: area.y + area.height }\n // Glyphs leave a little room at their sides (`slim`): a label may brush a neighbour.\n const slim = (p: Placed): Rect => ({ ...p.box, x: p.box.x + 5, width: p.box.width - 10 })\n const fits = (p: Placed, over = false) =>\n contains(pie ? area : room, p.box) &&\n (!p.inside || !box || contains(box, p.box)) &&\n (!pie || sliceFits(item, area, share, p.box)) &&\n !placed.some((other) => overlaps(other.box, p.box)) &&\n (over || !marks.some((mark) => mark !== box && overlaps(mark, slim(p))))\n // A free place first; with `overMarks`, a point's label may then lie over a bar.\n const spot =\n candidates.find((p) => fits(p)) ??\n (options.overMarks && !box && !pie ? candidates.find((p) => fits(p, true)) : undefined)\n if (spot) placed.push(spot)\n })\n\n if (!placed.length) return null\n return h(\n 'g',\n { key: 'value-labels', class: 'tc-value-labels', 'aria-hidden': 'true' },\n placed.map((p) =>\n h(\n 'text',\n {\n key: p.key,\n class: [\n 'tc-value-label',\n 'tc-series',\n `tc-series-${p.series + 1}`,\n p.inside && 'tc-value-label-inside',\n ],\n style: `transform:translate(${round(p.x)}px,${round(p.y)}px)`,\n 'text-anchor': 'middle',\n dy: '0.35em',\n },\n p.text,\n ),\n ),\n )\n}\n\n/**\n * Whether a label fits its slice: it sits at the slice's centroid, where the\n * slice is about its share of the circle wide and twice the distance to the\n * outer edge deep.\n */\nfunction sliceFits(item: HitItem, area: Rect, share: number, label: Rect): boolean {\n const outer = area.width / 2\n const radius = Math.hypot(item.x - area.x - outer, (item.y as number) - area.y - outer)\n const depth = 2 * (outer - radius)\n return label.width <= share * 2 * Math.PI * radius && label.height <= depth\n}\n\n/** The step that adds the labels over the content of charts with `valueLabels`. */\nexport const labelsStep: PostStep = (config, content, interaction, ctx) =>\n interaction && wanted(config) ? [content, valueLabels(config, interaction, ctx)] : content\n"],"mappings":";;;;;AAgCA,MAAM,MAAM;AAYZ,MAAM,YAAY,GAAS,MACzB,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE;AAEtF,MAAM,YAAY,OAAa,UAC7B,MAAM,KAAK,MAAM,IAAI,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xE;;AAGA,MAAa,cAAwB,QAAQ,SAAS,aAAa,QACjE,eAAe,OAAO,MAAM,IAAI,CAAC,SAAS,YAAY,QAAQ,aAAa,GAAG,CAAC,IAAI"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_value_labels = require("./value-labels-DzaKIWKp.cjs");
2
+ const require_value_labels = require("./value-labels-Dcyk3GIY.cjs");
3
3
  // src/value-labels.ts
4
4
  /**
5
5
  * Standalone entry: `import '@tabler/charts/value-labels'` enables
@@ -2,5 +2,5 @@
2
2
  * Standalone entry: `import '@tabler/charts/value-labels'` enables
3
3
  * `valueLabels` (values written on the marks) on the core.
4
4
  */
5
- import { F as ValueLabelOptions, I as labelsStep, L as valueLabels } from "./chart-CbPzP5Dp.cjs";
5
+ import { M as ValueLabelOptions, N as labelsStep, P as valueLabels } from "./chart-Dz4geQZy.cjs";
6
6
  export { type ValueLabelOptions, labelsStep, valueLabels };
@@ -2,5 +2,5 @@
2
2
  * Standalone entry: `import '@tabler/charts/value-labels'` enables
3
3
  * `valueLabels` (values written on the marks) on the core.
4
4
  */
5
- import { F as ValueLabelOptions, I as labelsStep, L as valueLabels } from "./chart-CYrrUCi3.js";
5
+ import { M as ValueLabelOptions, N as labelsStep, P as valueLabels } from "./chart-CE9EVbfV.js";
6
6
  export { type ValueLabelOptions, labelsStep, valueLabels };
@@ -1,4 +1,4 @@
1
- import { n as valueLabels, t as labelsStep } from "./value-labels-C7GrhOXJ.js";
1
+ import { n as valueLabels, t as labelsStep } from "./value-labels-B0VeheyE.js";
2
2
  import { t as addPost } from "./features-B55rwpQC.js";
3
3
  // src/value-labels.ts
4
4
  /**