@tabler/charts 0.2.0 → 0.3.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 +74 -4
- package/dist/{annotations-D0YQ0IoA.js → annotations-BQ8l-qHs.js} +3 -3
- package/dist/{annotations-D0YQ0IoA.js.map → annotations-BQ8l-qHs.js.map} +1 -1
- package/dist/{annotations-DdRdeBUB.cjs → annotations-CpCWA29b.cjs} +3 -3
- package/dist/{annotations-DdRdeBUB.cjs.map → annotations-CpCWA29b.cjs.map} +1 -1
- package/dist/annotations.cjs +2 -2
- package/dist/annotations.js +2 -2
- package/dist/{area-d11XePuw.d.ts → area-DEFQm_SQ.d.ts} +2 -2
- package/dist/{area-4eRs3c0K.cjs → area-DYdQ_sMV.cjs} +3 -3
- package/dist/{area-4eRs3c0K.cjs.map → area-DYdQ_sMV.cjs.map} +1 -1
- package/dist/{area-0-L1bG9B.js → area-WdtfqvhX.js} +3 -3
- package/dist/{area-0-L1bG9B.js.map → area-WdtfqvhX.js.map} +1 -1
- package/dist/{area-CJX9219z.d.cts → area-h_FvieFb.d.cts} +2 -2
- 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-MMaVoSWB.js +235 -0
- package/dist/axis-MMaVoSWB.js.map +1 -0
- package/dist/axis-YfAerNBA.cjs +300 -0
- package/dist/axis-YfAerNBA.cjs.map +1 -0
- package/dist/{bar-BNZ3GhIw.js → bar-BOcRcArc.js} +74 -56
- package/dist/bar-BOcRcArc.js.map +1 -0
- package/dist/{bar-Da6dE_nI.cjs → bar-CVkOJ7WA.cjs} +76 -58
- package/dist/bar-CVkOJ7WA.cjs.map +1 -0
- 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-XwzM6Pb0.d.ts → bar-D9B_arKf.d.ts} +1 -1
- package/dist/{bar-BDLR4p9c.d.cts → bar-DZCQ-kyf.d.cts} +2 -2
- 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-BSvO8nRb.d.cts +106 -0
- package/dist/calendar-BXgIX5H1.js +502 -0
- package/dist/calendar-BXgIX5H1.js.map +1 -0
- package/dist/calendar-Bq3vFzPl.d.ts +106 -0
- package/dist/calendar-DAFXjV99.cjs +507 -0
- package/dist/calendar-DAFXjV99.cjs.map +1 -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-D0xKkdqd.d.ts → candlestick-B3WcLzph.d.ts} +1 -1
- package/dist/{candlestick-Dq7qp-F0.d.cts → candlestick-BcomxeVG.d.cts} +1 -1
- package/dist/{candlestick-BHQkQfxH.js → candlestick-BtT9glp9.js} +16 -14
- package/dist/{candlestick-BHQkQfxH.js.map → candlestick-BtT9glp9.js.map} +1 -1
- package/dist/{candlestick-CYCQXgky.cjs → candlestick-CSmRuZ4v.cjs} +16 -14
- package/dist/{candlestick-CYCQXgky.cjs.map → candlestick-CSmRuZ4v.cjs.map} +1 -1
- 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-CI2x6N7N.js → cartesian-BrPqb5Qn.js} +122 -248
- package/dist/cartesian-BrPqb5Qn.js.map +1 -0
- package/dist/{cartesian-DV02PsBe.cjs → cartesian-DRSXHxWe.cjs} +146 -308
- package/dist/cartesian-DRSXHxWe.cjs.map +1 -0
- package/dist/{chart-DWn9v6qw.js → chart-B6TTY4Kr.js} +94 -62
- package/dist/chart-B6TTY4Kr.js.map +1 -0
- package/dist/{chart-QilhWP8Z.d.ts → chart-CYrrUCi3.d.ts} +193 -56
- package/dist/{chart-kqFMEwDo.d.cts → chart-CbPzP5Dp.d.cts} +193 -56
- package/dist/{chart-e2VqomCI.cjs → chart-D_lyOy-M.cjs} +106 -68
- package/dist/chart-D_lyOy-M.cjs.map +1 -0
- package/dist/{core-PAX5ogLk.d.cts → core-9BnLEW4K.d.cts} +24 -20
- package/dist/{core-DRUCk67j.d.ts → core-C3qEppSm.d.ts} +7 -6
- package/dist/{core-BKRQvPAT.js → core-CQ0FaJ4G.js} +112 -65
- package/dist/core-CQ0FaJ4G.js.map +1 -0
- package/dist/{core-DIOC61up.cjs → core-D2PSked3.cjs} +113 -66
- package/dist/core-D2PSked3.cjs.map +1 -0
- package/dist/core.cjs +41 -31
- package/dist/core.d.cts +20 -17
- package/dist/core.d.ts +20 -17
- package/dist/core.js +27 -23
- package/dist/{dates-C2RzY3rE.js → dates-DLe2Ww64.js} +2 -2
- package/dist/{dates-C2RzY3rE.js.map → dates-DLe2Ww64.js.map} +1 -1
- package/dist/{dates-DurEr9WT.cjs → dates-DerXTb1J.cjs} +2 -2
- package/dist/{dates-DurEr9WT.cjs.map → dates-DerXTb1J.cjs.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/{export-chart-mYgEfK-L.cjs → export-chart-CPtXmZvi.cjs} +17 -12
- package/dist/export-chart-CPtXmZvi.cjs.map +1 -0
- package/dist/{export-chart-83UYH48t.js → export-chart-DoeiAyR2.js} +17 -12
- package/dist/export-chart-DoeiAyR2.js.map +1 -0
- package/dist/export.cjs +2 -2
- package/dist/export.d.cts +1 -1
- package/dist/export.d.ts +1 -1
- package/dist/export.js +2 -2
- 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-BdcfUkb5.d.ts +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-CarOh8w_.d.cts +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-ts0kqN1-.js → gauge-DiTk5aWO.js} +28 -28
- package/dist/gauge-DiTk5aWO.js.map +1 -0
- package/dist/{gauge-BSist7My.d.cts → gauge-Ds9k1UV2.d.cts} +1 -1
- package/dist/{gauge-0VJuAHWF.d.ts → gauge-Zy25jfps.d.ts} +1 -1
- 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/{heatmap-19BGJTKF.js → heatmap-C1v8bwpq.js} +35 -33
- package/dist/heatmap-C1v8bwpq.js.map +1 -0
- package/dist/{heatmap-Dp_oyEe0.d.cts → heatmap-CJ-0dfhJ.d.cts} +1 -1
- package/dist/{heatmap-CXhlrLTl.cjs → heatmap-Dcc_bsoQ.cjs} +39 -37
- package/dist/heatmap-Dcc_bsoQ.cjs.map +1 -0
- package/dist/{heatmap-59lmClj9.d.ts → heatmap-Jp5sHRTo.d.ts} +1 -1
- 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 +55 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -18
- package/dist/index.d.ts +21 -18
- package/dist/index.js +41 -34
- 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-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-DtSh7HQU.d.ts → line-Bpr5uVLQ.d.ts} +1 -1
- package/dist/{line-DO66LtwH.js → line-CxR4tg1Q.js} +46 -34
- package/dist/line-CxR4tg1Q.js.map +1 -0
- package/dist/{line-Dbt6KFRK.cjs → line-YiCuhVMI.cjs} +46 -34
- package/dist/line-YiCuhVMI.cjs.map +1 -0
- package/dist/{line-_rNdeKmS.d.cts → line-vyWO030v.d.cts} +2 -3
- 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-49FcfdmJ.d.cts +156 -0
- package/dist/map-BMC61J-P.d.ts +156 -0
- package/dist/map-BqrZ80vT.cjs +818 -0
- package/dist/map-BqrZ80vT.cjs.map +1 -0
- package/dist/map-C15NC7kW.js +807 -0
- package/dist/map-C15NC7kW.js.map +1 -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-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/others-ls5eKtZ4.d.cts +31 -0
- package/dist/{parliament-Cru4IcuM.js → parliament-BKN6ikBJ.js} +30 -29
- package/dist/parliament-BKN6ikBJ.js.map +1 -0
- package/dist/{parliament-CgsVnWEe.d.cts → parliament-C7V8UJj1.d.cts} +1 -1
- package/dist/{parliament-CLCI7tUO.d.ts → parliament-Cz9n_DoK.d.ts} +1 -1
- 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-CufKZYhm.js → patterns-BMUINoka.js} +2 -2
- package/dist/{patterns-CufKZYhm.js.map → patterns-BMUINoka.js.map} +1 -1
- package/dist/{patterns-D3-wQagb.cjs → patterns-Dw7OMD_2.cjs} +2 -2
- package/dist/{patterns-D3-wQagb.cjs.map → patterns-Dw7OMD_2.cjs.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-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-R1--2grK.d.cts} +10 -14
- package/dist/{percentage-bar-nhTeakD_.d.ts → percentage-bar-cSeiLdwU.d.ts} +10 -14
- 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-CFptILSm.d.ts → pie-BQQkvy1N.d.ts} +7 -13
- package/dist/{pie-CVsc-6qD.js → pie-Bd8wyrtY.js} +45 -44
- package/dist/pie-Bd8wyrtY.js.map +1 -0
- package/dist/{pie-BpjvSPnz.cjs → pie-BseZlCgP.cjs} +45 -44
- package/dist/pie-BseZlCgP.cjs.map +1 -0
- package/dist/{pie-BXg2gNpb.d.cts → pie-vD5-g8je.d.cts} +7 -13
- 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-D1-lItDy.d.cts → radar-7I6hsY_h.d.cts} +1 -1
- package/dist/{radar-BR-mumDd.js → radar-D6XqkFWQ.js} +21 -22
- package/dist/radar-D6XqkFWQ.js.map +1 -0
- package/dist/{radar-HPDrIdzc.cjs → radar-DjISDnSf.cjs} +22 -23
- package/dist/radar-DjISDnSf.cjs.map +1 -0
- package/dist/{radar-BC9Skgpj.d.ts → radar-vLxilcr4.d.ts} +1 -1
- 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/{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-D_v7KxnJ.d.ts → sankey-7As41Fo4.d.ts} +1 -1
- package/dist/{sankey-D6JeZfK5.js → sankey-Dp4CuLVe.js} +72 -71
- package/dist/sankey-Dp4CuLVe.js.map +1 -0
- package/dist/{sankey-Dk7jUt8x.d.cts → sankey-DqiuxUx7.d.cts} +1 -1
- 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-CXEsioOJ.d.ts → scatter-BXkXGgM_.d.ts} +7 -1
- package/dist/{scatter-DVqB_fP9.cjs → scatter-Bwkblr4L.cjs} +40 -38
- package/dist/scatter-Bwkblr4L.cjs.map +1 -0
- package/dist/{scatter-C0TWjFpW.js → scatter-DCMAtt5L.js} +38 -36
- package/dist/scatter-DCMAtt5L.js.map +1 -0
- package/dist/{scatter-DZeEIfyo.d.cts → scatter-DL0zAV09.d.cts} +7 -1
- package/dist/scatter.cjs +1 -1
- package/dist/scatter.d.cts +1 -1
- package/dist/scatter.d.ts +1 -1
- package/dist/scatter.js +1 -1
- package/dist/{sparkline-cbvRkWqS.d.ts → sparkline-BElUSd0r.d.ts} +1 -1
- package/dist/{sparkline-B39NA0Mi.cjs → sparkline-BMSuEPHP.cjs} +13 -15
- package/dist/sparkline-BMSuEPHP.cjs.map +1 -0
- package/dist/{sparkline-XO_TqCNP.js → sparkline-NDmq90kP.js} +13 -15
- package/dist/sparkline-NDmq90kP.js.map +1 -0
- package/dist/{sparkline-DAP6jtzw.d.cts → sparkline-RYly7bR0.d.cts} +1 -1
- 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-BgPzoQmv.cjs → stack-BO4624CY.cjs} +2 -2
- package/dist/{stack-BgPzoQmv.cjs.map → stack-BO4624CY.cjs.map} +1 -1
- package/dist/{stack-Dagxq7l2.d.cts → stack-BTWYIwLO.d.cts} +1 -1
- package/dist/{stack-2H2Gfs1Q.js → stack-jVKvg2x_.js} +2 -2
- package/dist/{stack-2H2Gfs1Q.js.map → stack-jVKvg2x_.js.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/{time-axis-BjZ1bYTK.cjs → time-axis-B3VekUfX.cjs} +4 -3
- package/dist/{time-axis-BjZ1bYTK.cjs.map → time-axis-B3VekUfX.cjs.map} +1 -1
- package/dist/{time-axis-FLONo54E.js → time-axis-CLjqOakA.js} +3 -2
- package/dist/{time-axis-FLONo54E.js.map → time-axis-CLjqOakA.js.map} +1 -1
- package/dist/time.cjs +3 -3
- package/dist/time.js +3 -3
- package/dist/{treemap-BAkhmVQc.d.cts → treemap-25vHO_UK.d.cts} +12 -2
- package/dist/{treemap-BNpxFBao.d.ts → treemap-BCXUbixd.d.ts} +12 -2
- package/dist/{treemap-CQdavQ9u.js → treemap-C4glsx-g.js} +20 -25
- package/dist/treemap-C4glsx-g.js.map +1 -0
- package/dist/{treemap-BWpEUlDh.cjs → treemap-CZk8kKFD.cjs} +21 -26
- package/dist/treemap-CZk8kKFD.cjs.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-C7GrhOXJ.js} +25 -5
- package/dist/value-labels-C7GrhOXJ.js.map +1 -0
- package/dist/{value-labels-BV9keAuL.cjs → value-labels-DzaKIWKp.cjs} +25 -5
- package/dist/value-labels-DzaKIWKp.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/package.json +93 -233
- package/dist/bar-BNZ3GhIw.js.map +0 -1
- package/dist/bar-Da6dE_nI.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,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as ChartType } from "./chart-CbPzP5Dp.cjs";
|
|
2
2
|
import { c as NumberFormat } from "./time-B4oxWHQI.cjs";
|
|
3
3
|
import { a as InsetsInput } from "./annotations-CHafaGd4.cjs";
|
|
4
4
|
import { a as ClassValue } from "./vnode-Du2cC8Fm.cjs";
|
|
5
|
+
import { n as WithSlices, t as SliceGrouping } from "./others-ls5eKtZ4.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 };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as ChartType } from "./chart-CYrrUCi3.js";
|
|
2
2
|
import { c as NumberFormat } from "./time-DRIDgv2a.js";
|
|
3
3
|
import { a as InsetsInput } from "./annotations-B02GR_KU.js";
|
|
4
4
|
import { a as ClassValue } from "./vnode-Du2cC8Fm.js";
|
|
5
|
+
import { n as WithSlices, t as SliceGrouping } from "./others-DBO4Kjwl.js";
|
|
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-R1--2grK.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-cSeiLdwU.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,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as ChartType } from "./chart-CYrrUCi3.js";
|
|
2
2
|
import { c as NumberFormat } from "./time-DRIDgv2a.js";
|
|
3
3
|
import { a as InsetsInput } from "./annotations-B02GR_KU.js";
|
|
4
4
|
import { a as ClassValue } from "./vnode-Du2cC8Fm.js";
|
|
5
|
+
import { n as WithSlices, t as SliceGrouping } from "./others-DBO4Kjwl.js";
|
|
5
6
|
/** One slice of a pie or donut. */
|
|
6
7
|
interface PieSlice {
|
|
7
8
|
name: string;
|
|
@@ -19,17 +20,8 @@ interface PieSlice {
|
|
|
19
20
|
/** Start hidden (toggle it back from the legend). */
|
|
20
21
|
hidden?: boolean;
|
|
21
22
|
}
|
|
22
|
-
interface PieOptions {
|
|
23
|
+
interface PieOptions extends SliceGrouping {
|
|
23
24
|
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
25
|
/** Hole size relative to the radius, `0…0.95`. Defaults to `0` (`0.62` for `donut`). */
|
|
34
26
|
innerRadius?: number;
|
|
35
27
|
/** Gap between slices in pixels, drawn as surface. Defaults to `2`. */
|
|
@@ -51,6 +43,8 @@ interface PieOptions {
|
|
|
51
43
|
/** Extra space around the pie, in pixels. */
|
|
52
44
|
padding?: InsetsInput;
|
|
53
45
|
}
|
|
46
|
+
/** The chart model of a pie: its options, with the slices as drawn (the rest grouped). */
|
|
47
|
+
type PieModel = WithSlices<PieOptions>;
|
|
54
48
|
/**
|
|
55
49
|
* Pie chart: parts of a whole as slices, in data order, clockwise from the top.
|
|
56
50
|
*
|
|
@@ -58,7 +52,7 @@ interface PieOptions {
|
|
|
58
52
|
* new Chart('#el', { type: pie, data: [{ name: 'Direct', value: 42 }, { name: 'Search', value: 31 }] })
|
|
59
53
|
* ```
|
|
60
54
|
*/
|
|
61
|
-
declare const pie: ChartType<PieOptions>;
|
|
55
|
+
declare const pie: ChartType<PieOptions, PieModel>;
|
|
62
56
|
/** Donut chart: a pie with a hole showing the total (or your own `center`). */
|
|
63
|
-
declare const donut: ChartType<PieOptions>;
|
|
57
|
+
declare const donut: ChartType<PieOptions, PieModel>;
|
|
64
58
|
export { pie as i, PieSlice as n, donut as r, PieOptions as t };
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { r as features } from "./features-BMxkqCyS.js";
|
|
2
1
|
import { o as getNumberFormat, r as formatNumber } from "./format-it1kepFG.js";
|
|
3
|
-
import { i as insets, r as innerRect } from "./layout-
|
|
2
|
+
import { i as insets, r as innerRect } from "./layout-DqAte3H8.js";
|
|
4
3
|
import { n as sweep, t as arcNode } from "./sweep-BpRPlhs6.js";
|
|
5
4
|
import { i as padAngleForGap, n as arcCentroid, r as arcPathStable, t as DEG } from "./arc-B3V5IR0w.js";
|
|
6
5
|
import { t as h } from "./vnode-_EMUqysL.js";
|
|
7
6
|
import { n as cleanItems, t as cleanData } from "./clean-CkoQobGv.js";
|
|
8
7
|
import { n as keyOf, t as groupAttrs } from "./named-BOiBah6I.js";
|
|
9
|
-
import { n as
|
|
8
|
+
import { n as withSlices, t as slicesLegend } from "./others-DBIGE6jr.js";
|
|
10
9
|
// src/charts/pie.ts
|
|
11
10
|
/** Angles of the visible slices, clockwise from `startAngle`. */
|
|
12
|
-
function layoutSlices(
|
|
13
|
-
const visible =
|
|
11
|
+
function layoutSlices(model, hidden) {
|
|
12
|
+
const visible = model.slices.filter((slice) => !hidden.has(keyOf(slice.data)));
|
|
14
13
|
const total = visible.reduce((sum, slice) => sum + slice.value, 0);
|
|
15
|
-
let angle = (
|
|
14
|
+
let angle = (model.startAngle ?? 0) * DEG;
|
|
16
15
|
return {
|
|
17
16
|
slices: visible.map((slice) => {
|
|
18
17
|
const sweep = total > 0 ? slice.value / total * Math.PI * 2 : 0;
|
|
@@ -77,7 +76,8 @@ function renderPie(options, ctx, defaults) {
|
|
|
77
76
|
},
|
|
78
77
|
items: [item],
|
|
79
78
|
seriesIndex: slice.index,
|
|
80
|
-
|
|
79
|
+
highlight: {
|
|
80
|
+
kind: "halo",
|
|
81
81
|
d: arcPathStable({
|
|
82
82
|
...geometry(slice, outer + 2, outer + 6),
|
|
83
83
|
cornerRadius: 2
|
|
@@ -106,42 +106,44 @@ function renderPie(options, ctx, defaults) {
|
|
|
106
106
|
return position === -1 ? null : hitFor(drawn[position], position);
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
-
ctx.onHitTest(interaction);
|
|
110
109
|
const groups = slices.map((slice) => h("g", groupAttrs(slice.data, slice.index), arcNode("tc-slice", geometry(slice))));
|
|
111
110
|
const center = options.center;
|
|
112
111
|
const showCenter = inner > 0 && center !== false;
|
|
113
112
|
const centerValue = showCenter ? center?.value ?? value(total) : "";
|
|
114
113
|
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
|
-
|
|
114
|
+
return {
|
|
115
|
+
content: [h("g", {
|
|
116
|
+
class: "tc-pie",
|
|
117
|
+
style: `transform:translate(${cx}px,${cy}px)`
|
|
118
|
+
}, total === 0 && h("path", {
|
|
119
|
+
class: "tc-pie-track",
|
|
120
|
+
d: arcPathStable({
|
|
121
|
+
innerRadius: inner,
|
|
122
|
+
outerRadius: outer,
|
|
123
|
+
startAngle: 0,
|
|
124
|
+
endAngle: Math.PI * 2
|
|
125
|
+
})
|
|
126
|
+
}), h("g", {
|
|
127
|
+
class: "tc-pie-slices",
|
|
128
|
+
style: strokeGap > 0 ? `--tc-pie-gap:${strokeGap}px` : void 0
|
|
129
|
+
}, groups)), showCenter && h("g", {
|
|
130
|
+
class: "tc-pie-center",
|
|
131
|
+
"aria-hidden": "true"
|
|
132
|
+
}, h("text", {
|
|
133
|
+
class: "tc-pie-value",
|
|
134
|
+
x: cx,
|
|
135
|
+
y: cy,
|
|
136
|
+
dy: centerLabel ? "0" : "0.35em",
|
|
137
|
+
"text-anchor": "middle"
|
|
138
|
+
}, centerValue), centerLabel && h("text", {
|
|
139
|
+
class: "tc-pie-label",
|
|
140
|
+
x: cx,
|
|
141
|
+
y: cy,
|
|
142
|
+
dy: "1.6em",
|
|
143
|
+
"text-anchor": "middle"
|
|
144
|
+
}, centerLabel))],
|
|
145
|
+
interaction
|
|
146
|
+
};
|
|
145
147
|
}
|
|
146
148
|
function pieTable(options, ctx) {
|
|
147
149
|
const { slices, total } = layoutSlices(options, ctx.hidden);
|
|
@@ -167,11 +169,10 @@ function pieType(name, defaults) {
|
|
|
167
169
|
return {
|
|
168
170
|
name,
|
|
169
171
|
clean: cleanData(cleanItems),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
legend: (options) => groupLegend(groupSlices(options.data, options.maxSlices, options.othersLabel)),
|
|
172
|
+
prepare: withSlices,
|
|
173
|
+
render: (options, ctx) => renderPie(options, ctx, defaults),
|
|
174
|
+
sweep,
|
|
175
|
+
legend: slicesLegend,
|
|
175
176
|
table: pieTable,
|
|
176
177
|
valueLabels: { marks: "slice" }
|
|
177
178
|
};
|
|
@@ -194,4 +195,4 @@ const donut = pieType("donut", {
|
|
|
194
195
|
});
|
|
195
196
|
export { pie as n, donut as t };
|
|
196
197
|
|
|
197
|
-
//# sourceMappingURL=pie-
|
|
198
|
+
//# sourceMappingURL=pie-Bd8wyrtY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-Bd8wyrtY.js","names":[],"sources":["../src/charts/pie.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 } 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'\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\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 area = innerRect(width, height, insets(options.padding, 0))\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 const { slices, total } = layoutSlices(options, ctx.hidden)\n const drawn = slices.filter((slice) => slice.value > 0)\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 const value = formatNumber(options.format, locale)\n const share = getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 })\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 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 the total (or your own `center`). */\nexport const donut: ChartType<PieOptions, PieModel> = pieType('donut', { inner: 0.62, corner: 4 })\n"],"mappings":";;;;;;;;;;AA+DA,SAAS,aACP,OACA,QACoC;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,QAAQ,UAAU,aAAa,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,OAAO,KAAK,UAAU;GAC1B,MAAM,KAAK;GACX,MAAM,MAAM,KAAK;GACjB,MAAM,OAAO,QAAQ,IAAI,MAAM,QAAQ,QAAQ,CAAC;EAClD,CAAC;CACH;AACF;AAEA,SAAS,QACP,MACA,UACiC;CACjC,OAAO;EACL;EACA,OAAO,UAAU,UAAU;EAC3B,SAAS;EACT,SAAS,SAAS,QAAsB,UAAU,SAAS,KAAK,QAAQ;EACxE;EACA,QAAQ;EACR,OAAO;EACP,aAAa,EAAE,OAAO,QAAQ;CAChC;AACF;;;;;;;;AASA,MAAa,MAAuC,QAAQ,OAAO;CAAE,OAAO;CAAG,QAAQ;AAAE,CAAC;;AAG1F,MAAa,QAAyC,QAAQ,SAAS;CAAE,OAAO;CAAM,QAAQ;AAAE,CAAC"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
const require_features = require("./features-DCXEvoya.cjs");
|
|
2
1
|
const require_format = require("./format-CAE5ruy6.cjs");
|
|
3
|
-
const require_layout = require("./layout-
|
|
2
|
+
const require_layout = require("./layout-Cfg9x1k2.cjs");
|
|
4
3
|
const require_sweep = require("./sweep-Dnp6LDBz.cjs");
|
|
5
4
|
const require_arc = require("./arc-CYhI62kO.cjs");
|
|
6
5
|
const require_vnode = require("./vnode-ClAiw28x.cjs");
|
|
7
6
|
const require_clean = require("./clean-Die2iCNc.cjs");
|
|
8
7
|
const require_named = require("./named-BBASc8dW.cjs");
|
|
9
|
-
const require_others = require("./others-
|
|
8
|
+
const require_others = require("./others-WfjCsjqT.cjs");
|
|
10
9
|
// src/charts/pie.ts
|
|
11
10
|
/** Angles of the visible slices, clockwise from `startAngle`. */
|
|
12
|
-
function layoutSlices(
|
|
13
|
-
const visible =
|
|
11
|
+
function layoutSlices(model, hidden) {
|
|
12
|
+
const visible = model.slices.filter((slice) => !hidden.has(require_named.keyOf(slice.data)));
|
|
14
13
|
const total = visible.reduce((sum, slice) => sum + slice.value, 0);
|
|
15
|
-
let angle = (
|
|
14
|
+
let angle = (model.startAngle ?? 0) * require_arc.DEG;
|
|
16
15
|
return {
|
|
17
16
|
slices: visible.map((slice) => {
|
|
18
17
|
const sweep = total > 0 ? slice.value / total * Math.PI * 2 : 0;
|
|
@@ -77,7 +76,8 @@ function renderPie(options, ctx, defaults) {
|
|
|
77
76
|
},
|
|
78
77
|
items: [item],
|
|
79
78
|
seriesIndex: slice.index,
|
|
80
|
-
|
|
79
|
+
highlight: {
|
|
80
|
+
kind: "halo",
|
|
81
81
|
d: require_arc.arcPathStable({
|
|
82
82
|
...geometry(slice, outer + 2, outer + 6),
|
|
83
83
|
cornerRadius: 2
|
|
@@ -106,42 +106,44 @@ function renderPie(options, ctx, defaults) {
|
|
|
106
106
|
return position === -1 ? null : hitFor(drawn[position], position);
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
-
ctx.onHitTest(interaction);
|
|
110
109
|
const groups = slices.map((slice) => require_vnode.h("g", require_named.groupAttrs(slice.data, slice.index), require_sweep.arcNode("tc-slice", geometry(slice))));
|
|
111
110
|
const center = options.center;
|
|
112
111
|
const showCenter = inner > 0 && center !== false;
|
|
113
112
|
const centerValue = showCenter ? center?.value ?? value(total) : "";
|
|
114
113
|
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
|
-
|
|
114
|
+
return {
|
|
115
|
+
content: [require_vnode.h("g", {
|
|
116
|
+
class: "tc-pie",
|
|
117
|
+
style: `transform:translate(${cx}px,${cy}px)`
|
|
118
|
+
}, total === 0 && require_vnode.h("path", {
|
|
119
|
+
class: "tc-pie-track",
|
|
120
|
+
d: require_arc.arcPathStable({
|
|
121
|
+
innerRadius: inner,
|
|
122
|
+
outerRadius: outer,
|
|
123
|
+
startAngle: 0,
|
|
124
|
+
endAngle: Math.PI * 2
|
|
125
|
+
})
|
|
126
|
+
}), require_vnode.h("g", {
|
|
127
|
+
class: "tc-pie-slices",
|
|
128
|
+
style: strokeGap > 0 ? `--tc-pie-gap:${strokeGap}px` : void 0
|
|
129
|
+
}, groups)), showCenter && require_vnode.h("g", {
|
|
130
|
+
class: "tc-pie-center",
|
|
131
|
+
"aria-hidden": "true"
|
|
132
|
+
}, require_vnode.h("text", {
|
|
133
|
+
class: "tc-pie-value",
|
|
134
|
+
x: cx,
|
|
135
|
+
y: cy,
|
|
136
|
+
dy: centerLabel ? "0" : "0.35em",
|
|
137
|
+
"text-anchor": "middle"
|
|
138
|
+
}, centerValue), centerLabel && require_vnode.h("text", {
|
|
139
|
+
class: "tc-pie-label",
|
|
140
|
+
x: cx,
|
|
141
|
+
y: cy,
|
|
142
|
+
dy: "1.6em",
|
|
143
|
+
"text-anchor": "middle"
|
|
144
|
+
}, centerLabel))],
|
|
145
|
+
interaction
|
|
146
|
+
};
|
|
145
147
|
}
|
|
146
148
|
function pieTable(options, ctx) {
|
|
147
149
|
const { slices, total } = layoutSlices(options, ctx.hidden);
|
|
@@ -167,11 +169,10 @@ function pieType(name, defaults) {
|
|
|
167
169
|
return {
|
|
168
170
|
name,
|
|
169
171
|
clean: require_clean.cleanData(require_clean.cleanItems),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
legend: (options) => require_others.groupLegend(require_others.groupSlices(options.data, options.maxSlices, options.othersLabel)),
|
|
172
|
+
prepare: require_others.withSlices,
|
|
173
|
+
render: (options, ctx) => renderPie(options, ctx, defaults),
|
|
174
|
+
sweep: require_sweep.sweep,
|
|
175
|
+
legend: require_others.slicesLegend,
|
|
175
176
|
table: pieTable,
|
|
176
177
|
valueLabels: { marks: "slice" }
|
|
177
178
|
};
|
|
@@ -205,4 +206,4 @@ Object.defineProperty(exports, "pie", {
|
|
|
205
206
|
}
|
|
206
207
|
});
|
|
207
208
|
|
|
208
|
-
//# sourceMappingURL=pie-
|
|
209
|
+
//# sourceMappingURL=pie-BseZlCgP.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-BseZlCgP.cjs","names":["keyOf","DEG","innerRect","insets","padAngleForGap","formatNumber","getNumberFormat","arcCentroid","arcPathStable","h","groupAttrs","arcNode","cleanData","cleanItems","withSlices","sweep","slicesLegend"],"sources":["../src/charts/pie.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 } 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'\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\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 area = innerRect(width, height, insets(options.padding, 0))\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 const { slices, total } = layoutSlices(options, ctx.hidden)\n const drawn = slices.filter((slice) => slice.value > 0)\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 const value = formatNumber(options.format, locale)\n const share = getNumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 })\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 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 the total (or your own `center`). */\nexport const donut: ChartType<PieOptions, PieModel> = pieType('donut', { inner: 0.62, corner: 4 })\n"],"mappings":";;;;;;;;;;AA+DA,SAAS,aACP,OACA,QACoC;CACpC,MAAM,UAAU,MAAM,OAAO,QAAQ,UAAU,CAAC,OAAO,IAAIA,cAAAA,MAAM,MAAM,IAAI,CAAC,CAAC;CAC7E,MAAM,QAAQ,QAAQ,QAAQ,KAAK,UAAU,MAAM,MAAM,OAAO,CAAC;CACjE,IAAI,SAAS,MAAM,cAAc,KAAKC,YAAAA;CAOtC,OAAO;EAAE,QANM,QAAQ,KAAK,UAAU;GACpC,MAAM,QAAQ,QAAQ,IAAK,MAAM,QAAQ,QAAS,KAAK,KAAK,IAAI;GAChE,MAAM,MAAa;IAAE,GAAG;IAAO,YAAY;IAAO,UAAU,QAAQ;GAAM;GAC1E,SAAS;GACT,OAAO;EACT,CACc;EAAG;CAAM;AACzB;AAEA,SAAS,UACP,SACA,KACA,UACA;CACA,MAAM,EAAE,OAAO,QAAQ,WAAW;CAClC,MAAM,MAAM,QAAQ,OAAO;CAC3B,MAAM,OAAOC,eAAAA,UAAU,OAAO,QAAQC,eAAAA,OAA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AOM,cAAAA,UAAUC,cAAAA,UAAU;EAC3B,SAASC,eAAAA;EACT,SAAS,SAAS,QAAsB,UAAU,SAAS,KAAK,QAAQ;EACxEC,OAAAA,cAAAA;EACA,QAAQC,eAAAA;EACR,OAAO;EACP,aAAa,EAAE,OAAO,QAAQ;CAChC;AACF;;;;;;;;AASA,MAAa,MAAuC,QAAQ,OAAO;CAAE,OAAO;CAAG,QAAQ;AAAE,CAAC;;AAG1F,MAAa,QAAyC,QAAQ,SAAS;CAAE,OAAO;CAAM,QAAQ;AAAE,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as ChartType } from "./chart-CbPzP5Dp.cjs";
|
|
2
2
|
import { c as NumberFormat } from "./time-B4oxWHQI.cjs";
|
|
3
3
|
import { a as InsetsInput } from "./annotations-CHafaGd4.cjs";
|
|
4
4
|
import { a as ClassValue } from "./vnode-Du2cC8Fm.cjs";
|
|
5
|
+
import { n as WithSlices, t as SliceGrouping } from "./others-ls5eKtZ4.cjs";
|
|
5
6
|
/** One slice of a pie or donut. */
|
|
6
7
|
interface PieSlice {
|
|
7
8
|
name: string;
|
|
@@ -19,17 +20,8 @@ interface PieSlice {
|
|
|
19
20
|
/** Start hidden (toggle it back from the legend). */
|
|
20
21
|
hidden?: boolean;
|
|
21
22
|
}
|
|
22
|
-
interface PieOptions {
|
|
23
|
+
interface PieOptions extends SliceGrouping {
|
|
23
24
|
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
25
|
/** Hole size relative to the radius, `0…0.95`. Defaults to `0` (`0.62` for `donut`). */
|
|
34
26
|
innerRadius?: number;
|
|
35
27
|
/** Gap between slices in pixels, drawn as surface. Defaults to `2`. */
|
|
@@ -51,6 +43,8 @@ interface PieOptions {
|
|
|
51
43
|
/** Extra space around the pie, in pixels. */
|
|
52
44
|
padding?: InsetsInput;
|
|
53
45
|
}
|
|
46
|
+
/** The chart model of a pie: its options, with the slices as drawn (the rest grouped). */
|
|
47
|
+
type PieModel = WithSlices<PieOptions>;
|
|
54
48
|
/**
|
|
55
49
|
* Pie chart: parts of a whole as slices, in data order, clockwise from the top.
|
|
56
50
|
*
|
|
@@ -58,7 +52,7 @@ interface PieOptions {
|
|
|
58
52
|
* new Chart('#el', { type: pie, data: [{ name: 'Direct', value: 42 }, { name: 'Search', value: 31 }] })
|
|
59
53
|
* ```
|
|
60
54
|
*/
|
|
61
|
-
declare const pie: ChartType<PieOptions>;
|
|
55
|
+
declare const pie: ChartType<PieOptions, PieModel>;
|
|
62
56
|
/** Donut chart: a pie with a hole showing the total (or your own `center`). */
|
|
63
|
-
declare const donut: ChartType<PieOptions>;
|
|
57
|
+
declare const donut: ChartType<PieOptions, PieModel>;
|
|
64
58
|
export { pie as i, PieSlice as n, donut as r, PieOptions as t };
|
package/dist/pie.cjs
CHANGED
package/dist/pie.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Standalone entry: `import { pie, donut } from '@tabler/charts/pie'`. */
|
|
2
|
-
import { i as pie, n as PieSlice, r as donut, t as PieOptions } from "./pie-
|
|
2
|
+
import { i as pie, n as PieSlice, r as donut, t as PieOptions } from "./pie-vD5-g8je.cjs";
|
|
3
3
|
export { type PieOptions, type PieSlice, donut, pie };
|
package/dist/pie.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Standalone entry: `import { pie, donut } from '@tabler/charts/pie'`. */
|
|
2
|
-
import { i as pie, n as PieSlice, r as donut, t as PieOptions } from "./pie-
|
|
2
|
+
import { i as pie, n as PieSlice, r as donut, t as PieOptions } from "./pie-BQQkvy1N.js";
|
|
3
3
|
export { type PieOptions, type PieSlice, donut, pie };
|
package/dist/pie.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as donut, n as pie } from "./pie-
|
|
1
|
+
export { t as donut, n as pie } from "./pie-Bd8wyrtY.js";
|