@tabler/charts 0.3.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 +94 -16
- package/dist/{annotations-CpCWA29b.cjs → annotations--m-HzMBM.cjs} +86 -10
- 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-BQ8l-qHs.js → annotations-DGITy6th.js} +86 -10
- package/dist/annotations-DGITy6th.js.map +1 -0
- package/dist/annotations.cjs +1 -1
- package/dist/annotations.d.cts +1 -1
- package/dist/annotations.d.ts +1 -1
- package/dist/annotations.js +1 -1
- package/dist/{area-WdtfqvhX.js → area-BN0uE9R0.js} +4 -3
- package/dist/area-BN0uE9R0.js.map +1 -0
- package/dist/{area-h_FvieFb.d.cts → area-D6LNLk3r.d.cts} +2 -2
- package/dist/{area-DEFQm_SQ.d.ts → area-DEFL-Yun.d.ts} +2 -2
- package/dist/{area-DYdQ_sMV.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-YfAerNBA.cjs → axis-BzBkkC5X.cjs} +12 -7
- package/dist/axis-BzBkkC5X.cjs.map +1 -0
- package/dist/{axis-MMaVoSWB.js → axis-C5obgdJt.js} +12 -7
- package/dist/axis-C5obgdJt.js.map +1 -0
- package/dist/{bar-CVkOJ7WA.cjs → bar-BrmfXugT.cjs} +5 -4
- package/dist/bar-BrmfXugT.cjs.map +1 -0
- package/dist/{bar-D9B_arKf.d.ts → bar-Bs_rPqgR.d.ts} +1 -1
- package/dist/{bar-DZCQ-kyf.d.cts → bar-CEt8YRxf.d.cts} +2 -2
- package/dist/{bar-BOcRcArc.js → bar-D_KKd2fL.js} +5 -4
- package/dist/bar-D_KKd2fL.js.map +1 -0
- 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 → calendar-B7843sQu.d.cts} +2 -2
- package/dist/{calendar-DAFXjV99.cjs → calendar-BG_q_NC_.cjs} +2 -2
- package/dist/{calendar-DAFXjV99.cjs.map → calendar-BG_q_NC_.cjs.map} +1 -1
- package/dist/{calendar-BXgIX5H1.js → calendar-CF3gfDQk.js} +2 -2
- package/dist/{calendar-BXgIX5H1.js.map → calendar-CF3gfDQk.js.map} +1 -1
- package/dist/{calendar-Bq3vFzPl.d.ts → calendar-D10_ki1S.d.ts} +2 -2
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.cts +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +1 -1
- package/dist/{candlestick-BtT9glp9.js → candlestick-B1onjo1o.js} +3 -2
- package/dist/candlestick-B1onjo1o.js.map +1 -0
- package/dist/{candlestick-BcomxeVG.d.cts → candlestick-B7YXUVVh.d.cts} +4 -3
- package/dist/{candlestick-CSmRuZ4v.cjs → candlestick-BwrFKak_.cjs} +3 -2
- package/dist/candlestick-BwrFKak_.cjs.map +1 -0
- package/dist/{candlestick-B3WcLzph.d.ts → candlestick-XpqJvarq.d.ts} +4 -3
- package/dist/candlestick.cjs +2 -2
- package/dist/candlestick.d.cts +1 -1
- package/dist/candlestick.d.ts +1 -1
- package/dist/candlestick.js +2 -2
- package/dist/{cartesian-DRSXHxWe.cjs → cartesian-B9CrasFJ.cjs} +49 -7
- package/dist/cartesian-B9CrasFJ.cjs.map +1 -0
- package/dist/{cartesian-BrPqb5Qn.js → cartesian-COglz544.js} +45 -9
- package/dist/cartesian-COglz544.js.map +1 -0
- package/dist/{chart-B6TTY4Kr.js → chart-B97FBRCd.js} +22 -12
- package/dist/chart-B97FBRCd.js.map +1 -0
- package/dist/{chart-CYrrUCi3.d.ts → chart-CE9EVbfV.d.ts} +240 -62
- package/dist/{chart-CbPzP5Dp.d.cts → chart-Dz4geQZy.d.cts} +240 -62
- package/dist/{chart-D_lyOy-M.cjs → chart-GUmmjJ7S.cjs} +27 -11
- package/dist/chart-GUmmjJ7S.cjs.map +1 -0
- package/dist/{core-CQ0FaJ4G.js → core-7fgM3su0.js} +84 -16
- package/dist/core-7fgM3su0.js.map +1 -0
- package/dist/{core-C3qEppSm.d.ts → core-BUQzLsRJ.d.ts} +21 -6
- package/dist/{core-D2PSked3.cjs → core-BZTrsPxc.cjs} +93 -13
- package/dist/core-BZTrsPxc.cjs.map +1 -0
- package/dist/{core-9BnLEW4K.d.cts → core-Ck5uHcW8.d.cts} +40 -23
- package/dist/core.cjs +20 -16
- package/dist/core.d.cts +23 -21
- package/dist/core.d.ts +23 -21
- package/dist/core.js +18 -17
- package/dist/{dates-DerXTb1J.cjs → dates-0YNY49KQ.cjs} +2 -2
- package/dist/{dates-DerXTb1J.cjs.map → dates-0YNY49KQ.cjs.map} +1 -1
- package/dist/{dates-DLe2Ww64.js → dates-CKDRgpin.js} +2 -2
- package/dist/{dates-DLe2Ww64.js.map → dates-CKDRgpin.js.map} +1 -1
- 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-DoeiAyR2.js → export-chart-BOH_nfcH.js} +76 -4
- package/dist/export-chart-BOH_nfcH.js.map +1 -0
- package/dist/{export-chart-CPtXmZvi.cjs → export-chart-Be4T9J3m.cjs} +81 -3
- package/dist/export-chart-Be4T9J3m.cjs.map +1 -0
- package/dist/export.cjs +4 -2
- 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 +4 -3
- package/dist/export.js.map +1 -1
- package/dist/features-B55rwpQC.js.map +1 -1
- package/dist/features-DEDP5CEQ.cjs.map +1 -1
- package/dist/{funnel-CarOh8w_.d.cts → funnel-B9ridzNx.d.cts} +2 -2
- package/dist/{funnel-BdcfUkb5.d.ts → funnel-FogM8flk.d.ts} +2 -2
- package/dist/funnel.d.cts +1 -1
- package/dist/funnel.d.ts +1 -1
- package/dist/{gauge-Ds9k1UV2.d.cts → gauge-BScJ7U6O.d.cts} +2 -2
- package/dist/{gauge-Zy25jfps.d.ts → gauge-D78oq1Lx.d.ts} +2 -2
- package/dist/gauge.d.cts +1 -1
- package/dist/gauge.d.ts +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-Dcc_bsoQ.cjs → heatmap-Dyzrd4Fd.cjs} +3 -3
- package/dist/{heatmap-Dcc_bsoQ.cjs.map → heatmap-Dyzrd4Fd.cjs.map} +1 -1
- package/dist/{heatmap-C1v8bwpq.js → heatmap-J7fxG7MM.js} +3 -3
- package/dist/{heatmap-C1v8bwpq.js.map → heatmap-J7fxG7MM.js.map} +1 -1
- package/dist/{heatmap-CJ-0dfhJ.d.cts → heatmap-Jvwo7iFW.d.cts} +2 -2
- package/dist/{heatmap-Jp5sHRTo.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/index.cjs +37 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -21
- package/dist/index.d.ts +23 -21
- package/dist/index.js +34 -27
- package/dist/index.js.map +1 -1
- package/dist/interaction-DXYSjgnP.cjs.map +1 -1
- package/dist/interaction-En1KlwFO.js.map +1 -1
- package/dist/layout-CYerDebD.d.cts +29 -0
- package/dist/layout-CYerDebD.d.ts +29 -0
- package/dist/{line-CxR4tg1Q.js → line-CXH0L10d.js} +43 -8
- package/dist/line-CXH0L10d.js.map +1 -0
- package/dist/{line-vyWO030v.d.cts → line-Cu9ctpbv.d.cts} +9 -2
- package/dist/{line-YiCuhVMI.cjs → line-DHbYCQy4.cjs} +43 -8
- package/dist/line-DHbYCQy4.cjs.map +1 -0
- package/dist/{line-Bpr5uVLQ.d.ts → line-TkzA7wMK.d.ts} +8 -1
- package/dist/line.cjs +1 -1
- package/dist/line.d.cts +1 -1
- package/dist/line.d.ts +1 -1
- package/dist/line.js +1 -1
- package/dist/{map-49FcfdmJ.d.cts → map-BirylCmT.d.cts} +2 -2
- package/dist/{map-C15NC7kW.js → map-CYp6x-uS.js} +3 -26
- package/dist/map-CYp6x-uS.js.map +1 -0
- package/dist/{map-BqrZ80vT.cjs → map-ChwSgooH.cjs} +4 -27
- package/dist/map-ChwSgooH.cjs.map +1 -0
- package/dist/{map-BMC61J-P.d.ts → map-DNqog2Xs.d.ts} +2 -2
- package/dist/map.cjs +1 -1
- package/dist/map.d.cts +1 -1
- package/dist/map.d.ts +1 -1
- package/dist/map.js +1 -1
- package/dist/maps/world.d.cts +1 -1
- package/dist/maps/world.d.ts +1 -1
- package/dist/{others-ls5eKtZ4.d.cts → others-CuNdpvjd.d.cts} +1 -1
- package/dist/{parliament-Cz9n_DoK.d.ts → parliament-CHdf13XU.d.ts} +2 -2
- package/dist/{parliament-C7V8UJj1.d.cts → parliament-CsYgh4N2.d.cts} +2 -2
- package/dist/parliament.d.cts +1 -1
- package/dist/parliament.d.ts +1 -1
- package/dist/{patterns-Dw7OMD_2.cjs → patterns-BPN1c9qe.cjs} +2 -2
- package/dist/{patterns-Dw7OMD_2.cjs.map → patterns-BPN1c9qe.cjs.map} +1 -1
- package/dist/{patterns-BMUINoka.js → patterns-CVrLrJXg.js} +2 -2
- package/dist/{patterns-BMUINoka.js.map → patterns-CVrLrJXg.js.map} +1 -1
- package/dist/patterns.cjs +1 -1
- package/dist/patterns.d.cts +1 -1
- package/dist/patterns.d.ts +1 -1
- package/dist/patterns.js +1 -1
- package/dist/{percentage-bar-cSeiLdwU.d.ts → percentage-bar-CSAbzDOn.d.ts} +2 -2
- package/dist/{percentage-bar-R1--2grK.d.cts → percentage-bar-UZHCRvlK.d.cts} +3 -3
- package/dist/percentage-bar.d.cts +1 -1
- package/dist/percentage-bar.d.ts +1 -1
- package/dist/{pie-vD5-g8je.d.cts → pie-AFedsDcF.d.cts} +12 -3
- package/dist/{pie-Bd8wyrtY.js → pie-Ch6Bx0ih.js} +54 -39
- package/dist/pie-Ch6Bx0ih.js.map +1 -0
- package/dist/{pie-BseZlCgP.cjs → pie-Cll1OrVZ.cjs} +54 -39
- package/dist/pie-Cll1OrVZ.cjs.map +1 -0
- package/dist/{pie-BQQkvy1N.d.ts → pie-Cn2H3pz8.d.ts} +11 -2
- 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.d.cts +1 -1
- package/dist/point-shapes.d.ts +1 -1
- package/dist/{radar-D6XqkFWQ.js → radar-Bg-IiIWB.js} +3 -3
- package/dist/{radar-D6XqkFWQ.js.map → radar-Bg-IiIWB.js.map} +1 -1
- package/dist/{radar-vLxilcr4.d.ts → radar-DEer2jjd.d.ts} +2 -2
- package/dist/{radar-7I6hsY_h.d.cts → radar-DxmjXhMc.d.cts} +2 -2
- package/dist/{radar-DjISDnSf.cjs → radar-wDyX17S3.cjs} +3 -3
- package/dist/{radar-DjISDnSf.cjs.map → radar-wDyX17S3.cjs.map} +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/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/{sankey-DqiuxUx7.d.cts → sankey-D-8ATwBT.d.cts} +2 -2
- package/dist/{sankey-7As41Fo4.d.ts → sankey-DpYJsOI4.d.ts} +2 -2
- package/dist/sankey.d.cts +1 -1
- package/dist/sankey.d.ts +1 -1
- package/dist/{scatter-DCMAtt5L.js → scatter-0Z7K_YUz.js} +65 -19
- package/dist/scatter-0Z7K_YUz.js.map +1 -0
- package/dist/{scatter-BXkXGgM_.d.ts → scatter-BAL5K9_4.d.ts} +22 -9
- package/dist/{scatter-DL0zAV09.d.cts → scatter-BUGbnRzM.d.cts} +22 -9
- package/dist/{scatter-Bwkblr4L.cjs → scatter-CZ8do3Up.cjs} +65 -19
- 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-BElUSd0r.d.ts → sparkline-CtoBJe-a.d.ts} +2 -2
- package/dist/{sparkline-BMSuEPHP.cjs → sparkline-DjR-V6BI.cjs} +2 -2
- package/dist/{sparkline-BMSuEPHP.cjs.map → sparkline-DjR-V6BI.cjs.map} +1 -1
- package/dist/{sparkline-RYly7bR0.d.cts → sparkline-DwHJfeZz.d.cts} +2 -2
- package/dist/{sparkline-NDmq90kP.js → sparkline-_dxwtdli.js} +2 -2
- package/dist/{sparkline-NDmq90kP.js.map → sparkline-_dxwtdli.js.map} +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-BTWYIwLO.d.cts → stack-CcmyALx0.d.cts} +1 -1
- package/dist/{stack-jVKvg2x_.js → stack-CyVlS7Fr.js} +2 -2
- package/dist/{stack-jVKvg2x_.js.map → stack-CyVlS7Fr.js.map} +1 -1
- package/dist/{stack-BO4624CY.cjs → stack-DBhmYNat.cjs} +2 -2
- package/dist/{stack-BO4624CY.cjs.map → stack-DBhmYNat.cjs.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/{time-axis-B3VekUfX.cjs → time-axis-CVKjQKSS.cjs} +3 -3
- package/dist/{time-axis-B3VekUfX.cjs.map → time-axis-CVKjQKSS.cjs.map} +1 -1
- package/dist/{time-axis-CLjqOakA.js → time-axis-CkmbAw4Z.js} +3 -3
- package/dist/{time-axis-CLjqOakA.js.map → time-axis-CkmbAw4Z.js.map} +1 -1
- package/dist/time.cjs +2 -2
- package/dist/time.js +2 -2
- package/dist/{treemap-25vHO_UK.d.cts → treemap-C2maqerU.d.cts} +26 -4
- package/dist/{treemap-BCXUbixd.d.ts → treemap-D_zbubo3.d.ts} +26 -4
- package/dist/{treemap-CZk8kKFD.cjs → treemap-PulGXZv0.cjs} +38 -8
- package/dist/treemap-PulGXZv0.cjs.map +1 -0
- package/dist/{treemap-C4glsx-g.js → treemap-lbYxb-7h.js} +38 -8
- 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-C7GrhOXJ.js → value-labels-B0VeheyE.js} +5 -4
- package/dist/value-labels-B0VeheyE.js.map +1 -0
- package/dist/{value-labels-DzaKIWKp.cjs → value-labels-Dcyk3GIY.cjs} +5 -4
- package/dist/value-labels-Dcyk3GIY.cjs.map +1 -0
- package/dist/value-labels.cjs +1 -1
- package/dist/value-labels.d.cts +1 -1
- package/dist/value-labels.d.ts +1 -1
- package/dist/value-labels.js +1 -1
- 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 +27 -2
- package/dist/annotations-BQ8l-qHs.js.map +0 -1
- package/dist/annotations-CpCWA29b.cjs.map +0 -1
- package/dist/area-DYdQ_sMV.cjs.map +0 -1
- package/dist/area-WdtfqvhX.js.map +0 -1
- package/dist/axis-MMaVoSWB.js.map +0 -1
- package/dist/axis-YfAerNBA.cjs.map +0 -1
- package/dist/bar-BOcRcArc.js.map +0 -1
- package/dist/bar-CVkOJ7WA.cjs.map +0 -1
- package/dist/candlestick-BtT9glp9.js.map +0 -1
- package/dist/candlestick-CSmRuZ4v.cjs.map +0 -1
- package/dist/cartesian-BrPqb5Qn.js.map +0 -1
- package/dist/cartesian-DRSXHxWe.cjs.map +0 -1
- package/dist/chart-B6TTY4Kr.js.map +0 -1
- package/dist/chart-D_lyOy-M.cjs.map +0 -1
- package/dist/core-CQ0FaJ4G.js.map +0 -1
- package/dist/core-D2PSked3.cjs.map +0 -1
- package/dist/export-chart-CPtXmZvi.cjs.map +0 -1
- package/dist/export-chart-DoeiAyR2.js.map +0 -1
- package/dist/line-CxR4tg1Q.js.map +0 -1
- package/dist/line-YiCuhVMI.cjs.map +0 -1
- package/dist/map-BqrZ80vT.cjs.map +0 -1
- package/dist/map-C15NC7kW.js.map +0 -1
- package/dist/pie-Bd8wyrtY.js.map +0 -1
- package/dist/pie-BseZlCgP.cjs.map +0 -1
- package/dist/scatter-Bwkblr4L.cjs.map +0 -1
- package/dist/scatter-DCMAtt5L.js.map +0 -1
- package/dist/treemap-C4glsx-g.js.map +0 -1
- package/dist/treemap-CZk8kKFD.cjs.map +0 -1
- package/dist/value-labels-C7GrhOXJ.js.map +0 -1
- package/dist/value-labels-DzaKIWKp.cjs.map +0 -1
package/dist/parliament.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Standalone entry: `import { parliament } from '@tabler/charts/parliament'`. */
|
|
2
|
-
import { n as ParliamentParty, r as parliament, t as ParliamentOptions } from "./parliament-
|
|
2
|
+
import { n as ParliamentParty, r as parliament, t as ParliamentOptions } from "./parliament-CHdf13XU.js";
|
|
3
3
|
export { type ParliamentOptions, type ParliamentParty, parliament };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_chart = require("./chart-
|
|
1
|
+
const require_chart = require("./chart-GUmmjJ7S.cjs");
|
|
2
2
|
const require_vnode = require("./vnode-ClAiw28x.cjs");
|
|
3
3
|
// src/charts/patterns.ts
|
|
4
4
|
/**
|
|
@@ -98,4 +98,4 @@ Object.defineProperty(exports, "patternVars", {
|
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
//# sourceMappingURL=patterns-
|
|
101
|
+
//# sourceMappingURL=patterns-BPN1c9qe.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns-
|
|
1
|
+
{"version":3,"file":"patterns-BPN1c9qe.cjs","names":["h","resolveLegend"],"sources":["../src/charts/patterns.ts"],"sourcesContent":["/**\n * Pattern fills, so series do not depend on color alone (color vision\n * deficiency, grayscale print, forced colors). Every legend entry gets an\n * 8×8 tile: its series color with lines or dots in `--tc-pattern-color` (the\n * surface by default) over it, one shape per color slot. The chart root\n * carries `--tc-pattern-{n}: url(#…)` and the slot classes map it to\n * `--tc-series-pattern`, which the stylesheet uses as the fill of bars,\n * areas, slices, rings and bubbles (lines get dashes instead) when\n * `patterns` is `true`, or with `'auto'` (the default) in forced colors.\n */\nimport { type ChartConfig, resolveLegend } from '../chart.ts'\nimport type { LegendItem } from '../legend.ts'\nimport { h, type VNode } from '../vnode.ts'\n\n/** Tile shapes by color slot: lines as strokes, dots as round-capped stubs. */\nconst TILES = [\n // Diagonal /, with the corners filled in so tiles join up.\n 'M-2,2L2,-2M0,8L8,0M6,10L10,6',\n // Dots.\n 'M2,2h.01M6,6h.01',\n // Diagonal \.\n 'M-2,6L2,10M0,0L8,8M6,-2L10,2',\n // Horizontal.\n 'M0,4H8',\n // Cross-hatch.\n 'M0,8L8,0M0,0L8,8',\n // Vertical.\n 'M4,0V8',\n // Grid.\n 'M0,4H8M4,0V8',\n // Dashes.\n 'M1,2H4M5,6H8',\n]\n\n/** Slots with a pattern of their own; series 9+ share the one of the \"other\" color. */\nconst SLOTS = TILES.length\n\n/** The pattern of a slot (0-based): its id suffix and slot class. */\nconst slot = (index: number): [string, string] =>\n index < SLOTS ? [`${index + 1}`, `tc-series-${index + 1}`] : ['other', '']\n\n/** `<pattern>` elements for the legend entries of a chart. */\nexport function patternDefs(items: readonly LegendItem[], id: string): VNode[] {\n const out = new Map<string, VNode>()\n for (const item of items) {\n const [n, cls] = slot(item.index)\n if (out.has(n)) continue\n out.set(\n n,\n h(\n 'pattern',\n {\n key: n,\n id: `${id}-pattern-${n}`,\n class: ['tc-pattern', 'tc-series', cls],\n width: 8,\n height: 8,\n patternUnits: 'userSpaceOnUse',\n // A map, so a color from data cannot inject CSS (see normalizeStyle).\n style: { '--tc-series-color': item.color },\n },\n h('rect', { class: 'tc-pattern-bg', width: 8, height: 8 }),\n h('path', { class: 'tc-pattern-ink', d: TILES[item.index % SLOTS] as string }),\n ),\n )\n }\n return [...out.values()]\n}\n\n/** The `--tc-pattern-{n}` references for the chart root. */\nexport function patternVars(items: readonly LegendItem[], id: string): Record<string, string> {\n const vars: Record<string, string> = {}\n for (const item of items) {\n const [n] = slot(item.index)\n vars[`--tc-pattern-${n}`] = `url(#${id}-pattern-${n})`\n }\n return vars\n}\n\n/**\n * The pattern fills of a chart: its root class (`tc-patterned` with\n * `patterns: true`, `tc-patterns-auto` for forced colors), the root's\n * `--tc-pattern-{n}` references and the `<defs>` with the patterns;\n * `undefined` for a chart without legend entries.\n */\nexport function patternFills(\n config: ChartConfig<object>,\n id: string,\n): [string, Record<string, string>, VNode] | undefined {\n const { items } = resolveLegend(config)\n if (!items.length) return undefined\n return [\n config.patterns === true ? 'tc-patterned' : 'tc-patterns-auto',\n patternVars(items, id),\n h('defs', { key: 'patterns' }, patternDefs(items, id)),\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,QAAQ;CAEZ;CAEA;CAEA;CAEA;CAEA;CAEA;CAEA;CAEA;AACF;;AAGA,MAAM,QAAQ,MAAM;;AAGpB,MAAM,QAAQ,UACZ,QAAQ,QAAQ,CAAC,GAAG,QAAQ,KAAK,aAAa,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE;;AAG3E,SAAgB,YAAY,OAA8B,IAAqB;CAC7E,MAAM,sBAAM,IAAI,IAAmB;CACnC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,CAAC,GAAG,OAAO,KAAK,KAAK,KAAK;EAChC,IAAI,IAAI,IAAI,CAAC,GAAG;EAChB,IAAI,IACF,GACAA,cAAAA,EACE,WACA;GACE,KAAK;GACL,IAAI,GAAG,GAAG,WAAW;GACrB,OAAO;IAAC;IAAc;IAAa;GAAG;GACtC,OAAO;GACP,QAAQ;GACR,cAAc;GAEd,OAAO,EAAE,qBAAqB,KAAK,MAAM;EAC3C,GACAA,cAAAA,EAAE,QAAQ;GAAE,OAAO;GAAiB,OAAO;GAAG,QAAQ;EAAE,CAAC,GACzDA,cAAAA,EAAE,QAAQ;GAAE,OAAO;GAAkB,GAAG,MAAM,KAAK,QAAQ;EAAiB,CAAC,CAC/E,CACF;CACF;CACA,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC;AACzB;;AAGA,SAAgB,YAAY,OAA8B,IAAoC;CAC5F,MAAM,OAA+B,CAAC;CACtC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,CAAC,KAAK,KAAK,KAAK,KAAK;EAC3B,KAAK,gBAAgB,OAAO,QAAQ,GAAG,WAAW,EAAE;CACtD;CACA,OAAO;AACT;;;;;;;AAQA,SAAgB,aACd,QACA,IACqD;CACrD,MAAM,EAAE,UAAUC,cAAAA,cAAc,MAAM;CACtC,IAAI,CAAC,MAAM,QAAQ,OAAO,KAAA;CAC1B,OAAO;EACL,OAAO,aAAa,OAAO,iBAAiB;EAC5C,YAAY,OAAO,EAAE;EACrBD,cAAAA,EAAE,QAAQ,EAAE,KAAK,WAAW,GAAG,YAAY,OAAO,EAAE,CAAC;CACvD;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { u as resolveLegend } from "./chart-B97FBRCd.js";
|
|
2
2
|
import { t as h } from "./vnode-_EMUqysL.js";
|
|
3
3
|
// src/charts/patterns.ts
|
|
4
4
|
/**
|
|
@@ -81,4 +81,4 @@ function patternFills(config, id) {
|
|
|
81
81
|
}
|
|
82
82
|
export { patternFills as n, patternVars as r, patternDefs as t };
|
|
83
83
|
|
|
84
|
-
//# sourceMappingURL=patterns-
|
|
84
|
+
//# sourceMappingURL=patterns-CVrLrJXg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns-
|
|
1
|
+
{"version":3,"file":"patterns-CVrLrJXg.js","names":[],"sources":["../src/charts/patterns.ts"],"sourcesContent":["/**\n * Pattern fills, so series do not depend on color alone (color vision\n * deficiency, grayscale print, forced colors). Every legend entry gets an\n * 8×8 tile: its series color with lines or dots in `--tc-pattern-color` (the\n * surface by default) over it, one shape per color slot. The chart root\n * carries `--tc-pattern-{n}: url(#…)` and the slot classes map it to\n * `--tc-series-pattern`, which the stylesheet uses as the fill of bars,\n * areas, slices, rings and bubbles (lines get dashes instead) when\n * `patterns` is `true`, or with `'auto'` (the default) in forced colors.\n */\nimport { type ChartConfig, resolveLegend } from '../chart.ts'\nimport type { LegendItem } from '../legend.ts'\nimport { h, type VNode } from '../vnode.ts'\n\n/** Tile shapes by color slot: lines as strokes, dots as round-capped stubs. */\nconst TILES = [\n // Diagonal /, with the corners filled in so tiles join up.\n 'M-2,2L2,-2M0,8L8,0M6,10L10,6',\n // Dots.\n 'M2,2h.01M6,6h.01',\n // Diagonal \.\n 'M-2,6L2,10M0,0L8,8M6,-2L10,2',\n // Horizontal.\n 'M0,4H8',\n // Cross-hatch.\n 'M0,8L8,0M0,0L8,8',\n // Vertical.\n 'M4,0V8',\n // Grid.\n 'M0,4H8M4,0V8',\n // Dashes.\n 'M1,2H4M5,6H8',\n]\n\n/** Slots with a pattern of their own; series 9+ share the one of the \"other\" color. */\nconst SLOTS = TILES.length\n\n/** The pattern of a slot (0-based): its id suffix and slot class. */\nconst slot = (index: number): [string, string] =>\n index < SLOTS ? [`${index + 1}`, `tc-series-${index + 1}`] : ['other', '']\n\n/** `<pattern>` elements for the legend entries of a chart. */\nexport function patternDefs(items: readonly LegendItem[], id: string): VNode[] {\n const out = new Map<string, VNode>()\n for (const item of items) {\n const [n, cls] = slot(item.index)\n if (out.has(n)) continue\n out.set(\n n,\n h(\n 'pattern',\n {\n key: n,\n id: `${id}-pattern-${n}`,\n class: ['tc-pattern', 'tc-series', cls],\n width: 8,\n height: 8,\n patternUnits: 'userSpaceOnUse',\n // A map, so a color from data cannot inject CSS (see normalizeStyle).\n style: { '--tc-series-color': item.color },\n },\n h('rect', { class: 'tc-pattern-bg', width: 8, height: 8 }),\n h('path', { class: 'tc-pattern-ink', d: TILES[item.index % SLOTS] as string }),\n ),\n )\n }\n return [...out.values()]\n}\n\n/** The `--tc-pattern-{n}` references for the chart root. */\nexport function patternVars(items: readonly LegendItem[], id: string): Record<string, string> {\n const vars: Record<string, string> = {}\n for (const item of items) {\n const [n] = slot(item.index)\n vars[`--tc-pattern-${n}`] = `url(#${id}-pattern-${n})`\n }\n return vars\n}\n\n/**\n * The pattern fills of a chart: its root class (`tc-patterned` with\n * `patterns: true`, `tc-patterns-auto` for forced colors), the root's\n * `--tc-pattern-{n}` references and the `<defs>` with the patterns;\n * `undefined` for a chart without legend entries.\n */\nexport function patternFills(\n config: ChartConfig<object>,\n id: string,\n): [string, Record<string, string>, VNode] | undefined {\n const { items } = resolveLegend(config)\n if (!items.length) return undefined\n return [\n config.patterns === true ? 'tc-patterned' : 'tc-patterns-auto',\n patternVars(items, id),\n h('defs', { key: 'patterns' }, patternDefs(items, id)),\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,QAAQ;CAEZ;CAEA;CAEA;CAEA;CAEA;CAEA;CAEA;CAEA;AACF;;AAGA,MAAM,QAAQ,MAAM;;AAGpB,MAAM,QAAQ,UACZ,QAAQ,QAAQ,CAAC,GAAG,QAAQ,KAAK,aAAa,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE;;AAG3E,SAAgB,YAAY,OAA8B,IAAqB;CAC7E,MAAM,sBAAM,IAAI,IAAmB;CACnC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,CAAC,GAAG,OAAO,KAAK,KAAK,KAAK;EAChC,IAAI,IAAI,IAAI,CAAC,GAAG;EAChB,IAAI,IACF,GACA,EACE,WACA;GACE,KAAK;GACL,IAAI,GAAG,GAAG,WAAW;GACrB,OAAO;IAAC;IAAc;IAAa;GAAG;GACtC,OAAO;GACP,QAAQ;GACR,cAAc;GAEd,OAAO,EAAE,qBAAqB,KAAK,MAAM;EAC3C,GACA,EAAE,QAAQ;GAAE,OAAO;GAAiB,OAAO;GAAG,QAAQ;EAAE,CAAC,GACzD,EAAE,QAAQ;GAAE,OAAO;GAAkB,GAAG,MAAM,KAAK,QAAQ;EAAiB,CAAC,CAC/E,CACF;CACF;CACA,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC;AACzB;;AAGA,SAAgB,YAAY,OAA8B,IAAoC;CAC5F,MAAM,OAA+B,CAAC;CACtC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,CAAC,KAAK,KAAK,KAAK,KAAK;EAC3B,KAAK,gBAAgB,OAAO,QAAQ,GAAG,WAAW,EAAE;CACtD;CACA,OAAO;AACT;;;;;;;AAQA,SAAgB,aACd,QACA,IACqD;CACrD,MAAM,EAAE,UAAU,cAAc,MAAM;CACtC,IAAI,CAAC,MAAM,QAAQ,OAAO,KAAA;CAC1B,OAAO;EACL,OAAO,aAAa,OAAO,iBAAiB;EAC5C,YAAY,OAAO,EAAE;EACrB,EAAE,QAAQ,EAAE,KAAK,WAAW,GAAG,YAAY,OAAO,EAAE,CAAC;CACvD;AACF"}
|
package/dist/patterns.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_patterns = require("./patterns-
|
|
2
|
+
const require_patterns = require("./patterns-BPN1c9qe.cjs");
|
|
3
3
|
// src/patterns.ts
|
|
4
4
|
/**
|
|
5
5
|
* Standalone entry: `import '@tabler/charts/patterns'` enables pattern fills
|
package/dist/patterns.d.cts
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Standalone entry: `import '@tabler/charts/patterns'` enables pattern fills
|
|
3
3
|
* (`patterns: true`, and in forced colors by default) on the core.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { at as patternDefs, ot as patternFills, st as patternVars } from "./chart-Dz4geQZy.cjs";
|
|
6
6
|
export { patternDefs, patternFills, patternVars };
|
package/dist/patterns.d.ts
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Standalone entry: `import '@tabler/charts/patterns'` enables pattern fills
|
|
3
3
|
* (`patterns: true`, and in forced colors by default) on the core.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { nt as patternFills, rt as patternVars, tt as patternDefs } from "./chart-CE9EVbfV.js";
|
|
6
6
|
export { patternDefs, patternFills, patternVars };
|
package/dist/patterns.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as patternFills, r as patternVars, t as patternDefs } from "./patterns-
|
|
1
|
+
import { n as patternFills, r as patternVars, t as patternDefs } from "./patterns-CVrLrJXg.js";
|
|
2
2
|
import { i as register } from "./features-B55rwpQC.js";
|
|
3
3
|
// src/patterns.ts
|
|
4
4
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as ChartType } from "./chart-
|
|
1
|
+
import { o as ChartType } from "./chart-CE9EVbfV.js";
|
|
2
2
|
import { c as NumberFormat } from "./time-DRIDgv2a.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as InsetsInput } from "./layout-CYerDebD.js";
|
|
4
4
|
import { a as ClassValue } from "./vnode-Du2cC8Fm.js";
|
|
5
5
|
import { n as WithSlices, t as SliceGrouping } from "./others-DBO4Kjwl.js";
|
|
6
6
|
/** One segment of a percentage bar. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { o as ChartType } from "./chart-
|
|
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-
|
|
5
|
+
import { n as WithSlices, t as SliceGrouping } from "./others-CuNdpvjd.cjs";
|
|
6
6
|
/** One segment of a percentage bar. */
|
|
7
7
|
interface PercentageBarSegment {
|
|
8
8
|
name: string;
|
|
@@ -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 };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { o as ChartType } from "./chart-
|
|
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-
|
|
5
|
+
import { n as WithSlices, t as SliceGrouping } from "./others-CuNdpvjd.cjs";
|
|
6
|
+
import { t as SliceLabelOptions } from "./slice-labels-1TBq7p3q.cjs";
|
|
6
7
|
/** One slice of a pie or donut. */
|
|
7
8
|
interface PieSlice {
|
|
8
9
|
name: string;
|
|
@@ -42,6 +43,14 @@ interface PieOptions extends SliceGrouping {
|
|
|
42
43
|
};
|
|
43
44
|
/** Extra space around the pie, in pixels. */
|
|
44
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;
|
|
45
54
|
}
|
|
46
55
|
/** The chart model of a pie: its options, with the slices as drawn (the rest grouped). */
|
|
47
56
|
type PieModel = WithSlices<PieOptions>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as feature } from "./features-B55rwpQC.js";
|
|
1
2
|
import { o as getNumberFormat, r as formatNumber } from "./format-it1kepFG.js";
|
|
2
3
|
import { i as insets, r as innerRect } from "./layout-DqAte3H8.js";
|
|
3
4
|
import { n as sweep, t as arcNode } from "./sweep-BpRPlhs6.js";
|
|
@@ -29,21 +30,31 @@ function layoutSlices(model, hidden) {
|
|
|
29
30
|
function renderPie(options, ctx, defaults) {
|
|
30
31
|
const { width, height, locale } = ctx;
|
|
31
32
|
const gap = options.gap ?? 2;
|
|
32
|
-
const area = innerRect(width, height, insets(options.padding, 0));
|
|
33
|
-
const outer = Math.max(0, Math.min(area.width, area.height) / 2 - 8);
|
|
34
|
-
const inner = outer * Math.min(.95, Math.max(0, options.innerRadius ?? defaults.inner));
|
|
35
|
-
const cornerRadius = options.cornerRadius ?? defaults.corner;
|
|
36
|
-
const cx = area.x + area.width / 2;
|
|
37
|
-
const cy = area.y + area.height / 2;
|
|
38
33
|
const { slices, total } = layoutSlices(options, ctx.hidden);
|
|
39
34
|
const drawn = slices.filter((slice) => slice.value > 0);
|
|
40
|
-
const strokeGap = inner === 0 && drawn.length > 1 ? gap : 0;
|
|
41
|
-
const padAngle = inner > 0 && drawn.length > 1 ? padAngleForGap(gap, inner, outer) : 0;
|
|
42
35
|
const value = formatNumber(options.format, locale);
|
|
43
36
|
const share = getNumberFormat(locale, {
|
|
44
37
|
style: "percent",
|
|
45
38
|
maximumFractionDigits: 1
|
|
46
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;
|
|
47
58
|
const geometry = (slice, r0 = inner, r1 = outer) => ({
|
|
48
59
|
innerRadius: r0,
|
|
49
60
|
outerRadius: r1,
|
|
@@ -112,36 +123,40 @@ function renderPie(options, ctx, defaults) {
|
|
|
112
123
|
const centerValue = showCenter ? center?.value ?? value(total) : "";
|
|
113
124
|
const centerLabel = showCenter ? center?.label : void 0;
|
|
114
125
|
return {
|
|
115
|
-
content: [
|
|
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
|
-
|
|
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
|
+
],
|
|
145
160
|
interaction
|
|
146
161
|
};
|
|
147
162
|
}
|
|
@@ -195,4 +210,4 @@ const donut = pieType("donut", {
|
|
|
195
210
|
});
|
|
196
211
|
export { pie as n, donut as t };
|
|
197
212
|
|
|
198
|
-
//# 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 the total (or your own `center`). */\nexport const donut: ChartType<PieOptions, PieModel> = pieType('donut', { inner: 0.62, corner: 4 })\n"],"mappings":";;;;;;;;;;;AAyEA,SAAS,aACP,OACA,QACoC;CACpC,MAAM,UAAU,MAAM,OAAO,QAAQ,UAAU,CAAC,OAAO,IAAI,MAAM,MAAM,IAAI,CAAC,CAAC;CAC7E,MAAM,QAAQ,QAAQ,QAAQ,KAAK,UAAU,MAAM,MAAM,OAAO,CAAC;CACjE,IAAI,SAAS,MAAM,cAAc,KAAK;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,EAAE,QAAQ,UAAU,aAAa,SAAS,IAAI,MAAM;CAC1D,MAAM,QAAQ,OAAO,QAA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AAE,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,3 +1,4 @@
|
|
|
1
|
+
const require_features = require("./features-DEDP5CEQ.cjs");
|
|
1
2
|
const require_format = require("./format-CAE5ruy6.cjs");
|
|
2
3
|
const require_layout = require("./layout-Cfg9x1k2.cjs");
|
|
3
4
|
const require_sweep = require("./sweep-Dnp6LDBz.cjs");
|
|
@@ -29,21 +30,31 @@ function layoutSlices(model, hidden) {
|
|
|
29
30
|
function renderPie(options, ctx, defaults) {
|
|
30
31
|
const { width, height, locale } = ctx;
|
|
31
32
|
const gap = options.gap ?? 2;
|
|
32
|
-
const area = require_layout.innerRect(width, height, require_layout.insets(options.padding, 0));
|
|
33
|
-
const outer = Math.max(0, Math.min(area.width, area.height) / 2 - 8);
|
|
34
|
-
const inner = outer * Math.min(.95, Math.max(0, options.innerRadius ?? defaults.inner));
|
|
35
|
-
const cornerRadius = options.cornerRadius ?? defaults.corner;
|
|
36
|
-
const cx = area.x + area.width / 2;
|
|
37
|
-
const cy = area.y + area.height / 2;
|
|
38
33
|
const { slices, total } = layoutSlices(options, ctx.hidden);
|
|
39
34
|
const drawn = slices.filter((slice) => slice.value > 0);
|
|
40
|
-
const strokeGap = inner === 0 && drawn.length > 1 ? gap : 0;
|
|
41
|
-
const padAngle = inner > 0 && drawn.length > 1 ? require_arc.padAngleForGap(gap, inner, outer) : 0;
|
|
42
35
|
const value = require_format.formatNumber(options.format, locale);
|
|
43
36
|
const share = require_format.getNumberFormat(locale, {
|
|
44
37
|
style: "percent",
|
|
45
38
|
maximumFractionDigits: 1
|
|
46
39
|
});
|
|
40
|
+
const frame = require_layout.innerRect(width, height, require_layout.insets(options.padding, 0));
|
|
41
|
+
const shown = options.labels === true ? "share" : options.labels ? options.labels.value : false;
|
|
42
|
+
const labelled = options.labels ? require_features.feature("slice-labels")(drawn.map((slice) => ({
|
|
43
|
+
key: require_named.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 ? require_arc.padAngleForGap(gap, inner, outer) : 0;
|
|
47
58
|
const geometry = (slice, r0 = inner, r1 = outer) => ({
|
|
48
59
|
innerRadius: r0,
|
|
49
60
|
outerRadius: r1,
|
|
@@ -112,36 +123,40 @@ function renderPie(options, ctx, defaults) {
|
|
|
112
123
|
const centerValue = showCenter ? center?.value ?? value(total) : "";
|
|
113
124
|
const centerLabel = showCenter ? center?.label : void 0;
|
|
114
125
|
return {
|
|
115
|
-
content: [
|
|
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
|
-
|
|
126
|
+
content: [
|
|
127
|
+
require_vnode.h("g", {
|
|
128
|
+
class: "tc-pie",
|
|
129
|
+
style: `transform:translate(${cx}px,${cy}px)`
|
|
130
|
+
}, total === 0 && require_vnode.h("path", {
|
|
131
|
+
class: "tc-pie-track",
|
|
132
|
+
d: require_arc.arcPathStable({
|
|
133
|
+
innerRadius: inner,
|
|
134
|
+
outerRadius: outer,
|
|
135
|
+
startAngle: 0,
|
|
136
|
+
endAngle: Math.PI * 2
|
|
137
|
+
})
|
|
138
|
+
}), require_vnode.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 && require_vnode.h("g", {
|
|
144
|
+
class: "tc-pie-center",
|
|
145
|
+
"aria-hidden": "true"
|
|
146
|
+
}, require_vnode.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 && require_vnode.h("text", {
|
|
153
|
+
class: "tc-pie-label",
|
|
154
|
+
x: cx,
|
|
155
|
+
y: cy,
|
|
156
|
+
dy: "1.6em",
|
|
157
|
+
"text-anchor": "middle"
|
|
158
|
+
}, centerLabel))
|
|
159
|
+
],
|
|
145
160
|
interaction
|
|
146
161
|
};
|
|
147
162
|
}
|
|
@@ -206,4 +221,4 @@ Object.defineProperty(exports, "pie", {
|
|
|
206
221
|
}
|
|
207
222
|
});
|
|
208
223
|
|
|
209
|
-
//# sourceMappingURL=pie-
|
|
224
|
+
//# sourceMappingURL=pie-Cll1OrVZ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-Cll1OrVZ.cjs","names":["keyOf","DEG","formatNumber","getNumberFormat","innerRect","insets","feature","padAngleForGap","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 { 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 the total (or your own `center`). */\nexport const donut: ChartType<PieOptions, PieModel> = pieType('donut', { inner: 0.62, corner: 4 })\n"],"mappings":";;;;;;;;;;;AAyEA,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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CAAE,OAAO;CAAM,QAAQ;AAAE,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { o as ChartType } from "./chart-
|
|
1
|
+
import { o as ChartType } from "./chart-CE9EVbfV.js";
|
|
2
2
|
import { c as NumberFormat } from "./time-DRIDgv2a.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as InsetsInput } from "./layout-CYerDebD.js";
|
|
4
4
|
import { a as ClassValue } from "./vnode-Du2cC8Fm.js";
|
|
5
5
|
import { n as WithSlices, t as SliceGrouping } from "./others-DBO4Kjwl.js";
|
|
6
|
+
import { t as SliceLabelOptions } from "./slice-labels-Cm5CyV7B.js";
|
|
6
7
|
/** One slice of a pie or donut. */
|
|
7
8
|
interface PieSlice {
|
|
8
9
|
name: string;
|
|
@@ -42,6 +43,14 @@ interface PieOptions extends SliceGrouping {
|
|
|
42
43
|
};
|
|
43
44
|
/** Extra space around the pie, in pixels. */
|
|
44
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;
|
|
45
54
|
}
|
|
46
55
|
/** The chart model of a pie: its options, with the slices as drawn (the rest grouped). */
|
|
47
56
|
type PieModel = WithSlices<PieOptions>;
|
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-AFedsDcF.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-Cn2H3pz8.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-Ch6Bx0ih.js";
|
package/dist/point-shapes.d.cts
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Standalone entry: `import '@tabler/charts/point-shapes'` enables `shapes`
|
|
3
3
|
* (a point shape per series) on the core.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { it as shapesStep, nt as markerClip, rt as markerPath } from "./chart-Dz4geQZy.cjs";
|
|
6
6
|
export { markerClip, markerPath, shapesStep };
|
package/dist/point-shapes.d.ts
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Standalone entry: `import '@tabler/charts/point-shapes'` enables `shapes`
|
|
3
3
|
* (a point shape per series) on the core.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { $ as markerPath, Q as markerClip, et as shapesStep } from "./chart-CE9EVbfV.js";
|
|
6
6
|
export { markerClip, markerPath, shapesStep };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { o as linearTicks } from "./axis-
|
|
1
|
+
import { o as linearTicks } from "./axis-C5obgdJt.js";
|
|
2
2
|
import { n as formatDetail } from "./format-it1kepFG.js";
|
|
3
3
|
import { i as insets, n as estimateTextWidth, r as innerRect, s as round, t as LINE_HEIGHT } from "./layout-DqAte3H8.js";
|
|
4
|
-
import {
|
|
4
|
+
import { _ as seriesTable, d as resolveLabels, f as seriesAttrs, h as seriesLegend, m as seriesKey, o as labelKey, r as domainOf, s as markerShape, u as pointMark, v as tickCount, w as linear } from "./cartesian-COglz544.js";
|
|
5
5
|
import { t as h } from "./vnode-_EMUqysL.js";
|
|
6
6
|
import { r as cleanSeries, t as cleanData } from "./clean-CkoQobGv.js";
|
|
7
7
|
// src/charts/radar.ts
|
|
@@ -280,4 +280,4 @@ const radar = {
|
|
|
280
280
|
};
|
|
281
281
|
export { radar as t };
|
|
282
282
|
|
|
283
|
-
//# sourceMappingURL=radar-
|
|
283
|
+
//# sourceMappingURL=radar-Bg-IiIWB.js.map
|