@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
package/README.md CHANGED
@@ -68,9 +68,12 @@ Chart types have their own entries (`@tabler/charts/line`, `/bar`, `/pie` …).
68
68
  | `@tabler/charts/time` | `x: { type: 'time' }`: points at their real distance in time, calendar ticks, date labels |
69
69
  | `@tabler/charts/log` | `y: { scale: 'log' }` |
70
70
  | `@tabler/charts/decimate` | `decimate: 500` on line and area charts (LTTB downsampling) |
71
- | `@tabler/charts/annotations` | `annotations` on line, area, bar and candlestick charts |
71
+ | `@tabler/charts/annotations` | `annotations` on line, area, bar, candlestick and range bar charts |
72
+ | `@tabler/charts/end-labels` | `endLabels` on line and area charts: each line named at its end |
73
+ | `@tabler/charts/slice-labels` | `labels` on pie and donut charts: each slice named beside the chart |
72
74
  | `@tabler/charts/hydrate` | Taking over server-rendered markup node by node (otherwise it is replaced) |
73
- | `@tabler/charts/export` | `exportSVG()`, `exportImage()`, `downloadChart()`, and the `download` menu option (also with the default `Chart`) |
75
+ | `@tabler/charts/export` | `exportSVG()`, `exportImage()`, `exportCSV()`, `downloadChart()`, and the `download` menu option (also with the default `Chart`) |
76
+ | `@tabler/charts/zoom` | `zoom: true` and `view` on line, area, bar and candlestick charts (also with the default `Chart`) |
74
77
 
75
78
  A feature you use but did not import throws an error that names the import.
76
79
 
@@ -81,25 +84,51 @@ A feature you use but did not import throws an error that names the import.
81
84
  | `line` | `{ labels, series }` | `curve` (`'monotone'`, `'linear'`, `'step'` …), `points` (`'none'`, `'last'`, `'all'`), `area`, `stacked`, `connectNulls`, `decimate` |
82
85
  | `area` | `{ labels, series }` | as `line`, filled; `fill: 'gradient' \| 'solid'` |
83
86
  | `bar` | `{ labels, series }` | `stacked` (`true` or `'percent'`), `orientation: 'horizontal'`, `radius`, `gap`, `maxBarWidth`; `series[].type: 'line' \| 'area'` mixes in lines |
84
- | `pie`, `donut` | `[{ name, value }]` | `innerRadius`, `gap`, `cornerRadius`, `center` (text in the middle), `maxSlices` (the rest is grouped into `othersLabel`) |
87
+ | `pie`, `donut` | `[{ name, value }]` | `labels` (names beside the slices), `innerRadius`, `gap`, `cornerRadius`, `center` (text in the middle), `maxSlices` (the rest is grouped into `othersLabel`) |
85
88
  | `gauge` | a number, a ring or rings | `max`, `startAngle`, `angle` (`270` for a dial), `thickness`, `center` |
86
89
  | `radar` | `{ labels, series }` | `grid: 'polygon' \| 'circle'`, `fill`, `points`, `r` (radial axis), `labelWidth` (long spoke labels wrap at their spaces, by default past a quarter of the width) |
87
90
  | `sankey` | `{ nodes?, links: [{ from, to, value }] }` | `nodeWidth`, `nodePadding`, `align: 'justify' \| 'left'`, `format`; nodes with a `color` make the legend |
88
91
  | `parliament` | `[{ name, seats }]` | `total` (vacant seats), `rows`, `angle` (`180` for a hemicycle), `innerRadius`, `gap`, `center` |
89
- | `treemap` | `[{ name, value }]`, or groups `[{ name, children }]` | `gap`, `radius`, `labels` (names and values in the tiles), `format`; `--tc-treemap-opacity` fades the tiles |
92
+ | `treemap` | `[{ name, value }]`, or groups `[{ name, children }]` | `gap`, `radius`, `labels` (names and values in the tiles), `format`, `colorBy: 'value'` (one hue, `--tc-heat-color`, lighter as the value drops) with `min`, `max`, `colors` + `mid` (a scale of colors); `--tc-treemap-opacity` fades the tiles |
90
93
  | `percentageBar` | `[{ name, value }]` | `order: 'data' \| 'size'`, `maxSlices` (the rest is grouped into `othersLabel`), `gap`, `radius`, `format`; a strip 16 px tall unless `height` is set |
91
- | `scatter` | `{ series: [{ name, points: [{ x, y, size? }] }] }` | `radius`, `size` (bubble radii); points with `size` are bubbles |
94
+ | `funnel` | `[{ name, value }]`, in the order of the process | `labels` (name, value and share of the first stage above every stage), `radius`, `format`; `--tc-funnel-color` is the color the stages shade towards |
95
+ | `rangeBar` | `[{ name, from, to }]` (dates, or numbers) | `x: { type: 'time' }` for dates (`min`, `max`, `format`, `utc`), `radius`, `maxBarWidth`, `annotations` (`x`: a moment or a period, `y`: a row); ranges with the same `name` share a row |
96
+ | `scatter` | `{ labels?, series: [{ name, points: [{ x, y, size? }] }] }` | `radius`, `size` (bubble radii); points with `size` are bubbles; with `labels` (or a text `x`) the x axis shows categories and each point stands at the label its `x` names |
92
97
  | `heatmap` | `{ labels, series }` (rows) | `min`, `max`, `ranges`, `colors` + `mid` (scales), `colorBy: 'series'` |
98
+ | `calendar` | `[{ date, value }]`, or `{ series }` of them (added up per day) | `weeks`, `from`, `to` (more than a year is split into bands of twelve months), `weekStart`, `levels`, `min`, `max`, `colors` + `mid` (a scale of colors, `'diverging'` around zero), `scale`, `dateFormat`; the height follows the range unless `aspectRatio` or `height` is set |
99
+ | `map` | `{ PL: 80, DE: 45 }` (a value per region code) | `map` (a map file such as `world` from `@tabler/charts/maps/world`, or the name given with `addMap()`), `min`, `max`, `colors` + `mid`, `markers` (`{ name, lat, lng }`), `lines` (`{ from, to }`), `markerRadius`, `scale`, `zoom`, `view`, `select`, `selected`, `onSelect`; the proportions follow the map unless `aspectRatio` or `height` is set |
93
100
  | `candlestick` | `[{ x, open, high, low, close }]` | time axes, `maxCandleWidth` |
94
101
  | `sparkline` | `number[]` | `variant` (`'line'`, `'area'`, `'bar'`, `'tristate'`), `point`, `markers: 'minmax'` |
95
102
 
96
103
  `types` (from `@tabler/charts`) has every type by its name, for charts declared in markup (`types[name]`); it brings all of them into the bundle.
97
104
 
98
- Series take `name`, `values`, and optionally `id` (stable identity), `color`, `dash`, `width`, `class` and `hidden`.
105
+ Series take `name`, `values`, and optionally `id` (stable identity), `color`, `dash`, `width`, `class` and `hidden`. In line and area charts `dashFrom: '2025'` dashes a line only from that label on (a forecast): solid before it, `dash` (`'5 4'` by default) after.
99
106
 
100
107
  Cartesian charts share two axes:
