@tabler/charts 0.2.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 (420) hide show
  1. package/README.md +165 -17
  2. package/dist/{annotations-DdRdeBUB.cjs → annotations--m-HzMBM.cjs} +87 -11
  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-D0YQ0IoA.js → annotations-DGITy6th.js} +87 -11
  7. package/dist/annotations-DGITy6th.js.map +1 -0
  8. package/dist/annotations.cjs +2 -2
  9. package/dist/annotations.d.cts +1 -1
  10. package/dist/annotations.d.ts +1 -1
  11. package/dist/annotations.js +2 -2
  12. package/dist/{area-0-L1bG9B.js → area-BN0uE9R0.js} +4 -3
  13. package/dist/area-BN0uE9R0.js.map +1 -0
  14. package/dist/{area-CJX9219z.d.cts → area-D6LNLk3r.d.cts} +2 -2
  15. package/dist/{area-d11XePuw.d.ts → area-DEFL-Yun.d.ts} +2 -2
  16. package/dist/{area-4eRs3c0K.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-BzBkkC5X.cjs +305 -0
  23. package/dist/axis-BzBkkC5X.cjs.map +1 -0
  24. package/dist/axis-C5obgdJt.js +240 -0
  25. package/dist/axis-C5obgdJt.js.map +1 -0
  26. package/dist/{bar-Da6dE_nI.cjs → bar-BrmfXugT.cjs} +77 -58
  27. package/dist/bar-BrmfXugT.cjs.map +1 -0
  28. package/dist/{bar-XwzM6Pb0.d.ts → bar-Bs_rPqgR.d.ts} +1 -1
  29. package/dist/{bar-BDLR4p9c.d.cts → bar-CEt8YRxf.d.cts} +2 -2
  30. package/dist/{bar-B5n2oq9-.js → bar-CgpC2EpX.js} +2 -2
  31. package/dist/{bar-B5n2oq9-.js.map → bar-CgpC2EpX.js.map} +1 -1
  32. package/dist/{bar-BNZ3GhIw.js → bar-D_KKd2fL.js} +75 -56
  33. package/dist/bar-D_KKd2fL.js.map +1 -0
  34. package/dist/{bar-LYIF8MEz.cjs → bar-wVykm1us.cjs} +2 -2
  35. package/dist/{bar-LYIF8MEz.cjs.map → bar-wVykm1us.cjs.map} +1 -1
  36. package/dist/bar.cjs +1 -1
  37. package/dist/bar.d.cts +1 -1
  38. package/dist/bar.d.ts +1 -1
  39. package/dist/bar.js +1 -1
  40. package/dist/calendar-B7843sQu.d.cts +106 -0
  41. package/dist/calendar-BG_q_NC_.cjs +507 -0
  42. package/dist/calendar-BG_q_NC_.cjs.map +1 -0
  43. package/dist/calendar-CF3gfDQk.js +502 -0
  44. package/dist/calendar-CF3gfDQk.js.map +1 -0
  45. package/dist/calendar-D10_ki1S.d.ts +106 -0
  46. package/dist/calendar.cjs +3 -0
  47. package/dist/calendar.d.cts +3 -0
  48. package/dist/calendar.d.ts +3 -0
  49. package/dist/calendar.js +1 -0
  50. package/dist/{candlestick-BHQkQfxH.js → candlestick-B1onjo1o.js} +17 -14
  51. package/dist/candlestick-B1onjo1o.js.map +1 -0
  52. package/dist/{candlestick-Dq7qp-F0.d.cts → candlestick-B7YXUVVh.d.cts} +4 -3
  53. package/dist/{candlestick-CYCQXgky.cjs → candlestick-BwrFKak_.cjs} +17 -14
  54. package/dist/candlestick-BwrFKak_.cjs.map +1 -0
  55. package/dist/{candlestick-D0xKkdqd.d.ts → candlestick-XpqJvarq.d.ts} +4 -3
  56. package/dist/candlestick.cjs +3 -3
  57. package/dist/candlestick.d.cts +1 -1
  58. package/dist/candlestick.d.ts +1 -1
  59. package/dist/candlestick.js +3 -3
  60. package/dist/{cartesian-DV02PsBe.cjs → cartesian-B9CrasFJ.cjs} +190 -310
  61. package/dist/cartesian-B9CrasFJ.cjs.map +1 -0
  62. package/dist/{cartesian-CI2x6N7N.js → cartesian-COglz544.js} +161 -251
  63. package/dist/cartesian-COglz544.js.map +1 -0
  64. package/dist/{chart-DWn9v6qw.js → chart-B97FBRCd.js} +114 -72
  65. package/dist/chart-B97FBRCd.js.map +1 -0
  66. package/dist/{chart-QilhWP8Z.d.ts → chart-CE9EVbfV.d.ts} +427 -112
  67. package/dist/{chart-kqFMEwDo.d.cts → chart-Dz4geQZy.d.cts} +427 -112
  68. package/dist/{chart-e2VqomCI.cjs → chart-GUmmjJ7S.cjs} +132 -78
  69. package/dist/chart-GUmmjJ7S.cjs.map +1 -0
  70. package/dist/{core-BKRQvPAT.js → core-7fgM3su0.js} +188 -73
  71. package/dist/core-7fgM3su0.js.map +1 -0
  72. package/dist/{core-DRUCk67j.d.ts → core-BUQzLsRJ.d.ts} +26 -10
  73. package/dist/{core-DIOC61up.cjs → core-BZTrsPxc.cjs} +200 -73
  74. package/dist/core-BZTrsPxc.cjs.map +1 -0
  75. package/dist/{core-PAX5ogLk.d.cts → core-Ck5uHcW8.d.cts} +45 -24
  76. package/dist/core.cjs +45 -31
  77. package/dist/core.d.cts +23 -18
  78. package/dist/core.d.ts +23 -18
  79. package/dist/core.js +28 -23
  80. package/dist/{dates-DurEr9WT.cjs → dates-0YNY49KQ.cjs} +2 -2
  81. package/dist/{dates-DurEr9WT.cjs.map → dates-0YNY49KQ.cjs.map} +1 -1
  82. package/dist/{dates-C2RzY3rE.js → dates-CKDRgpin.js} +2 -2
  83. package/dist/{dates-C2RzY3rE.js.map → dates-CKDRgpin.js.map} +1 -1
  84. package/dist/decimate.cjs +1 -1
  85. package/dist/decimate.js +1 -1
  86. package/dist/{dom-D_g13XWY.cjs → dom-C33zvtPo.cjs} +3 -7
  87. package/dist/dom-C33zvtPo.cjs.map +1 -0
  88. package/dist/{dom-CuceR8gt.js → dom-CTse6Rvd.js} +3 -7
  89. package/dist/dom-CTse6Rvd.js.map +1 -0
  90. package/dist/end-labels-B3oRvjxw.js +114 -0
  91. package/dist/end-labels-B3oRvjxw.js.map +1 -0
  92. package/dist/end-labels-CS-fnpp-.cjs +119 -0
  93. package/dist/end-labels-CS-fnpp-.cjs.map +1 -0
  94. package/dist/end-labels.cjs +11 -0
  95. package/dist/end-labels.cjs.map +1 -0
  96. package/dist/end-labels.d.cts +6 -0
  97. package/dist/end-labels.d.ts +6 -0
  98. package/dist/end-labels.js +11 -0
  99. package/dist/end-labels.js.map +1 -0
  100. package/dist/{export-chart-83UYH48t.js → export-chart-BOH_nfcH.js} +92 -15
  101. package/dist/export-chart-BOH_nfcH.js.map +1 -0
  102. package/dist/{export-chart-mYgEfK-L.cjs → export-chart-Be4T9J3m.cjs} +97 -14
  103. package/dist/export-chart-Be4T9J3m.cjs.map +1 -0
  104. package/dist/export.cjs +5 -3
  105. package/dist/export.cjs.map +1 -1
  106. package/dist/export.d.cts +4 -3
  107. package/dist/export.d.ts +4 -3
  108. package/dist/export.js +5 -4
  109. package/dist/export.js.map +1 -1
  110. package/dist/{fade-GGxcBdss.js → fade-CDrQjnDz.js} +56 -78
  111. package/dist/fade-CDrQjnDz.js.map +1 -0
  112. package/dist/{fade-DVTkhrFU.cjs → fade-CRqcKMWY.cjs} +56 -78
  113. package/dist/fade-CRqcKMWY.cjs.map +1 -0
  114. package/dist/{features-BMxkqCyS.js → features-B55rwpQC.js} +4 -2
  115. package/dist/features-B55rwpQC.js.map +1 -0
  116. package/dist/{features-DCXEvoya.cjs → features-DEDP5CEQ.cjs} +9 -1
  117. package/dist/features-DEDP5CEQ.cjs.map +1 -0
  118. package/dist/fit-BPyPRnsK.js +16 -0
  119. package/dist/fit-BPyPRnsK.js.map +1 -0
  120. package/dist/fit-D4MIIQQz.cjs +21 -0
  121. package/dist/fit-D4MIIQQz.cjs.map +1 -0
  122. package/dist/funnel-B9ridzNx.d.cts +50 -0
  123. package/dist/funnel-CFEEulw_.cjs +244 -0
  124. package/dist/funnel-CFEEulw_.cjs.map +1 -0
  125. package/dist/funnel-CYCv8cq2.js +239 -0
  126. package/dist/funnel-CYCv8cq2.js.map +1 -0
  127. package/dist/funnel-FogM8flk.d.ts +50 -0
  128. package/dist/funnel.cjs +3 -0
  129. package/dist/funnel.d.cts +3 -0
  130. package/dist/funnel.d.ts +3 -0
  131. package/dist/funnel.js +1 -0
  132. package/dist/{gauge-DXkjXNCD.cjs → gauge-6HfDcLMJ.cjs} +28 -28
  133. package/dist/gauge-6HfDcLMJ.cjs.map +1 -0
  134. package/dist/{gauge-BSist7My.d.cts → gauge-BScJ7U6O.d.cts} +2 -2
  135. package/dist/{gauge-0VJuAHWF.d.ts → gauge-D78oq1Lx.d.ts} +2 -2
  136. package/dist/{gauge-ts0kqN1-.js → gauge-DiTk5aWO.js} +28 -28
  137. package/dist/gauge-DiTk5aWO.js.map +1 -0
  138. package/dist/gauge.cjs +1 -1
  139. package/dist/gauge.d.cts +1 -1
  140. package/dist/gauge.d.ts +1 -1
  141. package/dist/gauge.js +1 -1
  142. package/dist/heat-Bsqq4zw9.js +38 -0
  143. package/dist/heat-Bsqq4zw9.js.map +1 -0
  144. package/dist/heat-DYsivvDq.cjs +49 -0
  145. package/dist/heat-DYsivvDq.cjs.map +1 -0
  146. package/dist/{heatmap-CXhlrLTl.cjs → heatmap-Dyzrd4Fd.cjs} +39 -37
  147. package/dist/heatmap-Dyzrd4Fd.cjs.map +1 -0
  148. package/dist/{heatmap-19BGJTKF.js → heatmap-J7fxG7MM.js} +35 -33
  149. package/dist/heatmap-J7fxG7MM.js.map +1 -0
  150. package/dist/{heatmap-Dp_oyEe0.d.cts → heatmap-Jvwo7iFW.d.cts} +2 -2
  151. package/dist/{heatmap-59lmClj9.d.ts → heatmap-mFCnP6aB.d.ts} +2 -2
  152. package/dist/heatmap.cjs +1 -1
  153. package/dist/heatmap.d.cts +1 -1
  154. package/dist/heatmap.d.ts +1 -1
  155. package/dist/heatmap.js +1 -1
  156. package/dist/{hydrate-OA6R2_Pn.js → hydrate-BB3MlR36.js} +2 -2
  157. package/dist/{hydrate-OA6R2_Pn.js.map → hydrate-BB3MlR36.js.map} +1 -1
  158. package/dist/{hydrate-CmN1k8Mo.cjs → hydrate-m0I5m6ue.cjs} +2 -2
  159. package/dist/{hydrate-CmN1k8Mo.cjs.map → hydrate-m0I5m6ue.cjs.map} +1 -1
  160. package/dist/hydrate.cjs +2 -2
  161. package/dist/hydrate.js +2 -2
  162. package/dist/index.cjs +69 -45
  163. package/dist/index.cjs.map +1 -1
  164. package/dist/index.d.cts +24 -19
  165. package/dist/index.d.ts +24 -19
  166. package/dist/index.js +51 -37
  167. package/dist/index.js.map +1 -1
  168. package/dist/interaction-DXYSjgnP.cjs +32 -0
  169. package/dist/interaction-DXYSjgnP.cjs.map +1 -0
  170. package/dist/interaction-En1KlwFO.js +21 -0
  171. package/dist/interaction-En1KlwFO.js.map +1 -0
  172. package/dist/layout-CYerDebD.d.cts +29 -0
  173. package/dist/layout-CYerDebD.d.ts +29 -0
  174. package/dist/{layout-JY2aR-yE.cjs → layout-Cfg9x1k2.cjs} +32 -1
  175. package/dist/layout-Cfg9x1k2.cjs.map +1 -0
  176. package/dist/{layout-DmrrLjwN.js → layout-DqAte3H8.js} +27 -2
  177. package/dist/layout-DqAte3H8.js.map +1 -0
  178. package/dist/{line-DO66LtwH.js → line-CXH0L10d.js} +84 -37
  179. package/dist/line-CXH0L10d.js.map +1 -0
  180. package/dist/{line-_rNdeKmS.d.cts → line-Cu9ctpbv.d.cts} +9 -3
  181. package/dist/{line-Dbt6KFRK.cjs → line-DHbYCQy4.cjs} +84 -37
  182. package/dist/line-DHbYCQy4.cjs.map +1 -0
  183. package/dist/{line-DtSh7HQU.d.ts → line-TkzA7wMK.d.ts} +8 -1
  184. package/dist/line.cjs +3 -3
  185. package/dist/line.d.cts +1 -1
  186. package/dist/line.d.ts +1 -1
  187. package/dist/line.js +3 -3
  188. package/dist/log.cjs +1 -1
  189. package/dist/log.js +1 -1
  190. package/dist/map-BirylCmT.d.cts +156 -0
  191. package/dist/map-CYp6x-uS.js +784 -0
  192. package/dist/map-CYp6x-uS.js.map +1 -0
  193. package/dist/map-ChwSgooH.cjs +795 -0
  194. package/dist/map-ChwSgooH.cjs.map +1 -0
  195. package/dist/map-DNqog2Xs.d.ts +156 -0
  196. package/dist/map.cjs +4 -0
  197. package/dist/map.d.cts +3 -0
  198. package/dist/map.d.ts +3 -0
  199. package/dist/map.js +1 -0
  200. package/dist/maps/world.cjs +875 -0
  201. package/dist/maps/world.cjs.map +1 -0
  202. package/dist/maps/world.d.cts +2 -0
  203. package/dist/maps/world.d.ts +2 -0
  204. package/dist/maps/world.js +874 -0
  205. package/dist/maps/world.js.map +1 -0
  206. package/dist/{morph-9_LJL0ra.cjs → morph-3I1Nf_tR.cjs} +2 -2
  207. package/dist/{morph-9_LJL0ra.cjs.map → morph-3I1Nf_tR.cjs.map} +1 -1
  208. package/dist/{morph-DnRxuwR-.js → morph-GfBab-b3.js} +2 -2
  209. package/dist/{morph-DnRxuwR-.js.map → morph-GfBab-b3.js.map} +1 -1
  210. package/dist/morph.cjs +2 -2
  211. package/dist/morph.js +2 -2
  212. package/dist/others-CuNdpvjd.d.cts +31 -0
  213. package/dist/{others-J7NCAMA0.js → others-DBIGE6jr.js} +11 -3
  214. package/dist/others-DBIGE6jr.js.map +1 -0
  215. package/dist/others-DBO4Kjwl.d.ts +29 -0
  216. package/dist/{others-DWdK7vKp.cjs → others-WfjCsjqT.cjs} +14 -6
  217. package/dist/others-WfjCsjqT.cjs.map +1 -0
  218. package/dist/{parliament-Cru4IcuM.js → parliament-BKN6ikBJ.js} +30 -29
  219. package/dist/parliament-BKN6ikBJ.js.map +1 -0
  220. package/dist/{parliament-CLCI7tUO.d.ts → parliament-CHdf13XU.d.ts} +2 -2
  221. package/dist/{parliament-CgsVnWEe.d.cts → parliament-CsYgh4N2.d.cts} +2 -2
  222. package/dist/{parliament-x5hcFaQ3.cjs → parliament-DhxAaIZ3.cjs} +30 -29
  223. package/dist/parliament-DhxAaIZ3.cjs.map +1 -0
  224. package/dist/parliament.cjs +1 -1
  225. package/dist/parliament.d.cts +1 -1
  226. package/dist/parliament.d.ts +1 -1
  227. package/dist/parliament.js +1 -1
  228. package/dist/{patterns-D3-wQagb.cjs → patterns-BPN1c9qe.cjs} +2 -2
  229. package/dist/{patterns-D3-wQagb.cjs.map → patterns-BPN1c9qe.cjs.map} +1 -1
  230. package/dist/{patterns-CufKZYhm.js → patterns-CVrLrJXg.js} +2 -2
  231. package/dist/{patterns-CufKZYhm.js.map → patterns-CVrLrJXg.js.map} +1 -1
  232. package/dist/patterns.cjs +2 -2
  233. package/dist/patterns.d.cts +1 -1
  234. package/dist/patterns.d.ts +1 -1
  235. package/dist/patterns.js +2 -2
  236. package/dist/{percentage-bar-ybNS3goo.cjs → percentage-bar-BChkTRoz.cjs} +37 -35
  237. package/dist/percentage-bar-BChkTRoz.cjs.map +1 -0
  238. package/dist/{percentage-bar-nhTeakD_.d.ts → percentage-bar-CSAbzDOn.d.ts} +11 -15
  239. package/dist/{percentage-bar-B6tNOqNn.js → percentage-bar-CaInxrL8.js} +37 -35
  240. package/dist/percentage-bar-CaInxrL8.js.map +1 -0
  241. package/dist/{percentage-bar-tepMr7Hd.d.cts → percentage-bar-UZHCRvlK.d.cts} +11 -15
  242. package/dist/percentage-bar.cjs +1 -1
  243. package/dist/percentage-bar.d.cts +1 -1
  244. package/dist/percentage-bar.d.ts +1 -1
  245. package/dist/percentage-bar.js +1 -1
  246. package/dist/{pie-BXg2gNpb.d.cts → pie-AFedsDcF.d.cts} +17 -14
  247. package/dist/{pie-CVsc-6qD.js → pie-Ch6Bx0ih.js} +68 -52
  248. package/dist/pie-Ch6Bx0ih.js.map +1 -0
  249. package/dist/{pie-BpjvSPnz.cjs → pie-Cll1OrVZ.cjs} +68 -52
  250. package/dist/pie-Cll1OrVZ.cjs.map +1 -0
  251. package/dist/{pie-CFptILSm.d.ts → pie-Cn2H3pz8.d.ts} +17 -14
  252. package/dist/pie.cjs +1 -1
  253. package/dist/pie.d.cts +1 -1
  254. package/dist/pie.d.ts +1 -1
  255. package/dist/pie.js +1 -1
  256. package/dist/{point-shapes--_gmdTyK.cjs → point-shapes-BRawRM78.cjs} +23 -22
  257. package/dist/point-shapes-BRawRM78.cjs.map +1 -0
  258. package/dist/{point-shapes-DD2Ektzm.js → point-shapes-DI6GhcI7.js} +18 -23
  259. package/dist/point-shapes-DI6GhcI7.js.map +1 -0
  260. package/dist/point-shapes.cjs +6 -4
  261. package/dist/point-shapes.cjs.map +1 -1
  262. package/dist/point-shapes.d.cts +2 -2
  263. package/dist/point-shapes.d.ts +2 -2
  264. package/dist/point-shapes.js +7 -5
  265. package/dist/point-shapes.js.map +1 -1
  266. package/dist/{radar-BR-mumDd.js → radar-Bg-IiIWB.js} +21 -22
  267. package/dist/radar-Bg-IiIWB.js.map +1 -0
  268. package/dist/{radar-BC9Skgpj.d.ts → radar-DEer2jjd.d.ts} +2 -2
  269. package/dist/{radar-D1-lItDy.d.cts → radar-DxmjXhMc.d.cts} +2 -2
  270. package/dist/{radar-HPDrIdzc.cjs → radar-wDyX17S3.cjs} +22 -23
  271. package/dist/radar-wDyX17S3.cjs.map +1 -0
  272. package/dist/radar.cjs +1 -1
  273. package/dist/radar.d.cts +1 -1
  274. package/dist/radar.d.ts +1 -1
  275. package/dist/radar.js +1 -1
  276. package/dist/range-bar-BnKjJP89.cjs +348 -0
  277. package/dist/range-bar-BnKjJP89.cjs.map +1 -0
  278. package/dist/range-bar-C4cRaaQE.d.ts +123 -0
  279. package/dist/range-bar-D32dIQOY.d.cts +123 -0
  280. package/dist/range-bar-Dx6ce0J1.js +343 -0
  281. package/dist/range-bar-Dx6ce0J1.js.map +1 -0
  282. package/dist/range-bar.cjs +3 -0
  283. package/dist/range-bar.d.cts +3 -0
  284. package/dist/range-bar.d.ts +3 -0
  285. package/dist/range-bar.js +1 -0
  286. package/dist/{rect-DSVmUZrD.js → rect-CZTNvMlf.js} +2 -2
  287. package/dist/{rect-DSVmUZrD.js.map → rect-CZTNvMlf.js.map} +1 -1
  288. package/dist/{rect-D6VhynBM.cjs → rect-DPr9QRxl.cjs} +2 -2
  289. package/dist/{rect-D6VhynBM.cjs.map → rect-DPr9QRxl.cjs.map} +1 -1
  290. package/dist/{sankey-fCoo1cpz.cjs → sankey-0CSp_Er9.cjs} +72 -71
  291. package/dist/sankey-0CSp_Er9.cjs.map +1 -0
  292. package/dist/{sankey-Dk7jUt8x.d.cts → sankey-D-8ATwBT.d.cts} +2 -2
  293. package/dist/{sankey-D6JeZfK5.js → sankey-Dp4CuLVe.js} +72 -71
  294. package/dist/sankey-Dp4CuLVe.js.map +1 -0
  295. package/dist/{sankey-D_v7KxnJ.d.ts → sankey-DpYJsOI4.d.ts} +2 -2
  296. package/dist/sankey.cjs +1 -1
  297. package/dist/sankey.d.cts +1 -1
  298. package/dist/sankey.d.ts +1 -1
  299. package/dist/sankey.js +1 -1
  300. package/dist/{scatter-C0TWjFpW.js → scatter-0Z7K_YUz.js} +94 -46
  301. package/dist/scatter-0Z7K_YUz.js.map +1 -0
  302. package/dist/{scatter-CXEsioOJ.d.ts → scatter-BAL5K9_4.d.ts} +28 -9
  303. package/dist/{scatter-DZeEIfyo.d.cts → scatter-BUGbnRzM.d.cts} +28 -9
  304. package/dist/{scatter-DVqB_fP9.cjs → scatter-CZ8do3Up.cjs} +95 -47
  305. package/dist/scatter-CZ8do3Up.cjs.map +1 -0
  306. package/dist/scatter.cjs +1 -1
  307. package/dist/scatter.d.cts +2 -2
  308. package/dist/scatter.d.ts +2 -2
  309. package/dist/scatter.js +1 -1
  310. package/dist/slice-labels-1TBq7p3q.d.cts +28 -0
  311. package/dist/slice-labels-C9ucsBVW.js +88 -0
  312. package/dist/slice-labels-C9ucsBVW.js.map +1 -0
  313. package/dist/slice-labels-CbFiy46l.cjs +93 -0
  314. package/dist/slice-labels-CbFiy46l.cjs.map +1 -0
  315. package/dist/slice-labels-Cm5CyV7B.d.ts +28 -0
  316. package/dist/slice-labels.cjs +11 -0
  317. package/dist/slice-labels.cjs.map +1 -0
  318. package/dist/slice-labels.d.cts +6 -0
  319. package/dist/slice-labels.d.ts +6 -0
  320. package/dist/slice-labels.js +11 -0
  321. package/dist/slice-labels.js.map +1 -0
  322. package/dist/{sparkline-cbvRkWqS.d.ts → sparkline-CtoBJe-a.d.ts} +2 -2
  323. package/dist/{sparkline-B39NA0Mi.cjs → sparkline-DjR-V6BI.cjs} +13 -15
  324. package/dist/sparkline-DjR-V6BI.cjs.map +1 -0
  325. package/dist/{sparkline-DAP6jtzw.d.cts → sparkline-DwHJfeZz.d.cts} +2 -2
  326. package/dist/{sparkline-XO_TqCNP.js → sparkline-_dxwtdli.js} +13 -15
  327. package/dist/sparkline-_dxwtdli.js.map +1 -0
  328. package/dist/sparkline.cjs +1 -1
  329. package/dist/sparkline.d.cts +1 -1
  330. package/dist/sparkline.d.ts +1 -1
  331. package/dist/sparkline.js +1 -1
  332. package/dist/{stack-Dagxq7l2.d.cts → stack-CcmyALx0.d.cts} +1 -1
  333. package/dist/{stack-2H2Gfs1Q.js → stack-CyVlS7Fr.js} +2 -2
  334. package/dist/{stack-2H2Gfs1Q.js.map → stack-CyVlS7Fr.js.map} +1 -1
  335. package/dist/{stack-BgPzoQmv.cjs → stack-DBhmYNat.cjs} +2 -2
  336. package/dist/{stack-BgPzoQmv.cjs.map → stack-DBhmYNat.cjs.map} +1 -1
  337. package/dist/style.css +1 -1
  338. package/dist/{time-axis-BjZ1bYTK.cjs → time-axis-CVKjQKSS.cjs} +4 -3
  339. package/dist/{time-axis-BjZ1bYTK.cjs.map → time-axis-CVKjQKSS.cjs.map} +1 -1
  340. package/dist/{time-axis-FLONo54E.js → time-axis-CkmbAw4Z.js} +3 -2
  341. package/dist/{time-axis-FLONo54E.js.map → time-axis-CkmbAw4Z.js.map} +1 -1
  342. package/dist/time.cjs +3 -3
  343. package/dist/time.js +3 -3
  344. package/dist/{treemap-BAkhmVQc.d.cts → treemap-C2maqerU.d.cts} +37 -5
  345. package/dist/{treemap-BNpxFBao.d.ts → treemap-D_zbubo3.d.ts} +37 -5
  346. package/dist/{treemap-BWpEUlDh.cjs → treemap-PulGXZv0.cjs} +58 -33
  347. package/dist/treemap-PulGXZv0.cjs.map +1 -0
  348. package/dist/{treemap-CQdavQ9u.js → treemap-lbYxb-7h.js} +57 -32
  349. package/dist/treemap-lbYxb-7h.js.map +1 -0
  350. package/dist/treemap.cjs +1 -1
  351. package/dist/treemap.d.cts +1 -1
  352. package/dist/treemap.d.ts +1 -1
  353. package/dist/treemap.js +1 -1
  354. package/dist/{value-labels-BBuSi4i0.js → value-labels-B0VeheyE.js} +29 -8
  355. package/dist/value-labels-B0VeheyE.js.map +1 -0
  356. package/dist/{value-labels-BV9keAuL.cjs → value-labels-Dcyk3GIY.cjs} +29 -8
  357. package/dist/value-labels-Dcyk3GIY.cjs.map +1 -0
  358. package/dist/value-labels.cjs +2 -2
  359. package/dist/value-labels.d.cts +1 -1
  360. package/dist/value-labels.d.ts +1 -1
  361. package/dist/value-labels.js +2 -2
  362. package/dist/zoom.cjs +810 -0
  363. package/dist/zoom.cjs.map +1 -0
  364. package/dist/zoom.d.cts +34 -0
  365. package/dist/zoom.d.ts +34 -0
  366. package/dist/zoom.js +806 -0
  367. package/dist/zoom.js.map +1 -0
  368. package/package.json +120 -235
  369. package/dist/annotations-D0YQ0IoA.js.map +0 -1
  370. package/dist/annotations-DdRdeBUB.cjs.map +0 -1
  371. package/dist/area-0-L1bG9B.js.map +0 -1
  372. package/dist/area-4eRs3c0K.cjs.map +0 -1
  373. package/dist/bar-BNZ3GhIw.js.map +0 -1
  374. package/dist/bar-Da6dE_nI.cjs.map +0 -1
  375. package/dist/candlestick-BHQkQfxH.js.map +0 -1
  376. package/dist/candlestick-CYCQXgky.cjs.map +0 -1
  377. package/dist/cartesian-CI2x6N7N.js.map +0 -1
  378. package/dist/cartesian-DV02PsBe.cjs.map +0 -1
  379. package/dist/chart-DWn9v6qw.js.map +0 -1
  380. package/dist/chart-e2VqomCI.cjs.map +0 -1
  381. package/dist/core-BKRQvPAT.js.map +0 -1
  382. package/dist/core-DIOC61up.cjs.map +0 -1
  383. package/dist/dom-CuceR8gt.js.map +0 -1
  384. package/dist/dom-D_g13XWY.cjs.map +0 -1
  385. package/dist/export-chart-83UYH48t.js.map +0 -1
  386. package/dist/export-chart-mYgEfK-L.cjs.map +0 -1
  387. package/dist/fade-DVTkhrFU.cjs.map +0 -1
  388. package/dist/fade-GGxcBdss.js.map +0 -1
  389. package/dist/features-BMxkqCyS.js.map +0 -1
  390. package/dist/features-DCXEvoya.cjs.map +0 -1
  391. package/dist/gauge-DXkjXNCD.cjs.map +0 -1
  392. package/dist/gauge-ts0kqN1-.js.map +0 -1
  393. package/dist/heatmap-19BGJTKF.js.map +0 -1
  394. package/dist/heatmap-CXhlrLTl.cjs.map +0 -1
  395. package/dist/layout-DmrrLjwN.js.map +0 -1
  396. package/dist/layout-JY2aR-yE.cjs.map +0 -1
  397. package/dist/line-DO66LtwH.js.map +0 -1
  398. package/dist/line-Dbt6KFRK.cjs.map +0 -1
  399. package/dist/others-DWdK7vKp.cjs.map +0 -1
  400. package/dist/others-J7NCAMA0.js.map +0 -1
  401. package/dist/parliament-Cru4IcuM.js.map +0 -1
  402. package/dist/parliament-x5hcFaQ3.cjs.map +0 -1
  403. package/dist/percentage-bar-B6tNOqNn.js.map +0 -1
  404. package/dist/percentage-bar-ybNS3goo.cjs.map +0 -1
  405. package/dist/pie-BpjvSPnz.cjs.map +0 -1
  406. package/dist/pie-CVsc-6qD.js.map +0 -1
  407. package/dist/point-shapes--_gmdTyK.cjs.map +0 -1
  408. package/dist/point-shapes-DD2Ektzm.js.map +0 -1
  409. package/dist/radar-BR-mumDd.js.map +0 -1
  410. package/dist/radar-HPDrIdzc.cjs.map +0 -1
  411. package/dist/sankey-D6JeZfK5.js.map +0 -1
  412. package/dist/sankey-fCoo1cpz.cjs.map +0 -1
  413. package/dist/scatter-C0TWjFpW.js.map +0 -1
  414. package/dist/scatter-DVqB_fP9.cjs.map +0 -1
  415. package/dist/sparkline-B39NA0Mi.cjs.map +0 -1
  416. package/dist/sparkline-XO_TqCNP.js.map +0 -1
  417. package/dist/treemap-BWpEUlDh.cjs.map +0 -1
  418. package/dist/treemap-CQdavQ9u.js.map +0 -1
  419. package/dist/value-labels-BBuSi4i0.js.map +0 -1
  420. package/dist/value-labels-BV9keAuL.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
- import { a as ChartType } from "./chart-kqFMEwDo.cjs";
1
+ import { o as ChartType } from "./chart-Dz4geQZy.cjs";
2
2
  import { c as NumberFormat } from "./time-B4oxWHQI.cjs";
3
- import { a as InsetsInput } from "./annotations-CHafaGd4.cjs";
3
+ import { n as InsetsInput } from "./layout-CYerDebD.cjs";
4
4
  import { a as ClassValue } from "./vnode-Du2cC8Fm.cjs";
5
5
  /** A tile of a treemap, or a group of them. */
6
6
  interface TreemapNode {
@@ -14,16 +14,36 @@ interface TreemapNode {
14
14
  /**
15
15
  * Custom color; overrides the palette slot via `--tc-series-color`.
16
16
  * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.
17
+ * Not used when the tiles are shaded by value.
17
18
  */
18
19
  color?: string;
19
20
  /** Extra classes on the group (top level) or the tile. */
20
21
  class?: ClassValue;
21
- /** Start hidden (top level; toggle it back from the legend). */
22
+ /** Start hidden (top level; toggle it back from the legend, which there is none of when shaded by value). */
22
23
  hidden?: boolean;
23
24
  }
24
25
  interface TreemapOptions {
25
26
  /** Tiles, or groups of tiles; each top-level entry takes a palette color and a legend entry. */
26
27
  data: readonly TreemapNode[];
28
+ /**
29
+ * `'value'` shades every tile in one hue, `--tc-heat-color`, lighter as
30
+ * the value drops (as a heatmap does), with no legend; `'series'` (the
31
+ * default) gives each top-level entry its palette color.
32
+ */
33
+ colorBy?: "series" | "value";
34
+ /**
35
+ * A continuous scale through two or more colors (any CSS color, including
36
+ * `var(--tc-…)`), from `min` to `max`; the tiles are then colored by value
37
+ * whatever `colorBy` says. Values that could inject CSS are ignored, as
38
+ * for the colors of the nodes.
39
+ */
40
+ colors?: readonly string[];
41
+ /** Value shown with the lightest shade (or the first color). Defaults to `0`. */
42
+ min?: number;
43
+ /** Value shown with the full color (or the last color). Defaults to the largest tile. */
44
+ max?: number;
45
+ /** Value placed on the middle color of `colors`. Defaults to halfway. */
46
+ mid?: number;
27
47
  /** Space between tiles in pixels. Defaults to `2`. */
28
48
  gap?: number;
29
49
  /** Corner radius of the tiles. Defaults to `3`. */
@@ -35,11 +55,23 @@ interface TreemapOptions {
35
55
  /** Extra space around the chart, in pixels. */
36
56
  padding?: InsetsInput;
37
57
  }
58
+ /** A node with its size worked out. */
59
+ interface Sized {
60
+ node: TreemapNode;
61
+ value: number;
62
+ children?: Sized[];
63
+ }
64
+ /** The chart model of a treemap: its options, with every node's size worked out. */
65
+ type TreemapModel = TreemapOptions & {
66
+ sized: Sized[];
67
+ };
38
68
  /**
39
69
  * Treemap: parts of a whole as tiles, each as large as its value, laid out
40
70
  * as close to squares as they go with the largest in the top left corner.
41
71
  * Entries with `children` are groups: their tiles stay together and share
42
- * the group's color.
72
+ * the group's color. `colorBy: 'value'` shades the tiles in one hue instead
73
+ * (`--tc-heat-color`), lighter as the value drops, and `colors` sets a scale
74
+ * of colors for it.
43
75
  *
44
76
  * ```ts
45
77
  * new Chart('#el', {
@@ -51,5 +83,5 @@ interface TreemapOptions {
51
83
  * })
52
84
  * ```
53
85
  */
54
- declare const treemap: ChartType<TreemapOptions>;
86
+ declare const treemap: ChartType<TreemapOptions, TreemapModel>;
55
87
  export { TreemapOptions as n, treemap as r, TreemapNode as t };
@@ -1,6 +1,6 @@
1
- import { a as ChartType } from "./chart-QilhWP8Z.js";
1
+ import { o as ChartType } from "./chart-CE9EVbfV.js";
2
2
  import { c as NumberFormat } from "./time-DRIDgv2a.js";
3
- import { a as InsetsInput } from "./annotations-B02GR_KU.js";
3
+ import { n as InsetsInput } from "./layout-CYerDebD.js";
4
4
  import { a as ClassValue } from "./vnode-Du2cC8Fm.js";
5
5
  /** A tile of a treemap, or a group of them. */
6
6
  interface TreemapNode {
@@ -14,16 +14,36 @@ interface TreemapNode {
14
14
  /**
15
15
  * Custom color; overrides the palette slot via `--tc-series-color`.
16
16
  * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.
17
+ * Not used when the tiles are shaded by value.
17
18
  */
18
19
  color?: string;
19
20
  /** Extra classes on the group (top level) or the tile. */
20
21
  class?: ClassValue;
21
- /** Start hidden (top level; toggle it back from the legend). */
22
+ /** Start hidden (top level; toggle it back from the legend, which there is none of when shaded by value). */
22
23
  hidden?: boolean;
23
24
  }
24
25
  interface TreemapOptions {
25
26
  /** Tiles, or groups of tiles; each top-level entry takes a palette color and a legend entry. */
26
27
  data: readonly TreemapNode[];
28
+ /**
29
+ * `'value'` shades every tile in one hue, `--tc-heat-color`, lighter as
30
+ * the value drops (as a heatmap does), with no legend; `'series'` (the
31
+ * default) gives each top-level entry its palette color.
32
+ */
33
+ colorBy?: "series" | "value";
34
+ /**
35
+ * A continuous scale through two or more colors (any CSS color, including
36
+ * `var(--tc-…)`), from `min` to `max`; the tiles are then colored by value
37
+ * whatever `colorBy` says. Values that could inject CSS are ignored, as
38
+ * for the colors of the nodes.
39
+ */
40
+ colors?: readonly string[];
41
+ /** Value shown with the lightest shade (or the first color). Defaults to `0`. */
42
+ min?: number;
43
+ /** Value shown with the full color (or the last color). Defaults to the largest tile. */
44
+ max?: number;
45
+ /** Value placed on the middle color of `colors`. Defaults to halfway. */
46
+ mid?: number;
27
47
  /** Space between tiles in pixels. Defaults to `2`. */
28
48
  gap?: number;
29
49
  /** Corner radius of the tiles. Defaults to `3`. */
@@ -35,11 +55,23 @@ interface TreemapOptions {
35
55
  /** Extra space around the chart, in pixels. */
36
56
  padding?: InsetsInput;
37
57
  }
58
+ /** A node with its size worked out. */
59
+ interface Sized {
60
+ node: TreemapNode;
61
+ value: number;
62
+ children?: Sized[];
63
+ }
64
+ /** The chart model of a treemap: its options, with every node's size worked out. */
65
+ type TreemapModel = TreemapOptions & {
66
+ sized: Sized[];
67
+ };
38
68
  /**
39
69
  * Treemap: parts of a whole as tiles, each as large as its value, laid out
40
70
  * as close to squares as they go with the largest in the top left corner.
41
71
  * Entries with `children` are groups: their tiles stay together and share
42
- * the group's color.
72
+ * the group's color. `colorBy: 'value'` shades the tiles in one hue instead
73
+ * (`--tc-heat-color`), lighter as the value drops, and `colors` sets a scale
74
+ * of colors for it.
43
75
  *
44
76
  * ```ts
45
77
  * new Chart('#el', {
@@ -51,5 +83,5 @@ interface TreemapOptions {
51
83
  * })
52
84
  * ```
53
85
  */
54
- declare const treemap: ChartType<TreemapOptions>;
86
+ declare const treemap: ChartType<TreemapOptions, TreemapModel>;
55
87
  export { TreemapOptions as n, treemap as r, TreemapNode as t };
@@ -1,8 +1,10 @@
1
1
  const require_format = require("./format-CAE5ruy6.cjs");
2
- const require_layout = require("./layout-JY2aR-yE.cjs");
3
- const require_rect = require("./rect-D6VhynBM.cjs");
2
+ const require_layout = require("./layout-Cfg9x1k2.cjs");
3
+ 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
+ const require_fit = require("./fit-D4MIIQQz.cjs");
7
+ const require_heat = require("./heat-DYsivvDq.cjs");
6
8
  const require_named = require("./named-BBASc8dW.cjs");
7
9
  // src/charts/treemap.ts
8
10
  /** Levels of nesting read from the data, and the most nodes: enough for any chart, few enough to draw. */
@@ -10,6 +12,8 @@ const MAX_DEPTH = 8;
10
12
  const MAX_NODES = 5e3;
11
13
  /** Space between a tile's edge and its text. */
12
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;
13
17
  function sized(nodes) {
14
18
  return nodes.map((node) => {
15
19
  if (node.children?.length) {
@@ -26,12 +30,32 @@ function sized(nodes) {
26
30
  };
27
31
  });
28
32
  }
29
- /** The top-level entries with their sizes and color slots, without the hidden ones. */
30
- function visible(options, hidden) {
31
- return sized(options.data).map((entry, index) => ({
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
+ */
53
+ function visible(model, hidden) {
54
+ const fixed = byValue(model);
55
+ return model.sized.map((entry, index) => ({
32
56
  entry,
33
57
  index
34
- })).filter(({ entry }) => !hidden.has(require_named.keyOf(entry.node)));
58
+ })).filter(({ entry }) => !hidden.has(require_named.keyOf(entry.node)) && !(fixed && entry.node.hidden));
35
59
  }
36
60
  /**
37
61
  * Squarified layout (Bruls, Huizing, van Wijk): `items`, largest first, fill
@@ -116,17 +140,6 @@ function layout(items, x, y, w, hgt, gap, out, edges, top, slots) {
116
140
  }
117
141
  });
118
142
  }
119
- /** `text` cut to `width` pixels with an ellipsis, or `''` when not even a few letters fit. */
120
- function fit(text, width, fontSize) {
121
- if (require_layout.estimateTextWidth(text, fontSize) <= width) return text;
122
- const chars = [...text];
123
- while (chars.length > 2) {
124
- chars.pop();
125
- const cut = `${chars.join("").trimEnd()}…`;
126
- if (require_layout.estimateTextWidth(cut, fontSize) <= width) return cut;
127
- }
128
- return "";
129
- }
130
143
  function renderTreemap(options, ctx) {
131
144
  const { width, height, fontSize, locale } = ctx;
132
145
  const gap = Math.max(0, options.gap ?? 2);
@@ -141,6 +154,7 @@ function renderTreemap(options, ctx) {
141
154
  0,
142
155
  0
143
156
  ], void 0, entries.map(({ index }) => index));
157
+ const paint = byValue(options) ? scale(options) : void 0;
144
158
  const value = require_format.formatNumber(options.format, locale);
145
159
  const share = require_format.getNumberFormat(locale, {
146
160
  style: "percent",
@@ -156,7 +170,7 @@ function renderTreemap(options, ctx) {
156
170
  x,
157
171
  y: tile.y + tile.height / 2
158
172
  };
159
- 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;
160
174
  if (color) item.color = color;
161
175
  return {
162
176
  index,
@@ -166,10 +180,9 @@ function renderTreemap(options, ctx) {
166
180
  area,
167
181
  items: [item],
168
182
  seriesIndex: tile.top,
169
- mark: {
170
- d: require_rect.rectPath(tile.x + 1, tile.y + 1, tile.width - 2, tile.height - 2, radius - 1),
171
- x: 0,
172
- y: 0
183
+ highlight: {
184
+ kind: "halo",
185
+ d: require_rect.rectPath(tile.x + 1, tile.y + 1, tile.width - 2, tile.height - 2, radius - 1)
173
186
  }
174
187
  };
175
188
  };
@@ -184,21 +197,24 @@ function renderTreemap(options, ctx) {
184
197
  return index < 0 ? null : hitFor(tiles[index], index);
185
198
  }
186
199
  };
187
- ctx.onHitTest(interaction);
188
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", {
189
201
  key: tile.key,
190
- 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
+ ],
191
207
  x: require_layout.round(tile.x),
192
208
  y: require_layout.round(tile.y),
193
209
  width: require_layout.round(tile.width),
194
210
  height: require_layout.round(tile.height),
195
211
  rx: require_layout.round(Math.min(radius, tile.width / 2, tile.height / 2)),
196
- 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
197
213
  }))));
198
214
  const line = fontSize * 1.3;
199
215
  const labels = options.labels !== false && tiles.flatMap((tile) => {
200
216
  const room = tile.width - 12;
201
- const name = tile.height >= line + INSET ? fit(tile.node.name, room, fontSize) : "";
217
+ const name = tile.height >= line + INSET ? require_fit.fit(tile.node.name, room, fontSize) : "";
202
218
  if (!name) return [];
203
219
  const text = value(tile.value);
204
220
  const x = require_layout.round(tile.x + INSET);
@@ -215,10 +231,13 @@ function renderTreemap(options, ctx) {
215
231
  y: require_layout.round(y + line)
216
232
  }, text)];
217
233
  });
218
- return [require_vnode.h("g", { class: "tc-treemap-tiles" }, groups), labels && require_vnode.h("g", {
219
- class: "tc-treemap-labels",
220
- "aria-hidden": "true"
221
- }, labels)];
234
+ return {
235
+ content: [require_vnode.h("g", { class: "tc-treemap-tiles" }, groups), labels && require_vnode.h("g", {
236
+ class: "tc-treemap-labels",
237
+ "aria-hidden": "true"
238
+ }, labels)],
239
+ interaction
240
+ };
222
241
  }
