@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
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { o as getNumberFormat, r as formatNumber } from "./format-it1kepFG.js";
|
|
2
|
-
import { i as insets,
|
|
2
|
+
import { i as insets, r as innerRect, s as round } from "./layout-DqAte3H8.js";
|
|
3
3
|
import { t as h } from "./vnode-_EMUqysL.js";
|
|
4
4
|
import { n as cleanItems } from "./clean-CkoQobGv.js";
|
|
5
5
|
import { n as keyOf, t as groupAttrs } from "./named-BOiBah6I.js";
|
|
6
|
-
import { n as
|
|
6
|
+
import { n as withSlices, t as slicesLegend } from "./others-DBIGE6jr.js";
|
|
7
7
|
// src/charts/percentage-bar.ts
|
|
8
8
|
/** Height of the chart when neither `height` nor `aspectRatio` is set: a strip. */
|
|
9
9
|
const HEIGHT = 16;
|
|
10
|
-
/** The segments of the data: nine at most by default, the one for the rest included. */
|
|
11
|
-
const group = (options) => groupSlices(options.data, options.maxSlices, options.othersLabel);
|
|
12
10
|
/** The visible segments in their order along the bar, and their sum. */
|
|
13
11
|
function segmentsOf(options, hidden) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
if (options.order === "size") segments.sort((a, b) => Number(a.index >= count) - Number(b.index >= count) || b.value - a.value || a.index - b.index);
|
|
12
|
+
const segments = options.slices.filter((segment) => !hidden.has(keyOf(segment.data)));
|
|
13
|
+
if (options.order === "size") segments.sort((a, b) => Number(!!a.others) - Number(!!b.others) || b.value - a.value || a.index - b.index);
|
|
17
14
|
return {
|
|
18
15
|
segments,
|
|
19
16
|
total: segments.reduce((sum, segment) => sum + segment.value, 0)
|
|
@@ -31,10 +28,12 @@ function renderPercentageBar(options, ctx) {
|
|
|
31
28
|
const length = segment.value / total * area.width;
|
|
32
29
|
const left = position === 0 ? 0 : gap / 2;
|
|
33
30
|
const right = position === drawn.length - 1 ? 0 : gap / 2;
|
|
31
|
+
const boxWidth = Math.max(0, length - left - right);
|
|
32
|
+
const start = offset + left;
|
|
34
33
|
const box = {
|
|
35
|
-
x:
|
|
34
|
+
x: ctx.rtl ? area.x * 2 + area.width - start - boxWidth : start,
|
|
36
35
|
y: area.y,
|
|
37
|
-
width:
|
|
36
|
+
width: boxWidth,
|
|
38
37
|
height: area.height
|
|
39
38
|
};
|
|
40
39
|
offset += length;
|
|
@@ -68,15 +67,15 @@ function renderPercentageBar(options, ctx) {
|
|
|
68
67
|
area,
|
|
69
68
|
items: [item],
|
|
70
69
|
seriesIndex: segment.index,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
y: 0
|
|
70
|
+
highlight: {
|
|
71
|
+
kind: "halo",
|
|
72
|
+
d: `M${n(box.x + 1)},${n(box.y + 1)}h${n(box.width - 2)}v${n(box.height - 2)}h${n(2 - box.width)}Z`
|
|
75
73
|
}
|
|
76
74
|
};
|
|
77
75
|
};
|
|
78
76
|
const interaction = {
|
|
79
77
|
count: drawn.length,
|
|
78
|
+
reversed: ctx.rtl === true,
|
|
80
79
|
hitIndex: (position) => drawn[position] ? hitFor(position) : null,
|
|
81
80
|
hitTest(px, py) {
|
|
82
81
|
if (py < area.y || py > area.y + area.height) return null;
|
|
@@ -84,26 +83,28 @@ function renderPercentageBar(options, ctx) {
|
|
|
84
83
|
return position < 0 ? null : hitFor(position);
|
|
85
84
|
}
|
|
86
85
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
86
|
+
return {
|
|
87
|
+
content: h("g", { class: "tc-percentage-bar" }, drawn.length === 0 && h("rect", {
|
|
88
|
+
key: "track",
|
|
89
|
+
class: "tc-percentage-bar-track",
|
|
90
|
+
x: round(area.x),
|
|
91
|
+
y: round(area.y),
|
|
92
|
+
width: round(area.width),
|
|
93
|
+
height: round(area.height),
|
|
94
|
+
rx: round(Math.min(radius, area.width / 2, area.height / 2))
|
|
95
|
+
}), segments.map((segment) => {
|
|
96
|
+
const box = boxes[drawn.indexOf(segment)];
|
|
97
|
+
return h("g", groupAttrs(segment.data, segment.index), box && h("rect", {
|
|
98
|
+
class: "tc-segment",
|
|
99
|
+
x: round(box.x),
|
|
100
|
+
y: round(box.y),
|
|
101
|
+
width: round(box.width),
|
|
102
|
+
height: round(box.height),
|
|
103
|
+
rx: round(Math.min(radius, box.width / 2, box.height / 2))
|
|
104
|
+
}));
|
|
105
|
+
})),
|
|
106
|
+
interaction
|
|
107
|
+
};
|
|
107
108
|
}
|
|
108
109
|
function percentageBarTable(options, ctx) {
|
|
109
110
|
const { segments, total } = segmentsOf(options, ctx.hidden);
|
|
@@ -147,11 +148,12 @@ const percentageBar = {
|
|
|
147
148
|
height: config.height ?? (config.aspectRatio ? void 0 : HEIGHT)
|
|
148
149
|
};
|
|
149
150
|
},
|
|
151
|
+
prepare: withSlices,
|
|
150
152
|
render: renderPercentageBar,
|
|
151
|
-
legend:
|
|
153
|
+
legend: slicesLegend,
|
|
152
154
|
table: percentageBarTable,
|
|
153
155
|
valueLabels: { marks: "cell" }
|
|
154
156
|
};
|
|
155
157
|
export { percentageBar as t };
|
|
156
158
|
|
|
157
|
-
//# sourceMappingURL=percentage-bar-
|
|
159
|
+
//# sourceMappingURL=percentage-bar-CaInxrL8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"percentage-bar-CaInxrL8.js","names":[],"sources":["../src/charts/percentage-bar.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext, RenderResult, TableContext } from '../chart.ts'\nimport { formatNumber, getNumberFormat, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { type InsetsInput, innerRect, insets, round } from '../layout.ts'\nimport { type ClassValue, h } from '../vnode.ts'\nimport { cleanItems } from './clean.ts'\nimport { groupAttrs, keyOf } from './named.ts'\nimport {\n type Grouped,\n type SliceGrouping,\n slicesLegend,\n type WithSlices,\n withSlices,\n} from './others.ts'\n\n/** One segment of a percentage bar. */\nexport interface PercentageBarSegment {\n name: string\n /** Non-negative value; negative values count as zero. */\n value: number\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 segment group. */\n class?: ClassValue\n /** Start hidden (toggle it back from the legend). */\n hidden?: boolean\n}\n\nexport interface PercentageBarOptions extends SliceGrouping {\n data: readonly PercentageBarSegment[]\n /**\n * Order of the segments along the bar: as in the data (`'data'`, the\n * default) or the largest first (`'size'`). Colors follow the data either\n * way, and Others always comes last.\n */\n order?: 'data' | 'size'\n /** Space between segments in pixels, drawn as surface. Defaults to `2`. */\n gap?: number\n /** Corner radius of the segments. Defaults to `4`. */\n radius?: number\n /** Format of the values (tooltip, table). */\n format?: NumberFormat\n /** Extra space around the bar, in pixels. */\n padding?: InsetsInput\n}\n\n/** Height of the chart when neither `height` nor `aspectRatio` is set: a strip. */\nconst HEIGHT = 16\n\ntype Segment = Grouped<PercentageBarSegment>\n\n/**\n * The chart model of a percentage bar: its options, with the segments of the\n * data (nine at most by default, the one for the rest included).\n */\nexport type PercentageBarModel = WithSlices<PercentageBarOptions>\n\n/** The visible segments in their order along the bar, and their sum. */\nfunction segmentsOf(\n options: PercentageBarModel,\n hidden: ReadonlySet<string>,\n): { segments: Segment[]; total: number } {\n const segments = options.slices.filter((segment) => !hidden.has(keyOf(segment.data)))\n if (options.order === 'size') {\n // (Others stays last, whatever its size.)\n segments.sort(\n (a, b) => Number(!!a.others) - Number(!!b.others) || b.value - a.value || a.index - b.index,\n )\n }\n return { segments, total: segments.reduce((sum, segment) => sum + segment.value, 0) }\n}\n\nfunction renderPercentageBar(options: PercentageBarModel, ctx: RenderContext): RenderResult {\n const { width, height, locale } = ctx\n const gap = Math.max(0, options.gap ?? 2)\n const radius = Math.max(0, options.radius ?? 4)\n const area = innerRect(width, height, insets(options.padding, 0))\n const { segments, total } = segmentsOf(options, ctx.hidden)\n const drawn = segments.filter((segment) => segment.value > 0)\n\n // Every segment gives up half a gap on each side but the ends of the bar.\n let offset = area.x\n const boxes = drawn.map((segment, position) => {\n const length = (segment.value / total) * area.width\n const left = position === 0 ? 0 : gap / 2\n const right = position === drawn.length - 1 ? 0 : gap / 2\n const boxWidth = Math.max(0, length - left - right)\n const start = offset + left\n const box = {\n // Right to left, the bar starts from the right: every segment takes its mirror place.\n x: ctx.rtl ? area.x * 2 + area.width - start - boxWidth : start,\n y: area.y,\n width: boxWidth,\n height: area.height,\n }\n offset += length\n return box\n })\n\n const value = formatNumber(options.format, locale)\n const share = getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 })\n const hitFor = (position: number): Hit => {\n const segment = drawn[position] as Segment\n const box = boxes[position] as (typeof boxes)[number]\n const x = box.x + box.width / 2\n const item: HitItem = {\n name: segment.data.name,\n seriesIndex: segment.index,\n value: segment.value,\n text: `${value(segment.value)} (${share.format(segment.value / total)})`,\n x,\n y: box.y + box.height / 2,\n box,\n }\n if (segment.data.color) item.color = segment.data.color\n const n = round\n return {\n index: position,\n label: segment.data.name,\n title: '',\n x,\n area,\n items: [item],\n seriesIndex: segment.index,\n // A ring just inside the hovered segment.\n highlight: {\n kind: 'halo',\n d: `M${n(box.x + 1)},${n(box.y + 1)}h${n(box.width - 2)}v${n(box.height - 2)}h${n(2 - box.width)}Z`,\n },\n }\n }\n\n const interaction: Interaction = {\n count: drawn.length,\n reversed: ctx.rtl === true,\n hitIndex: (position) => (drawn[position] ? hitFor(position) : null),\n hitTest(px, py) {\n if (py < area.y || py > area.y + area.height) return null\n const position = boxes.findIndex(\n (box) => px >= box.x - gap / 2 && px <= box.x + box.width + gap / 2,\n )\n return position < 0 ? null : hitFor(position)\n },\n }\n\n const content = h(\n 'g',\n { class: 'tc-percentage-bar' },\n // Empty: the track alone, so the chart keeps its place.\n drawn.length === 0 &&\n h('rect', {\n key: 'track',\n class: 'tc-percentage-bar-track',\n x: round(area.x),\n y: round(area.y),\n width: round(area.width),\n height: round(area.height),\n rx: round(Math.min(radius, area.width / 2, area.height / 2)),\n }),\n segments.map((segment) => {\n const box = boxes[drawn.indexOf(segment)]\n return h(\n 'g',\n groupAttrs(segment.data, segment.index),\n box &&\n h('rect', {\n class: 'tc-segment',\n x: round(box.x),\n y: round(box.y),\n width: round(box.width),\n height: round(box.height),\n rx: round(Math.min(radius, box.width / 2, box.height / 2)),\n }),\n )\n }),\n )\n return { content, interaction }\n}\n\nfunction percentageBarTable(options: PercentageBarModel, ctx: TableContext): DataTable {\n const { segments, total } = segmentsOf(options, ctx.hidden)\n const value = formatNumber(options.format, ctx.locale)\n const share = getNumberFormat(ctx.locale, { style: 'percent', maximumFractionDigits: 1 })\n return {\n columns: ['', 'Value', 'Share'],\n rows: segments.map((segment) => [\n segment.data.name,\n value(segment.value),\n share.format(total > 0 ? segment.value / total : 0),\n ]),\n }\n}\n\n/**\n * Percentage bar: parts of a whole as segments of one horizontal bar, each as\n * wide as its share (a donut's ring unrolled, for a strip under a number).\n * The chart is a strip 16 pixels tall unless `height` or `aspectRatio` is set.\n *\n * ```ts\n * new Chart('#el', {\n * type: percentageBar,\n * data: [{ name: 'Paid', value: 62 }, { name: 'Open', value: 27 }, { name: 'Overdue', value: 11 }],\n * })\n * ```\n */\nexport const percentageBar: ChartType<PercentageBarOptions, PercentageBarModel> = {\n name: 'percentage-bar',\n // (The options come with the whole config: its size is defaulted here.)\n clean: (options) => {\n const config = options as PercentageBarOptions & { height?: unknown; aspectRatio?: unknown }\n return {\n ...config,\n data: cleanItems(config.data),\n height: config.height ?? (config.aspectRatio ? undefined : HEIGHT),\n }\n },\n prepare: withSlices,\n render: renderPercentageBar,\n legend: slicesLegend,\n table: percentageBarTable,\n valueLabels: { marks: 'cell' },\n}\n"],"mappings":";;;;;;;;AAqDA,MAAM,SAAS;;AAWf,SAAS,WACP,SACA,QACwC;CACxC,MAAM,WAAW,QAAQ,OAAO,QAAQ,YAAY,CAAC,OAAO,IAAI,MAAM,QAAQ,IAAI,CAAC,CAAC;CACpF,IAAI,QAAQ,UAAU,QAEpB,SAAS,MACN,GAAG,MAAM,OAAO,CAAC,CAAC,EAAE,MAAM,IAAI,OAAO,CAAC,CAAC,EAAE,MAAM,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,KACxF;CAEF,OAAO;EAAE;EAAU,OAAO,SAAS,QAAQ,KAAK,YAAY,MAAM,QAAQ,OAAO,CAAC;CAAE;AACtF;AAEA,SAAS,oBAAoB,SAA6B,KAAkC;CAC1F,MAAM,EAAE,OAAO,QAAQ,WAAW;CAClC,MAAM,MAAM,KAAK,IAAI,GAAG,QAAQ,OAAO,CAAC;CACxC,MAAM,SAAS,KAAK,IAAI,GAAG,QAAQ,UAAU,CAAC;CAC9C,MAAM,OAAO,UAAU,OAAO,QAAQ,OAAO,QAAQ,SAAS,CAAC,CAAC;CAChE,MAAM,EAAE,UAAU,UAAU,WAAW,S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GAC3D,CAAC,CACL;EACF,CAAC,CAEY;EAAG;CAAY;AAChC;AAEA,SAAS,mBAAmB,SAA6B,KAA8B;CACrF,MAAM,EAAE,UAAU,UAAU,WAAW,SAAS,IAAI,MAAM;CAC1D,MAAM,QAAQ,aAAa,QAAQ,QAAQ,IAAI,MAAM;CACrD,MAAM,QAAQ,gBAAgB,IAAI,QAAQ;EAAE,OAAO;EAAW,uBAAuB;CAAE,CAAC;CACxF,OAAO;EACL,SAAS;GAAC;GAAI;GAAS;EAAO;EAC9B,MAAM,SAAS,KAAK,YAAY;GAC9B,QAAQ,KAAK;GACb,MAAM,QAAQ,KAAK;GACnB,MAAM,OAAO,QAAQ,IAAI,QAAQ,QAAQ,QAAQ,CAAC;EACpD,CAAC;CACH;AACF;;;;;;;;;;;;;AAcA,MAAa,gBAAqE;CAChF,MAAM;CAEN,QAAQ,YAAY;EAClB,MAAM,SAAS;EACf,OAAO;GACL,GAAG;GACH,MAAM,WAAW,OAAO,IAAI;GAC5B,QAAQ,OAAO,WAAW,OAAO,cAAc,KAAA,IAAY;EAC7D;CACF;CACA,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,aAAa,EAAE,OAAO,OAAO;AAC/B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as ChartType } from "./chart-Dz4geQZy.cjs";
|
|
2
2
|
import { c as NumberFormat } from "./time-B4oxWHQI.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { n as InsetsInput } from "./layout-CYerDebD.cjs";
|
|
4
4
|
import { a as ClassValue } from "./vnode-Du2cC8Fm.cjs";
|
|
5
|
+
import { n as WithSlices, t as SliceGrouping } from "./others-CuNdpvjd.cjs";
|
|
5
6
|
/** One segment of a percentage bar. */
|
|
6
7
|
interface PercentageBarSegment {
|
|
7
8
|
name: string;
|
|
@@ -19,24 +20,14 @@ interface PercentageBarSegment {
|
|
|
19
20
|
/** Start hidden (toggle it back from the legend). */
|
|
20
21
|
hidden?: boolean;
|
|
21
22
|
}
|
|
22
|
-
interface PercentageBarOptions {
|
|
23
|
+
interface PercentageBarOptions extends SliceGrouping {
|
|
23
24
|
data: readonly PercentageBarSegment[];
|
|
24
25
|
/**
|
|
25
26
|
* Order of the segments along the bar: as in the data (`'data'`, the
|
|
26
27
|
* default) or the largest first (`'size'`). Colors follow the data either
|
|
27
|
-
* way, and
|
|
28
|
+
* way, and Others always comes last.
|
|
28
29
|
*/
|
|
29
30
|
order?: "data" | "size";
|
|
30
|
-
/**
|
|
31
|
-
* The most segments drawn, the one for the rest included: with more entries
|
|
32
|
-
* than that, the largest `maxSlices - 1` keep a segment of their own and
|
|
33
|
-
* the others share one, named by `othersLabel`, at the end of the bar.
|
|
34
|
-
* Defaults to `9` (the eight palette colors and the rest); `0` never
|
|
35
|
-
* groups.
|
|
36
|
-
*/
|
|
37
|
-
maxSlices?: number;
|
|
38
|
-
/** Name of the segment that groups the rest. Defaults to `'Others'`. */
|
|
39
|
-
othersLabel?: string;
|
|
40
31
|
/** Space between segments in pixels, drawn as surface. Defaults to `2`. */
|
|
41
32
|
gap?: number;
|
|
42
33
|
/** Corner radius of the segments. Defaults to `4`. */
|
|
@@ -46,6 +37,11 @@ interface PercentageBarOptions {
|
|
|
46
37
|
/** Extra space around the bar, in pixels. */
|
|
47
38
|
padding?: InsetsInput;
|
|
48
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* The chart model of a percentage bar: its options, with the segments of the
|
|
42
|
+
* data (nine at most by default, the one for the rest included).
|
|
43
|
+
*/
|
|
44
|
+
type PercentageBarModel = WithSlices<PercentageBarOptions>;
|
|
49
45
|
/**
|
|
50
46
|
* Percentage bar: parts of a whole as segments of one horizontal bar, each as
|
|
51
47
|
* wide as its share (a donut's ring unrolled, for a strip under a number).
|
|
@@ -58,5 +54,5 @@ interface PercentageBarOptions {
|
|
|
58
54
|
* })
|
|
59
55
|
* ```
|
|
60
56
|
*/
|
|
61
|
-
declare const percentageBar: ChartType<PercentageBarOptions>;
|
|
57
|
+
declare const percentageBar: ChartType<PercentageBarOptions, PercentageBarModel>;
|
|
62
58
|
export { PercentageBarSegment as n, percentageBar as r, PercentageBarOptions as t };
|
package/dist/percentage-bar.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_percentage_bar = require("./percentage-bar-
|
|
2
|
+
const require_percentage_bar = require("./percentage-bar-BChkTRoz.cjs");
|
|
3
3
|
exports.percentageBar = require_percentage_bar.percentageBar;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Standalone entry: `import { percentageBar } from '@tabler/charts/percentage-bar'`. */
|
|
2
|
-
import { n as PercentageBarSegment, r as percentageBar, t as PercentageBarOptions } from "./percentage-bar-
|
|
2
|
+
import { n as PercentageBarSegment, r as percentageBar, t as PercentageBarOptions } from "./percentage-bar-UZHCRvlK.cjs";
|
|
3
3
|
export { type PercentageBarOptions, type PercentageBarSegment, percentageBar };
|
package/dist/percentage-bar.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Standalone entry: `import { percentageBar } from '@tabler/charts/percentage-bar'`. */
|
|
2
|
-
import { n as PercentageBarSegment, r as percentageBar, t as PercentageBarOptions } from "./percentage-bar-
|
|
2
|
+
import { n as PercentageBarSegment, r as percentageBar, t as PercentageBarOptions } from "./percentage-bar-CSAbzDOn.js";
|
|
3
3
|
export { type PercentageBarOptions, type PercentageBarSegment, percentageBar };
|
package/dist/percentage-bar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as percentageBar } from "./percentage-bar-
|
|
1
|
+
export { t as percentageBar } from "./percentage-bar-CaInxrL8.js";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as ChartType } from "./chart-Dz4geQZy.cjs";
|
|
2
2
|
import { c as NumberFormat } from "./time-B4oxWHQI.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { n as InsetsInput } from "./layout-CYerDebD.cjs";
|
|
4
4
|
import { a as ClassValue } from "./vnode-Du2cC8Fm.cjs";
|
|
5
|
+
import { n as WithSlices, t as SliceGrouping } from "./others-CuNdpvjd.cjs";
|
|
6
|
+
import { t as SliceLabelOptions } from "./slice-labels-1TBq7p3q.cjs";
|
|
5
7
|
/** One slice of a pie or donut. */
|
|
6
8
|
interface PieSlice {
|
|
7
9
|
name: string;
|
|
@@ -19,17 +21,8 @@ interface PieSlice {
|
|
|
19
21
|
/** Start hidden (toggle it back from the legend). */
|
|
20
22
|
hidden?: boolean;
|
|
21
23
|
}
|
|
22
|
-
interface PieOptions {
|
|
24
|
+
interface PieOptions extends SliceGrouping {
|
|
23
25
|
data: readonly PieSlice[];
|
|
24
|
-
/**
|
|
25
|
-
* The most slices drawn, the one for the rest included: with more entries
|
|
26
|
-
* than that, the largest `maxSlices - 1` keep a slice of their own and the
|
|
27
|
-
* others share one, named by `othersLabel`, after them. Defaults to `9`
|
|
28
|
-
* (the eight palette colors and the rest); `0` never groups.
|
|
29
|
-
*/
|
|
30
|
-
maxSlices?: number;
|
|
31
|
-
/** Name of the slice that groups the rest. Defaults to `'Others'`. */
|
|
32
|
-
othersLabel?: string;
|
|
33
26
|
/** Hole size relative to the radius, `0…0.95`. Defaults to `0` (`0.62` for `donut`). */
|
|
34
27
|
innerRadius?: number;
|
|
35
28
|
/** Gap between slices in pixels, drawn as surface. Defaults to `2`. */
|
|
@@ -50,7 +43,17 @@ interface PieOptions {
|
|
|
50
43
|
};
|
|
51
44
|
/** Extra space around the pie, in pixels. */
|
|
52
45
|
padding?: InsetsInput;
|
|
46
|
+
/**
|
|
47
|
+
* Name every slice beside the chart, with its share, joined to the slice
|
|
48
|
+
* by a line: `true`, or `{ value: 'value' }` for the values and
|
|
49
|
+
* `{ value: false }` for the names alone. The pie gets smaller to leave the
|
|
50
|
+
* labels room; a chart too small for them goes without. Needs
|
|
51
|
+
* `@tabler/charts/slice-labels` on the core.
|
|
52
|
+
*/
|
|
53
|
+
labels?: boolean | SliceLabelOptions;
|
|
53
54
|
}
|
|
55
|
+
/** The chart model of a pie: its options, with the slices as drawn (the rest grouped). */
|
|
56
|
+
type PieModel = WithSlices<PieOptions>;
|
|
54
57
|
/**
|
|
55
58
|
* Pie chart: parts of a whole as slices, in data order, clockwise from the top.
|
|
56
59
|
*
|
|
@@ -58,7 +61,7 @@ interface PieOptions {
|
|
|
58
61
|
* new Chart('#el', { type: pie, data: [{ name: 'Direct', value: 42 }, { name: 'Search', value: 31 }] })
|
|
59
62
|
* ```
|
|
60
63
|
*/
|
|
61
|
-
declare const pie: ChartType<PieOptions>;
|
|
64
|
+
declare const pie: ChartType<PieOptions, PieModel>;
|
|
62
65
|
/** Donut chart: a pie with a hole showing the total (or your own `center`). */
|
|
63
|
-
declare const donut: ChartType<PieOptions>;
|
|
66
|
+
declare const donut: ChartType<PieOptions, PieModel>;
|
|
64
67
|
export { pie as i, PieSlice as n, donut as r, PieOptions as t };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as feature } from "./features-B55rwpQC.js";
|
|
2
2
|
import { o as getNumberFormat, r as formatNumber } from "./format-it1kepFG.js";
|
|
3
|
-
import { i as insets, r as innerRect } from "./layout-
|
|
3
|
+
import { i as insets, r as innerRect } from "./layout-DqAte3H8.js";
|
|
4
4
|
import { n as sweep, t as arcNode } from "./sweep-BpRPlhs6.js";
|
|
5
5
|
import { i as padAngleForGap, n as arcCentroid, r as arcPathStable, t as DEG } from "./arc-B3V5IR0w.js";
|
|
6
6
|
import { t as h } from "./vnode-_EMUqysL.js";
|
|
7
7
|
import { n as cleanItems, t as cleanData } from "./clean-CkoQobGv.js";
|
|
8
8
|
import { n as keyOf, t as groupAttrs } from "./named-BOiBah6I.js";
|
|
9
|
-
import { n as
|
|
9
|
+
import { n as withSlices, t as slicesLegend } from "./others-DBIGE6jr.js";
|
|
10
10
|
// src/charts/pie.ts
|
|
11
11
|
/** Angles of the visible slices, clockwise from `startAngle`. */
|
|
12
|
-
function layoutSlices(
|
|
13
|
-
const visible =
|
|
12
|
+
function layoutSlices(model, hidden) {
|
|
13
|
+
const visible = model.slices.filter((slice) => !hidden.has(keyOf(slice.data)));
|
|
14
14
|
const total = visible.reduce((sum, slice) => sum + slice.value, 0);
|
|
15
|
-
let angle = (
|
|
15
|
+
let angle = (model.startAngle ?? 0) * DEG;
|
|
16
16
|
return {
|
|
17
17
|
slices: visible.map((slice) => {
|
|
18
18
|
const sweep = total > 0 ? slice.value / total * Math.PI * 2 : 0;
|
|
@@ -30,21 +30,31 @@ function layoutSlices(options, hidden) {
|
|
|
30
30
|
function renderPie(options, ctx, defaults) {
|
|
31
31
|
const { width, height, locale } = ctx;
|
|
32
32
|
const gap = options.gap ?? 2;
|
|
33
|
-
const area = innerRect(width, height, insets(options.padding, 0));
|
|
34
|
-
const outer = Math.max(0, Math.min(area.width, area.height) / 2 - 8);
|
|
35
|
-
const inner = outer * Math.min(.95, Math.max(0, options.innerRadius ?? defaults.inner));
|
|
36
|
-
const cornerRadius = options.cornerRadius ?? defaults.corner;
|
|
37
|
-
const cx = area.x + area.width / 2;
|
|
38
|
-
const cy = area.y + area.height / 2;
|
|
39
33
|
const { slices, total } = layoutSlices(options, ctx.hidden);
|
|
40
34
|
const drawn = slices.filter((slice) => slice.value > 0);
|
|
41
|
-
const strokeGap = inner === 0 && drawn.length > 1 ? gap : 0;
|
|
42
|
-
const padAngle = inner > 0 && drawn.length > 1 ? padAngleForGap(gap, inner, outer) : 0;
|
|
43
35
|
const value = formatNumber(options.format, locale);
|
|
44
36
|
const share = getNumberFormat(locale, {
|
|
45
37
|
style: "percent",
|
|
46
38
|
maximumFractionDigits: 1
|
|
47
39
|
});
|
|
40
|
+
const frame = innerRect(width, height, insets(options.padding, 0));
|
|
41
|
+
const shown = options.labels === true ? "share" : options.labels ? options.labels.value : false;
|
|
42
|
+
const labelled = options.labels ? feature("slice-labels")(drawn.map((slice) => ({
|
|
43
|
+
key: keyOf(slice.data),
|
|
44
|
+
index: slice.index,
|
|
45
|
+
name: slice.data.name,
|
|
46
|
+
value: shown === false ? "" : shown === "value" ? value(slice.value) : share.format(slice.value / total),
|
|
47
|
+
angle: (slice.startAngle + slice.endAngle) / 2,
|
|
48
|
+
weight: slice.value
|
|
49
|
+
})), frame, ctx.fontSize) : null;
|
|
50
|
+
const area = labelled?.area ?? frame;
|
|
51
|
+
const outer = Math.max(0, Math.min(area.width, area.height) / 2 - 8);
|
|
52
|
+
const inner = outer * Math.min(.95, Math.max(0, options.innerRadius ?? defaults.inner));
|
|
53
|
+
const cornerRadius = options.cornerRadius ?? defaults.corner;
|
|
54
|
+
const cx = area.x + area.width / 2;
|
|
55
|
+
const cy = area.y + area.height / 2;
|
|
56
|
+
const strokeGap = inner === 0 && drawn.length > 1 ? gap : 0;
|
|
57
|
+
const padAngle = inner > 0 && drawn.length > 1 ? padAngleForGap(gap, inner, outer) : 0;
|
|
48
58
|
const geometry = (slice, r0 = inner, r1 = outer) => ({
|
|
49
59
|
innerRadius: r0,
|
|
50
60
|
outerRadius: r1,
|
|
@@ -77,7 +87,8 @@ function renderPie(options, ctx, defaults) {
|
|
|
77
87
|
},
|
|
78
88
|
items: [item],
|
|
79
89
|
seriesIndex: slice.index,
|
|
80
|
-
|
|
90
|
+
highlight: {
|
|
91
|
+
kind: "halo",
|
|
81
92
|
d: arcPathStable({
|
|
82
93
|
...geometry(slice, outer + 2, outer + 6),
|
|
83
94
|
cornerRadius: 2
|
|
@@ -106,42 +117,48 @@ function renderPie(options, ctx, defaults) {
|
|
|
106
117
|
return position === -1 ? null : hitFor(drawn[position], position);
|
|
107
118
|
}
|
|
108
119
|
};
|
|
109
|
-
ctx.onHitTest(interaction);
|
|
110
120
|
const groups = slices.map((slice) => h("g", groupAttrs(slice.data, slice.index), arcNode("tc-slice", geometry(slice))));
|
|
111
121
|
const center = options.center;
|
|
112
122
|
const showCenter = inner > 0 && center !== false;
|
|
113
123
|
const centerValue = showCenter ? center?.value ?? value(total) : "";
|
|
114
124
|
const centerLabel = showCenter ? center?.label : void 0;
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
125
|
+
return {
|
|
126
|
+
content: [
|
|
127
|
+
h("g", {
|
|
128
|
+
class: "tc-pie",
|
|
129
|
+
style: `transform:translate(${cx}px,${cy}px)`
|
|
130
|
+
}, total === 0 && h("path", {
|
|
131
|
+
class: "tc-pie-track",
|
|
132
|
+
d: arcPathStable({
|
|
133
|
+
innerRadius: inner,
|
|
134
|
+
outerRadius: outer,
|
|
135
|
+
startAngle: 0,
|
|
136
|
+
endAngle: Math.PI * 2
|
|
137
|
+
})
|
|
138
|
+
}), h("g", {
|
|
139
|
+
class: "tc-pie-slices",
|
|
140
|
+
style: strokeGap > 0 ? `--tc-pie-gap:${strokeGap}px` : void 0
|
|
141
|
+
}, groups)),
|
|
142
|
+
labelled?.layer(cx, cy, outer),
|
|
143
|
+
showCenter && h("g", {
|
|
144
|
+
class: "tc-pie-center",
|
|
145
|
+
"aria-hidden": "true"
|
|
146
|
+
}, h("text", {
|
|
147
|
+
class: "tc-pie-value",
|
|
148
|
+
x: cx,
|
|
149
|
+
y: cy,
|
|
150
|
+
dy: centerLabel ? "0" : "0.35em",
|
|
151
|
+
"text-anchor": "middle"
|
|
152
|
+
}, centerValue), centerLabel && h("text", {
|
|
153
|
+
class: "tc-pie-label",
|
|
154
|
+
x: cx,
|
|
155
|
+
y: cy,
|
|
156
|
+
dy: "1.6em",
|
|
157
|
+
"text-anchor": "middle"
|
|
158
|
+
}, centerLabel))
|
|
159
|
+
],
|
|
160
|
+
interaction
|
|
161
|
+
};
|
|
145
162
|
}
|
|
146
163
|
function pieTable(options, ctx) {
|
|
147
164
|
const { slices, total } = layoutSlices(options, ctx.hidden);
|
|
@@ -167,11 +184,10 @@ function pieType(name, defaults) {
|
|
|
167
184
|
return {
|
|
168
185
|
name,
|
|
169
186
|
clean: cleanData(cleanItems),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
legend: (options) => groupLegend(groupSlices(options.data, options.maxSlices, options.othersLabel)),
|
|
187
|
+
prepare: withSlices,
|
|
188
|
+
render: (options, ctx) => renderPie(options, ctx, defaults),
|
|
189
|
+
sweep,
|
|
190
|
+
legend: slicesLegend,
|
|
175
191
|
table: pieTable,
|
|
176
192
|
valueLabels: { marks: "slice" }
|
|
177
193
|
};
|
|
@@ -194,4 +210,4 @@ const donut = pieType("donut", {
|
|
|
194
210
|
});
|
|
195
211
|
export { pie as n, donut as t };
|
|
196
212
|
|
|
197
|
-
//# sourceMappingURL=pie-
|
|
213
|
+
//# sourceMappingURL=pie-Ch6Bx0ih.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-Ch6Bx0ih.js","names":[],"sources":["../src/charts/pie.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext, RenderResult, TableContext } from '../chart.ts'\nimport { feature } from '../features.ts'\nimport { formatNumber, getNumberFormat, type NumberFormat } from '../format.ts'\nimport type { Hit, HitItem, Interaction } from '../interaction.ts'\nimport { type InsetsInput, innerRect, insets } from '../layout.ts'\nimport { arcNode, sweep } from '../render/sweep.ts'\nimport { arcCentroid, arcPathStable, DEG, HALO, padAngleForGap } from '../shapes/arc.ts'\nimport { type ClassValue, h } from '../vnode.ts'\nimport { cleanData, cleanItems } from './clean.ts'\nimport { groupAttrs, keyOf } from './named.ts'\nimport { type SliceGrouping, slicesLegend, type WithSlices, withSlices } from './others.ts'\nimport type { SliceLabelOptions } from './slice-labels.ts'\n\n/** One slice of a pie or donut. */\nexport interface PieSlice {\n name: string\n /** Non-negative value; negative values count as zero. */\n value: number\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 slice group. */\n class?: ClassValue\n /** Start hidden (toggle it back from the legend). */\n hidden?: boolean\n}\n\nexport interface PieOptions extends SliceGrouping {\n data: readonly PieSlice[]\n /** Hole size relative to the radius, `0…0.95`. Defaults to `0` (`0.62` for `donut`). */\n innerRadius?: number\n /** Gap between slices in pixels, drawn as surface. Defaults to `2`. */\n gap?: number\n /** Corner radius of the slices. Defaults to `0` (`4` for `donut`). */\n cornerRadius?: number\n /** Where the first slice starts, in degrees clockwise from 12 o'clock. Defaults to `0`. */\n startAngle?: number\n /** Format of the values (tooltip, table, donut total). */\n format?: NumberFormat\n /**\n * Text in the donut hole: the total by default; `false` hides it, or give\n * your own `value` / `label`.\n */\n center?: false | { value?: string; label?: string }\n /** Extra space around the pie, in pixels. */\n padding?: InsetsInput\n /**\n * Name every slice beside the chart, with its share, joined to the slice\n * by a line: `true`, or `{ value: 'value' }` for the values and\n * `{ value: false }` for the names alone. The pie gets smaller to leave the\n * labels room; a chart too small for them goes without. Needs\n * `@tabler/charts/slice-labels` on the core.\n */\n labels?: boolean | SliceLabelOptions\n}\n\n/** The chart model of a pie: its options, with the slices as drawn (the rest grouped). */\nexport type PieModel = WithSlices<PieOptions>\n\ninterface Slice {\n data: PieSlice\n index: number\n value: number\n startAngle: number\n endAngle: number\n}\n\n/** Angles of the visible slices, clockwise from `startAngle`. */\nfunction layoutSlices(\n model: PieModel,\n hidden: ReadonlySet<string>,\n): { slices: Slice[]; total: number } {\n const visible = model.slices.filter((slice) => !hidden.has(keyOf(slice.data)))\n const total = visible.reduce((sum, slice) => sum + slice.value, 0)\n let angle = (model.startAngle ?? 0) * DEG\n const slices = visible.map((slice) => {\n const sweep = total > 0 ? (slice.value / total) * Math.PI * 2 : 0\n const out: Slice = { ...slice, startAngle: angle, endAngle: angle + sweep }\n angle += sweep\n return out\n })\n return { slices, total }\n}\n\nfunction renderPie(\n options: PieModel,\n ctx: RenderContext,\n defaults: { inner: number; corner: number },\n) {\n const { width, height, locale } = ctx\n const gap = options.gap ?? 2\n const { slices, total } = layoutSlices(options, ctx.hidden)\n const drawn = slices.filter((slice) => slice.value > 0)\n const value = formatNumber(options.format, locale)\n const share = getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 })\n const frame = innerRect(width, height, insets(options.padding, 0))\n const shown = options.labels === true ? 'share' : options.labels ? options.labels.value : false\n const labelled = options.labels\n ? feature('slice-labels')(\n drawn.map((slice) => ({\n key: keyOf(slice.data),\n index: slice.index,\n name: slice.data.name,\n value:\n shown === false\n ? ''\n : shown === 'value'\n ? value(slice.value)\n : share.format(slice.value / total),\n angle: (slice.startAngle + slice.endAngle) / 2,\n weight: slice.value,\n })),\n frame,\n ctx.fontSize,\n )\n : null\n const area = labelled?.area ?? frame\n const outer = Math.max(0, Math.min(area.width, area.height) / 2 - HALO)\n const ratio = Math.min(0.95, Math.max(0, options.innerRadius ?? defaults.inner))\n const inner = outer * ratio\n const cornerRadius = options.cornerRadius ?? defaults.corner\n const cx = area.x + area.width / 2\n const cy = area.y + area.height / 2\n // A single slice is a full ring: no gap to cut.\n // Rings get a pad angle, which keeps a constant gap width along the whole\n // edge. In a full pie every slice meets at the center, so a pad angle would\n // widen into a wedge: the gap is a surface-colored stroke instead.\n const strokeGap = inner === 0 && drawn.length > 1 ? gap : 0\n const padAngle = inner > 0 && drawn.length > 1 ? padAngleForGap(gap, inner, outer) : 0\n\n const geometry = (slice: Slice, r0 = inner, r1 = outer) => ({\n innerRadius: r0,\n outerRadius: r1,\n startAngle: slice.startAngle,\n endAngle: slice.endAngle,\n padAngle,\n cornerRadius,\n })\n\n const hitFor = (slice: Slice, position: number): Hit => {\n const [x, y] = arcCentroid(geometry(slice))\n const item: HitItem = {\n name: slice.data.name,\n seriesIndex: slice.index,\n value: slice.value,\n text: `${value(slice.value)} (${share.format(total > 0 ? slice.value / total : 0)})`,\n x: cx + x,\n y: cy + y,\n }\n if (slice.data.color) item.color = slice.data.color\n return {\n index: position,\n label: slice.data.name,\n title: '',\n x: cx + x,\n area: { x: cx - outer, y: cy - outer, width: outer * 2, height: outer * 2 },\n items: [item],\n seriesIndex: slice.index,\n // A thin halo just outside the slice.\n highlight: {\n kind: 'halo',\n d: arcPathStable({ ...geometry(slice, outer + 2, outer + 6), cornerRadius: 2 }),\n x: cx,\n y: cy,\n },\n }\n }\n\n const interaction: Interaction = {\n count: drawn.length,\n hitIndex: (position) => {\n const slice = drawn[position]\n return slice ? hitFor(slice, position) : null\n },\n hitTest(px, py) {\n const dx = px - cx\n const dy = py - cy\n const r = Math.hypot(dx, dy)\n if (r < inner - 2 || r > outer + HALO) return null\n const start = (options.startAngle ?? 0) * DEG\n const turn = Math.PI * 2\n // Clockwise angle from 12 o'clock, normalized into [start, start + turn).\n let angle = Math.atan2(dx, -dy)\n angle = start + ((((angle - start) % turn) + turn) % turn)\n const position = drawn.findIndex((s) => angle >= s.startAngle && angle < s.endAngle)\n return position === -1 ? null : hitFor(drawn[position] as Slice, position)\n },\n }\n\n const groups = slices.map((slice) =>\n h(\n 'g',\n groupAttrs(slice.data, slice.index),\n // The path keeps its arc, so new data sweeps slices around the center\n // (see `sweep`). An empty slice keeps its path, a line with no area in\n // the gap between its neighbors, to grow from there.\n arcNode('tc-slice', geometry(slice)),\n ),\n )\n\n const center = options.center\n const showCenter = inner > 0 && center !== false\n const centerValue = showCenter ? (center?.value ?? value(total)) : ''\n const centerLabel = showCenter ? center?.label : undefined\n\n const content = [\n h(\n 'g',\n { class: 'tc-pie', style: `transform:translate(${cx}px,${cy}px)` },\n total === 0 &&\n h('path', {\n class: 'tc-pie-track',\n d: arcPathStable({\n innerRadius: inner,\n outerRadius: outer,\n startAngle: 0,\n endAngle: Math.PI * 2,\n }),\n }),\n h(\n 'g',\n {\n class: 'tc-pie-slices',\n style: strokeGap > 0 ? `--tc-pie-gap:${strokeGap}px` : undefined,\n },\n groups,\n ),\n ),\n labelled?.layer(cx, cy, outer),\n showCenter &&\n h(\n 'g',\n { class: 'tc-pie-center', 'aria-hidden': 'true' },\n h(\n 'text',\n {\n class: 'tc-pie-value',\n x: cx,\n y: cy,\n dy: centerLabel ? '0' : '0.35em',\n 'text-anchor': 'middle',\n },\n centerValue,\n ),\n centerLabel &&\n h(\n 'text',\n { class: 'tc-pie-label', x: cx, y: cy, dy: '1.6em', 'text-anchor': 'middle' },\n centerLabel,\n ),\n ),\n ]\n return { content, interaction }\n}\n\nfunction pieTable(options: PieModel, ctx: TableContext): DataTable {\n const { slices, total } = layoutSlices(options, ctx.hidden)\n const value = formatNumber(options.format, ctx.locale)\n const share = getNumberFormat(ctx.locale, { style: 'percent', maximumFractionDigits: 1 })\n return {\n columns: ['', 'Value', 'Share'],\n rows: slices.map((slice) => [\n slice.data.name,\n value(slice.value),\n share.format(total > 0 ? slice.value / total : 0),\n ]),\n }\n}\n\nfunction pieType(\n name: string,\n defaults: { inner: number; corner: number },\n): ChartType<PieOptions, PieModel> {\n return {\n name,\n clean: cleanData(cleanItems),\n prepare: withSlices,\n render: (options, ctx): RenderResult => renderPie(options, ctx, defaults),\n sweep,\n legend: slicesLegend,\n table: pieTable,\n valueLabels: { marks: 'slice' },\n }\n}\n\n/**\n * Pie chart: parts of a whole as slices, in data order, clockwise from the top.\n *\n * ```ts\n * new Chart('#el', { type: pie, data: [{ name: 'Direct', value: 42 }, { name: 'Search', value: 31 }] })\n * ```\n */\nexport const pie: ChartType<PieOptions, PieModel> = pieType('pie', { inner: 0, corner: 0 })\n\n/** Donut chart: a pie with a hole showing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