101
- - `x`: `format`, `type: 'time'`, `utc`, `grid`, `line`, `show`.
102
- - `y`: `min`, `max`, `zero`, `nice`, `ticks`, `format`, `scale: 'log'`, `grid`, `show`.
108
+ - `x`: `format`, `type: 'time'`, `utc`, `grid`, `line`, `show`, `title`, `rotate` (labels turned 90°, so that many or long categories all keep theirs).
109
+ - `y`: `min`, `max`, `zero`, `nice`, `ticks`, `format`, `scale: 'log'`, `grid`, `show`, `title`.
110
+ - `y2`: the same as `y`, for series with `axis: 'y2'`.
111
+
112
+ An axis `title` names the axis (a unit, for example): `y.title` is turned 90° beside the value axis — on the right in an `rtl` chart — and `x.title` sits below the categories. Style both with `.tc-axis-title`.
113
+
114
+ A series with `axis: 'y2'` is drawn against a second value axis on the right (on the left in `rtl`), with its own scale; `y2` takes the same options as `y`. Use it for series in different units, such as daily sales as bars and the average price per person as a line:
115
+
116
+ ```ts
117
+ new Chart('#chart', {
118
+ type: bar,
119
+ data: {
120
+ labels,
121
+ series: [
122
+ { name: 'Net revenue', values: revenue },
123
+ { name: 'Net revenue / PAX', values: perPax, type: 'line', axis: 'y2' },
124
+ ],
125
+ },
126
+ y: { title: 'Net revenue' },
127
+ y2: { title: 'Net revenue / PAX' },
128
+ })
129
+ ```
130
+
131
+ Series on `y2` stay out of stacks (their bars stand beside the stack), and the grid lines follow `y`. Line, area and vertical bar charts.
103
132
 
104
133
  A number `format` is `Intl.NumberFormat` options or a function. `notation: 'compact'` shortens long numbers in the locale's words ("1.1M", "1,1 mln" in Polish); `compactSymbols` writes suffixes of your own in the locale's separators instead:
105
134
 
@@ -115,22 +144,86 @@ annotations: [
115
144
  { y: 99.9, label: 'SLA' }, // a line at a value
116
145
  { y: [40, 60], label: 'Normal' }, // a band between values
117
146
  { x: 'Jun', label: 'Launch' }, // a line at a category (or a date)
147
+ { x: 'Jun', y: 42, label: 'Peak' }, // a point: a dot with its label
118
148
  ]
119
149
  ```
120
150
 
151
+ An annotation also takes `color`, `position` (`'start'` or `'end'`, where the label sits), `dash` (the dashes of its line: a length in pixels or a `stroke-dasharray` such as `'6 3'`, `0` for a solid line) and `labelBackground: true`, which draws the label on a box in the surface color so it reads where it crosses lines and points (style it with `.tc-annotation-label-bg`).
152
+
153
+ ### Maps
154
+
155
+ `map` draws the regions of a map file as SVG shapes and shades them by value. The shapes are projected when the map file is built, so no geo library ships to the browser, and the map file is an import of its own:
156
+
157
+ ```ts
158
+ import { Chart, map } from '@tabler/charts'
159
+ import { world } from '@tabler/charts/maps/world'
160
+
161
+ new Chart('#visits', {
162
+ type: map,
163
+ map: world,
164
+ data: { US: 100, DE: 80, PL: 54 }, // by ISO 3166-1 alpha-2 code
165
+ markers: [
166
+ { name: 'Warsaw', lat: 52.23, lng: 21.01 },
167
+ { name: 'New York', lat: 40.71, lng: -74.01 },
168
+ ],
169
+ lines: [{ from: 'Warsaw', to: 'New York' }],
170
+ })
171
+ ```
172
+
173
+ Regions take one hue from the empty shade to the full color (`--tc-heat-color` and `--tc-heat-empty`, as heatmap cells do), or a scale through `colors`. Countries too small for a shape are drawn as a dot when they have a value. `--tc-map-marker-color` and `--tc-map-line-color` color the markers and the lines. The `click` event gives the region code in `hit.region` (or the marker's name in `hit.marker`).
174
+
175
+ `zoom: true` lets the map be magnified with its buttons, the wheel, a double click, a pinch or the `+`, `-` and `0` keys, and dragged around; `zoom: { max: 16, wheel: false }` sets the limit and leaves the wheel to the page. The part in sight is the `view` option (`{ x, y, scale }` in the coordinates of the map file): zooming writes it, and you can set it to start on a part of the map, or `chart.update({ view: undefined })` to show all of it again.
176
+
177
+ `select: 'single'` or `'multiple'` lets a click (or Enter on the region the keyboard is on) select regions; a click on a selected region takes it out. The codes are the `selected` option, and `onSelect(selected, code)` is called when they change. `.tc-region-selected` styles the outline.
178
+
179
+ For charts declared in markup or JSON, register the map under a name and pass that name: `addMap('world', world)`, then `map: 'world'`.
180
+
181
+ `world` is the countries of [Natural Earth](https://www.naturalearthdata.com/) (public domain) in the Miller projection, 27 kB gzipped. `pnpm generate:maps` rebuilds it.
182
+
183
+ ### End labels
184
+
185
+ `endLabels: true` on a line or area chart names each line at its end: the series name and its last value beside the last point, past the edge of the plot, which leaves them room. Labels of lines that end close together are moved apart, and a thin line in the series color joins a moved label to its point. `endLabels: { format }` formats the values (the axis format by default) and `{ value: false }` writes the names only. With them a chart often reads without its legend (`legend: false`). On the core, `import '@tabler/charts/end-labels'` enables them.
186
+
187
+ ```js
188
+ new Chart('#el', { type: line, data, endLabels: true, legend: false })
189
+ ```
190
+
191
+ ### Slice labels
192
+
193
+ `labels: true` on a pie or donut names every slice beside the chart: the name and the slice's share, in a column on the side the slice is on, joined to it by a thin line. Labels of small neighboring slices are moved apart so none overlap, and the pie gets smaller to leave them room. `labels: { value: 'value' }` writes the values (in the chart's `format`) instead of the shares, `{ value: false }` the names alone. With them a chart reads without its legend (`legend: false`). A chart too narrow or too low for them is drawn without labels; when one side holds more slices than lines of text fit, the smallest go without. Style them with `.tc-slice-label-text`, `.tc-slice-label-name` and `.tc-slice-label-line`. On the core, `import '@tabler/charts/slice-labels'` enables them.
194
+
195
+ ```js
196
+ new Chart('#el', { type: donut, data, labels: true, legend: false })
197
+ ```
198
+
121
199
  ### Value labels
122
200
 
123
- `valueLabels: true` writes the values on the marks: bars at their end (inside when there is no room outside), stacked segments and heatmap cells inside, slices their share, lines and scatters above their last point (`valueLabels: { points: 'all' }` for every point). Values take the axis format (`valueLabels: { format }` overrides it). A label that does not fit its mark or the chart, or would cover another label or mark, is left out: labels never overlap. On the core, `import '@tabler/charts/value-labels'` enables them.
201
+ `valueLabels: true` writes the values on the marks: bars at their end (inside when there is no room outside), stacked segments and heatmap cells inside, slices their share, lines and scatters above their last point (`valueLabels: { points: 'all' }` for every point). Values take the axis format (`valueLabels: { format }` overrides it). A label that does not fit its mark or the chart, or would cover another label or mark, is left out: labels never overlap. `valueLabels: { points: 'all', overMarks: true }` lets the label of a point lie over a bar when it has no free place, so a line keeps every label where it crosses the bars (labels still never cover each other). On the core, `import '@tabler/charts/value-labels'` enables them.
124
202
 
125
203
  ```js
126
204
  new Chart('#el', { type: bar, data, valueLabels: true })
