@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.
- package/README.md +165 -17
- package/dist/{annotations-DdRdeBUB.cjs → annotations--m-HzMBM.cjs} +87 -11
- package/dist/annotations--m-HzMBM.cjs.map +1 -0
- package/dist/{annotations-B02GR_KU.d.ts → annotations-CCDUC1lW.d.ts} +16 -30
- package/dist/{annotations-CHafaGd4.d.cts → annotations-CqZM1z9R.d.cts} +16 -30
- package/dist/{annotations-D0YQ0IoA.js → annotations-DGITy6th.js} +87 -11
- package/dist/annotations-DGITy6th.js.map +1 -0
- package/dist/annotations.cjs +2 -2
- package/dist/annotations.d.cts +1 -1
- package/dist/annotations.d.ts +1 -1
- package/dist/annotations.js +2 -2
- package/dist/{area-0-L1bG9B.js → area-BN0uE9R0.js} +4 -3
- package/dist/area-BN0uE9R0.js.map +1 -0
- package/dist/{area-CJX9219z.d.cts → area-D6LNLk3r.d.cts} +2 -2
- package/dist/{area-d11XePuw.d.ts → area-DEFL-Yun.d.ts} +2 -2
- package/dist/{area-4eRs3c0K.cjs → area-D_N8b4Ng.cjs} +4 -3
- package/dist/area-D_N8b4Ng.cjs.map +1 -0
- package/dist/area.cjs +1 -1
- package/dist/area.d.cts +1 -1
- package/dist/area.d.ts +1 -1
- package/dist/area.js +1 -1
- package/dist/axis-BzBkkC5X.cjs +305 -0
- package/dist/axis-BzBkkC5X.cjs.map +1 -0
- package/dist/axis-C5obgdJt.js +240 -0
- package/dist/axis-C5obgdJt.js.map +1 -0
- package/dist/{bar-Da6dE_nI.cjs → bar-BrmfXugT.cjs} +77 -58
- package/dist/bar-BrmfXugT.cjs.map +1 -0
- package/dist/{bar-XwzM6Pb0.d.ts → bar-Bs_rPqgR.d.ts} +1 -1
- package/dist/{bar-BDLR4p9c.d.cts → bar-CEt8YRxf.d.cts} +2 -2
- package/dist/{bar-B5n2oq9-.js → bar-CgpC2EpX.js} +2 -2
- package/dist/{bar-B5n2oq9-.js.map → bar-CgpC2EpX.js.map} +1 -1
- package/dist/{bar-BNZ3GhIw.js → bar-D_KKd2fL.js} +75 -56
- package/dist/bar-D_KKd2fL.js.map +1 -0
- package/dist/{bar-LYIF8MEz.cjs → bar-wVykm1us.cjs} +2 -2
- package/dist/{bar-LYIF8MEz.cjs.map → bar-wVykm1us.cjs.map} +1 -1
- package/dist/bar.cjs +1 -1
- package/dist/bar.d.cts +1 -1
- package/dist/bar.d.ts +1 -1
- package/dist/bar.js +1 -1
- package/dist/calendar-B7843sQu.d.cts +106 -0
- package/dist/calendar-BG_q_NC_.cjs +507 -0
- package/dist/calendar-BG_q_NC_.cjs.map +1 -0
- package/dist/calendar-CF3gfDQk.js +502 -0
- package/dist/calendar-CF3gfDQk.js.map +1 -0
- package/dist/calendar-D10_ki1S.d.ts +106 -0
- package/dist/calendar.cjs +3 -0
- package/dist/calendar.d.cts +3 -0
- package/dist/calendar.d.ts +3 -0
- package/dist/calendar.js +1 -0
- package/dist/{candlestick-BHQkQfxH.js → candlestick-B1onjo1o.js} +17 -14
- package/dist/candlestick-B1onjo1o.js.map +1 -0
- package/dist/{candlestick-Dq7qp-F0.d.cts → candlestick-B7YXUVVh.d.cts} +4 -3
- package/dist/{candlestick-CYCQXgky.cjs → candlestick-BwrFKak_.cjs} +17 -14
- package/dist/candlestick-BwrFKak_.cjs.map +1 -0
- package/dist/{candlestick-D0xKkdqd.d.ts → candlestick-XpqJvarq.d.ts} +4 -3
- package/dist/candlestick.cjs +3 -3
- package/dist/candlestick.d.cts +1 -1
- package/dist/candlestick.d.ts +1 -1
- package/dist/candlestick.js +3 -3
- package/dist/{cartesian-DV02PsBe.cjs → cartesian-B9CrasFJ.cjs} +190 -310
- package/dist/cartesian-B9CrasFJ.cjs.map +1 -0
- package/dist/{cartesian-CI2x6N7N.js → cartesian-COglz544.js} +161 -251
- package/dist/cartesian-COglz544.js.map +1 -0
- package/dist/{chart-DWn9v6qw.js → chart-B97FBRCd.js} +114 -72
- package/dist/chart-B97FBRCd.js.map +1 -0
- package/dist/{chart-QilhWP8Z.d.ts → chart-CE9EVbfV.d.ts} +427 -112
- package/dist/{chart-kqFMEwDo.d.cts → chart-Dz4geQZy.d.cts} +427 -112
- package/dist/{chart-e2VqomCI.cjs → chart-GUmmjJ7S.cjs} +132 -78
- package/dist/chart-GUmmjJ7S.cjs.map +1 -0
- package/dist/{core-BKRQvPAT.js → core-7fgM3su0.js} +188 -73
- package/dist/core-7fgM3su0.js.map +1 -0
- package/dist/{core-DRUCk67j.d.ts → core-BUQzLsRJ.d.ts} +26 -10
- package/dist/{core-DIOC61up.cjs → core-BZTrsPxc.cjs} +200 -73
- package/dist/core-BZTrsPxc.cjs.map +1 -0
- package/dist/{core-PAX5ogLk.d.cts → core-Ck5uHcW8.d.cts} +45 -24
- package/dist/core.cjs +45 -31
- package/dist/core.d.cts +23 -18
- package/dist/core.d.ts +23 -18
- package/dist/core.js +28 -23
- package/dist/{dates-DurEr9WT.cjs → dates-0YNY49KQ.cjs} +2 -2
- package/dist/{dates-DurEr9WT.cjs.map → dates-0YNY49KQ.cjs.map} +1 -1
- package/dist/{dates-C2RzY3rE.js → dates-CKDRgpin.js} +2 -2
- package/dist/{dates-C2RzY3rE.js.map → dates-CKDRgpin.js.map} +1 -1
- package/dist/decimate.cjs +1 -1
- package/dist/decimate.js +1 -1
- package/dist/{dom-D_g13XWY.cjs → dom-C33zvtPo.cjs} +3 -7
- package/dist/dom-C33zvtPo.cjs.map +1 -0
- package/dist/{dom-CuceR8gt.js → dom-CTse6Rvd.js} +3 -7
- package/dist/dom-CTse6Rvd.js.map +1 -0
- package/dist/end-labels-B3oRvjxw.js +114 -0
- package/dist/end-labels-B3oRvjxw.js.map +1 -0
- package/dist/end-labels-CS-fnpp-.cjs +119 -0
- package/dist/end-labels-CS-fnpp-.cjs.map +1 -0
- package/dist/end-labels.cjs +11 -0
- package/dist/end-labels.cjs.map +1 -0
- package/dist/end-labels.d.cts +6 -0
- package/dist/end-labels.d.ts +6 -0
- package/dist/end-labels.js +11 -0
- package/dist/end-labels.js.map +1 -0
- package/dist/{export-chart-83UYH48t.js → export-chart-BOH_nfcH.js} +92 -15
- package/dist/export-chart-BOH_nfcH.js.map +1 -0
- package/dist/{export-chart-mYgEfK-L.cjs → export-chart-Be4T9J3m.cjs} +97 -14
- package/dist/export-chart-Be4T9J3m.cjs.map +1 -0
- package/dist/export.cjs +5 -3
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +4 -3
- package/dist/export.d.ts +4 -3
- package/dist/export.js +5 -4
- package/dist/export.js.map +1 -1
- package/dist/{fade-GGxcBdss.js → fade-CDrQjnDz.js} +56 -78
- package/dist/fade-CDrQjnDz.js.map +1 -0
- package/dist/{fade-DVTkhrFU.cjs → fade-CRqcKMWY.cjs} +56 -78
- package/dist/fade-CRqcKMWY.cjs.map +1 -0
- package/dist/{features-BMxkqCyS.js → features-B55rwpQC.js} +4 -2
- package/dist/features-B55rwpQC.js.map +1 -0
- package/dist/{features-DCXEvoya.cjs → features-DEDP5CEQ.cjs} +9 -1
- package/dist/features-DEDP5CEQ.cjs.map +1 -0
- package/dist/fit-BPyPRnsK.js +16 -0
- package/dist/fit-BPyPRnsK.js.map +1 -0
- package/dist/fit-D4MIIQQz.cjs +21 -0
- package/dist/fit-D4MIIQQz.cjs.map +1 -0
- package/dist/funnel-B9ridzNx.d.cts +50 -0
- package/dist/funnel-CFEEulw_.cjs +244 -0
- package/dist/funnel-CFEEulw_.cjs.map +1 -0
- package/dist/funnel-CYCv8cq2.js +239 -0
- package/dist/funnel-CYCv8cq2.js.map +1 -0
- package/dist/funnel-FogM8flk.d.ts +50 -0
- package/dist/funnel.cjs +3 -0
- package/dist/funnel.d.cts +3 -0
- package/dist/funnel.d.ts +3 -0
- package/dist/funnel.js +1 -0
- package/dist/{gauge-DXkjXNCD.cjs → gauge-6HfDcLMJ.cjs} +28 -28
- package/dist/gauge-6HfDcLMJ.cjs.map +1 -0
- package/dist/{gauge-BSist7My.d.cts → gauge-BScJ7U6O.d.cts} +2 -2
- package/dist/{gauge-0VJuAHWF.d.ts → gauge-D78oq1Lx.d.ts} +2 -2
- package/dist/{gauge-ts0kqN1-.js → gauge-DiTk5aWO.js} +28 -28
- package/dist/gauge-DiTk5aWO.js.map +1 -0
- package/dist/gauge.cjs +1 -1
- package/dist/gauge.d.cts +1 -1
- package/dist/gauge.d.ts +1 -1
- package/dist/gauge.js +1 -1
- package/dist/heat-Bsqq4zw9.js +38 -0
- package/dist/heat-Bsqq4zw9.js.map +1 -0
- package/dist/heat-DYsivvDq.cjs +49 -0
- package/dist/heat-DYsivvDq.cjs.map +1 -0
- package/dist/{heatmap-CXhlrLTl.cjs → heatmap-Dyzrd4Fd.cjs} +39 -37
- package/dist/heatmap-Dyzrd4Fd.cjs.map +1 -0
- package/dist/{heatmap-19BGJTKF.js → heatmap-J7fxG7MM.js} +35 -33
- package/dist/heatmap-J7fxG7MM.js.map +1 -0
- package/dist/{heatmap-Dp_oyEe0.d.cts → heatmap-Jvwo7iFW.d.cts} +2 -2
- package/dist/{heatmap-59lmClj9.d.ts → heatmap-mFCnP6aB.d.ts} +2 -2
- package/dist/heatmap.cjs +1 -1
- package/dist/heatmap.d.cts +1 -1
- package/dist/heatmap.d.ts +1 -1
- package/dist/heatmap.js +1 -1
- package/dist/{hydrate-OA6R2_Pn.js → hydrate-BB3MlR36.js} +2 -2
- package/dist/{hydrate-OA6R2_Pn.js.map → hydrate-BB3MlR36.js.map} +1 -1
- package/dist/{hydrate-CmN1k8Mo.cjs → hydrate-m0I5m6ue.cjs} +2 -2
- package/dist/{hydrate-CmN1k8Mo.cjs.map → hydrate-m0I5m6ue.cjs.map} +1 -1
- package/dist/hydrate.cjs +2 -2
- package/dist/hydrate.js +2 -2
- package/dist/index.cjs +69 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -19
- package/dist/index.d.ts +24 -19
- package/dist/index.js +51 -37
- package/dist/index.js.map +1 -1
- package/dist/interaction-DXYSjgnP.cjs +32 -0
- package/dist/interaction-DXYSjgnP.cjs.map +1 -0
- package/dist/interaction-En1KlwFO.js +21 -0
- package/dist/interaction-En1KlwFO.js.map +1 -0
- package/dist/layout-CYerDebD.d.cts +29 -0
- package/dist/layout-CYerDebD.d.ts +29 -0
- package/dist/{layout-JY2aR-yE.cjs → layout-Cfg9x1k2.cjs} +32 -1
- package/dist/layout-Cfg9x1k2.cjs.map +1 -0
- package/dist/{layout-DmrrLjwN.js → layout-DqAte3H8.js} +27 -2
- package/dist/layout-DqAte3H8.js.map +1 -0
- package/dist/{line-DO66LtwH.js → line-CXH0L10d.js} +84 -37
- package/dist/line-CXH0L10d.js.map +1 -0
- package/dist/{line-_rNdeKmS.d.cts → line-Cu9ctpbv.d.cts} +9 -3
- package/dist/{line-Dbt6KFRK.cjs → line-DHbYCQy4.cjs} +84 -37
- package/dist/line-DHbYCQy4.cjs.map +1 -0
- package/dist/{line-DtSh7HQU.d.ts → line-TkzA7wMK.d.ts} +8 -1
- package/dist/line.cjs +3 -3
- package/dist/line.d.cts +1 -1
- package/dist/line.d.ts +1 -1
- package/dist/line.js +3 -3
- package/dist/log.cjs +1 -1
- package/dist/log.js +1 -1
- package/dist/map-BirylCmT.d.cts +156 -0
- package/dist/map-CYp6x-uS.js +784 -0
- package/dist/map-CYp6x-uS.js.map +1 -0
- package/dist/map-ChwSgooH.cjs +795 -0
- package/dist/map-ChwSgooH.cjs.map +1 -0
- package/dist/map-DNqog2Xs.d.ts +156 -0
- package/dist/map.cjs +4 -0
- package/dist/map.d.cts +3 -0
- package/dist/map.d.ts +3 -0
- package/dist/map.js +1 -0
- package/dist/maps/world.cjs +875 -0
- package/dist/maps/world.cjs.map +1 -0
- package/dist/maps/world.d.cts +2 -0
- package/dist/maps/world.d.ts +2 -0
- package/dist/maps/world.js +874 -0
- package/dist/maps/world.js.map +1 -0
- package/dist/{morph-9_LJL0ra.cjs → morph-3I1Nf_tR.cjs} +2 -2
- package/dist/{morph-9_LJL0ra.cjs.map → morph-3I1Nf_tR.cjs.map} +1 -1
- package/dist/{morph-DnRxuwR-.js → morph-GfBab-b3.js} +2 -2
- package/dist/{morph-DnRxuwR-.js.map → morph-GfBab-b3.js.map} +1 -1
- package/dist/morph.cjs +2 -2
- package/dist/morph.js +2 -2
- package/dist/others-CuNdpvjd.d.cts +31 -0
- package/dist/{others-J7NCAMA0.js → others-DBIGE6jr.js} +11 -3
- package/dist/others-DBIGE6jr.js.map +1 -0
- package/dist/others-DBO4Kjwl.d.ts +29 -0
- package/dist/{others-DWdK7vKp.cjs → others-WfjCsjqT.cjs} +14 -6
- package/dist/others-WfjCsjqT.cjs.map +1 -0
- package/dist/{parliament-Cru4IcuM.js → parliament-BKN6ikBJ.js} +30 -29
- package/dist/parliament-BKN6ikBJ.js.map +1 -0
- package/dist/{parliament-CLCI7tUO.d.ts → parliament-CHdf13XU.d.ts} +2 -2
- package/dist/{parliament-CgsVnWEe.d.cts → parliament-CsYgh4N2.d.cts} +2 -2
- package/dist/{parliament-x5hcFaQ3.cjs → parliament-DhxAaIZ3.cjs} +30 -29
- package/dist/parliament-DhxAaIZ3.cjs.map +1 -0
- package/dist/parliament.cjs +1 -1
- package/dist/parliament.d.cts +1 -1
- package/dist/parliament.d.ts +1 -1
- package/dist/parliament.js +1 -1
- package/dist/{patterns-D3-wQagb.cjs → patterns-BPN1c9qe.cjs} +2 -2
- package/dist/{patterns-D3-wQagb.cjs.map → patterns-BPN1c9qe.cjs.map} +1 -1
- package/dist/{patterns-CufKZYhm.js → patterns-CVrLrJXg.js} +2 -2
- package/dist/{patterns-CufKZYhm.js.map → patterns-CVrLrJXg.js.map} +1 -1
- package/dist/patterns.cjs +2 -2
- package/dist/patterns.d.cts +1 -1
- package/dist/patterns.d.ts +1 -1
- package/dist/patterns.js +2 -2
- package/dist/{percentage-bar-ybNS3goo.cjs → percentage-bar-BChkTRoz.cjs} +37 -35
- package/dist/percentage-bar-BChkTRoz.cjs.map +1 -0
- package/dist/{percentage-bar-nhTeakD_.d.ts → percentage-bar-CSAbzDOn.d.ts} +11 -15
- package/dist/{percentage-bar-B6tNOqNn.js → percentage-bar-CaInxrL8.js} +37 -35
- package/dist/percentage-bar-CaInxrL8.js.map +1 -0
- package/dist/{percentage-bar-tepMr7Hd.d.cts → percentage-bar-UZHCRvlK.d.cts} +11 -15
- package/dist/percentage-bar.cjs +1 -1
- package/dist/percentage-bar.d.cts +1 -1
- package/dist/percentage-bar.d.ts +1 -1
- package/dist/percentage-bar.js +1 -1
- package/dist/{pie-BXg2gNpb.d.cts → pie-AFedsDcF.d.cts} +17 -14
- package/dist/{pie-CVsc-6qD.js → pie-Ch6Bx0ih.js} +68 -52
- package/dist/pie-Ch6Bx0ih.js.map +1 -0
- package/dist/{pie-BpjvSPnz.cjs → pie-Cll1OrVZ.cjs} +68 -52
- package/dist/pie-Cll1OrVZ.cjs.map +1 -0
- package/dist/{pie-CFptILSm.d.ts → pie-Cn2H3pz8.d.ts} +17 -14
- package/dist/pie.cjs +1 -1
- package/dist/pie.d.cts +1 -1
- package/dist/pie.d.ts +1 -1
- package/dist/pie.js +1 -1
- package/dist/{point-shapes--_gmdTyK.cjs → point-shapes-BRawRM78.cjs} +23 -22
- package/dist/point-shapes-BRawRM78.cjs.map +1 -0
- package/dist/{point-shapes-DD2Ektzm.js → point-shapes-DI6GhcI7.js} +18 -23
- package/dist/point-shapes-DI6GhcI7.js.map +1 -0
- package/dist/point-shapes.cjs +6 -4
- package/dist/point-shapes.cjs.map +1 -1
- package/dist/point-shapes.d.cts +2 -2
- package/dist/point-shapes.d.ts +2 -2
- package/dist/point-shapes.js +7 -5
- package/dist/point-shapes.js.map +1 -1
- package/dist/{radar-BR-mumDd.js → radar-Bg-IiIWB.js} +21 -22
- package/dist/radar-Bg-IiIWB.js.map +1 -0
- package/dist/{radar-BC9Skgpj.d.ts → radar-DEer2jjd.d.ts} +2 -2
- package/dist/{radar-D1-lItDy.d.cts → radar-DxmjXhMc.d.cts} +2 -2
- package/dist/{radar-HPDrIdzc.cjs → radar-wDyX17S3.cjs} +22 -23
- package/dist/radar-wDyX17S3.cjs.map +1 -0
- package/dist/radar.cjs +1 -1
- package/dist/radar.d.cts +1 -1
- package/dist/radar.d.ts +1 -1
- package/dist/radar.js +1 -1
- package/dist/range-bar-BnKjJP89.cjs +348 -0
- package/dist/range-bar-BnKjJP89.cjs.map +1 -0
- package/dist/range-bar-C4cRaaQE.d.ts +123 -0
- package/dist/range-bar-D32dIQOY.d.cts +123 -0
- package/dist/range-bar-Dx6ce0J1.js +343 -0
- package/dist/range-bar-Dx6ce0J1.js.map +1 -0
- package/dist/range-bar.cjs +3 -0
- package/dist/range-bar.d.cts +3 -0
- package/dist/range-bar.d.ts +3 -0
- package/dist/range-bar.js +1 -0
- package/dist/{rect-DSVmUZrD.js → rect-CZTNvMlf.js} +2 -2
- package/dist/{rect-DSVmUZrD.js.map → rect-CZTNvMlf.js.map} +1 -1
- package/dist/{rect-D6VhynBM.cjs → rect-DPr9QRxl.cjs} +2 -2
- package/dist/{rect-D6VhynBM.cjs.map → rect-DPr9QRxl.cjs.map} +1 -1
- package/dist/{sankey-fCoo1cpz.cjs → sankey-0CSp_Er9.cjs} +72 -71
- package/dist/sankey-0CSp_Er9.cjs.map +1 -0
- package/dist/{sankey-Dk7jUt8x.d.cts → sankey-D-8ATwBT.d.cts} +2 -2
- package/dist/{sankey-D6JeZfK5.js → sankey-Dp4CuLVe.js} +72 -71
- package/dist/sankey-Dp4CuLVe.js.map +1 -0
- package/dist/{sankey-D_v7KxnJ.d.ts → sankey-DpYJsOI4.d.ts} +2 -2
- package/dist/sankey.cjs +1 -1
- package/dist/sankey.d.cts +1 -1
- package/dist/sankey.d.ts +1 -1
- package/dist/sankey.js +1 -1
- package/dist/{scatter-C0TWjFpW.js → scatter-0Z7K_YUz.js} +94 -46
- package/dist/scatter-0Z7K_YUz.js.map +1 -0
- package/dist/{scatter-CXEsioOJ.d.ts → scatter-BAL5K9_4.d.ts} +28 -9
- package/dist/{scatter-DZeEIfyo.d.cts → scatter-BUGbnRzM.d.cts} +28 -9
- package/dist/{scatter-DVqB_fP9.cjs → scatter-CZ8do3Up.cjs} +95 -47
- package/dist/scatter-CZ8do3Up.cjs.map +1 -0
- package/dist/scatter.cjs +1 -1
- package/dist/scatter.d.cts +2 -2
- package/dist/scatter.d.ts +2 -2
- package/dist/scatter.js +1 -1
- package/dist/slice-labels-1TBq7p3q.d.cts +28 -0
- package/dist/slice-labels-C9ucsBVW.js +88 -0
- package/dist/slice-labels-C9ucsBVW.js.map +1 -0
- package/dist/slice-labels-CbFiy46l.cjs +93 -0
- package/dist/slice-labels-CbFiy46l.cjs.map +1 -0
- package/dist/slice-labels-Cm5CyV7B.d.ts +28 -0
- package/dist/slice-labels.cjs +11 -0
- package/dist/slice-labels.cjs.map +1 -0
- package/dist/slice-labels.d.cts +6 -0
- package/dist/slice-labels.d.ts +6 -0
- package/dist/slice-labels.js +11 -0
- package/dist/slice-labels.js.map +1 -0
- package/dist/{sparkline-cbvRkWqS.d.ts → sparkline-CtoBJe-a.d.ts} +2 -2
- package/dist/{sparkline-B39NA0Mi.cjs → sparkline-DjR-V6BI.cjs} +13 -15
- package/dist/sparkline-DjR-V6BI.cjs.map +1 -0
- package/dist/{sparkline-DAP6jtzw.d.cts → sparkline-DwHJfeZz.d.cts} +2 -2
- package/dist/{sparkline-XO_TqCNP.js → sparkline-_dxwtdli.js} +13 -15
- package/dist/sparkline-_dxwtdli.js.map +1 -0
- package/dist/sparkline.cjs +1 -1
- package/dist/sparkline.d.cts +1 -1
- package/dist/sparkline.d.ts +1 -1
- package/dist/sparkline.js +1 -1
- package/dist/{stack-Dagxq7l2.d.cts → stack-CcmyALx0.d.cts} +1 -1
- package/dist/{stack-2H2Gfs1Q.js → stack-CyVlS7Fr.js} +2 -2
- package/dist/{stack-2H2Gfs1Q.js.map → stack-CyVlS7Fr.js.map} +1 -1
- package/dist/{stack-BgPzoQmv.cjs → stack-DBhmYNat.cjs} +2 -2
- package/dist/{stack-BgPzoQmv.cjs.map → stack-DBhmYNat.cjs.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/{time-axis-BjZ1bYTK.cjs → time-axis-CVKjQKSS.cjs} +4 -3
- package/dist/{time-axis-BjZ1bYTK.cjs.map → time-axis-CVKjQKSS.cjs.map} +1 -1
- package/dist/{time-axis-FLONo54E.js → time-axis-CkmbAw4Z.js} +3 -2
- package/dist/{time-axis-FLONo54E.js.map → time-axis-CkmbAw4Z.js.map} +1 -1
- package/dist/time.cjs +3 -3
- package/dist/time.js +3 -3
- package/dist/{treemap-BAkhmVQc.d.cts → treemap-C2maqerU.d.cts} +37 -5
- package/dist/{treemap-BNpxFBao.d.ts → treemap-D_zbubo3.d.ts} +37 -5
- package/dist/{treemap-BWpEUlDh.cjs → treemap-PulGXZv0.cjs} +58 -33
- package/dist/treemap-PulGXZv0.cjs.map +1 -0
- package/dist/{treemap-CQdavQ9u.js → treemap-lbYxb-7h.js} +57 -32
- package/dist/treemap-lbYxb-7h.js.map +1 -0
- package/dist/treemap.cjs +1 -1
- package/dist/treemap.d.cts +1 -1
- package/dist/treemap.d.ts +1 -1
- package/dist/treemap.js +1 -1
- package/dist/{value-labels-BBuSi4i0.js → value-labels-B0VeheyE.js} +29 -8
- package/dist/value-labels-B0VeheyE.js.map +1 -0
- package/dist/{value-labels-BV9keAuL.cjs → value-labels-Dcyk3GIY.cjs} +29 -8
- package/dist/value-labels-Dcyk3GIY.cjs.map +1 -0
- package/dist/value-labels.cjs +2 -2
- package/dist/value-labels.d.cts +1 -1
- package/dist/value-labels.d.ts +1 -1
- package/dist/value-labels.js +2 -2
- package/dist/zoom.cjs +810 -0
- package/dist/zoom.cjs.map +1 -0
- package/dist/zoom.d.cts +34 -0
- package/dist/zoom.d.ts +34 -0
- package/dist/zoom.js +806 -0
- package/dist/zoom.js.map +1 -0
- package/package.json +120 -235
- package/dist/annotations-D0YQ0IoA.js.map +0 -1
- package/dist/annotations-DdRdeBUB.cjs.map +0 -1
- package/dist/area-0-L1bG9B.js.map +0 -1
- package/dist/area-4eRs3c0K.cjs.map +0 -1
- package/dist/bar-BNZ3GhIw.js.map +0 -1
- package/dist/bar-Da6dE_nI.cjs.map +0 -1
- package/dist/candlestick-BHQkQfxH.js.map +0 -1
- package/dist/candlestick-CYCQXgky.cjs.map +0 -1
- package/dist/cartesian-CI2x6N7N.js.map +0 -1
- package/dist/cartesian-DV02PsBe.cjs.map +0 -1
- package/dist/chart-DWn9v6qw.js.map +0 -1
- package/dist/chart-e2VqomCI.cjs.map +0 -1
- package/dist/core-BKRQvPAT.js.map +0 -1
- package/dist/core-DIOC61up.cjs.map +0 -1
- package/dist/dom-CuceR8gt.js.map +0 -1
- package/dist/dom-D_g13XWY.cjs.map +0 -1
- package/dist/export-chart-83UYH48t.js.map +0 -1
- package/dist/export-chart-mYgEfK-L.cjs.map +0 -1
- package/dist/fade-DVTkhrFU.cjs.map +0 -1
- package/dist/fade-GGxcBdss.js.map +0 -1
- package/dist/features-BMxkqCyS.js.map +0 -1
- package/dist/features-DCXEvoya.cjs.map +0 -1
- package/dist/gauge-DXkjXNCD.cjs.map +0 -1
- package/dist/gauge-ts0kqN1-.js.map +0 -1
- package/dist/heatmap-19BGJTKF.js.map +0 -1
- package/dist/heatmap-CXhlrLTl.cjs.map +0 -1
- package/dist/layout-DmrrLjwN.js.map +0 -1
- package/dist/layout-JY2aR-yE.cjs.map +0 -1
- package/dist/line-DO66LtwH.js.map +0 -1
- package/dist/line-Dbt6KFRK.cjs.map +0 -1
- package/dist/others-DWdK7vKp.cjs.map +0 -1
- package/dist/others-J7NCAMA0.js.map +0 -1
- package/dist/parliament-Cru4IcuM.js.map +0 -1
- package/dist/parliament-x5hcFaQ3.cjs.map +0 -1
- package/dist/percentage-bar-B6tNOqNn.js.map +0 -1
- package/dist/percentage-bar-ybNS3goo.cjs.map +0 -1
- package/dist/pie-BpjvSPnz.cjs.map +0 -1
- package/dist/pie-CVsc-6qD.js.map +0 -1
- package/dist/point-shapes--_gmdTyK.cjs.map +0 -1
- package/dist/point-shapes-DD2Ektzm.js.map +0 -1
- package/dist/radar-BR-mumDd.js.map +0 -1
- package/dist/radar-HPDrIdzc.cjs.map +0 -1
- package/dist/sankey-D6JeZfK5.js.map +0 -1
- package/dist/sankey-fCoo1cpz.cjs.map +0 -1
- package/dist/scatter-C0TWjFpW.js.map +0 -1
- package/dist/scatter-DVqB_fP9.cjs.map +0 -1
- package/dist/sparkline-B39NA0Mi.cjs.map +0 -1
- package/dist/sparkline-XO_TqCNP.js.map +0 -1
- package/dist/treemap-BWpEUlDh.cjs.map +0 -1
- package/dist/treemap-CQdavQ9u.js.map +0 -1
- package/dist/value-labels-BBuSi4i0.js.map +0 -1
- package/dist/value-labels-BV9keAuL.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scatter-CZ8do3Up.cjs","names":["formatDetail","keyOf","extent","tickCount","plottable","domainOf","valueTicks","valueScale","estimateTextWidth","axisSize","axisTitleSize","plotFrame","LINE_HEIGHT","thinTicks","formatNumber","circlePath","round","markerShape","h","grid","plotClip","groupAttrs","axis","axisTitle","cleanData","isRecord","text","records","named","finite","legendItems"],"sources":["../src/charts/scatter.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext } from '../chart.ts'\nimport {\n axis,\n axisSize,\n axisTitle,\n axisTitleSize,\n type Tick,\n thinTicks,\n} from '../components/axis.ts'\nimport { grid } from '../components/grid.ts'\nimport { formatDetail, formatNumber } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { estimateTextWidth, type InsetsInput, LINE_HEIGHT, plotFrame, round } from '../layout.ts'\nimport { extent } from '../scales/extent.ts'\nimport type { LinearScale } from '../scales/linear.ts'\nimport { circlePath } from '../shapes/circle.ts'\nimport { type ClassValue, h } from '../vnode.ts'\nimport {\n domainOf,\n markerShape,\n plotClip,\n plottable,\n tickCount,\n type ValueAxisOptions,\n valueScale,\n valueTicks,\n} from './cartesian.ts'\nimport { cleanData, finite, isRecord, named, records, text } from './clean.ts'\nimport { groupAttrs, keyOf, legendItems } from './named.ts'\n\n/** A point of a scatter or bubble chart. */\nexport interface ScatterPoint {\n /** A number on a value axis; on a category axis, the label the point stands at. */\n x: number | string\n y: number\n /** Bubble size; the circle area is proportional to it. */\n size?: number\n /** Name shown in the tooltip and table (e.g. a country). */\n label?: string\n}\n\nexport interface ScatterSeries {\n name: string\n points: readonly ScatterPoint[]\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 */\n color?: string\n /** Extra classes on the series group. */\n class?: ClassValue\n /** Start hidden (toggle it back from the legend). */\n hidden?: boolean\n /**\n * Write values on this series' marks, whatever the chart's `valueLabels`\n * says: `true` labels it even when the chart option is off, `false` leaves\n * it out. Needs `@tabler/charts/value-labels` on the core.\n */\n valueLabels?: boolean\n}\n\nexport interface ScatterData {\n /**\n * Categories along x, in their order: the x axis then shows these names and\n * each point stands at the label its `x` names (points naming none are left\n * out). Without `labels`, points with a text `x` make the categories\n * themselves, in order of appearance.\n */\n labels?: readonly (string | number)[]\n series: readonly ScatterSeries[]\n}\n\nexport interface ScatterOptions {\n data: ScatterData\n /**\n * Horizontal value axis; `reverse` runs it from the right (the default with\n * `rtl`). Over categories only `show`, `title`, `grid` and `reverse` apply.\n */\n x?: ValueAxisOptions & { reverse?: boolean }\n /** Vertical value axis. */\n y?: ValueAxisOptions\n /** Radius of points without a size, in pixels. Defaults to `4`. */\n radius?: number\n /** Radius range for bubbles (points with `size`). Defaults to `{ min: 4, max: 24 }`. */\n size?: { min?: number; max?: number }\n /** Extra space around the plot area, in pixels. */\n padding?: InsetsInput\n}\n\n/** Pointer distance (in pixels, beyond the radius) that still hits a point. */\nconst HIT_RADIUS = 24\nconst EDGE = 8\n\ninterface Placed {\n seriesIndex: number\n pointIndex: number\n point: ScatterPoint\n cx: number\n cy: number\n r: number\n}\n\n/**\n * The categories of the x axis, or `null` when it is a value axis: `data.labels`,\n * else every `x` in order of appearance once any of them is text.\n */\nfunction categories(data: ScatterData): string[] | null {\n if (data.labels) return data.labels.map(String)\n if (!data.series.some((s) => s.points.some((p) => typeof p.x === 'string'))) return null\n return [...new Set(data.series.flatMap((s) => s.points.map((p) => String(p.x))))]\n}\n\n/** A point's bubble size, or `undefined` when it has none (or an invalid one). */\nconst sizeOf = (p: ScatterPoint): number | undefined =>\n p.size != null && Number.isFinite(p.size) && p.size > 0 ? p.size : undefined\n\n/** An `x` as text for the tooltip and the table: the category's name, or the formatted number. */\nfunction xText(options: ScatterOptions, locale: RenderContext['locale']) {\n const format = formatDetail(options.x?.format, locale)\n const named = !!categories(options.data)\n return (value: number | string) =>\n named || typeof value === 'string' ? String(value) : format(value)\n}\n\nfunction renderScatter(options: ScatterOptions, ctx: RenderContext) {\n const { width, height, fontSize, locale } = ctx\n const xOptions = options.x ?? {}\n const yOptions = options.y ?? {}\n const radius = options.radius ?? 4\n const visible = options.data.series.filter((s) => !ctx.hidden.has(keyOf(s)))\n const points = visible.flatMap((s) => s.points)\n const sizes = points.map(sizeOf).filter((v): v is number => v !== undefined)\n const maxSize = extent(sizes)?.[1] ?? 0\n const rMin = options.size?.min ?? 4\n const rMax = options.size?.max ?? 24\n // Area-proportional bubbles: the radius grows with the square root of the size.\n const bubble = (size: number | undefined) =>\n size != null && size > 0 && maxSize > 0\n ? rMin + (rMax - rMin) * Math.sqrt(size / maxSize)\n : radius\n const overhang = Math.max(radius, sizes.length ? rMax : 0) + 2\n\n const countY = tickCount(yOptions, Math.max(2, Math.round(height / 60)))\n const countX = tickCount(xOptions, Math.max(2, Math.round(width / 80)))\n const labels = categories(options.data)\n // Where each category stands (the first of two with one name).\n const index = new Map((labels ?? []).map((label, i) => [label, i] as const).reverse())\n // Only points that can be plotted on both axes take part.\n const usable = (p: ScatterPoint) =>\n (labels ? index.has(String(p.x)) : typeof p.x === 'number' && plottable(p.x, xOptions)) &&\n plottable(p.y, yOptions)\n const shown = points.filter(usable)\n const xDomain = domainOf(labels ? [] : shown.map((p) => p.x as number), xOptions, false, countX)\n const yDomain = domainOf(\n shown.map((p) => p.y),\n yOptions,\n false,\n countY,\n )\n\n const showX = xOptions.show !== false\n const showY = yOptions.show !== false\n // Linear or logarithmic, as each axis asks (see valueScale).\n const ticksOf = (scale: LinearScale, axis: ValueAxisOptions, count: number) =>\n valueTicks(scale, axis, count, axis.format, locale)\n const probeY = ticksOf(valueScale(yDomain, [1, 0], yOptions), yOptions, countY)\n const probeX: Tick[] = labels\n ? labels.map((label) => ({ value: label, position: 0, label }))\n : ticksOf(valueScale(xDomain, [0, 1], xOptions), xOptions, countX)\n // What an edge label needs beside the plot: half of it on a value axis, where\n // it is centered on the edge; over categories it has half a band of room first.\n const half = (tick: Tick | undefined, halfBand = 0) =>\n showX && tick\n ? Math.max(0, Math.ceil(estimateTextWidth(tick.label, fontSize) / 2 - halfBand))\n : 0\n const reverse = xOptions.reverse ?? ctx.rtl === true\n // The x tick on the start side of the plot, and the one on the end side.\n const near = reverse === (ctx.rtl === true) ? 0 : probeX.length - 1\n const valueWidth =\n (showY ? axisSize('left', probeY, fontSize) : 0) + axisTitleSize(yOptions.title, fontSize)\n const { area, side, range } = plotFrame(ctx, options.padding, (pad) => {\n const sides = (halfBand: number) => ({\n start: pad.start + Math.max(valueWidth, half(probeX[near], halfBand), overhang),\n end: pad.end + Math.max(half(probeX[probeX.length - 1 - near], halfBand), overhang, EDGE),\n })\n let both = sides(0)\n // The band depends on the margins, so they are worked out twice.\n if (labels?.length) both = sides((width - both.start - both.end) / (labels.length * 2))\n return {\n top:\n pad.top + Math.max(showY ? Math.ceil((fontSize * LINE_HEIGHT) / 2) : 0, overhang, EDGE / 2),\n bottom:\n pad.bottom +\n Math.max(\n (showX ? axisSize('bottom', probeX, fontSize) : 0) +\n axisTitleSize(xOptions.title, fontSize),\n overhang,\n EDGE / 2,\n ),\n ...both,\n }\n })\n const y = valueScale(yDomain, [area.y + area.height, area.y], yOptions)\n // Pixel of an `x`, and the ticks of its axis: a point stands in the middle of its category.\n let x: (value: number | string) => number\n let allX: Tick[]\n if (labels) {\n // Equal bands along the range (it runs backwards when reversed).\n const [from, to] = range(reverse)\n const at = (i: number) => from + ((to - from) * (i + 0.5)) / labels.length\n x = (value) => at(index.get(String(value)) as number)\n allX = labels.map((label, i) => ({ value: label, position: at(i), label }))\n } else {\n const scale = valueScale(xDomain, range(reverse), xOptions)\n x = (value) => scale(value as number)\n allX = ticksOf(scale, xOptions, countX)\n }\n // Thinned like the ticks of the other charts: on a log axis they crowd at the end of each decade.\n const xTicks = thinTicks(allX, 'bottom', fontSize)\n const yTicks = thinTicks(ticksOf(y, yOptions, countY), 'left', fontSize, 4)\n\n // Every visible point in pixels, sorted by x for fast nearest-point lookups.\n const placed: Placed[] = []\n options.data.series.forEach((series, seriesIndex) => {\n if (ctx.hidden.has(keyOf(series))) return\n series.points.forEach((point, pointIndex) => {\n if (!usable(point)) return\n placed.push({\n seriesIndex,\n pointIndex,\n point,\n cx: x(point.x),\n cy: y(point.y),\n r: bubble(sizeOf(point)),\n })\n })\n })\n placed.sort((a, b) => a.cx - b.cx)\n\n const fx = xText(options, locale)\n const fy = formatDetail(yOptions.format, locale)\n const fs = formatNumber(undefined, locale)\n const hitFor = (p: Placed, index: number): Hit => {\n const series = options.data.series[p.seriesIndex] as ScatterSeries\n const sz = sizeOf(p.point)\n const size = sz === undefined ? '' : ` · ${fs(sz)}`\n const item: HitItem = {\n name: series.name,\n seriesIndex: p.seriesIndex,\n value: p.point.y,\n text: `${fx(p.point.x)}, ${fy(p.point.y)}${size}`,\n x: p.cx,\n y: p.cy,\n }\n if (series.color) item.color = series.color\n return {\n index,\n label: p.point.label ?? series.name,\n title: p.point.label ?? '',\n x: p.cx,\n area,\n items: [item],\n seriesIndex: p.seriesIndex,\n highlight: { kind: 'halo', d: circlePath(round(p.r + 4)), x: p.cx, y: p.cy },\n }\n }\n\n const interaction: Interaction = {\n count: placed.length,\n hitIndex: (index) => {\n const p = placed[index]\n return p ? hitFor(p, index) : null\n },\n hitTest(px, py) {\n // Binary search the first point within reach on x, then scan the window.\n let lo = 0\n let hi = placed.length\n const reach = HIT_RADIUS + rMax\n while (lo < hi) {\n const mid = (lo + hi) >> 1\n if ((placed[mid] as Placed).cx < px - reach) lo = mid + 1\n else hi = mid\n }\n let best = -1\n let bestDistance = Number.POSITIVE_INFINITY\n for (let i = lo; i < placed.length; i++) {\n const p = placed[i] as Placed\n if (p.cx > px + reach) break\n const distance = Math.hypot(p.cx - px, p.cy - py) - p.r\n if (distance < bestDistance && distance <= HIT_RADIUS) {\n best = i\n bestDistance = distance\n }\n }\n return best === -1 ? null : hitFor(placed[best] as Placed, best)\n },\n }\n\n /** One path drawing a dot of `radius` at every point (two arcs each, or the series' shape). */\n const shape = markerShape(options)\n const dotsPath = (dots: readonly ScatterPoint[], slot: number) => {\n if (!dots.length) return null\n const r = round(radius)\n let d = ''\n for (const p of dots) {\n d += shape\n ? shape(slot, x(p.x), y(p.y), r)\n : `M${round(x(p.x) - radius)},${round(y(p.y))}a${r},${r},0,1,0,${2 * r},0a${r},${r},0,1,0,${-2 * r},0`\n }\n return h('path', { key: 'dots', class: ['tc-point tc-dots', shape && 'tc-marker'], d })\n }\n\n const background = []\n if (yOptions.grid !== false) background.push(grid({ direction: 'y', ticks: yTicks, area }))\n if (xOptions.grid) background.push(grid({ direction: 'x', ticks: xTicks, area }))\n\n // Dots may reach a little past the plot edges; bubbles are cut at them (like\n // Chart.js), as a big one there would cover the axis labels.\n const clip = plotClip(ctx, area, sizes.length ? 0 : overhang)\n const groups = options.data.series.map(\n (series, seriesIndex) =>\n !ctx.hidden.has(keyOf(series)) &&\n h(\n 'g',\n groupAttrs(series, seriesIndex),\n // Plain points share one path per series: thousands of circles would\n // each cost the browser style and layout work. The path keeps its\n // commands while the point count does, so new data morphs. Bubbles\n // stay circles: each is see-through over the others.\n dotsPath(\n series.points.filter((p) => usable(p) && sizeOf(p) === undefined),\n seriesIndex,\n ),\n series.points.map(\n (point, i) =>\n usable(point) &&\n sizeOf(point) !== undefined &&\n h('circle', {\n key: i,\n class: 'tc-point tc-bubble',\n cx: round(x(point.x)),\n cy: round(y(point.y)),\n r: round(bubble(sizeOf(point))),\n }),\n ),\n ),\n )\n\n const content = [\n h('defs', null, clip.def),\n background,\n h('g', { key: 'series', class: 'tc-series-list', 'clip-path': clip.url }, groups),\n showY && axis({ position: side, ticks: yTicks, area }),\n showX && axis({ position: 'bottom', ticks: xTicks, area }),\n !!yOptions.title && axisTitle(side, showY ? yTicks : [], area, yOptions.title, fontSize),\n !!xOptions.title && axisTitle('bottom', showX ? xTicks : [], area, xOptions.title, fontSize),\n ]\n return { content, interaction }\n}\n\nfunction scatterTable(\n options: ScatterOptions,\n ctx: RenderContext,\n limit: number = Number.POSITIVE_INFINITY,\n): DataTable {\n const fx = xText(options, ctx.locale)\n const fy = formatDetail(options.y?.format, ctx.locale)\n const fs = formatNumber(undefined, ctx.locale)\n const series = options.data.series.filter((s) => !ctx.hidden.has(keyOf(s)))\n const withSize = series.some((s) => s.points.some((p) => p.size != null))\n const withLabel = series.some((s) => s.points.some((p) => p.label != null))\n const total = series.reduce((sum, s) => sum + s.points.length, 0)\n let left = limit\n return {\n columns: ['', ...(withLabel ? ['Label'] : []), 'x', 'y', ...(withSize ? ['Size'] : [])],\n total,\n rows: series.flatMap((s) => {\n const take = s.points.slice(0, Math.max(0, left))\n left -= take.length\n return take.map((p) => [\n s.name,\n ...(withLabel ? [p.label ?? ''] : []),\n fx(p.x),\n fy(p.y),\n ...(withSize ? [sizeOf(p) === undefined ? '–' : fs(sizeOf(p) as number)] : []),\n ])\n }),\n }\n}\n\n/**\n * Scatter chart: points on two value axes; give points a `size` for a\n * bubble chart (area-proportional radii). With `data.labels` (or a text `x`)\n * the points stand over named categories instead.\n *\n * ```ts\n * new Chart('#el', {\n * type: scatter,\n * data: { series: [{ name: 'Cities', points: [{ x: 12, y: 3.4 }, { x: 18, y: 5.1 }] }] },\n * })\n * ```\n */\nexport const scatter: ChartType<ScatterOptions> = {\n name: 'scatter',\n clean: cleanData((data) => ({\n ...(isRecord(data) ? data : {}),\n labels: isRecord(data) && Array.isArray(data.labels) ? data.labels.map(text) : undefined,\n series: records(isRecord(data) && data.series, (s) => ({\n ...named(s),\n points: records(s.points, (p) => ({\n ...p,\n x: typeof p.x === 'string' ? p.x : finite(p.x),\n y: finite(p.y),\n size: finite(p.size) ?? undefined,\n label: p.label == null ? undefined : text(p.label),\n })).filter((p) => p.x !== null && p.y !== null),\n })),\n })),\n render: renderScatter,\n legend: (options) => legendItems(options.data.series),\n table: scatterTable,\n valueLabels: { format: (options) => options.y?.format },\n}\n"],"mappings":";;;;;;;;;;;AA6FA,MAAM,aAAa;AACnB,MAAM,OAAO;;;;;AAeb,SAAS,WAAW,MAAoC;CACtD,IAAI,KAAK,QAAQ,OAAO,KAAK,OAAO,IAAI,MAAM;CAC9C,IAAI,CAAC,KAAK,OAAO,MAAM,MAAM,EAAE,OAAO,MAAM,MAAM,OAAO,EAAE,MAAM,QAAQ,CAAC,GAAG,OAAO;CACpF,OAAO,CAAC,GAAG,IAAI,IAAI,KAAK,OAAO,SAAS,MAAM,EAAE,OAAO,KAAK,MAAM,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF;;AAGA,MAAM,UAAU,MACd,EAAE,QAAQ,QAAQ,OAAO,SAAS,EAAE,IAAI,KAAK,EAAE,OAAO,IAAI,EAAE,OAAO,KAAA;;AAGrE,SAAS,MAAM,SAAyB,QAAiC;CACvE,MAAM,SAASA,eAAAA,aAAa,QAAQ,GAAG,QAAQ,MAAM;CACrD,MAAM,QAAQ,CAAC,CAAC,WAAW,QAAQ,IAAI;CACvC,QAAQ,UACN,SAAS,OAAO,UAAU,WAAW,OAAO,KAAK,IAAI,OAAO,K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C,MAAM,KAAA,IAAY,MAAM,GAAG,OAAO,CAAC,CAAW,CAAC,IAAI,CAAC;GAC9E,CAAC;EACH,CAAC;CACH;AACF;;;;;;;;;;;;;AAcA,MAAa,UAAqC;CAChD,MAAM;CACN,OAAOuB,cAAAA,WAAW,UAAU;EAC1B,GAAIC,cAAAA,SAAS,IAAI,IAAI,OAAO,CAAC;EAC7B,QAAQA,cAAAA,SAAS,IAAI,KAAK,MAAM,QAAQ,KAAK,MAAM,IAAI,KAAK,OAAO,IAAIC,cAAAA,IAAI,IAAI,KAAA;EAC/E,QAAQC,cAAAA,QAAQF,cAAAA,SAAS,IAAI,KAAK,KAAK,SAAS,OAAO;GACrD,GAAGG,cAAAA,MAAM,CAAC;GACV,QAAQD,cAAAA,QAAQ,EAAE,SAAS,OAAO;IAChC,GAAG;IACH,GAAG,OAAO,EAAE,MAAM,WAAW,EAAE,IAAIE,cAAAA,OAAO,EAAE,CAAC;IAC7C,GAAGA,cAAAA,OAAO,EAAE,CAAC;IACb,MAAMA,cAAAA,OAAO,EAAE,IAAI,KAAK,KAAA;IACxB,OAAO,EAAE,SAAS,OAAO,KAAA,IAAYH,cAAAA,KAAK,EAAE,KAAK;GACnD,EAAE,CAAC,CAAC,QAAQ,MAAM,EAAE,MAAM,QAAQ,EAAE,MAAM,IAAI;EAChD,EAAE;CACJ,EAAE;CACF,QAAQ;CACR,SAAS,YAAYI,cAAAA,YAAY,QAAQ,KAAK,MAAM;CACpD,OAAO;CACP,aAAa,EAAE,SAAS,YAAY,QAAQ,GAAG,OAAO;AACxD"}
|
package/dist/scatter.cjs
CHANGED
package/dist/scatter.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Standalone entry: `import { scatter } from '@tabler/charts/scatter'`. */
|
|
2
|
-
import {
|
|
3
|
-
export { type ScatterOptions, type ScatterPoint, type ScatterSeries, scatter };
|
|
2
|
+
import { a as scatter, i as ScatterSeries, n as ScatterOptions, r as ScatterPoint, t as ScatterData } from "./scatter-BUGbnRzM.cjs";
|
|
3
|
+
export { type ScatterData, type ScatterOptions, type ScatterPoint, type ScatterSeries, scatter };
|
package/dist/scatter.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Standalone entry: `import { scatter } from '@tabler/charts/scatter'`. */
|
|
2
|
-
import {
|
|
3
|
-
export { type ScatterOptions, type ScatterPoint, type ScatterSeries, scatter };
|
|
2
|
+
import { a as scatter, i as ScatterSeries, n as ScatterOptions, r as ScatterPoint, t as ScatterData } from "./scatter-BAL5K9_4.js";
|
|
3
|
+
export { type ScatterData, type ScatterOptions, type ScatterPoint, type ScatterSeries, scatter };
|
package/dist/scatter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as scatter } from "./scatter-
|
|
1
|
+
export { t as scatter } from "./scatter-0Z7K_YUz.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { i as Rect } from "./layout-CYerDebD.cjs";
|
|
2
|
+
import { l as VNode } from "./vnode-Du2cC8Fm.cjs";
|
|
3
|
+
interface SliceLabelOptions {
|
|
4
|
+
/** What follows the name: the slice's share of the whole (the default), its value, or nothing. */
|
|
5
|
+
value?: "share" | "value" | false;
|
|
6
|
+
}
|
|
7
|
+
/** One label: the slice (by key and color slot), its texts, and the angle of its middle. */
|
|
8
|
+
interface SliceLabel {
|
|
9
|
+
key: string;
|
|
10
|
+
index: number;
|
|
11
|
+
name: string;
|
|
12
|
+
/** Text after the name; empty for the name alone. */
|
|
13
|
+
value: string;
|
|
14
|
+
/** Middle of the slice, in radians clockwise from 12 o'clock. */
|
|
15
|
+
angle: number;
|
|
16
|
+
/** Size of the slice: when there is no room for every label, the smallest go first. */
|
|
17
|
+
weight: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The slice labels of a pie drawn in `area`: the smaller area left for the
|
|
21
|
+
* pie itself, and the `layer` that draws the labels once its center and
|
|
22
|
+
* radius are known. `null` when the chart is too small to label.
|
|
23
|
+
*/
|
|
24
|
+
declare function sliceLabels(labels: readonly SliceLabel[], area: Rect, fontSize: number): {
|
|
25
|
+
area: Rect;
|
|
26
|
+
layer: (cx: number, cy: number, radius: number) => VNode;
|
|
27
|
+
} | null;
|
|
28
|
+
export { sliceLabels as n, SliceLabelOptions as t };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { n as estimateTextWidth, s as round, t as LINE_HEIGHT } from "./layout-DqAte3H8.js";
|
|
2
|
+
import { t as h } from "./vnode-_EMUqysL.js";
|
|
3
|
+
// src/charts/slice-labels.ts
|
|
4
|
+
/**
|
|
5
|
+
* Slice labels: every slice of a pie or donut named beside the chart, with
|
|
6
|
+
* its share, in a column on the side the slice is on. A thin line joins each
|
|
7
|
+
* label to its slice; labels of neighboring slices are moved apart so none
|
|
8
|
+
* overlap, and the pie gets smaller to leave them room.
|
|
9
|
+
*/
|
|
10
|
+
/** How far past the slice a line bends, how far it then runs sideways, and the space before the text. */
|
|
11
|
+
const ELBOW = 12;
|
|
12
|
+
const RUN = 12;
|
|
13
|
+
const GAP = 6;
|
|
14
|
+
/** How far into the slice a line starts. */
|
|
15
|
+
const INSIDE = 6;
|
|
16
|
+
/** The smallest radius a pie is worth labelling at: below it the labels are left out. */
|
|
17
|
+
const MIN_RADIUS = 32;
|
|
18
|
+
const SEPARATOR = " — ";
|
|
19
|
+
const textWidth = (label, fontSize) => estimateTextWidth(label.name, fontSize) * 1.08 + (label.value ? estimateTextWidth(SEPARATOR + label.value, fontSize) : 0);
|
|
20
|
+
const onRight = (label) => Math.sin(label.angle) >= 0;
|
|
21
|
+
/**
|
|
22
|
+
* The slice labels of a pie drawn in `area`: the smaller area left for the
|
|
23
|
+
* pie itself, and the `layer` that draws the labels once its center and
|
|
24
|
+
* radius are known. `null` when the chart is too small to label.
|
|
25
|
+
*/
|
|
26
|
+
function sliceLabels(labels, area, fontSize) {
|
|
27
|
+
const step = Math.ceil(fontSize * LINE_HEIGHT);
|
|
28
|
+
const lines = Math.max(1, Math.floor(area.height / step));
|
|
29
|
+
const sides = [false, true].map((right) => labels.filter((label) => onRight(label) === right).sort((a, b) => b.weight - a.weight).slice(0, lines));
|
|
30
|
+
const room = sides.map((side) => side.length ? Math.ceil(30 + Math.max(...side.map((label) => textWidth(label, fontSize)))) : 0);
|
|
31
|
+
const above = ELBOW + Math.ceil(step / 2);
|
|
32
|
+
const inner = {
|
|
33
|
+
x: area.x + room[0],
|
|
34
|
+
y: area.y + above,
|
|
35
|
+
width: area.width - room[0] - room[1],
|
|
36
|
+
height: area.height - above * 2
|
|
37
|
+
};
|
|
38
|
+
if (Math.min(inner.width, inner.height) / 2 < MIN_RADIUS) return null;
|
|
39
|
+
return {
|
|
40
|
+
area: inner,
|
|
41
|
+
layer: (cx, cy, radius) => h("g", {
|
|
42
|
+
key: "slice-labels",
|
|
43
|
+
class: "tc-slice-labels",
|
|
44
|
+
"aria-hidden": "true"
|
|
45
|
+
}, sides.flatMap((side, s) => {
|
|
46
|
+
const sign = s ? 1 : -1;
|
|
47
|
+
const placed = side.map((label) => ({
|
|
48
|
+
label,
|
|
49
|
+
y: cy - Math.cos(label.angle) * (radius + ELBOW)
|
|
50
|
+
})).sort((a, b) => a.y - b.y);
|
|
51
|
+
let floor = area.y + step / 2;
|
|
52
|
+
for (const item of placed) {
|
|
53
|
+
item.y = Math.max(item.y, floor);
|
|
54
|
+
floor = item.y + step;
|
|
55
|
+
}
|
|
56
|
+
let ceiling = area.y + area.height - step / 2;
|
|
57
|
+
for (const item of placed.slice().reverse()) {
|
|
58
|
+
item.y = Math.min(item.y, ceiling);
|
|
59
|
+
ceiling = item.y - step;
|
|
60
|
+
}
|
|
61
|
+
const column = cx + sign * (radius + ELBOW + RUN);
|
|
62
|
+
return placed.map(({ label, y }) => {
|
|
63
|
+
const sin = Math.sin(label.angle);
|
|
64
|
+
const cos = Math.cos(label.angle);
|
|
65
|
+
const from = radius - INSIDE;
|
|
66
|
+
return h("g", {
|
|
67
|
+
key: label.key,
|
|
68
|
+
class: [
|
|
69
|
+
"tc-slice-label",
|
|
70
|
+
"tc-series",
|
|
71
|
+
`tc-series-${label.index + 1}`
|
|
72
|
+
]
|
|
73
|
+
}, h("path", {
|
|
74
|
+
class: "tc-slice-label-line",
|
|
75
|
+
d: `M${round(cx + sin * from)},${round(cy - cos * from)}L${round(cx + sin * (radius + ELBOW))},${round(y)}H${round(column)}`
|
|
76
|
+
}), h("text", {
|
|
77
|
+
class: "tc-slice-label-text",
|
|
78
|
+
style: `transform:translate(${round(column + sign * GAP)}px,${round(y)}px)`,
|
|
79
|
+
"text-anchor": s ? "start" : "end",
|
|
80
|
+
dy: "0.35em"
|
|
81
|
+
}, h("tspan", { class: "tc-slice-label-name" }, label.name), label.value && SEPARATOR + label.value));
|
|
82
|
+
});
|
|
83
|
+
}))
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export { sliceLabels as t };
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=slice-labels-C9ucsBVW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slice-labels-C9ucsBVW.js","names":[],"sources":["../src/charts/slice-labels.ts"],"sourcesContent":["/**\n * Slice labels: every slice of a pie or donut named beside the chart, with\n * its share, in a column on the side the slice is on. A thin line joins each\n * label to its slice; labels of neighboring slices are moved apart so none\n * overlap, and the pie gets smaller to leave them room.\n */\nimport { estimateTextWidth, LINE_HEIGHT, type Rect, round } from '../layout.ts'\nimport { h, type VNode } from '../vnode.ts'\n\nexport interface SliceLabelOptions {\n /** What follows the name: the slice's share of the whole (the default), its value, or nothing. */\n value?: 'share' | 'value' | false\n}\n\n/** One label: the slice (by key and color slot), its texts, and the angle of its middle. */\nexport interface SliceLabel {\n key: string\n index: number\n name: string\n /** Text after the name; empty for the name alone. */\n value: string\n /** Middle of the slice, in radians clockwise from 12 o'clock. */\n angle: number\n /** Size of the slice: when there is no room for every label, the smallest go first. */\n weight: number\n}\n\n/** How far past the slice a line bends, how far it then runs sideways, and the space before the text. */\nconst ELBOW = 12\nconst RUN = 12\nconst GAP = 6\n/** How far into the slice a line starts. */\nconst INSIDE = 6\n/** The smallest radius a pie is worth labelling at: below it the labels are left out. */\nconst MIN_RADIUS = 32\nconst SEPARATOR = ' — '\n\nconst textWidth = (label: SliceLabel, fontSize: number): number =>\n // The name is set in a heavier weight: a little wider than estimated.\n estimateTextWidth(label.name, fontSize) * 1.08 +\n (label.value ? estimateTextWidth(SEPARATOR + label.value, fontSize) : 0)\n\nconst onRight = (label: SliceLabel): boolean => Math.sin(label.angle) >= 0\n\n/**\n * The slice labels of a pie drawn in `area`: the smaller area left for the\n * pie itself, and the `layer` that draws the labels once its center and\n * radius are known. `null` when the chart is too small to label.\n */\nexport function sliceLabels(\n labels: readonly SliceLabel[],\n area: Rect,\n fontSize: number,\n): { area: Rect; layer: (cx: number, cy: number, radius: number) => VNode } | null {\n const step = Math.ceil(fontSize * LINE_HEIGHT)\n // A column holds a label per line of the chart's height: the smallest slices go without.\n const lines = Math.max(1, Math.floor(area.height / step))\n const sides = [false, true].map((right) =>\n labels\n .filter((label) => onRight(label) === right)\n .sort((a, b) => b.weight - a.weight)\n .slice(0, lines),\n ) as [SliceLabel[], SliceLabel[]]\n const room = sides.map((side) =>\n side.length\n ? Math.ceil(ELBOW + RUN + GAP + Math.max(...side.map((label) => textWidth(label, fontSize))))\n : 0,\n ) as [number, number]\n const above = ELBOW + Math.ceil(step / 2)\n const inner: Rect = {\n x: area.x + room[0],\n y: area.y + above,\n width: area.width - room[0] - room[1],\n height: area.height - above * 2,\n }\n if (Math.min(inner.width, inner.height) / 2 < MIN_RADIUS) return null\n\n return {\n area: inner,\n layer: (cx, cy, radius) =>\n h(\n 'g',\n { key: 'slice-labels', class: 'tc-slice-labels', 'aria-hidden': 'true' },\n sides.flatMap((side, s) => {\n const sign = s ? 1 : -1\n const placed = side\n .map((label) => ({ label, y: cy - Math.cos(label.angle) * (radius + ELBOW) }))\n .sort((a, b) => a.y - b.y)\n // Top to bottom, each a line below the one before; then back up from the bottom.\n let floor = area.y + step / 2\n for (const item of placed) {\n item.y = Math.max(item.y, floor)\n floor = item.y + step\n }\n let ceiling = area.y + area.height - step / 2\n for (const item of placed.slice().reverse()) {\n item.y = Math.min(item.y, ceiling)\n ceiling = item.y - step\n }\n const column = cx + sign * (radius + ELBOW + RUN)\n return placed.map(({ label, y }) => {\n const sin = Math.sin(label.angle)\n const cos = Math.cos(label.angle)\n const from = radius - INSIDE\n return h(\n 'g',\n {\n key: label.key,\n class: ['tc-slice-label', 'tc-series', `tc-series-${label.index + 1}`],\n },\n // From inside the slice out to the label's line, then along it to the text.\n h('path', {\n class: 'tc-slice-label-line',\n d: `M${round(cx + sin * from)},${round(cy - cos * from)}L${round(cx + sin * (radius + ELBOW))},${round(y)}H${round(column)}`,\n }),\n h(\n 'text',\n {\n class: 'tc-slice-label-text',\n style: `transform:translate(${round(column + sign * GAP)}px,${round(y)}px)`,\n 'text-anchor': s ? 'start' : 'end',\n dy: '0.35em',\n },\n h('tspan', { class: 'tc-slice-label-name' }, label.name),\n label.value && SEPARATOR + label.value,\n ),\n )\n })\n }),\n ),\n }\n}\n"],"mappings":";;;;;;;;;;AA4BA,MAAM,QAAQ;AACd,MAAM,MAAM;AACZ,MAAM,MAAM;;AAEZ,MAAM,SAAS;;AAEf,MAAM,aAAa;AACnB,MAAM,YAAY;AAElB,MAAM,aAAa,OAAmB,aAEpC,kBAAkB,MAAM,MAAM,QAAQ,IAAI,QACzC,MAAM,QAAQ,kBAAkB,YAAY,MAAM,OAAO,QAAQ,IAAI;AAExE,MAAM,WAAW,UAA+B,KAAK,IAAI,MAAM,KAAK,KAAK;;;;;;AAOzE,SAAgB,YACd,QACA,MACA,UACiF;CACjF,MAAM,OAAO,KAAK,KAAK,WAAW,WAAW;CAE7C,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,SAAS,IAAI,CAAC;CACxD,MAAM,QAAQ,CAAC,OAAO,IAAI,CAAC,CA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KAAK,IAAI;GACrB;GACA,MAAM,SAAS,KAAK,QAAQ,SAAS,QAAQ;GAC7C,OAAO,OAAO,KAAK,EAAE,OAAO,QAAQ;IAClC,MAAM,MAAM,KAAK,IAAI,MAAM,KAAK;IAChC,MAAM,MAAM,KAAK,IAAI,MAAM,KAAK;IAChC,MAAM,OAAO,SAAS;IACtB,OAAO,EACL,KACA;KACE,KAAK,MAAM;KACX,OAAO;MAAC;MAAkB;MAAa,aAAa,MAAM,QAAQ;KAAG;IACvE,GAEA,EAAE,QAAQ;KACR,OAAO;KACP,GAAG,IAAI,MAAM,KAAK,MAAM,IAAI,EAAE,GAAG,MAAM,KAAK,MAAM,IAAI,EAAE,GAAG,MAAM,KAAK,OAAO,SAAS,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM,MAAM;IAC3H,CAAC,GACD,EACE,QACA;KACE,OAAO;KACP,OAAO,uBAAuB,MAAM,SAAS,OAAO,GAAG,EAAE,KAAK,MAAM,CAAC,EAAE;KACvE,eAAe,IAAI,UAAU;KAC7B,IAAI;IACN,GACA,EAAE,SAAS,EAAE,OAAO,sBAAsB,GAAG,MAAM,IAAI,GACvD,MAAM,SAAS,YAAY,MAAM,KACnC,CACF;GACF,CAAC;EACH,CAAC,CACH;CACJ;AACF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
const require_layout = require("./layout-Cfg9x1k2.cjs");
|
|
2
|
+
const require_vnode = require("./vnode-ClAiw28x.cjs");
|
|
3
|
+
// src/charts/slice-labels.ts
|
|
4
|
+
/**
|
|
5
|
+
* Slice labels: every slice of a pie or donut named beside the chart, with
|
|
6
|
+
* its share, in a column on the side the slice is on. A thin line joins each
|
|
7
|
+
* label to its slice; labels of neighboring slices are moved apart so none
|
|
8
|
+
* overlap, and the pie gets smaller to leave them room.
|
|
9
|
+
*/
|
|
10
|
+
/** How far past the slice a line bends, how far it then runs sideways, and the space before the text. */
|
|
11
|
+
const ELBOW = 12;
|
|
12
|
+
const RUN = 12;
|
|
13
|
+
const GAP = 6;
|
|
14
|
+
/** How far into the slice a line starts. */
|
|
15
|
+
const INSIDE = 6;
|
|
16
|
+
/** The smallest radius a pie is worth labelling at: below it the labels are left out. */
|
|
17
|
+
const MIN_RADIUS = 32;
|
|
18
|
+
const SEPARATOR = " — ";
|
|
19
|
+
const textWidth = (label, fontSize) => require_layout.estimateTextWidth(label.name, fontSize) * 1.08 + (label.value ? require_layout.estimateTextWidth(SEPARATOR + label.value, fontSize) : 0);
|
|
20
|
+
const onRight = (label) => Math.sin(label.angle) >= 0;
|
|
21
|
+
/**
|
|
22
|
+
* The slice labels of a pie drawn in `area`: the smaller area left for the
|
|
23
|
+
* pie itself, and the `layer` that draws the labels once its center and
|
|
24
|
+
* radius are known. `null` when the chart is too small to label.
|
|
25
|
+
*/
|
|
26
|
+
function sliceLabels(labels, area, fontSize) {
|
|
27
|
+
const step = Math.ceil(fontSize * require_layout.LINE_HEIGHT);
|
|
28
|
+
const lines = Math.max(1, Math.floor(area.height / step));
|
|
29
|
+
const sides = [false, true].map((right) => labels.filter((label) => onRight(label) === right).sort((a, b) => b.weight - a.weight).slice(0, lines));
|
|
30
|
+
const room = sides.map((side) => side.length ? Math.ceil(30 + Math.max(...side.map((label) => textWidth(label, fontSize)))) : 0);
|
|
31
|
+
const above = ELBOW + Math.ceil(step / 2);
|
|
32
|
+
const inner = {
|
|
33
|
+
x: area.x + room[0],
|
|
34
|
+
y: area.y + above,
|
|
35
|
+
width: area.width - room[0] - room[1],
|
|
36
|
+
height: area.height - above * 2
|
|
37
|
+
};
|
|
38
|
+
if (Math.min(inner.width, inner.height) / 2 < MIN_RADIUS) return null;
|
|
39
|
+
return {
|
|
40
|
+
area: inner,
|
|
41
|
+
layer: (cx, cy, radius) => require_vnode.h("g", {
|
|
42
|
+
key: "slice-labels",
|
|
43
|
+
class: "tc-slice-labels",
|
|
44
|
+
"aria-hidden": "true"
|
|
45
|
+
}, sides.flatMap((side, s) => {
|
|
46
|
+
const sign = s ? 1 : -1;
|
|
47
|
+
const placed = side.map((label) => ({
|
|
48
|
+
label,
|
|
49
|
+
y: cy - Math.cos(label.angle) * (radius + ELBOW)
|
|
50
|
+
})).sort((a, b) => a.y - b.y);
|
|
51
|
+
let floor = area.y + step / 2;
|
|
52
|
+
for (const item of placed) {
|
|
53
|
+
item.y = Math.max(item.y, floor);
|
|
54
|
+
floor = item.y + step;
|
|
55
|
+
}
|
|
56
|
+
let ceiling = area.y + area.height - step / 2;
|
|
57
|
+
for (const item of placed.slice().reverse()) {
|
|
58
|
+
item.y = Math.min(item.y, ceiling);
|
|
59
|
+
ceiling = item.y - step;
|
|
60
|
+
}
|
|
61
|
+
const column = cx + sign * (radius + ELBOW + RUN);
|
|
62
|
+
return placed.map(({ label, y }) => {
|
|
63
|
+
const sin = Math.sin(label.angle);
|
|
64
|
+
const cos = Math.cos(label.angle);
|
|
65
|
+
const from = radius - INSIDE;
|
|
66
|
+
return require_vnode.h("g", {
|
|
67
|
+
key: label.key,
|
|
68
|
+
class: [
|
|
69
|
+
"tc-slice-label",
|
|
70
|
+
"tc-series",
|
|
71
|
+
`tc-series-${label.index + 1}`
|
|
72
|
+
]
|
|
73
|
+
}, require_vnode.h("path", {
|
|
74
|
+
class: "tc-slice-label-line",
|
|
75
|
+
d: `M${require_layout.round(cx + sin * from)},${require_layout.round(cy - cos * from)}L${require_layout.round(cx + sin * (radius + ELBOW))},${require_layout.round(y)}H${require_layout.round(column)}`
|
|
76
|
+
}), require_vnode.h("text", {
|
|
77
|
+
class: "tc-slice-label-text",
|
|
78
|
+
style: `transform:translate(${require_layout.round(column + sign * GAP)}px,${require_layout.round(y)}px)`,
|
|
79
|
+
"text-anchor": s ? "start" : "end",
|
|
80
|
+
dy: "0.35em"
|
|
81
|
+
}, require_vnode.h("tspan", { class: "tc-slice-label-name" }, label.name), label.value && SEPARATOR + label.value));
|
|
82
|
+
});
|
|
83
|
+
}))
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
Object.defineProperty(exports, "sliceLabels", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function() {
|
|
89
|
+
return sliceLabels;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=slice-labels-CbFiy46l.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slice-labels-CbFiy46l.cjs","names":["estimateTextWidth","LINE_HEIGHT","h","round"],"sources":["../src/charts/slice-labels.ts"],"sourcesContent":["/**\n * Slice labels: every slice of a pie or donut named beside the chart, with\n * its share, in a column on the side the slice is on. A thin line joins each\n * label to its slice; labels of neighboring slices are moved apart so none\n * overlap, and the pie gets smaller to leave them room.\n */\nimport { estimateTextWidth, LINE_HEIGHT, type Rect, round } from '../layout.ts'\nimport { h, type VNode } from '../vnode.ts'\n\nexport interface SliceLabelOptions {\n /** What follows the name: the slice's share of the whole (the default), its value, or nothing. */\n value?: 'share' | 'value' | false\n}\n\n/** One label: the slice (by key and color slot), its texts, and the angle of its middle. */\nexport interface SliceLabel {\n key: string\n index: number\n name: string\n /** Text after the name; empty for the name alone. */\n value: string\n /** Middle of the slice, in radians clockwise from 12 o'clock. */\n angle: number\n /** Size of the slice: when there is no room for every label, the smallest go first. */\n weight: number\n}\n\n/** How far past the slice a line bends, how far it then runs sideways, and the space before the text. */\nconst ELBOW = 12\nconst RUN = 12\nconst GAP = 6\n/** How far into the slice a line starts. */\nconst INSIDE = 6\n/** The smallest radius a pie is worth labelling at: below it the labels are left out. */\nconst MIN_RADIUS = 32\nconst SEPARATOR = ' — '\n\nconst textWidth = (label: SliceLabel, fontSize: number): number =>\n // The name is set in a heavier weight: a little wider than estimated.\n estimateTextWidth(label.name, fontSize) * 1.08 +\n (label.value ? estimateTextWidth(SEPARATOR + label.value, fontSize) : 0)\n\nconst onRight = (label: SliceLabel): boolean => Math.sin(label.angle) >= 0\n\n/**\n * The slice labels of a pie drawn in `area`: the smaller area left for the\n * pie itself, and the `layer` that draws the labels once its center and\n * radius are known. `null` when the chart is too small to label.\n */\nexport function sliceLabels(\n labels: readonly SliceLabel[],\n area: Rect,\n fontSize: number,\n): { area: Rect; layer: (cx: number, cy: number, radius: number) => VNode } | null {\n const step = Math.ceil(fontSize * LINE_HEIGHT)\n // A column holds a label per line of the chart's height: the smallest slices go without.\n const lines = Math.max(1, Math.floor(area.height / step))\n const sides = [false, true].map((right) =>\n labels\n .filter((label) => onRight(label) === right)\n .sort((a, b) => b.weight - a.weight)\n .slice(0, lines),\n ) as [SliceLabel[], SliceLabel[]]\n const room = sides.map((side) =>\n side.length\n ? Math.ceil(ELBOW + RUN + GAP + Math.max(...side.map((label) => textWidth(label, fontSize))))\n : 0,\n ) as [number, number]\n const above = ELBOW + Math.ceil(step / 2)\n const inner: Rect = {\n x: area.x + room[0],\n y: area.y + above,\n width: area.width - room[0] - room[1],\n height: area.height - above * 2,\n }\n if (Math.min(inner.width, inner.height) / 2 < MIN_RADIUS) return null\n\n return {\n area: inner,\n layer: (cx, cy, radius) =>\n h(\n 'g',\n { key: 'slice-labels', class: 'tc-slice-labels', 'aria-hidden': 'true' },\n sides.flatMap((side, s) => {\n const sign = s ? 1 : -1\n const placed = side\n .map((label) => ({ label, y: cy - Math.cos(label.angle) * (radius + ELBOW) }))\n .sort((a, b) => a.y - b.y)\n // Top to bottom, each a line below the one before; then back up from the bottom.\n let floor = area.y + step / 2\n for (const item of placed) {\n item.y = Math.max(item.y, floor)\n floor = item.y + step\n }\n let ceiling = area.y + area.height - step / 2\n for (const item of placed.slice().reverse()) {\n item.y = Math.min(item.y, ceiling)\n ceiling = item.y - step\n }\n const column = cx + sign * (radius + ELBOW + RUN)\n return placed.map(({ label, y }) => {\n const sin = Math.sin(label.angle)\n const cos = Math.cos(label.angle)\n const from = radius - INSIDE\n return h(\n 'g',\n {\n key: label.key,\n class: ['tc-slice-label', 'tc-series', `tc-series-${label.index + 1}`],\n },\n // From inside the slice out to the label's line, then along it to the text.\n h('path', {\n class: 'tc-slice-label-line',\n d: `M${round(cx + sin * from)},${round(cy - cos * from)}L${round(cx + sin * (radius + ELBOW))},${round(y)}H${round(column)}`,\n }),\n h(\n 'text',\n {\n class: 'tc-slice-label-text',\n style: `transform:translate(${round(column + sign * GAP)}px,${round(y)}px)`,\n 'text-anchor': s ? 'start' : 'end',\n dy: '0.35em',\n },\n h('tspan', { class: 'tc-slice-label-name' }, label.name),\n label.value && SEPARATOR + label.value,\n ),\n )\n })\n }),\n ),\n }\n}\n"],"mappings":";;;;;;;;;;AA4BA,MAAM,QAAQ;AACd,MAAM,MAAM;AACZ,MAAM,MAAM;;AAEZ,MAAM,SAAS;;AAEf,MAAM,aAAa;AACnB,MAAM,YAAY;AAElB,MAAM,aAAa,OAAmB,aAEpCA,eAAAA,kBAAkB,MAAM,MAAM,QAAQ,IAAI,QACzC,MAAM,QAAQA,eAAAA,kBAAkB,YAAY,MAAM,OAAO,QAAQ,IAAI;AAExE,MAAM,WAAW,UAA+B,KAAK,IAAI,MAAM,KAAK,KAAK;;;;;;AAOzE,SAAgB,YACd,QACA,MACA,UACiF;CACjF,MAAM,OAAO,KAAK,KAAK,WAAWC,eAAAA,WAAW;CAE7C,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,SAAS,IAAI,CAAC;CACxD,MAAM,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC,KAAK,UAC/B,OACG,QAAQ,UAAU,QAAQ,KAAK,MAAM,KAAK,CAAC,CAC3C,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CACnC,MAAM,GAAG,KAAK,CACnB;CACA,MAAM,OAAO,MAAM,KAAK,SACtB,KAAK,SACD,KAAK,KAAK,KAAoB,KAAK,IAAI,GAAG,KAAK,KAAK,UAAU,UAAU,OAAO,QAAQ,CAAC,CAAC,CAAC,IAC1F,CACN;CACA,MAAM,QAAQ,QAAQ,KAAK,KAAK,OAAO,CAAC;CACxC,MAAM,QAAc;EAClB,GAAG,KAA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C,eAAAA,MAAM,KAAK,MAAM,IAAI,EAAE,GAAGA,eAAAA,MAAM,KAAK,MAAM,IAAI,EAAE,GAAGA,eAAAA,MAAM,KAAK,OAAO,SAAS,MAAM,EAAE,GAAGA,eAAAA,MAAM,CAAC,EAAE,GAAGA,eAAAA,MAAM,MAAM;IAC3H,CAAC,GACDD,cAAAA,EACE,QACA;KACE,OAAO;KACP,OAAO,uBAAuBC,eAAAA,MAAM,SAAS,OAAO,GAAG,EAAE,KAAKA,eAAAA,MAAM,CAAC,EAAE;KACvE,eAAe,IAAI,UAAU;KAC7B,IAAI;IACN,GACAD,cAAAA,EAAE,SAAS,EAAE,OAAO,sBAAsB,GAAG,MAAM,IAAI,GACvD,MAAM,SAAS,YAAY,MAAM,KACnC,CACF;GACF,CAAC;EACH,CAAC,CACH;CACJ;AACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { i as Rect } from "./layout-CYerDebD.js";
|
|
2
|
+
import { l as VNode } from "./vnode-Du2cC8Fm.js";
|
|
3
|
+
interface SliceLabelOptions {
|
|
4
|
+
/** What follows the name: the slice's share of the whole (the default), its value, or nothing. */
|
|
5
|
+
value?: "share" | "value" | false;
|
|
6
|
+
}
|
|
7
|
+
/** One label: the slice (by key and color slot), its texts, and the angle of its middle. */
|
|
8
|
+
interface SliceLabel {
|
|
9
|
+
key: string;
|
|
10
|
+
index: number;
|
|
11
|
+
name: string;
|
|
12
|
+
/** Text after the name; empty for the name alone. */
|
|
13
|
+
value: string;
|
|
14
|
+
/** Middle of the slice, in radians clockwise from 12 o'clock. */
|
|
15
|
+
angle: number;
|
|
16
|
+
/** Size of the slice: when there is no room for every label, the smallest go first. */
|
|
17
|
+
weight: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The slice labels of a pie drawn in `area`: the smaller area left for the
|
|
21
|
+
* pie itself, and the `layer` that draws the labels once its center and
|
|
22
|
+
* radius are known. `null` when the chart is too small to label.
|
|
23
|
+
*/
|
|
24
|
+
declare function sliceLabels(labels: readonly SliceLabel[], area: Rect, fontSize: number): {
|
|
25
|
+
area: Rect;
|
|
26
|
+
layer: (cx: number, cy: number, radius: number) => VNode;
|
|
27
|
+
} | null;
|
|
28
|
+
export { sliceLabels as n, SliceLabelOptions as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_slice_labels = require("./slice-labels-CbFiy46l.cjs");
|
|
3
|
+
// src/slice-labels.ts
|
|
4
|
+
/**
|
|
5
|
+
* Standalone entry: `import '@tabler/charts/slice-labels'` enables `labels`
|
|
6
|
+
* (every slice named beside a pie or donut, joined to it by a line) on the core.
|
|
7
|
+
*/
|
|
8
|
+
require("./features-DEDP5CEQ.cjs").register({ "slice-labels": require_slice_labels.sliceLabels });
|
|
9
|
+
exports.sliceLabels = require_slice_labels.sliceLabels;
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=slice-labels.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slice-labels.cjs","names":["register","sliceLabels"],"sources":["../src/slice-labels.ts"],"sourcesContent":["/**\n * Standalone entry: `import '@tabler/charts/slice-labels'` enables `labels`\n * (every slice named beside a pie or donut, joined to it by a line) on the core.\n */\nimport { sliceLabels } from './charts/slice-labels.ts'\nimport { register } from './features.ts'\n\nregister({ 'slice-labels': sliceLabels })\n\nexport type { SliceLabelOptions } from './charts/slice-labels.ts'\nexport { sliceLabels }\n"],"mappings":";;;;;;;A,iCAOAA,CAAAA,CAAAA,SAAS,EAAE,gBAAgBC,qBAAAA,YAAY,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standalone entry: `import '@tabler/charts/slice-labels'` enables `labels`
|
|
3
|
+
* (every slice named beside a pie or donut, joined to it by a line) on the core.
|
|
4
|
+
*/
|
|
5
|
+
import { n as sliceLabels, t as SliceLabelOptions } from "./slice-labels-1TBq7p3q.cjs";
|
|
6
|
+
export { type SliceLabelOptions, sliceLabels };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standalone entry: `import '@tabler/charts/slice-labels'` enables `labels`
|
|
3
|
+
* (every slice named beside a pie or donut, joined to it by a line) on the core.
|
|
4
|
+
*/
|
|
5
|
+
import { n as sliceLabels, t as SliceLabelOptions } from "./slice-labels-Cm5CyV7B.js";
|
|
6
|
+
export { type SliceLabelOptions, sliceLabels };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { t as sliceLabels } from "./slice-labels-C9ucsBVW.js";
|
|
2
|
+
import { i as register } from "./features-B55rwpQC.js";
|
|
3
|
+
// src/slice-labels.ts
|
|
4
|
+
/**
|
|
5
|
+
* Standalone entry: `import '@tabler/charts/slice-labels'` enables `labels`
|
|
6
|
+
* (every slice named beside a pie or donut, joined to it by a line) on the core.
|
|
7
|
+
*/
|
|
8
|
+
register({ "slice-labels": sliceLabels });
|
|
9
|
+
export { sliceLabels };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=slice-labels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slice-labels.js","names":[],"sources":["../src/slice-labels.ts"],"sourcesContent":["/**\n * Standalone entry: `import '@tabler/charts/slice-labels'` enables `labels`\n * (every slice named beside a pie or donut, joined to it by a line) on the core.\n */\nimport { sliceLabels } from './charts/slice-labels.ts'\nimport { register } from './features.ts'\n\nregister({ 'slice-labels': sliceLabels })\n\nexport type { SliceLabelOptions } from './charts/slice-labels.ts'\nexport { sliceLabels }\n"],"mappings":";;;;;;;AAOA,SAAS,EAAE,gBAAgB,YAAY,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as ChartType, pt as Label } from "./chart-CE9EVbfV.js";
|
|
2
2
|
import { c as NumberFormat } from "./time-DRIDgv2a.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as InsetsInput } from "./layout-CYerDebD.js";
|
|
4
4
|
import { t as Curve } from "./path-YeUiOfG8.js";
|
|
5
5
|
interface SparklineOptions {
|
|
6
6
|
/** The values; `null` leaves a gap. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_fade = require("./fade-
|
|
1
|
+
const require_fade = require("./fade-CRqcKMWY.cjs");
|
|
2
2
|
const require_format = require("./format-CAE5ruy6.cjs");
|
|
3
|
-
const require_layout = require("./layout-
|
|
4
|
-
const require_cartesian = require("./cartesian-
|
|
5
|
-
const require_bar = require("./bar-
|
|
3
|
+
const require_layout = require("./layout-Cfg9x1k2.cjs");
|
|
4
|
+
const require_cartesian = require("./cartesian-B9CrasFJ.cjs");
|
|
5
|
+
const require_bar = require("./bar-wVykm1us.cjs");
|
|
6
6
|
const require_circle = require("./circle-Bwxy5j7B.cjs");
|
|
7
7
|
const require_vnode = require("./vnode-ClAiw28x.cjs");
|
|
8
8
|
const require_clean = require("./clean-Die2iCNc.cjs");
|
|
@@ -56,7 +56,8 @@ function renderSparkline(options, ctx) {
|
|
|
56
56
|
area,
|
|
57
57
|
items: [item]
|
|
58
58
|
};
|
|
59
|
-
if (value !== null) hit.
|
|
59
|
+
if (value !== null) hit.highlight = {
|
|
60
|
+
kind: "halo",
|
|
60
61
|
d: require_circle.circlePath(pointRadius + 3),
|
|
61
62
|
x: px,
|
|
62
63
|
y: yOf(value)
|
|
@@ -73,7 +74,6 @@ function renderSparkline(options, ctx) {
|
|
|
73
74
|
return hitFor(place(Math.max(0, Math.min(count - 1, i))));
|
|
74
75
|
}
|
|
75
76
|
};
|
|
76
|
-
ctx.onHitTest(interaction);
|
|
77
77
|
const marks = [];
|
|
78
78
|
if (tristate) {
|
|
79
79
|
const width = Math.max(1, slot - gap);
|
|
@@ -120,15 +120,10 @@ function renderSparkline(options, ctx) {
|
|
|
120
120
|
d: require_fade.linePath(points, { curve })
|
|
121
121
|
}));
|
|
122
122
|
}
|
|
123
|
+
const shape = require_cartesian.markerShape(options);
|
|
123
124
|
const dotAt = (i, cls) => {
|
|
124
125
|
const v = values[i];
|
|
125
|
-
return v == null ? null :
|
|
126
|
-
key: `${cls}-${i}`,
|
|
127
|
-
class: ["tc-point", cls],
|
|
128
|
-
cx: require_layout.round(xAt(i)),
|
|
129
|
-
cy: require_layout.round(y(v)),
|
|
130
|
-
r: pointRadius
|
|
131
|
-
});
|
|
126
|
+
return v == null ? null : require_cartesian.pointMark(shape, 0, `${cls}-${i}`, ["tc-point", cls], require_layout.round(xAt(i)), require_layout.round(y(v)), pointRadius);
|
|
132
127
|
};
|
|
133
128
|
const extremes = [];
|
|
134
129
|
if (markers === "minmax") {
|
|
@@ -149,7 +144,10 @@ function renderSparkline(options, ctx) {
|
|
|
149
144
|
break;
|
|
150
145
|
}
|
|
151
146
|
}
|
|
152
|
-
return
|
|
147
|
+
return {
|
|
148
|
+
content: [variant === "area" && require_vnode.h("defs", null, require_fade.fadeMask(`${ctx.id}-fade`)), require_vnode.h("g", { class: "tc-series tc-series-1 tc-sparkline" }, marks, extremes, last !== -1 && !bars && dotAt(last, "tc-point-last"))],
|
|
149
|
+
interaction
|
|
150
|
+
};
|
|
153
151
|
}
|
|
154
152
|
/**
|
|
155
153
|
* Sparkline: a tiny line, area or bar chart without axes, for stat tiles.
|
|
@@ -174,4 +172,4 @@ Object.defineProperty(exports, "sparkline", {
|
|
|
174
172
|
}
|
|
175
173
|
});
|
|
176
174
|
|
|
177
|
-
//# sourceMappingURL=sparkline-
|
|
175
|
+
//# sourceMappingURL=sparkline-DjR-V6BI.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sparkline-DjR-V6BI.cjs","names":["insets","innerRect","domainOf","linear","formatNumber","labelKey","circlePath","h","round","barPath","areaPath","linePath","markerShape","pointMark","fadeMask","cleanData","numbers","label"],"sources":["../src/charts/sparkline.ts"],"sourcesContent":["import type { ChartType, RenderContext } from '../chart.ts'\nimport { fadeMask } from '../components/fade.ts'\nimport { formatNumber, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { type InsetsInput, innerRect, insets, round } from '../layout.ts'\nimport { linear } from '../scales/linear.ts'\nimport { barPath } from '../shapes/bar.ts'\nimport { circlePath } from '../shapes/circle.ts'\nimport { areaPath, type Curve, linePath, type Point } from '../shapes/path.ts'\nimport { h } from '../vnode.ts'\nimport { domainOf, type Label, labelKey, markerShape, pointMark } from './cartesian.ts'\nimport { cleanData, label, numbers } from './clean.ts'\n\nexport interface SparklineOptions {\n /** The values; `null` leaves a gap. */\n data: readonly (number | null | undefined)[]\n /** Labels for the tooltip, one per value (e.g. dates). */\n labels?: readonly Label[]\n /** Name shown in the tooltip. Defaults to `'Value'`. */\n name?: string\n /**\n * `'line'` (default), `'area'`, `'bar'`, or `'tristate'`: only the sign\n * counts, as a full bar up (win), down (loss) or a tick on the middle (draw).\n */\n variant?: 'line' | 'area' | 'bar' | 'tristate'\n /** Interpolation for lines and areas. Defaults to `'monotone'`. */\n curve?: Curve\n /** Dot on the last value. Defaults to `'last'`. */\n point?: 'last' | 'none'\n /** Mark the minimum and maximum values. */\n markers?: 'minmax' | 'none'\n /** Dot radius in pixels. Defaults to `3`. */\n pointRadius?: number\n /** Include zero in the value range. Defaults to `true` for areas and bars, `false` for lines. */\n zero?: boolean\n /** Format of values in the tooltip. */\n format?: NumberFormat\n /** Extra space around the plot, in pixels. */\n padding?: InsetsInput\n}\n\nfunction renderSparkline(options: SparklineOptions, ctx: RenderContext) {\n const {\n variant = 'line',\n curve = 'monotone',\n point = 'last',\n markers = 'none',\n pointRadius = 3,\n name = 'Value',\n } = options\n const values = options.data.map((v) => (v == null || !Number.isFinite(v) ? null : v))\n // (No log option on sparklines, so finite is all that matters here.)\n const count = values.length\n const dots = point === 'last' || markers === 'minmax'\n // Room for the stroke and dots so nothing is clipped at the edges.\n const overhang = dots ? pointRadius + 2 : 2\n const pad = insets(options.padding, 0)\n const area = innerRect(ctx.width, ctx.height, {\n top: pad.top + overhang,\n right: pad.right + overhang,\n bottom: pad.bottom + overhang,\n left: pad.left + overhang,\n })\n const tristate = variant === 'tristate'\n const zero = options.zero ?? variant !== 'line'\n // Tristate bars span half the height each way, whatever the magnitude.\n const domain: [number, number] = tristate ? [-1, 1] : domainOf(values, { nice: false }, zero, 2)\n\n const bars = variant === 'bar' || tristate\n const gap = 1\n const slot = count > 0 ? area.width / count : 0\n // Right to left, the values run from the right: value `i` takes the place of its mirror.\n const place = (i: number) => (ctx.rtl ? count - 1 - i : i)\n const xAt = (i: number) =>\n bars\n ? area.x + slot * place(i) + slot / 2\n : area.x + (count > 1 ? (area.width * place(i)) / (count - 1) : area.width / 2)\n const y = linear(domain, [area.y + area.height, area.y])\n const baseline = y(Math.min(Math.max(0, domain[0]), domain[1]))\n const points: Point[] = values.map((v, i) => (v === null ? null : [xAt(i), y(v)]))\n\n const format = formatNumber(options.format, ctx.locale)\n const labelOf = (i: number) => {\n const label = options.labels?.[i]\n return label === undefined ? '' : String(label)\n }\n // Where a value is drawn: a tristate bar ends at its sign, not its magnitude.\n const yOf = (v: number) => y(tristate ? Math.sign(v) : v)\n const hitFor = (i: number): Hit | null => {\n const value = values[i]\n if (value === undefined) return null\n const px = xAt(i)\n const item: HitItem = {\n name,\n seriesIndex: 0,\n value,\n text: value === null ? '–' : format(value),\n x: px,\n y: value === null ? null : yOf(value),\n }\n const hit: Hit = {\n index: i,\n label: labelKey(options.labels?.[i] ?? i + 1),\n title: labelOf(i),\n x: px,\n area,\n items: [item],\n }\n if (value !== null) {\n hit.highlight = { kind: 'halo', d: circlePath(pointRadius + 3), x: px, y: yOf(value) }\n }\n return hit\n }\n const interaction: Interaction = {\n count,\n reversed: ctx.rtl === true,\n hitIndex: (i) => hitFor(i),\n hitTest(px, py) {\n if (count === 0 || py < area.y - overhang || py > area.y + area.height + overhang) return null\n const i = bars\n ? Math.floor((px - area.x) / slot)\n : Math.round(((px - area.x) / Math.max(1, area.width)) * (count - 1))\n return hitFor(place(Math.max(0, Math.min(count - 1, i))))\n },\n }\n\n const marks = []\n if (tristate) {\n const width = Math.max(1, slot - gap)\n marks.push(\n h('line', {\n class: 'tc-sparkline-zero',\n x1: area.x,\n x2: area.x + area.width,\n y1: round(baseline),\n y2: round(baseline),\n }),\n )\n values.forEach((v, i) => {\n if (v === null) return\n const sign = Math.sign(v)\n // A draw is a short tick centered on the middle line.\n const tick = Math.min(2, area.height / 2)\n const [from, to] =\n sign === 0 ? [baseline + tick / 2, baseline - tick / 2] : [baseline, y(sign)]\n marks.push(\n h('path', {\n key: i,\n class: [\n 'tc-bar',\n sign < 0 && 'tc-bar-negative',\n sign < 0 ? 'tc-tristate-loss' : sign > 0 ? 'tc-tristate-win' : 'tc-tristate-draw',\n ],\n d: barPath(xAt(i) - width / 2, width, from, to, sign === 0 ? 0 : Math.min(2, width / 2)),\n }),\n )\n })\n } else if (bars) {\n const width = Math.max(1, slot - gap)\n values.forEach((v, i) => {\n if (v === null) return\n marks.push(\n h('path', {\n key: i,\n class: ['tc-bar', v < 0 && 'tc-bar-negative'],\n d: barPath(xAt(i) - width / 2, width, baseline, y(v), Math.min(2, width / 2)),\n }),\n )\n })\n } else {\n if (variant === 'area') {\n marks.push(\n h('path', {\n class: 'tc-area tc-area-gradient',\n d: areaPath(points, baseline, { curve }),\n mask: `url(#${ctx.id}-fade)`,\n }),\n )\n }\n marks.push(h('path', { class: 'tc-line', d: linePath(points, { curve }) }))\n }\n\n const shape = markerShape(options)\n const dotAt = (i: number, cls: string) => {\n const v = values[i]\n return v == null\n ? null\n : pointMark(\n shape,\n 0,\n `${cls}-${i}`,\n ['tc-point', cls],\n round(xAt(i)),\n round(y(v)),\n pointRadius,\n )\n }\n const extremes = []\n if (markers === 'minmax') {\n let min = -1\n let max = -1\n values.forEach((v, i) => {\n if (v === null) return\n if (min === -1 || v < (values[min] as number)) min = i\n if (max === -1 || v > (values[max] as number)) max = i\n })\n if (min !== -1) extremes.push(dotAt(min, 'tc-point-min'))\n if (max !== -1 && max !== min) extremes.push(dotAt(max, 'tc-point-max'))\n }\n let last = -1\n if (point === 'last') {\n for (let i = count - 1; i >= 0; i--) {\n if (values[i] !== null) {\n last = i\n break\n }\n }\n }\n\n const content = [\n variant === 'area' && h('defs', null, fadeMask(`${ctx.id}-fade`)),\n h(\n 'g',\n { class: 'tc-series tc-series-1 tc-sparkline' },\n marks,\n extremes,\n last !== -1 && !bars && dotAt(last, 'tc-point-last'),\n ),\n ]\n return { content, interaction }\n}\n\n/**\n * Sparkline: a tiny line, area or bar chart without axes, for stat tiles.\n *\n * ```ts\n * new Chart('#el', { type: sparkline, data: [3, 5, 4, 7, 6], height: 40 })\n * ```\n */\nexport const sparkline: ChartType<SparklineOptions> = {\n name: 'sparkline',\n // The labels too: they come from outside like the values.\n clean: (options) => ({\n ...cleanData(numbers)(options),\n labels: Array.isArray(options.labels) ? options.labels.map(label) : undefined,\n }),\n render: renderSparkline,\n // Decorative by default: opt in with `keyboard: true`.\n keyboard: false,\n}\n"],"mappings":";;;;;;;;;AAyCA,SAAS,gBAAgB,SAA2B,KAAoB;CACtE,MAAM,EACJ,UAAU,QACV,QAAQ,YACR,QAAQ,QACR,UAAU,QACV,cAAc,GACd,OAAO,YACL;CACJ,MAAM,SAAS,QAAQ,KAAK,KAAK,MAAO,KAAK,QAAQ,CAAC,OAAO,SAAS,CAAC,IAAI,OAAO,CAAE;CAEpF,MAAM,QAAQ,OAAO;CAGrB,MAAM,WAFO,UAAU,UAAU,YAAY,WAErB,cAAc,IAAI;CAC1C,MAAM,MAAMA,eAAAA,OAAO,QAAQ,SAAS,CAAC;CACrC,MAAM,OAAOC,eAAAA,UAAU,IAAI,OAAO,IAAI,QAAQ;EAC5C,KAAK,IAAI,MAAM;EACf,OAAO,IAAI,QAAQ;EACnB,QAAQ,IAAI,SAAS;EACrB,MAAM,IAAI,OAAO;CACnB,CAAC;CACD,MAAM,WAAW,YAAY;CAC7B,MAAM,OAAO,QAAQ,QAAQ,YAAY;CAEzC,MAA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|
+
import { n as InsetsInput } from "./layout-CYerDebD.cjs";
|
|
4
4
|
import { t as Curve } from "./path-YeUiOfG8.cjs";
|
|
5
5
|
interface SparklineOptions {
|
|
6
6
|
/** The values; `null` leaves a gap. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as areaPath, r as linePath, t as fadeMask } from "./fade-
|
|
1
|
+
import { n as areaPath, r as linePath, t as fadeMask } from "./fade-CDrQjnDz.js";
|
|
2
2
|
import { r as formatNumber } from "./format-it1kepFG.js";
|
|
3
|
-
import { i as insets,
|
|
4
|
-
import {
|
|
5
|
-
import { t as barPath } from "./bar-
|
|
3
|
+
import { i as insets, r as innerRect, s as round } from "./layout-DqAte3H8.js";
|
|
4
|
+
import { o as labelKey, r as domainOf, s as markerShape, u as pointMark, w as linear } from "./cartesian-COglz544.js";
|
|
5
|
+
import { t as barPath } from "./bar-CgpC2EpX.js";
|
|
6
6
|
import { t as circlePath } from "./circle-YRDaOBpk.js";
|
|
7
7
|
import { t as h } from "./vnode-_EMUqysL.js";
|
|
8
8
|
import { l as numbers, o as label, t as cleanData } from "./clean-CkoQobGv.js";
|
|
@@ -56,7 +56,8 @@ function renderSparkline(options, ctx) {
|
|
|
56
56
|
area,
|
|
57
57
|
items: [item]
|
|
58
58
|
};
|
|
59
|
-
if (value !== null) hit.
|
|
59
|
+
if (value !== null) hit.highlight = {
|
|
60
|
+
kind: "halo",
|
|
60
61
|
d: circlePath(pointRadius + 3),
|
|
61
62
|
x: px,
|
|
62
63
|
y: yOf(value)
|
|
@@ -73,7 +74,6 @@ function renderSparkline(options, ctx) {
|
|
|
73
74
|
return hitFor(place(Math.max(0, Math.min(count - 1, i))));
|
|
74
75
|
}
|
|
75
76
|
};
|
|
76
|
-
ctx.onHitTest(interaction);
|
|
77
77
|
const marks = [];
|
|
78
78
|
if (tristate) {
|
|
79
79
|
const width = Math.max(1, slot - gap);
|
|
@@ -120,15 +120,10 @@ function renderSparkline(options, ctx) {
|
|
|
120
120
|
d: linePath(points, { curve })
|
|
121
121
|
}));
|
|
122
122
|
}
|
|
123
|
+
const shape = markerShape(options);
|
|
123
124
|
const dotAt = (i, cls) => {
|
|
124
125
|
const v = values[i];
|
|
125
|
-
return v == null ? null :
|
|
126
|
-
key: `${cls}-${i}`,
|
|
127
|
-
class: ["tc-point", cls],
|
|
128
|
-
cx: round(xAt(i)),
|
|
129
|
-
cy: round(y(v)),
|
|
130
|
-
r: pointRadius
|
|
131
|
-
});
|
|
126
|
+
return v == null ? null : pointMark(shape, 0, `${cls}-${i}`, ["tc-point", cls], round(xAt(i)), round(y(v)), pointRadius);
|
|
132
127
|
};
|
|
133
128
|
const extremes = [];
|
|
134
129
|
if (markers === "minmax") {
|
|
@@ -149,7 +144,10 @@ function renderSparkline(options, ctx) {
|
|
|
149
144
|
break;
|
|
150
145
|
}
|
|
151
146
|
}
|
|
152
|
-
return
|
|
147
|
+
return {
|
|
148
|
+
content: [variant === "area" && h("defs", null, fadeMask(`${ctx.id}-fade`)), h("g", { class: "tc-series tc-series-1 tc-sparkline" }, marks, extremes, last !== -1 && !bars && dotAt(last, "tc-point-last"))],
|
|
149
|
+
interaction
|
|
150
|
+
};
|
|
153
151
|
}
|
|
154
152
|
/**
|
|
155
153
|
* Sparkline: a tiny line, area or bar chart without axes, for stat tiles.
|
|
@@ -169,4 +167,4 @@ const sparkline = {
|
|
|
169
167
|
};
|
|
170
168
|
export { sparkline as t };
|
|
171
169
|
|
|
172
|
-
//# sourceMappingURL=sparkline-
|
|
170
|
+
//# sourceMappingURL=sparkline-_dxwtdli.js.map
|