223
242
  function treemapTable(options, ctx, limit) {
224
243
  const entries = visible(options, ctx.hidden);
@@ -274,7 +293,9 @@ function cleanNodes(data, depth = 0, budget = { left: MAX_NODES }) {
274
293
  * Treemap: parts of a whole as tiles, each as large as its value, laid out
275
294
  * as close to squares as they go with the largest in the top left corner.
276
295
  * Entries with `children` are groups: their tiles stay together and share
277
- * 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.
278
299
  *
279
300
  * ```ts
280
301
  * new Chart('#el', {
@@ -289,8 +310,12 @@ function cleanNodes(data, depth = 0, budget = { left: MAX_NODES }) {
289
310
  const treemap = {
290
311
  name: "treemap",
291
312
  clean: require_clean.cleanData((data) => cleanNodes(data)),
313
+ prepare: (options) => ({
314
+ ...options,
315
+ sized: sized(options.data)
316
+ }),
292
317
  render: renderTreemap,
293
- legend: (options) => require_named.legendItems(options.data),
318
+ legend: (options) => byValue(options) ? [] : require_named.legendItems(options.data),
294
319
  table: treemapTable
295
320
  };
296
321
  Object.defineProperty(exports, "treemap", {
@@ -300,4 +325,4 @@ Object.defineProperty(exports, "treemap", {
300
325
  }
301
326
  });
302
327
 
303
- //# sourceMappingURL=treemap-BWpEUlDh.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,OAAO,GACf,KACF;CACA,QAAQ,MAAM,MAAM,SAAS,CAAC,CAAC;AACjC;;;;;;AAOA,SAAS,QAAQ,OAAqB,QAA6B;CACjE,MAAM,QAAQ,QAAQ,KAAK;CAC3B,OAAO,MAAM,M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,IAAI;CAAE;CAChE,QAAQ;CAER,SAAS,YAAa,QAAQ,OAAO,IAAI,CAAC,IAAIC,cAAAA,YAAY,QAAQ,IAAI;CACtE,OAAO;AACT"}
@@ -1,8 +1,10 @@
1
1
  import { o as getNumberFormat, r as formatNumber } from "./format-it1kepFG.js";
2
- import { i as insets, n as estimateTextWidth, o as round, r as innerRect } from "./layout-DmrrLjwN.js";
3
- import { t as rectPath } from "./rect-DSVmUZrD.js";
2
+ import { i as insets, n as estimateTextWidth, r as innerRect, s as round } from "./layout-DqAte3H8.js";
3
+ 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
+ import { t as fit } from "./fit-BPyPRnsK.js";
7
+ import { n as heatScale } from "./heat-Bsqq4zw9.js";
6
8
  import { n as keyOf, r as legendItems, t as groupAttrs } from "./named-BOiBah6I.js";
7
9
  // src/charts/treemap.ts
8
10
  /** Levels of nesting read from the data, and the most nodes: enough for any chart, few enough to draw. */
@@ -10,6 +12,8 @@ const MAX_DEPTH = 8;
10
12
  const MAX_NODES = 5e3;
11
13
  /** Space between a tile's edge and its text. */
12
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;
13
17
  function sized(nodes) {
14
18
  return nodes.map((node) => {
15
19
  if (node.children?.length) {
@@ -26,12 +30,32 @@ function sized(nodes) {
26
30
  };
27
31
  });
28
32
  }
29
- /** The top-level entries with their sizes and color slots, without the hidden ones. */
30
- function visible(options, hidden) {
31
- return sized(options.data).map((entry, index) => ({
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
+ */
53
+ function visible(model, hidden) {
54
+ const fixed = byValue(model);
55
+ return model.sized.map((entry, index) => ({
32
56
  entry,
33
57
  index
34
- })).filter(({ entry }) => !hidden.has(keyOf(entry.node)));
58
+ })).filter(({ entry }) => !hidden.has(keyOf(entry.node)) && !(fixed && entry.node.hidden));
35
59
  }
36
60
  /**
37
61
  * Squarified layout (Bruls, Huizing, van Wijk): `items`, largest first, fill
@@ -116,17 +140,6 @@ function layout(items, x, y, w, hgt, gap, out, edges, top, slots) {
116
140
  }
117
141
  });
118
142
  }
119
- /** `text` cut to `width` pixels with an ellipsis, or `''` when not even a few letters fit. */
120
- function fit(text, width, fontSize) {
121
- if (estimateTextWidth(text, fontSize) <= width) return text;
122
- const chars = [...text];
123
- while (chars.length > 2) {
124
- chars.pop();
125
- const cut = `${chars.join("").trimEnd()}…`;
126
- if (estimateTextWidth(cut, fontSize) <= width) return cut;
127
- }
128
- return "";
129
- }
130
143
  function renderTreemap(options, ctx) {
131
144
  const { width, height, fontSize, locale } = ctx;
132
145
  const gap = Math.max(0, options.gap ?? 2);
@@ -141,6 +154,7 @@ function renderTreemap(options, ctx) {
141
154
  0,
142
155
  0
143
156
  ], void 0, entries.map(({ index }) => index));
157
+ const paint = byValue(options) ? scale(options) : void 0;
144
158
  const value = formatNumber(options.format, locale);
145
159
  const share = getNumberFormat(locale, {
146
160
  style: "percent",
@@ -156,7 +170,7 @@ function renderTreemap(options, ctx) {
156
170
  x,
157
171
  y: tile.y + tile.height / 2
158
172
  };
159
- 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;
160
174
  if (color) item.color = color;
161
175
  return {
162
176
  index,
@@ -166,10 +180,9 @@ function renderTreemap(options, ctx) {
166
180
  area,
167
181
  items: [item],
168
182
  seriesIndex: tile.top,
169
- mark: {
170
- d: rectPath(tile.x + 1, tile.y + 1, tile.width - 2, tile.height - 2, radius - 1),
171
- x: 0,
172
- y: 0
183
+ highlight: {
184
+ kind: "halo",
185
+ d: rectPath(tile.x + 1, tile.y + 1, tile.width - 2, tile.height - 2, radius - 1)
173
186
  }
174
187
  };
175
188
  };
@@ -184,16 +197,19 @@ function renderTreemap(options, ctx) {
184
197
  return index < 0 ? null : hitFor(tiles[index], index);
185
198
  }
186
199
  };
187
- ctx.onHitTest(interaction);
188
200
  const groups = entries.map(({ entry, index }) => h("g", groupAttrs(entry.node, index), tiles.filter((tile) => tile.top === index).map((tile) => h("rect", {
189
201
  key: tile.key,
190
- 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
+ ],
191
207
  x: round(tile.x),
192
208
  y: round(tile.y),
193
209
  width: round(tile.width),
194
210
  height: round(tile.height),
195
211
  rx: round(Math.min(radius, tile.width / 2, tile.height / 2)),
196
- 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
197
213
  }))));
198
214
  const line = fontSize * 1.3;
199
215
  const labels = options.labels !== false && tiles.flatMap((tile) => {
@@ -215,10 +231,13 @@ function renderTreemap(options, ctx) {
215
231
  y: round(y + line)
216
232
  }, text)];
217
233
  });
218
- return [h("g", { class: "tc-treemap-tiles" }, groups), labels && h("g", {
219
- class: "tc-treemap-labels",
220
- "aria-hidden": "true"
221
- }, labels)];
234
+ return {
235
+ content: [h("g", { class: "tc-treemap-tiles" }, groups), labels && h("g", {
236
+ class: "tc-treemap-labels",
237
+ "aria-hidden": "true"
238
+ }, labels)],
239
+ interaction
240
+ };
222
241
  }
223
242
  function treemapTable(options, ctx, limit) {
224
243
  const entries = visible(options, ctx.hidden);
@@ -274,7 +293,9 @@ function cleanNodes(data, depth = 0, budget = { left: MAX_NODES }) {
274
293
  * Treemap: parts of a whole as tiles, each as large as its value, laid out
275
294
  * as close to squares as they go with the largest in the top left corner.
276
295
  * Entries with `children` are groups: their tiles stay together and share
277
- * 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.
278
299
  *
279
300
  * ```ts
280
301
  * new Chart('#el', {
@@ -289,10 +310,14 @@ function cleanNodes(data, depth = 0, budget = { left: MAX_NODES }) {
289
310
  const treemap = {
290
311
  name: "treemap",
291
312
  clean: cleanData((data) => cleanNodes(data)),
313
+ prepare: (options) => ({
314
+ ...options,
315
+ sized: sized(options.data)
316
+ }),
292
317
  render: renderTreemap,
293
- legend: (options) => legendItems(options.data),
318
+ legend: (options) => byValue(options) ? [] : legendItems(options.data),
294
319
  table: treemapTable
295
320
  };
296
321
  export { treemap as t };
297
322
 
298
- //# sourceMappingURL=treemap-CQdavQ9u.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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,OAAO,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,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-BWpEUlDh.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-BAkhmVQc.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-BNpxFBao.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 };