127
205
  ```
128
206
 
207
+ A series' own `valueLabels` overrides the chart's for that series: `true` labels it even when the chart option is off, `false` leaves it out. Each label carries the classes of its series (`tc-series tc-series-{n}`), for styling per series.
208
+
209
+ ```js
210
+ const data = {
211
+ labels,
212
+ series: [
213
+ { name: 'Revenue', values: revenue },
214
+ { name: 'Per person', values: perPax, type: 'line', valueLabels: true },
215
+ ],
216
+ }
217
+ new Chart('#el', { type: bar, data }) // only the line is labelled
218
+ ```
219
+
129
220
  A chart type of your own gets labels from its hits like the built-in ones. Its `valueLabels` says what its marks are, when not bars or points (`{ marks: 'slice' }` for shares inside slices, `{ marks: 'cell' }` for values in the middle of cells), and where its number format is (`{ format: (options) => options.format }`).
130
221
 
131
222
  ### Right to left
132
223
 
133
- `rtl` mirrors line, area, bar, candlestick, scatter, heatmap, sparkline and sankey charts for right-to-left pages: the value axis on the right, categories from the right, flows running to the left, the arrow keys following the screen. The legend, the tooltip and the download menu follow the chart: they read right to left (the menu in the left corner) even on a left-to-right page.
224
+ `rtl` mirrors line, area, bar, range bar, candlestick, scatter, heatmap, sparkline, sankey and percentage bar charts for right-to-left pages: the value axis on the right, categories from the right, flows running to the left, the arrow keys following the screen. The legend, the tooltip and the download menu follow the chart: they read right to left (the menu in the left corner) even on a left-to-right page.
225
+
226
+ `legend: { position: 'left' }` or `'right'` puts the legend beside the chart, its entries stacked, and the chart takes the remaining width (sides swap with `rtl`). `'auto'` puts it on the right when the chart keeps two thirds of the container that way and below it otherwise, so a card is not taller on a wide screen and not cramped on a phone. The legend's `data-position` says where it ended up, for styling.
134
227
 
135
228
  ```ts
136
229
  // <html dir="rtl">
@@ -152,6 +245,57 @@ new Chart('#visitors', { type: line, data: visitors, sync: 'week' })
152
245
  new Chart('#signups', { type: bar, data: signups, sync: 'week' })
153
246
  ```
154
247
 
248
+ ### Zoom
249
+
250
+ `zoom: true` lets the reader zoom along the categories of line, area, bar and candlestick charts. The code comes with an import of its own, so charts that are never zoomed do not carry it; the chart tells you when the import is missing.
251
+
252
+ ```js
253
+ import { Chart, line } from '@tabler/charts'
254
+ import '@tabler/charts/zoom'
255
+
256
+ const chart = new Chart('#traffic', { type: line, data, zoom: true })
257
+ ```
258
+
259
+ | Input | What it does |
260
+ | --- | --- |
261
+ | Wheel, or a pinch | Zooms around the category under the pointer |
262
+ | Drag over the plot | Shows the range dragged over |
263
+ | Shift + drag, Shift + wheel, or a sideways wheel | Moves the range |
264
+ | Double click | Shows everything again |
265
+ | The buttons in the corner (`.tc-zoom`) | Zoom in, zoom out, reset |
266
+ | `+`, `-`, `0`, Shift + arrow (chart in focus) | Zoom in, zoom out, reset, move the range |
267
+
268
+ The range shown is the `view` option: the indexes of the first and last category, both included. Set it to start zoomed in or to zoom from your own controls, and read it from `chart.config.view` (it is `undefined` when everything is shown). The chart draws the categories of the view like any other data, so the value axis, stacks, the tooltip and the table follow the range, and `hit.index` in events counts from the start of the view (`hit.label` names the category).
269
+
270
+ ```js
271
+ new Chart('#traffic', { type: line, data, zoom: true, view: { start: 90, end: 119 } })
272
+ chart.update({ view: { start: 0, end: 29 } })
273
+ chart.on('render', () => console.log(chart.config.view))
274
+ ```
275
+
276
+ `zoom` also takes an object: `{ wheel: false }` leaves the wheel to the page, `{ controls: false }` hides the buttons, `{ min: 7 }` is the fewest categories a reader can zoom in to (2 by default), and `{ labels: { in, out, reset } }` names the buttons in another language. On the core, add the `zoom()` plugin.
277
+
278
+ #### Brush
279
+
280
+ `brush: true` (same import) turns a chart into an overview of all its data with a range marked on it. The reader drags the range to move it, drags one of its ends to resize it, drags elsewhere to draw a new one, and double clicks (or presses `0`) to mark everything; Shift with an arrow key moves the range by one category.
281
+
282
+ Charts in the same `sync` group show the range of the brush as their `view`, and a chart of the group that is zoomed moves the range of the brush. Categories are matched by label, so the charts need not have the same data.
283
+
284
+ ```js
285
+ new Chart('#traffic', { type: line, data, sync: 'traffic', zoom: true })
286
+ const brush = new Chart('#traffic-range', {
287
+ type: area,
288
+ data,
289
+ height: 96,
290
+ tooltip: false,
291
+ sync: 'traffic',
292
+ brush: true,
293
+ selection: { start: 90, end: 119 },
294
+ })
295
+ ```
296
+
297
+ The range is the `selection` option, with the same shape as `view`: set it to start with a range, read it from `brush.config.selection` (`undefined` when everything is marked). `brush: { min: 7 }` is the fewest categories a reader can mark (2 by default). The brush and the charts of its group add to their `padding` so that their plots start and end together, also when the value axis of the brush is hidden: each side takes the widest margin of the group. `brush: { align: false }` leaves the padding alone. A brush is not zoomed itself: `zoom` and `view` do nothing on it. Style the mark with `.tc-brush-selection` and `.tc-brush-handle`.
298
+
155
299
  ### Data from outside
156
300
 
157
301
  Data, annotations and axis bounds often come from users, APIs or JSON and are not always what the types say. Charts take them as they are and never throw or draw `NaN` over them: a value that is not a finite number (`null`, `'42'`, `NaN`, `Infinity`, an object) is a gap, as are numbers too large to plot (beyond ±1e300); names become text; a color that is not a string falls back to the palette; series, slices, points or annotations that are not objects are left out. Numbers in strings are not parsed: convert them first if your API sends them.
@@ -169,14 +313,15 @@ An option that is `NaN` or infinite (a `radius`, a `startAngle`, a `width`, a si
169
313
  | `rtl` | `false` | Mirror cartesian charts, heatmaps, sparklines and sankey diagrams for right-to-left pages: value axis on the right, categories from the right (`x: { reverse: false }` keeps those). Horizontal bars grow to the left. `'auto'` follows the container's `direction` |
170
314
  | `fontSize` | `--tc-font-size` | Used to lay out labels; set it for SSR |
171
315
  | `id` | generated | Prefix of ids inside the SVG; set it for SSR |
172
- | `legend` | for 2+ entries | `false`, `true` or `{ position: 'bottom' }` |
316
+ | `legend` | for 2+ entries | `false`, `true` or `{ position, withinHeight }`: `'top'`, `'bottom'`, `'left'`, `'right'` or `'auto'` (see below); `withinHeight: true` keeps the legend inside a `height` in pixels instead of adding to it |
173
317
  | `tooltip` | `true` | `false`, or `{ theme, format, footer }`: `theme: 'light'` for a white tooltip instead of the dark one, `format` and `footer` for custom content |
174
- | `crosshair` | `true` | |
318
+ | `crosshair` | `true` | `{ value: true }` also draws a line through the pointer, with the value under it on the value axis (line, area, bar and candlestick charts) |
319
+ | `activePoints` | `true` | The dot on every value of the hovered category; `false` leaves the crosshair and the tooltip |
175
320
  | `table` | `true` | Hidden data table for screen readers; `'visible'` shows it |
176
321
  | `keyboard` | `true` | Arrow keys walk the data; sparklines opt out |
177
322
  | `animate` | `true` | Charts with more than 1000 elements skip transitions unless `true` |
178
323
  | `patterns` | `'auto'` | Pattern fills: `true` always, `'auto'` in forced colors only, `false` never |
179
- | `valueLabels` | `false` | Values on the marks: `true`, or `{ points: 'all', format }` (see below) |
324
+ | `valueLabels` | `false` | Values on the marks: `true`, or `{ points: 'all', overMarks, format }` (see below) |
180
325
  | `sync` | | A group name: charts of the same group share the hover (see below) |
181
326
  | `shapes` | with `patterns: true` | A point shape per series in line, radar and scatter charts |
182
327
  | `class` | | Extra classes on the `<svg>` |
@@ -218,7 +363,7 @@ Everything visual is CSS. The stylesheet defines tokens on `:root` (light and da
218
363
 
219
364
  Tokens include `--tc-color-1` … `--tc-color-8`, `--tc-surface`, `--tc-text-color`, `--tc-text-muted`, `--tc-grid-color`, `--tc-baseline-color`, `--tc-font-family`, `--tc-font-size`, `--tc-stroke-width`, `--tc-area-opacity`, `--tc-duration`, `--tc-easing` and the `--tc-tooltip-*` set (`-bg`, `-color`, `-muted`, `-border`, `-shadow`, `-radius`, and `--tc-tooltip-light-*` for the white variant).
220
365
 
221
- On a [Tabler](https://tabler.io) page the colors come from the theme: each color token reads the matching `--tblr-*` variable first (`--tc-color-1` is `--tblr-primary`, series 2–8 are Tabler's orange, teal, yellow, pink, green, indigo and red, the surface is `--tblr-bg-surface`, text and borders, radius, shadow and font follow too) and falls back to the chart's own palette when the variable is not defined. Tabler switches its variables for dark mode itself; without Tabler the fallbacks have their own dark values.
366
+ On a [Tabler](https://tabler.io) page the colors come from the theme: each color token reads the matching `--tblr-*` variable first (series 1–5 are Tabler's chart palette, `--tblr-chart-1` … `--tblr-chart-5`: primary, green, azure, purple and orange, so an app that overrides the palette recolors every chart; series 6–8 are Tabler's cyan, indigo and red; a Tabler without the chart palette gives primary, orange, teal, yellow and pink for series 1–5; the surface is `--tblr-bg-surface`, text and borders, radius, shadow and font follow too) and falls back to the chart's own palette when the variable is not defined. Tabler switches its variables for dark mode itself; without Tabler the fallbacks have their own dark values.
222
367
 
223
368
  Colors given in data (`series.color`, slice, ring, heatmap and annotation colors, `series.dash`) may come from users: any CSS color works, `var(--…)` and `color-mix()` included, but a value that could inject CSS (a `;`, quotes, `url()` and the like) is ignored and the palette color stays.
224
369
 
@@ -244,11 +389,12 @@ Charts work under a strict CSP (`style-src 'self'`, no `'unsafe-inline'`): the b
244
389
  ## Export
245
390
 
246
391
  ```js
247
- import { downloadChart, exportImage, exportSVG } from '@tabler/charts'
392
+ import { downloadChart, exportCSV, exportImage, exportSVG } from '@tabler/charts'
248
393
 
249
394
  const svg = exportSVG(chart) // standalone SVG string
250
395
  const png = await exportImage(chart, { scale: 3 }) // Blob; also image/jpeg, image/webp
251
- await downloadChart(chart, { format: 'svg' }) // saves "<title>.svg"
396
+ const csv = exportCSV(chart) // the data as CSV text
397
+ await downloadChart(chart, { format: 'svg' }) // saves "<title>.svg" (or 'csv', 'png' …)
252
398
  ```
253
399
 
254
400
  The export copies the computed styles into the SVG, so CSS theming comes along. It also draws the legend in, leaves hover marks out and paints the surface color behind the chart (`background: false` for none).
@@ -257,10 +403,12 @@ Or let the chart offer it: `download: true` puts a small menu button in the char
257
403
 
258
404
  ```js
259
405
  new Chart('#sales', { type: line, data, download: true })
260
- new Chart('#sales', { type: line, data, download: ['png', 'svg', 'jpeg', 'webp'] })
406
+ new Chart('#sales', { type: line, data, download: ['png', 'svg', 'jpeg', 'webp', 'csv'] })
261
407
  new Chart('#sales', { type: line, data, download: { formats: ['svg'], filename: 'sales', background: false, scale: 3 } })
262
408
  ```
263
409
 
410
+ `'csv'` saves the data instead of a picture: one row per category and one column per visible series, as in the chart's data table but with every row. Line, area, bar, heatmap and radar charts write plain values (numbers without their format, dates in ISO 8601, gaps empty); the other types write the text of their table. `delimiter: ';'` changes the separator, and text that a spreadsheet would run as a formula is prefixed with `'`. `exportCSV()` takes the chart itself, not its element.
411
+
264
412
  The menu is a `download()` plugin (in the default `Chart`; install it yourself on the core). The saving comes from `import '@tabler/charts/export'`, so charts without a download menu never carry the export code; the chart tells you when the import is missing.
265
413
 
266
414
  ## Accessibility
@@ -1,6 +1,6 @@
1
- const require_layout = require("./layout-JY2aR-yE.cjs");
1
+ const require_layout = require("./layout-Cfg9x1k2.cjs");
2
2
  const require_vnode = require("./vnode-ClAiw28x.cjs");
3
- const require_cartesian = require("./cartesian-DV02PsBe.cjs");
3
+ const require_cartesian = require("./cartesian-B9CrasFJ.cjs");
4
4
  const require_clean = require("./clean-Die2iCNc.cjs");
5
5
  // src/charts/annotations.ts
6
6
  /** Pixel span of a category (or a date on a time axis), or `undefined` if it is not on the axis. */
@@ -86,7 +86,19 @@ function annotationLayers(annotations, scales) {
86
86
  vertical
87
87
  };
88
88
  };
89
- const shapes = annotations.map(geometry);
89
+ /** Where a point annotation (a single `x` and a single `y`) lands; `undefined` off the plot. */
90
+ const pointOf = (a) => {
91
+ if (a.x === void 0 || a.y === void 0 || isPair(a.x) || isPair(a.y)) return void 0;
92
+ const along = categorySpan(scales, a.x);
93
+ const v = scales.value(a.y);
94
+ if (!along || !Number.isFinite(v)) return void 0;
95
+ const c = (along[0] + along[1]) / 2;
96
+ const [px, py] = horizontal ? [v, c] : [c, v];
97
+ return inside(px, x0, x1) && inside(py, y0, y1) ? [px, py] : void 0;
98
+ };
99
+ const isPoint = (a) => a.x !== void 0 && a.y !== void 0 && !isPair(a.x) && !isPair(a.y);
100
+ const dots = annotations.map(pointOf);
101
+ const shapes = annotations.map((a) => isPoint(a) ? void 0 : geometry(a));
90
102
  /** Boxes labels keep clear of: the labels placed so far, and every line. */
91
103
  const placed = [];
92
104
  const obstacles = [];
@@ -105,6 +117,15 @@ function annotationLayers(annotations, scales) {
105
117
  at + 1.5
106
118
  ]]);
107
119
  });
120
+ const DOT = 4;
121
+ dots.forEach((p, i) => {
122
+ if (p) obstacles.push([i, [
123
+ p[0] - DOT,
124
+ p[1] - DOT,
125
+ p[0] + DOT,
126
+ p[1] + DOT
127
+ ]]);
128
+ });
108
129
  const apart = (box, [l, t, r, b]) => box[2] <= l || box[0] >= r || box[3] <= t || box[1] >= b;
109
130
  const clearOfLabels = (box) => placed.every((p) => apart(box, p));
110
131
  const clear = (box, own) => clearOfLabels(box) && obstacles.every(([i, l]) => i === own || apart(box, l));
@@ -114,12 +135,71 @@ function annotationLayers(annotations, scales) {
114
135
  key: part ? `${key}-${part}` : key,
115
136
  class: [
116
137
  "tc-annotation",
117
- a.y !== void 0 ? "tc-annotation-y" : "tc-annotation-x",
138
+ isPoint(a) ? "tc-annotation-point" : a.y !== void 0 ? "tc-annotation-y" : "tc-annotation-x",
118
139
  a.class
119
140
  ],
120
- style: { "--tc-annotation-color": a.color }
141
+ style: {
142
+ "--tc-annotation-color": a.color,
143
+ "--tc-annotation-dash": Number.isFinite(a.dash) ? `${a.dash}px` : a.dash
144
+ }
121
145
  });
146
+ /** The label at a spot ([left edge, baseline]), on its background when asked for. */
147
+ const labelAt = (spot, w) => {
148
+ const size = fontSize * .92;
149
+ const text = require_vnode.h("text", {
150
+ class: "tc-annotation-label",
151
+ x: require_layout.round(spot[0]),
152
+ y: require_layout.round(spot[1])
153
+ }, a.label);
154
+ return a.labelBackground ? [require_vnode.h("rect", {
155
+ class: "tc-annotation-label-bg",
156
+ x: require_layout.round(spot[0] - 3),
157
+ y: require_layout.round(spot[1] - size),
158
+ width: require_layout.round(w + 6),
159
+ height: require_layout.round(size * 1.35),
160
+ rx: 2
161
+ }), text] : [text];
162
+ };
122
163
  const end = a.position !== "start";
164
+ const dot = dots[index];
165
+ if (dot) {
166
+ const [px, py] = dot;
167
+ let text;
168
+ if (a.label) {
169
+ const w = require_layout.estimateTextWidth(a.label, fontSize * .92);
170
+ const off = 8;
171
+ const mid = py + fontSize * .35;
172
+ const spots = [
173
+ [px + off, mid],
174
+ [px - off - w, mid],
175
+ [px - w / 2, py - off],
176
+ [px - w / 2, py + off + fontSize * .8],
177
+ [px + off, py + off + fontSize * .8],
178
+ [px + off, py - off],
179
+ [px - off - w, py + off + fontSize * .8],
180
+ [px - off - w, py - off]
181
+ ];
182
+ const box = ([x, y]) => [
183
+ x,
184
+ y - fontSize,
185
+ x + w,
186
+ y + fontSize * .25
187
+ ];
188
+ const within = (s) => s[0] >= x0 && s[0] + w <= x1;
189
+ const spot = spots.find((s) => within(s) && clear(box(s), index)) ?? spots.find((s) => within(s) && clearOfLabels(box(s)));
190
+ if (spot) {
191
+ placed.push(box(spot));
192
+ text = labelAt(spot, w);
193
+ }
194
+ }
195
+ lines.push(require_vnode.h("g", attrs(), require_vnode.h("circle", {
196
+ class: "tc-annotation-dot",
197
+ cx: require_layout.round(px),
198
+ cy: require_layout.round(py),
199
+ r: DOT
200
+ }), text));
201
+ return;
202
+ }
123
203
  const shape = shapes[index];
124
204
  if (!shape) return;
125
205
  const { a0, a1, vertical } = shape;
@@ -153,11 +233,7 @@ function annotationLayers(annotations, scales) {
153
233
  ];
154
234
  const spot = spots.find((s) => clear(box(s), index)) ?? spots.find((s) => clearOfLabels(box(s))) ?? spots[0];
155
235
  placed.push(box(spot));
156
- label = require_vnode.h("text", {
157
- class: "tc-annotation-label",
158
- x: require_layout.round(spot[0]),
159
- y: require_layout.round(spot[1])
160
- }, a.label);
236
+ label = labelAt(spot, w);
161
237
  }
162
238
  if (a1 - a0 > .5) {
163
239
  const d = vertical ? `M${require_layout.round(a0)},${require_layout.round(y0)}H${require_layout.round(a1)}V${require_layout.round(y1)}H${require_layout.round(a0)}Z` : `M${require_layout.round(x0)},${require_layout.round(a0)}H${require_layout.round(x1)}V${require_layout.round(a1)}H${require_layout.round(x0)}Z`;
@@ -209,4 +285,4 @@ Object.defineProperty(exports, "annotationValues", {
209
285
  }
210
286
  });
211
287
 
212
- //# sourceMappingURL=annotations-DdRdeBUB.cjs.map
288
+ //# sourceMappingURL=annotations--m-HzMBM.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotations--m-HzMBM.cjs","names":["toMs","labelKey","records","finite","label","text","h","round","estimateTextWidth"],"sources":["../src/charts/annotations.ts"],"sourcesContent":["import { estimateTextWidth, type Rect, round } from '../layout.ts'\nimport type { BandKey, BandScale } from '../scales/band.ts'\nimport { type ClassValue, h, type VNode } from '../vnode.ts'\nimport { labelKey, toMs } from './cartesian.ts'\nimport { finite, label, records, text } from './clean.ts'\n\n/** A category label, a number, or a date (on a time axis). */\ntype AnnotationLabel = string | number | Date\n\n/**\n * A reference line or band drawn with the series: a target on the value\n * axis (`y: 99.9`), a normal range (`y: [40, 60]`), an event on the category\n * axis (`x: 'Jun'`, or a date on a time axis) or a period (`x: [from, to]`).\n * With both a single `x` and a single `y` it is a point: a dot at that\n * category and value, with its label beside it.\n */\nexport interface Annotation {\n /** A line at a value, or a band between two values, on the value axis. */\n y?: number | readonly [number, number]\n /** A line at a category (or a date on a time axis), or a band between two, on the category axis. */\n x?: AnnotationLabel | readonly [AnnotationLabel, AnnotationLabel]\n /** Short text next to the line or the point, or inside the band. */\n label?: string\n /** Where the label sits along the line or band. Defaults to `'end'` (right, or top). */\n position?: 'start' | 'end'\n /**\n * Any CSS color; sets `--tc-annotation-color`.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color?: string\n /**\n * The dashes of the line: dash and gap length in pixels, or a full\n * `stroke-dasharray` such as `'6 3'`; `0` draws it solid. Sets\n * `--tc-annotation-dash`. Defaults to `'4 3'`.\n */\n dash?: number | string\n /**\n * Draw the label on a background (the surface color), so it reads where\n * it crosses lines and points. Defaults to `false`.\n */\n labelBackground?: boolean\n /** Extra classes on the annotation group. */\n class?: ClassValue\n /** Stable identity for keyed updates. Defaults to the position in the list. */\n id?: string\n}\n\n/** How the layout maps data to pixels for annotations. */\nexport interface AnnotationScales {\n area: Rect\n /** Whether categories run along y (horizontal bars). */\n horizontal: boolean\n fontSize: number\n /** Pixel position of a value along the value axis. */\n value: (v: number) => number\n /** The category scale, and the keys of its categories in order. */\n band: BandScale\n keys: readonly BandKey[]\n /** Pixel position of a date, when the category axis is a time axis. */\n time?: ((date: Date) => number) | undefined\n}\n\n/** Pixel span of a category (or a date on a time axis), or `undefined` if it is not on the axis. */\nfunction categorySpan(\n scales: AnnotationScales,\n label: AnnotationLabel,\n): readonly [number, number] | undefined {\n if (scales.time) {\n const p = scales.time(new Date(toMs(label)))\n return Number.isFinite(p) ? [p, p] : undefined\n }\n const i = scales.keys.indexOf(labelKey(label))\n return i < 0 ? undefined : [scales.band.at(i), scales.band.at(i) + scales.band.bandwidth]\n}\n\n/** A value or a [from, to] pair, cleaned by `f`; `null` when anything is off. */\nconst span = <T>(v: unknown, f: (x: unknown) => T | null): T | readonly T[] | null => {\n if (!Array.isArray(v)) return f(v)\n const pair = v.map(f)\n return pair.length === 2 && !pair.includes(null) ? (pair as T[]) : null\n}\n\n/** Annotations from outside: lines or bands at finite values or labels, with text labels. */\nexport const cleanAnnotations = (v: unknown): Annotation[] | undefined =>\n v === undefined\n ? v\n : (records(v, (a) => ({\n ...a,\n y: a.y === undefined ? a.y : span(a.y, finite),\n x: a.x === undefined ? a.x : span(a.x, label),\n label: a.label == null ? undefined : text(a.label),\n color: typeof a.color === 'string' ? a.color : undefined,\n })).filter((a) => a.y !== null && a.x !== null && (a.x ?? a.y) !== undefined) as Annotation[])\n\nconst isPair = <T>(v: T | readonly [T, T]): v is readonly [T, T] => Array.isArray(v)\n\n/** Values the value axis should include so every annotation shows. */\nexport function annotationValues(annotations: readonly Annotation[] | undefined): number[] {\n const out: number[] = []\n for (const a of cleanAnnotations(annotations) ?? []) {\n if (a.y === undefined) continue\n for (const v of isPair(a.y) ? a.y : [a.y]) if (Number.isFinite(v)) out.push(v)\n }\n return out\n}\n\n/**\n * Annotation layers: bands go below the series, lines and labels above\n * them. Annotations outside the plot area are skipped.\n */\nexport function annotationLayers(\n annotations: readonly Annotation[] | undefined,\n scales: AnnotationScales,\n): { under: VNode | null; over: VNode | null } {\n // Annotations may come from outside (thresholds from an API).\n annotations = cleanAnnotations(annotations)\n if (!annotations?.length) return { under: null, over: null }\n const { area, horizontal, fontSize } = scales\n const bands: VNode[] = []\n const lines: VNode[] = []\n // Plot edges: \"across\" is the axis the annotation spans, \"along\" the one it marks.\n const x0 = area.x\n const x1 = area.x + area.width\n const y0 = area.y\n const y1 = area.y + area.height\n const inside = (p: number, lo: number, hi: number) => p >= lo - 0.5 && p <= hi + 0.5\n const pad = 4\n /**\n * Where an annotation lands: the pixel span it covers within the plot, and\n * whether it runs across x (a vertical line); `undefined` when it is off\n * the plot or names nothing on the axes.\n */\n const geometry = (a: Annotation): { a0: number; a1: number; vertical: boolean } | undefined => {\n let span: readonly [number, number]\n let vertical: boolean\n if (a.y !== undefined) {\n const [from, to] = isPair(a.y) ? a.y : [a.y, a.y]\n if (!Number.isFinite(from) || !Number.isFinite(to)) return undefined\n span = [scales.value(from), scales.value(to)]\n vertical = horizontal\n } else if (a.x !== undefined) {\n const [from, to] = isPair(a.x) ? a.x : [a.x, a.x]\n const start = categorySpan(scales, from)\n const stop = categorySpan(scales, to)\n if (!start || !stop) return undefined\n // A single category: its center; a range: from the start of one to the end of the other.\n span = isPair(a.x)\n ? [Math.min(start[0], stop[0]), Math.max(start[1], stop[1])]\n : [(start[0] + start[1]) / 2, (start[0] + start[1]) / 2]\n vertical = !horizontal\n } else {\n return undefined\n }\n const lo = Math.min(span[0], span[1])\n const hi = Math.max(span[0], span[1])\n const [min, max] = vertical ? [x0, x1] : [y0, y1]\n if (!inside(lo, min, max) && !inside(hi, min, max) && !(lo < min && hi > max)) return undefined\n return { a0: Math.max(lo, min), a1: Math.min(hi, max), vertical }\n }\n /** Where a point annotation (a single `x` and a single `y`) lands; `undefined` off the plot. */\n const pointOf = (a: Annotation): readonly [number, number] | undefined => {\n if (a.x === undefined || a.y === undefined || isPair(a.x) || isPair(a.y)) return undefined\n const along = categorySpan(scales, a.x)\n const v = scales.value(a.y)\n if (!along || !Number.isFinite(v)) return undefined\n const c = (along[0] + along[1]) / 2\n const [px, py] = horizontal ? [v, c] : [c, v]\n return inside(px, x0, x1) && inside(py, y0, y1) ? [px, py] : undefined\n }\n const isPoint = (a: Annotation) =>\n a.x !== undefined && a.y !== undefined && !isPair(a.x) && !isPair(a.y)\n const dots = annotations.map(pointOf)\n const shapes = annotations.map((a) => (isPoint(a) ? undefined : geometry(a)))\n\n type Box = [number, number, number, number]\n /** Boxes labels keep clear of: the labels placed so far, and every line. */\n const placed: Box[] = []\n const obstacles: [number, Box][] = []\n shapes.forEach((g, i) => {\n if (!g || g.a1 - g.a0 > 0.5) return\n const at = g.a0\n obstacles.push([i, g.vertical ? [at - 1.5, y0, at + 1.5, y1] : [x0, at - 1.5, x1, at + 1.5]])\n })\n const DOT = 4\n dots.forEach((p, i) => {\n if (p) obstacles.push([i, [p[0] - DOT, p[1] - DOT, p[0] + DOT, p[1] + DOT]])\n })\n const apart = (box: Box, [l, t, r, b]: Box) =>\n box[2] <= l || box[0] >= r || box[3] <= t || box[1] >= b\n const clearOfLabels = (box: Box) => placed.every((p) => apart(box, p))\n const clear = (box: Box, own: number) =>\n clearOfLabels(box) && obstacles.every(([i, l]) => i === own || apart(box, l))\n\n annotations.forEach((a, index) => {\n const key = a.id ?? index\n // Groups are named by axis; the line, band and label inside by what they are.\n const attrs = (part?: string) => ({\n key: part ? `${key}-${part}` : key,\n class: [\n 'tc-annotation',\n isPoint(a)\n ? 'tc-annotation-point'\n : a.y !== undefined\n ? 'tc-annotation-y'\n : 'tc-annotation-x',\n a.class,\n ],\n style: {\n '--tc-annotation-color': a.color,\n '--tc-annotation-dash': Number.isFinite(a.dash) ? `${a.dash}px` : a.dash,\n },\n })\n /** The label at a spot ([left edge, baseline]), on its background when asked for. */\n const labelAt = (spot: [number, number], w: number): VNode[] => {\n const size = fontSize * 0.92\n const text = h(\n 'text',\n { class: 'tc-annotation-label', x: round(spot[0]), y: round(spot[1]) },\n a.label,\n )\n return a.labelBackground\n ? [\n h('rect', {\n class: 'tc-annotation-label-bg',\n x: round(spot[0] - 3),\n y: round(spot[1] - size),\n width: round(w + 6),\n height: round(size * 1.35),\n rx: 2,\n }),\n text,\n ]\n : [text]\n }\n const end = a.position !== 'start'\n\n const dot = dots[index]\n if (dot) {\n const [px, py] = dot\n let text: VNode[] | undefined\n if (a.label) {\n const w = estimateTextWidth(a.label, fontSize * 0.92)\n const off = DOT + pad\n const mid = py + fontSize * 0.35\n // Beside the dot, then above or below it, then at its corners.\n const spots: [number, number][] = [\n [px + off, mid],\n [px - off - w, mid],\n [px - w / 2, py - off],\n [px - w / 2, py + off + fontSize * 0.8],\n [px + off, py + off + fontSize * 0.8],\n [px + off, py - off],\n [px - off - w, py + off + fontSize * 0.8],\n [px - off - w, py - off],\n ]\n const box = ([x, y]: [number, number]): Box => [x, y - fontSize, x + w, y + fontSize * 0.25]\n const within = (s: [number, number]) => s[0] >= x0 && s[0] + w <= x1\n // A label with no room in the plot is left out: the dot stays.\n const spot =\n spots.find((s) => within(s) && clear(box(s), index)) ??\n spots.find((s) => within(s) && clearOfLabels(box(s)))\n if (spot) {\n placed.push(box(spot))\n text = labelAt(spot, w)\n }\n }\n lines.push(\n h(\n 'g',\n attrs(),\n h('circle', { class: 'tc-annotation-dot', cx: round(px), cy: round(py), r: DOT }),\n text,\n ),\n )\n return\n }\n const shape = shapes[index]\n if (!shape) return\n const { a0, a1, vertical } = shape\n\n // Label: candidate spots in order of preference, inside the plot area; the\n // first that covers neither an earlier label nor another line wins (or the first one).\n let label: VNode[] | undefined\n if (a.label) {\n const w = estimateTextWidth(a.label, fontSize * 0.92)\n const line = a1 - a0 <= 0.5\n // [left edge, baseline] of each spot.\n const spots: [number, number][] = []\n if (vertical) {\n // Beside a line or at the start of a band; on the other side if it would\n // run out, and then on the other side anyway, stepping along the line.\n const after = a0 + pad\n const before = line ? a0 - pad - w : Math.max(x0, a1 - pad - w)\n const sides = after + w <= x1 ? [after, before] : [before, after]\n const top = end ? y0 + fontSize : y1 - pad\n const step = (end ? 1 : -1) * fontSize * 1.2\n for (const x of sides) {\n if (x < x0 || x + w > x1) continue\n for (let k = 0; k < 3; k++) spots.push([x, top + k * step])\n }\n if (!spots.length) spots.push([Math.max(x0 + pad, sides[0] as number), top])\n } else {\n // At the preferred end above or below, then at the other end.\n const near = end ? x1 - pad - w : x0 + pad\n const far = end ? x0 + pad : x1 - pad - w\n for (const x of [near, far]) {\n if (line) spots.push([x, a0 - pad], [x, a0 + fontSize])\n else spots.push([x, a0 + fontSize], [x, a1 - pad])\n }\n }\n const box = ([x, y]: [number, number]): Box => [x, y - fontSize, x + w, y + fontSize * 0.25]\n // Nothing free: at least keep off the other labels; a line through text reads better than text on text.\n const spot =\n spots.find((s) => clear(box(s), index)) ??\n spots.find((s) => clearOfLabels(box(s))) ??\n (spots[0] as [number, number])\n placed.push(box(spot))\n label = labelAt(spot, w)\n }\n\n if (a1 - a0 > 0.5) {\n // A band below the series; its label goes with the lines, above them.\n const d = vertical\n ? `M${round(a0)},${round(y0)}H${round(a1)}V${round(y1)}H${round(a0)}Z`\n : `M${round(x0)},${round(a0)}H${round(x1)}V${round(a1)}H${round(x0)}Z`\n bands.push(h('g', attrs(), h('path', { class: 'tc-annotation-band', d })))\n if (label) lines.push(h('g', attrs('label'), label))\n return\n }\n // A line across the plot area.\n const at = round(a0)\n lines.push(\n h(\n 'g',\n attrs(),\n h(\n 'line',\n vertical\n ? { class: 'tc-annotation-line', x1: at, x2: at, y1: round(y0), y2: round(y1) }\n : { class: 'tc-annotation-line', x1: round(x0), x2: round(x1), y1: at, y2: at },\n ),\n label,\n ),\n )\n })\n\n return {\n under: bands.length\n ? h('g', { key: 'annotations-under', class: 'tc-annotations', 'aria-hidden': 'true' }, bands)\n : null,\n over: lines.length\n ? h('g', { key: 'annotations-over', class: 'tc-annotations', 'aria-hidden': 'true' }, lines)\n : null,\n }\n}\n"],"mappings":";;;;;;AA+DA,SAAS,aACP,QACA,OACuC;CACvC,IAAI,OAAO,MAAM;EACf,MAAM,IAAI,OAAO,KAAK,IAAI,KAAKA,kBAAAA,KAAK,KAAK,CAAC,CAAC;EAC3C,OAAO,OAAO,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,KAAA;CACvC;CACA,MAAM,IAAI,OAAO,KAAK,QAAQC,kBAAAA,SAAS,KAAK,CAAC;CAC7C,OAAO,IAAI,IAAI,KAAA,IAAY,CAAC,OAAO,KAAK,GAAG,CAAC,GAAG,OAAO,KAAK,GAAG,CAAC,IAAI,OAAO,KAAK,SAAS;AAC1F;;AAGA,MAAM,QAAW,GAAY,MAAyD;CACpF,IAAI,CAAC,MAAM,QAAQ,CAAC,GAAG,OAAO,EAAE,CAAC;CACjC,MAAM,OAAO,EAAE,IAAI,CAAC;CACpB,OAAO,KAAK,WAAW,KAAK,CAAC,KAAK,SAAS,IAAI,IAAK,OAAe;AACrE;;AAGA,MAAa,oBAAoB,MAC/B,MAAM,KAAA,IACF,IACCC,cAAAA,QAAQ,IAAI,OAAO;CAClB,GAAG;CACH,GAAG,EAAE,MAAM,KAAA,IAAY,EAAE,IAAI,KAAK,EAAE,GAAGC,cAAAA,MAAM;CAC7C,GAAG,EAAE,MAAM,KAAA,IAAY,EAAE,IAAI,KAAK,EAAE,GAAGC,cAAAA,KAAK;CAC5C,OAAO,EAAE,SAAS,OAAO,KAAA,IAAYC,cAAAA,KAAK,EAAE,KAAK;CACjD,OAAO,OAAO,EAAE,UAAU,WAAW,EAAE,QAAQ,KAAA;AACjD,EAAE,CAAC,CAAC,QAAQ,MAAM,EAAE,MAAM,QAAQ,EAAE,MAAM,SAAS,EAAE,KAAK,EAAE,OAAO,KAAA,CAAS;AAElF,MAAM,UAAa,MA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,EAAE,GAAGA,eAAAA,MAAM,EAAE,EAAE,GAAGA,eAAAA,MAAM,EAAE,EAAE;GACtE,MAAM,KAAKD,cAAAA,EAAE,KAAK,MAAM,GAAGA,cAAAA,EAAE,QAAQ;IAAE,OAAO;IAAsB;GAAE,CAAC,CAAC,CAAC;GACzE,IAAI,OAAO,MAAM,KAAKA,cAAAA,EAAE,KAAK,MAAM,OAAO,GAAG,KAAK,CAAC;GACnD;EACF;EAEA,MAAM,KAAKC,eAAAA,MAAM,EAAE;EACnB,MAAM,KACJD,cAAAA,EACE,KACA,MAAM,GACNA,cAAAA,EACE,QACA,WACI;GAAE,OAAO;GAAsB,IAAI;GAAI,IAAI;GAAI,IAAIC,eAAAA,MAAM,EAAE;GAAG,IAAIA,eAAAA,MAAM,EAAE;EAAE,IAC5E;GAAE,OAAO;GAAsB,IAAIA,eAAAA,MAAM,EAAE;GAAG,IAAIA,eAAAA,MAAM,EAAE;GAAG,IAAI;GAAI,IAAI;EAAG,CAClF,GACA,KACF,CACF;CACF,CAAC;CAED,OAAO;EACL,OAAO,MAAM,SACTD,cAAAA,EAAE,KAAK;GAAE,KAAK;GAAqB,OAAO;GAAkB,eAAe;EAAO,GAAG,KAAK,IAC1F;EACJ,MAAM,MAAM,SACRA,cAAAA,EAAE,KAAK;GAAE,KAAK;GAAoB,OAAO;GAAkB,eAAe;EAAO,GAAG,KAAK,IACzF;CACN;AACF"}
@@ -1,46 +1,21 @@
1
+ import { i as Rect } from "./layout-CYerDebD.js";
1
2
  import { n as BandScale, t as BandKey } from "./band-CNKvdnTC.js";
2
3
  import { a as ClassValue, l as VNode } from "./vnode-Du2cC8Fm.js";
3
- /** Axis-aligned rectangle in pixels. */
4
- interface Rect {
5
- x: number;
6
- y: number;
7
- width: number;
8
- height: number;
9
- }
10
- /** Space around a box, in pixels. */
11
- interface Insets {
12
- top: number;
13
- right: number;
14
- bottom: number;
15
- left: number;
16
- }
17
- /** Insets given as one number for all sides or per side. */
18
- type InsetsInput = number | Partial<Insets>;
19
- /** Normalize an {@link InsetsInput}; missing sides fall back to `fallback`. */
20
- declare function insets(value: InsetsInput | undefined, fallback?: number): Insets;
21
- /** Rectangle left inside `width × height` after `margins`; never negative. */
22
- declare function innerRect(width: number, height: number, margins: Insets): Rect;
23
- /**
24
- * Estimate the rendered width of `text` without a DOM, for layout on the
25
- * server and in workers. Tuned for common UI sans-serif fonts; deterministic,
26
- * so SSR and client layouts agree.
27
- */
28
- declare function estimateTextWidth(text: string, fontSize: number): number;
29
- /** Line height used for single-line labels, relative to the font size. */
30
- declare const LINE_HEIGHT = 1.25;
31
4
  /** A category label, a number, or a date (on a time axis). */
32
5
  type AnnotationLabel = string | number | Date;
33
6
  /**
34
7
  * A reference line or band drawn with the series: a target on the value
35
8
  * axis (`y: 99.9`), a normal range (`y: [40, 60]`), an event on the category
36
9
  * axis (`x: 'Jun'`, or a date on a time axis) or a period (`x: [from, to]`).
10
+ * With both a single `x` and a single `y` it is a point: a dot at that
11
+ * category and value, with its label beside it.
37
12
  */
38
13
  interface Annotation {
39
14
  /** A line at a value, or a band between two values, on the value axis. */
40
15
  y?: number | readonly [number, number];
41
16
  /** A line at a category (or a date on a time axis), or a band between two, on the category axis. */
42
17
  x?: AnnotationLabel | readonly [AnnotationLabel, AnnotationLabel];
43
- /** Short text next to the line or inside the band. */
18
+ /** Short text next to the line or the point, or inside the band. */
44
19
  label?: string;
45
20
  /** Where the label sits along the line or band. Defaults to `'end'` (right, or top). */
46
21
  position?: "start" | "end";
@@ -49,6 +24,17 @@ interface Annotation {
49
24
  * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.
50
25
  */
51
26
  color?: string;
27
+ /**
28
+ * The dashes of the line: dash and gap length in pixels, or a full
29
+ * `stroke-dasharray` such as `'6 3'`; `0` draws it solid. Sets
30
+ * `--tc-annotation-dash`. Defaults to `'4 3'`.
31
+ */
32
+ dash?: number | string;
33
+ /**
34
+ * Draw the label on a background (the surface color), so it reads where
35
+ * it crosses lines and points. Defaults to `false`.
36
+ */
37
+ labelBackground?: boolean;
52
38
  /** Extra classes on the annotation group. */
53
39
  class?: ClassValue;
54
40
  /** Stable identity for keyed updates. Defaults to the position in the list. */
@@ -78,4 +64,4 @@ declare function annotationLayers(annotations: readonly Annotation[] | undefined
78
64
  under: VNode | null;
79
65
  over: VNode | null;
80
66
  };
81
- export { InsetsInput as a, estimateTextWidth as c, Insets as i, innerRect as l, annotationLayers as n, LINE_HEIGHT as o, annotationValues as r, Rect as s, Annotation as t, insets as u };
67
+ export { annotationLayers as n, annotationValues as r, Annotation as t };
@@ -1,46 +1,21 @@
1
+ import { i as Rect } from "./layout-CYerDebD.cjs";
1
2
  import { n as BandScale, t as BandKey } from "./band-CNKvdnTC.cjs";
2
3
  import { a as ClassValue, l as VNode } from "./vnode-Du2cC8Fm.cjs";
3
- /** Axis-aligned rectangle in pixels. */
4
- interface Rect {
5
- x: number;
6
- y: number;
7
- width: number;
8
- height: number;
9
- }
10
- /** Space around a box, in pixels. */
11
- interface Insets {
12
- top: number;
13
- right: number;
14
- bottom: number;
15
- left: number;
16
- }
17
- /** Insets given as one number for all sides or per side. */
18
- type InsetsInput = number | Partial<Insets>;
19
- /** Normalize an {@link InsetsInput}; missing sides fall back to `fallback`. */
20
- declare function insets(value: InsetsInput | undefined, fallback?: number): Insets;
21
- /** Rectangle left inside `width × height` after `margins`; never negative. */
22
- declare function innerRect(width: number, height: number, margins: Insets): Rect;
23
- /**
24
- * Estimate the rendered width of `text` without a DOM, for layout on the
25
- * server and in workers. Tuned for common UI sans-serif fonts; deterministic,
26
- * so SSR and client layouts agree.
27
- */
28
- declare function estimateTextWidth(text: string, fontSize: number): number;
29
- /** Line height used for single-line labels, relative to the font size. */
30
- declare const LINE_HEIGHT = 1.25;
31
4
  /** A category label, a number, or a date (on a time axis). */
32
5
  type AnnotationLabel = string | number | Date;
33
6
  /**
34
7
  * A reference line or band drawn with the series: a target on the value
35
8
  * axis (`y: 99.9`), a normal range (`y: [40, 60]`), an event on the category
36
9
  * axis (`x: 'Jun'`, or a date on a time axis) or a period (`x: [from, to]`).
10
+ * With both a single `x` and a single `y` it is a point: a dot at that
11
+ * category and value, with its label beside it.
37
12
  */
38
13
  interface Annotation {
39
14
  /** A line at a value, or a band between two values, on the value axis. */
40
15
  y?: number | readonly [number, number];
41
16
  /** A line at a category (or a date on a time axis), or a band between two, on the category axis. */
42
17
  x?: AnnotationLabel | readonly [AnnotationLabel, AnnotationLabel];
43
- /** Short text next to the line or inside the band. */
18
+ /** Short text next to the line or the point, or inside the band. */
44
19
  label?: string;
45
20
  /** Where the label sits along the line or band. Defaults to `'end'` (right, or top). */
46
21
  position?: "start" | "end";
@@ -49,6 +24,17 @@ interface Annotation {
49
24
  * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.
50
25
  */
51
26
  color?: string;
27
+ /**
28
+ * The dashes of the line: dash and gap length in pixels, or a full
29
+ * `stroke-dasharray` such as `'6 3'`; `0` draws it solid. Sets
30
+ * `--tc-annotation-dash`. Defaults to `'4 3'`.
31
+ */
32
+ dash?: number | string;
33
+ /**
34
+ * Draw the label on a background (the surface color), so it reads where
35
+ * it crosses lines and points. Defaults to `false`.
36
+ */
37
+ labelBackground?: boolean;
52
38
  /** Extra classes on the annotation group. */
53
39
  class?: ClassValue;
54
40
  /** Stable identity for keyed updates. Defaults to the position in the list. */
@@ -78,4 +64,4 @@ declare function annotationLayers(annotations: readonly Annotation[] | undefined
78
64
  under: VNode | null;
79
65
  over: VNode | null;
80
66
  };
81
- export { InsetsInput as a, estimateTextWidth as c, Insets as i, innerRect as l, annotationLayers as n, LINE_HEIGHT as o, annotationValues as r, Rect as s, Annotation as t, insets as u };
67
+ export { annotationLayers as n, annotationValues as r, Annotation as t };