@tabler/charts 0.1.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 +92 -4
- package/dist/{annotations-Bp7HwtF5.d.ts → annotations-B02GR_KU.d.ts} +3 -8
- package/dist/{annotations-BszTTjf9.js → annotations-BQ8l-qHs.js} +6 -7
- package/dist/{annotations-BszTTjf9.js.map → annotations-BQ8l-qHs.js.map} +1 -1
- package/dist/{annotations-lyt0I3HU.d.cts → annotations-CHafaGd4.d.cts} +3 -8
- package/dist/{annotations-DpETO8dE.cjs → annotations-CpCWA29b.cjs} +6 -7
- package/dist/{annotations-DpETO8dE.cjs.map → annotations-CpCWA29b.cjs.map} +1 -1
- package/dist/annotations.cjs +3 -5
- package/dist/annotations.cjs.map +1 -1
- package/dist/annotations.d.cts +2 -1
- package/dist/annotations.d.ts +2 -1
- package/dist/annotations.js +3 -4
- package/dist/{arc-a1tRTEw7.js → arc-B3V5IR0w.js} +2 -3
- package/dist/{arc-a1tRTEw7.js.map → arc-B3V5IR0w.js.map} +1 -1
- package/dist/{arc-BXpLrt9b.cjs → arc-CYhI62kO.cjs} +2 -3
- package/dist/{arc-BXpLrt9b.cjs.map → arc-CYhI62kO.cjs.map} +1 -1
- package/dist/{area-CF__HOwL.d.ts → area-DEFQm_SQ.d.ts} +3 -6
- package/dist/{area-sHCE3pg5.cjs → area-DYdQ_sMV.cjs} +5 -6
- package/dist/{area-sHCE3pg5.cjs.map → area-DYdQ_sMV.cjs.map} +1 -1
- package/dist/{area-DQsLERhx.js → area-WdtfqvhX.js} +5 -6
- package/dist/{area-DQsLERhx.js.map → area-WdtfqvhX.js.map} +1 -1
- package/dist/{area-DIxaAbYZ.d.cts → area-h_FvieFb.d.cts} +3 -6
- package/dist/area.cjs +1 -1
- package/dist/area.d.cts +2 -1
- package/dist/area.d.ts +2 -1
- package/dist/area.js +1 -2
- 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/{band-DTcNDAFO.d.ts → band-CNKvdnTC.d.cts} +1 -4
- package/dist/{band-DTcNDAFO.d.cts → band-CNKvdnTC.d.ts} +1 -4
- package/dist/{bar-jZEoao74.js → bar-BOcRcArc.js} +80 -62
- package/dist/bar-BOcRcArc.js.map +1 -0
- package/dist/{bar-C-7zR2qp.cjs → bar-CVkOJ7WA.cjs} +82 -64
- package/dist/bar-CVkOJ7WA.cjs.map +1 -0
- package/dist/{bar-DM16NUvV.js → bar-CgpC2EpX.js} +3 -4
- package/dist/{bar-DM16NUvV.js.map → bar-CgpC2EpX.js.map} +1 -1
- package/dist/{bar-BBM8RhoL.d.ts → bar-D9B_arKf.d.ts} +4 -7
- package/dist/{bar-CRKLDg98.d.cts → bar-DZCQ-kyf.d.cts} +4 -7
- package/dist/{bar-DGuUN3nc.cjs → bar-wVykm1us.cjs} +3 -4
- package/dist/{bar-DGuUN3nc.cjs.map → bar-wVykm1us.cjs.map} +1 -1
- package/dist/bar.cjs +1 -1
- package/dist/bar.d.cts +2 -1
- package/dist/bar.d.ts +2 -1
- package/dist/bar.js +1 -2
- 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-D_vV0_XZ.d.ts → candlestick-B3WcLzph.d.ts} +3 -6
- package/dist/{candlestick-__pXl_pV.d.cts → candlestick-BcomxeVG.d.cts} +3 -6
- package/dist/{candlestick-DuXwAFID.js → candlestick-BtT9glp9.js} +19 -18
- package/dist/{candlestick-DuXwAFID.js.map → candlestick-BtT9glp9.js.map} +1 -1
- package/dist/{candlestick-B5r1w3kc.cjs → candlestick-CSmRuZ4v.cjs} +19 -18
- package/dist/{candlestick-B5r1w3kc.cjs.map → candlestick-CSmRuZ4v.cjs.map} +1 -1
- package/dist/candlestick.cjs +4 -5
- package/dist/candlestick.d.cts +1 -1
- package/dist/candlestick.d.ts +1 -1
- package/dist/candlestick.js +4 -6
- package/dist/{cartesian-Cr0AF0nG.js → cartesian-BrPqb5Qn.js} +138 -264
- package/dist/cartesian-BrPqb5Qn.js.map +1 -0
- package/dist/{cartesian-BoDfgBCV.cjs → cartesian-DRSXHxWe.cjs} +162 -324
- package/dist/cartesian-DRSXHxWe.cjs.map +1 -0
- package/dist/{chart-BF2CK9I_.js → chart-B6TTY4Kr.js} +120 -77
- package/dist/chart-B6TTY4Kr.js.map +1 -0
- package/dist/{chart-DyN7bcx8.d.ts → chart-CYrrUCi3.d.ts} +222 -102
- package/dist/{chart-D7ooEFnk.d.cts → chart-CbPzP5Dp.d.cts} +248 -102
- package/dist/{chart-CowF_lWY.cjs → chart-D_lyOy-M.cjs} +132 -83
- package/dist/chart-D_lyOy-M.cjs.map +1 -0
- package/dist/{circle-BQMuAfls.cjs → circle-Bwxy5j7B.cjs} +2 -3
- package/dist/{circle-BQMuAfls.cjs.map → circle-Bwxy5j7B.cjs.map} +1 -1
- package/dist/{circle-Z7YfCoCM.js → circle-YRDaOBpk.js} +2 -3
- package/dist/{circle-Z7YfCoCM.js.map → circle-YRDaOBpk.js.map} +1 -1
- package/dist/{clean-o1vDEhFV.js → clean-CkoQobGv.js} +3 -4
- package/dist/{clean-o1vDEhFV.js.map → clean-CkoQobGv.js.map} +1 -1
- package/dist/{clean-Byl6kzf0.cjs → clean-Die2iCNc.cjs} +8 -3
- package/dist/{clean-Byl6kzf0.cjs.map → clean-Die2iCNc.cjs.map} +1 -1
- package/dist/{core-D1vO1LrC.d.cts → core-9BnLEW4K.d.cts} +31 -72
- package/dist/{core-DcbemzGf.d.ts → core-C3qEppSm.d.ts} +10 -46
- package/dist/{core-CegR_j55.js → core-CQ0FaJ4G.js} +138 -99
- package/dist/core-CQ0FaJ4G.js.map +1 -0
- package/dist/{core-RzS9IQO5.cjs → core-D2PSked3.cjs} +139 -100
- package/dist/core-D2PSked3.cjs.map +1 -0
- package/dist/core.cjs +47 -33
- package/dist/core.d.cts +26 -21
- package/dist/core.d.ts +26 -21
- package/dist/core.js +31 -25
- package/dist/{dates-CG-FvioW.js → dates-DLe2Ww64.js} +4 -5
- package/dist/{dates-CG-FvioW.js.map → dates-DLe2Ww64.js.map} +1 -1
- package/dist/{dates-Btm7Zm6W.cjs → dates-DerXTb1J.cjs} +4 -5
- package/dist/{dates-Btm7Zm6W.cjs.map → dates-DerXTb1J.cjs.map} +1 -1
- package/dist/{decimate-tLhDk1ys.cjs → decimate-BS3x8g-f.cjs} +2 -3
- package/dist/{decimate-tLhDk1ys.cjs.map → decimate-BS3x8g-f.cjs.map} +1 -1
- package/dist/{decimate-BGg9XgF0.d.ts → decimate-BxxYBJJk.d.cts} +2 -5
- package/dist/{decimate-C87cl_Sp.js → decimate-CapfgiDY.js} +2 -3
- package/dist/{decimate-C87cl_Sp.js.map → decimate-CapfgiDY.js.map} +1 -1
- package/dist/{decimate-CNSpgGa5.d.cts → decimate-Du87fMLG.d.ts} +2 -5
- package/dist/decimate.cjs +3 -4
- package/dist/decimate.d.cts +1 -1
- package/dist/decimate.d.ts +1 -1
- package/dist/decimate.js +3 -4
- package/dist/{dom-CLF868Qs.cjs → dom-C33zvtPo.cjs} +5 -11
- package/dist/dom-C33zvtPo.cjs.map +1 -0
- package/dist/{dom-vP3IcMak.js → dom-CTse6Rvd.js} +5 -11
- package/dist/dom-CTse6Rvd.js.map +1 -0
- package/dist/{export-chart-BhhYgksr.cjs → export-chart-CPtXmZvi.cjs} +18 -14
- package/dist/export-chart-CPtXmZvi.cjs.map +1 -0
- package/dist/{export-chart-9w8t3rjZ.js → export-chart-DoeiAyR2.js} +18 -14
- package/dist/export-chart-DoeiAyR2.js.map +1 -0
- package/dist/export.cjs +3 -5
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +8 -1
- package/dist/export.d.ts +8 -1
- package/dist/export.js +3 -4
- package/dist/{extent-BAMZo0Nq.js → extent-DOV8rs-6.js} +2 -3
- package/dist/{extent-BAMZo0Nq.js.map → extent-DOV8rs-6.js.map} +1 -1
- package/dist/{extent-DsFWvAHJ.cjs → extent-DuYDcvM9.cjs} +2 -3
- package/dist/{extent-DsFWvAHJ.cjs.map → extent-DuYDcvM9.cjs.map} +1 -1
- package/dist/{fade-D3NxH5Qg.js → fade-CDrQjnDz.js} +59 -83
- package/dist/fade-CDrQjnDz.js.map +1 -0
- package/dist/{fade-Cs74puQS.cjs → fade-CRqcKMWY.cjs} +59 -83
- package/dist/fade-CRqcKMWY.cjs.map +1 -0
- package/dist/{features-wASyHGic.js → features-B55rwpQC.js} +5 -4
- package/dist/features-B55rwpQC.js.map +1 -0
- package/dist/{features-BclHgg2W.cjs → features-DEDP5CEQ.cjs} +10 -3
- 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/{format-B0yKXBTH.cjs → format-CAE5ruy6.cjs} +2 -3
- package/dist/{format-B0yKXBTH.cjs.map → format-CAE5ruy6.cjs.map} +1 -1
- package/dist/{format-lStwuc1L.js → format-it1kepFG.js} +2 -3
- package/dist/{format-lStwuc1L.js.map → format-it1kepFG.js.map} +1 -1
- 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-D-FYhuds.cjs → gauge-6HfDcLMJ.cjs} +35 -36
- package/dist/gauge-6HfDcLMJ.cjs.map +1 -0
- package/dist/{gauge-Dh423FHh.js → gauge-DiTk5aWO.js} +35 -36
- package/dist/gauge-DiTk5aWO.js.map +1 -0
- package/dist/{gauge-zpia05t2.d.ts → gauge-Ds9k1UV2.d.cts} +5 -8
- package/dist/{gauge-DP_EB2z3.d.cts → gauge-Zy25jfps.d.ts} +5 -8
- package/dist/gauge.cjs +1 -1
- package/dist/gauge.d.cts +2 -1
- package/dist/gauge.d.ts +2 -1
- package/dist/gauge.js +1 -2
- package/dist/{heatmap-DSZ2bVIa.js → heatmap-C1v8bwpq.js} +43 -43
- package/dist/heatmap-C1v8bwpq.js.map +1 -0
- package/dist/{heatmap-BectCEeE.d.ts → heatmap-CJ-0dfhJ.d.cts} +4 -7
- package/dist/{heatmap-BK18EBgJ.cjs → heatmap-Dcc_bsoQ.cjs} +47 -47
- package/dist/heatmap-Dcc_bsoQ.cjs.map +1 -0
- package/dist/{heatmap-CCso6m61.d.cts → heatmap-Jp5sHRTo.d.ts} +4 -7
- package/dist/heatmap.cjs +1 -1
- package/dist/heatmap.d.cts +2 -1
- package/dist/heatmap.d.ts +2 -1
- package/dist/heatmap.js +1 -2
- package/dist/{hydrate-DDNIHYv_.js → hydrate-BB3MlR36.js} +3 -4
- package/dist/{hydrate-DDNIHYv_.js.map → hydrate-BB3MlR36.js.map} +1 -1
- package/dist/{hydrate-CzfxLfTv.d.ts → hydrate-BtAZf_5K.d.cts} +2 -5
- package/dist/{hydrate-CTTmQy0x.d.cts → hydrate-OjM1pIUG.d.ts} +2 -5
- package/dist/{hydrate-CxwTXDqO.cjs → hydrate-m0I5m6ue.cjs} +3 -4
- package/dist/hydrate-m0I5m6ue.cjs.map +1 -0
- package/dist/hydrate.cjs +3 -4
- package/dist/hydrate.cjs.map +1 -1
- package/dist/hydrate.d.cts +1 -1
- package/dist/hydrate.d.ts +1 -1
- package/dist/hydrate.js +3 -4
- package/dist/index.cjs +72 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -28
- package/dist/index.d.ts +28 -28
- package/dist/index.js +52 -44
- 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-CtMBhNd9.cjs → layout-Cfg9x1k2.cjs} +45 -3
- package/dist/layout-Cfg9x1k2.cjs.map +1 -0
- package/dist/{layout-B3hiqVEw.js → layout-DqAte3H8.js} +34 -4
- package/dist/layout-DqAte3H8.js.map +1 -0
- package/dist/{line-CN4uZ9ZX.d.ts → line-Bpr5uVLQ.d.ts} +4 -7
- package/dist/{line-B3Ed6u7j.js → line-CxR4tg1Q.js} +49 -38
- package/dist/line-CxR4tg1Q.js.map +1 -0
- package/dist/{line-fQbtP_jL.cjs → line-YiCuhVMI.cjs} +49 -38
- package/dist/line-YiCuhVMI.cjs.map +1 -0
- package/dist/{line-W7VD_qs1.d.cts → line-vyWO030v.d.cts} +4 -7
- package/dist/line.cjs +4 -5
- package/dist/line.cjs.map +1 -1
- package/dist/line.d.cts +1 -1
- package/dist/line.d.ts +1 -1
- package/dist/line.js +4 -6
- package/dist/{log-CaofN3-n.d.ts → log-CI41TmcU.d.cts} +1 -6
- package/dist/{log-CaofN3-n.d.cts → log-CI41TmcU.d.ts} +1 -6
- package/dist/{log-axis-83rSpvL5.cjs → log-axis-DdRNyAq8.cjs} +6 -8
- package/dist/{log-axis-83rSpvL5.cjs.map → log-axis-DdRNyAq8.cjs.map} +1 -1
- package/dist/{log-axis-B_uvvOFc.js → log-axis-DhthtHFk.js} +6 -8
- package/dist/{log-axis-B_uvvOFc.js.map → log-axis-DhthtHFk.js.map} +1 -1
- package/dist/log.cjs +3 -5
- package/dist/log.cjs.map +1 -1
- package/dist/log.d.cts +1 -1
- package/dist/log.d.ts +1 -1
- package/dist/log.js +3 -4
- 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-CqYDu1bY.cjs → morph-3I1Nf_tR.cjs} +4 -5
- package/dist/morph-3I1Nf_tR.cjs.map +1 -0
- package/dist/{morph-BMxz3X2b.d.ts → morph-Dh7gJkV4.d.cts} +1 -4
- package/dist/{morph-BMxz3X2b.d.cts → morph-Dh7gJkV4.d.ts} +1 -4
- package/dist/{morph-Bgg-24l8.js → morph-GfBab-b3.js} +4 -5
- package/dist/{morph-Bgg-24l8.js.map → morph-GfBab-b3.js.map} +1 -1
- package/dist/morph.cjs +3 -4
- package/dist/morph.cjs.map +1 -1
- package/dist/morph.d.cts +1 -1
- package/dist/morph.d.ts +1 -1
- package/dist/morph.js +3 -4
- package/dist/{named-BWWb5LQJ.cjs → named-BBASc8dW.cjs} +2 -3
- package/dist/{named-BWWb5LQJ.cjs.map → named-BBASc8dW.cjs.map} +1 -1
- package/dist/{named-DE15TOgh.js → named-BOiBah6I.js} +2 -3
- package/dist/{named-DE15TOgh.js.map → named-BOiBah6I.js.map} +1 -1
- package/dist/others-DBIGE6jr.js +57 -0
- package/dist/others-DBIGE6jr.js.map +1 -0
- package/dist/others-DBO4Kjwl.d.ts +29 -0
- package/dist/others-WfjCsjqT.cjs +68 -0
- package/dist/others-WfjCsjqT.cjs.map +1 -0
- package/dist/others-ls5eKtZ4.d.cts +31 -0
- package/dist/{parliament-Dw0sOERi.js → parliament-BKN6ikBJ.js} +36 -36
- package/dist/parliament-BKN6ikBJ.js.map +1 -0
- package/dist/{parliament-1Zv2Xh0D.d.ts → parliament-C7V8UJj1.d.cts} +5 -8
- package/dist/{parliament-DdrLVZwt.d.cts → parliament-Cz9n_DoK.d.ts} +5 -8
- package/dist/{parliament-CpWnoEvG.cjs → parliament-DhxAaIZ3.cjs} +36 -36
- package/dist/parliament-DhxAaIZ3.cjs.map +1 -0
- package/dist/parliament.cjs +1 -1
- package/dist/parliament.d.cts +2 -1
- package/dist/parliament.d.ts +2 -1
- package/dist/parliament.js +1 -2
- package/dist/{path-CwB28da0.d.ts → path-YeUiOfG8.d.cts} +1 -4
- package/dist/{path-CwB28da0.d.cts → path-YeUiOfG8.d.ts} +1 -4
- package/dist/{patterns-DtgcnA8o.js → patterns-BMUINoka.js} +4 -5
- package/dist/{patterns-DtgcnA8o.js.map → patterns-BMUINoka.js.map} +1 -1
- package/dist/{patterns-LfcQAWCy.cjs → patterns-Dw7OMD_2.cjs} +4 -5
- package/dist/{patterns-LfcQAWCy.cjs.map → patterns-Dw7OMD_2.cjs.map} +1 -1
- package/dist/patterns.cjs +3 -5
- package/dist/patterns.cjs.map +1 -1
- package/dist/patterns.d.cts +5 -1
- package/dist/patterns.d.ts +5 -1
- package/dist/patterns.js +3 -4
- package/dist/percentage-bar-BChkTRoz.cjs +164 -0
- package/dist/percentage-bar-BChkTRoz.cjs.map +1 -0
- package/dist/percentage-bar-CaInxrL8.js +159 -0
- package/dist/percentage-bar-CaInxrL8.js.map +1 -0
- package/dist/percentage-bar-R1--2grK.d.cts +58 -0
- package/dist/percentage-bar-cSeiLdwU.d.ts +58 -0
- package/dist/percentage-bar.cjs +3 -0
- package/dist/percentage-bar.d.cts +3 -0
- package/dist/percentage-bar.d.ts +3 -0
- package/dist/percentage-bar.js +1 -0
- package/dist/{pie-BF9yI5mE.d.cts → pie-BQQkvy1N.d.ts} +11 -11
- package/dist/{pie-DzUXDTcn.js → pie-Bd8wyrtY.js} +52 -55
- package/dist/pie-Bd8wyrtY.js.map +1 -0
- package/dist/{pie-BxTZt6Go.cjs → pie-BseZlCgP.cjs} +52 -55
- package/dist/pie-BseZlCgP.cjs.map +1 -0
- package/dist/{pie-5z1fDdKO.d.ts → pie-vD5-g8je.d.cts} +11 -11
- package/dist/pie.cjs +1 -1
- package/dist/pie.d.cts +2 -1
- package/dist/pie.d.ts +2 -1
- package/dist/pie.js +1 -2
- package/dist/{point-shapes-CGl4dugc.cjs → point-shapes-BRawRM78.cjs} +24 -24
- package/dist/point-shapes-BRawRM78.cjs.map +1 -0
- package/dist/{point-shapes-DI84NNpI.js → point-shapes-DI6GhcI7.js} +19 -25
- package/dist/point-shapes-DI6GhcI7.js.map +1 -0
- package/dist/point-shapes.cjs +7 -6
- package/dist/point-shapes.cjs.map +1 -1
- package/dist/point-shapes.d.cts +6 -2
- package/dist/point-shapes.d.ts +6 -2
- package/dist/point-shapes.js +8 -7
- package/dist/point-shapes.js.map +1 -1
- package/dist/{radar-1-EryihA.d.ts → radar-7I6hsY_h.d.cts} +4 -7
- package/dist/{radar-CYPab_I4.js → radar-D6XqkFWQ.js} +25 -27
- package/dist/radar-D6XqkFWQ.js.map +1 -0
- package/dist/{radar-CoGUNNSb.cjs → radar-DjISDnSf.cjs} +26 -28
- package/dist/radar-DjISDnSf.cjs.map +1 -0
- package/dist/{radar-DBW4O0Vt.d.cts → radar-vLxilcr4.d.ts} +4 -7
- package/dist/radar.cjs +1 -1
- package/dist/radar.d.cts +2 -1
- package/dist/radar.d.ts +2 -1
- package/dist/radar.js +1 -2
- package/dist/rect-CZTNvMlf.js +11 -0
- package/dist/rect-CZTNvMlf.js.map +1 -0
- package/dist/rect-DPr9QRxl.cjs +16 -0
- package/dist/rect-DPr9QRxl.cjs.map +1 -0
- package/dist/{sankey-Bacx4fVe.cjs → sankey-0CSp_Er9.cjs} +100 -95
- package/dist/sankey-0CSp_Er9.cjs.map +1 -0
- package/dist/{sankey-OV_WoPrl.d.ts → sankey-7As41Fo4.d.ts} +4 -7
- package/dist/{sankey-B4PNKusJ.js → sankey-Dp4CuLVe.js} +100 -95
- package/dist/sankey-Dp4CuLVe.js.map +1 -0
- package/dist/{sankey-DuGI3Qc5.d.cts → sankey-DqiuxUx7.d.cts} +4 -7
- package/dist/sankey.cjs +1 -1
- package/dist/sankey.d.cts +2 -1
- package/dist/sankey.d.ts +2 -1
- package/dist/sankey.js +1 -2
- package/dist/{scatter-DbxLyZX0.d.cts → scatter-BXkXGgM_.d.ts} +14 -9
- package/dist/{scatter-DgMN9zRy.cjs → scatter-Bwkblr4L.cjs} +47 -42
- package/dist/scatter-Bwkblr4L.cjs.map +1 -0
- package/dist/{scatter-kgtgR318.js → scatter-DCMAtt5L.js} +45 -40
- package/dist/scatter-DCMAtt5L.js.map +1 -0
- package/dist/{scatter-BqzgJqdX.d.ts → scatter-DL0zAV09.d.cts} +14 -9
- package/dist/scatter.cjs +1 -1
- package/dist/scatter.d.cts +2 -1
- package/dist/scatter.d.ts +2 -1
- package/dist/scatter.js +1 -2
- package/dist/{sparkline-BfyO_oNM.d.ts → sparkline-BElUSd0r.d.ts} +5 -8
- package/dist/{sparkline-BS9-hltA.cjs → sparkline-BMSuEPHP.cjs} +22 -23
- package/dist/sparkline-BMSuEPHP.cjs.map +1 -0
- package/dist/{sparkline-BQzt27Fr.js → sparkline-NDmq90kP.js} +22 -23
- package/dist/sparkline-NDmq90kP.js.map +1 -0
- package/dist/{sparkline-CWlJDKyh.d.cts → sparkline-RYly7bR0.d.cts} +5 -8
- package/dist/sparkline.cjs +1 -1
- package/dist/sparkline.d.cts +2 -1
- package/dist/sparkline.d.ts +2 -1
- package/dist/sparkline.js +1 -2
- package/dist/{stack-DVhJWaki.cjs → stack-BO4624CY.cjs} +3 -4
- package/dist/{stack-DVhJWaki.cjs.map → stack-BO4624CY.cjs.map} +1 -1
- package/dist/{stack-CpR6RGKd.d.ts → stack-BTWYIwLO.d.cts} +2 -4
- package/dist/{stack-CpR6RGKd.d.cts → stack-DR0eQTsB.d.ts} +1 -4
- package/dist/{stack-DRbwTeF3.js → stack-jVKvg2x_.js} +3 -4
- package/dist/{stack-DRbwTeF3.js.map → stack-jVKvg2x_.js.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/{sweep-CbfR7--d.js → sweep-BpRPlhs6.js} +5 -6
- package/dist/{sweep-CbfR7--d.js.map → sweep-BpRPlhs6.js.map} +1 -1
- package/dist/{sweep-DaTEDDuC.cjs → sweep-Dnp6LDBz.cjs} +5 -6
- package/dist/sweep-Dnp6LDBz.cjs.map +1 -0
- package/dist/{time-CNVnt-B2.d.cts → time-B4oxWHQI.d.cts} +2 -7
- package/dist/{time-CHjiY9Q4.d.ts → time-DRIDgv2a.d.ts} +2 -7
- package/dist/{time-axis-VSX34_Tb.cjs → time-axis-B3VekUfX.cjs} +11 -11
- package/dist/{time-axis-VSX34_Tb.cjs.map → time-axis-B3VekUfX.cjs.map} +1 -1
- package/dist/{time-axis-Bc9eHX1r.js → time-axis-CLjqOakA.js} +10 -10
- package/dist/{time-axis-Bc9eHX1r.js.map → time-axis-CLjqOakA.js.map} +1 -1
- package/dist/time.cjs +4 -6
- package/dist/time.cjs.map +1 -1
- package/dist/time.d.cts +1 -1
- package/dist/time.d.ts +1 -1
- package/dist/time.js +4 -5
- package/dist/treemap-25vHO_UK.d.cts +65 -0
- package/dist/treemap-BCXUbixd.d.ts +65 -0
- package/dist/treemap-C4glsx-g.js +293 -0
- package/dist/treemap-C4glsx-g.js.map +1 -0
- package/dist/treemap-CZk8kKFD.cjs +298 -0
- package/dist/treemap-CZk8kKFD.cjs.map +1 -0
- package/dist/treemap.cjs +3 -0
- package/dist/treemap.d.cts +3 -0
- package/dist/treemap.d.ts +3 -0
- package/dist/treemap.js +1 -0
- package/dist/{tween-BCYd0RTY.js → tween-BdQqUmmv.js} +2 -3
- package/dist/{tween-BCYd0RTY.js.map → tween-BdQqUmmv.js.map} +1 -1
- package/dist/{tween-CIGBlryn.cjs → tween-c3aOmfKE.cjs} +2 -3
- package/dist/{tween-CIGBlryn.cjs.map → tween-c3aOmfKE.cjs.map} +1 -1
- package/dist/{value-labels-IZIQPhfk.js → value-labels-C7GrhOXJ.js} +30 -10
- package/dist/value-labels-C7GrhOXJ.js.map +1 -0
- package/dist/{value-labels-B0WJoJ7x.cjs → value-labels-DzaKIWKp.cjs} +30 -10
- package/dist/value-labels-DzaKIWKp.cjs.map +1 -0
- package/dist/value-labels.cjs +3 -5
- package/dist/value-labels.cjs.map +1 -1
- package/dist/value-labels.d.cts +5 -1
- package/dist/value-labels.d.ts +5 -1
- package/dist/value-labels.js +3 -4
- package/dist/{vnode-CkQ27Cxe.cjs → vnode-ClAiw28x.cjs} +2 -3
- package/dist/{vnode-CkQ27Cxe.cjs.map → vnode-ClAiw28x.cjs.map} +1 -1
- package/dist/{vnode-BUflsBsa.d.ts → vnode-Du2cC8Fm.d.cts} +1 -4
- package/dist/{vnode-BUflsBsa.d.cts → vnode-Du2cC8Fm.d.ts} +1 -4
- package/dist/{vnode-tCWItoUH.js → vnode-_EMUqysL.js} +2 -3
- package/dist/{vnode-tCWItoUH.js.map → vnode-_EMUqysL.js.map} +1 -1
- package/package.json +94 -214
- package/dist/bar-C-7zR2qp.cjs.map +0 -1
- package/dist/bar-jZEoao74.js.map +0 -1
- package/dist/cartesian-BoDfgBCV.cjs.map +0 -1
- package/dist/cartesian-Cr0AF0nG.js.map +0 -1
- package/dist/chart-BF2CK9I_.js.map +0 -1
- package/dist/chart-CowF_lWY.cjs.map +0 -1
- package/dist/core-CegR_j55.js.map +0 -1
- package/dist/core-RzS9IQO5.cjs.map +0 -1
- package/dist/dom-CLF868Qs.cjs.map +0 -1
- package/dist/dom-vP3IcMak.js.map +0 -1
- package/dist/export-chart-9w8t3rjZ.js.map +0 -1
- package/dist/export-chart-BhhYgksr.cjs.map +0 -1
- package/dist/fade-Cs74puQS.cjs.map +0 -1
- package/dist/fade-D3NxH5Qg.js.map +0 -1
- package/dist/features-BclHgg2W.cjs.map +0 -1
- package/dist/features-wASyHGic.js.map +0 -1
- package/dist/gauge-D-FYhuds.cjs.map +0 -1
- package/dist/gauge-Dh423FHh.js.map +0 -1
- package/dist/heatmap-BK18EBgJ.cjs.map +0 -1
- package/dist/heatmap-DSZ2bVIa.js.map +0 -1
- package/dist/hydrate-CxwTXDqO.cjs.map +0 -1
- package/dist/layout-B3hiqVEw.js.map +0 -1
- package/dist/layout-CtMBhNd9.cjs.map +0 -1
- package/dist/line-B3Ed6u7j.js.map +0 -1
- package/dist/line-fQbtP_jL.cjs.map +0 -1
- package/dist/morph-CqYDu1bY.cjs.map +0 -1
- package/dist/parliament-CpWnoEvG.cjs.map +0 -1
- package/dist/parliament-Dw0sOERi.js.map +0 -1
- package/dist/pie-BxTZt6Go.cjs.map +0 -1
- package/dist/pie-DzUXDTcn.js.map +0 -1
- package/dist/point-shapes-CGl4dugc.cjs.map +0 -1
- package/dist/point-shapes-DI84NNpI.js.map +0 -1
- package/dist/radar-CYPab_I4.js.map +0 -1
- package/dist/radar-CoGUNNSb.cjs.map +0 -1
- package/dist/sankey-B4PNKusJ.js.map +0 -1
- package/dist/sankey-Bacx4fVe.cjs.map +0 -1
- package/dist/scatter-DgMN9zRy.cjs.map +0 -1
- package/dist/scatter-kgtgR318.js.map +0 -1
- package/dist/sparkline-BQzt27Fr.js.map +0 -1
- package/dist/sparkline-BS9-hltA.cjs.map +0 -1
- package/dist/sweep-DaTEDDuC.cjs.map +0 -1
- package/dist/value-labels-B0WJoJ7x.cjs.map +0 -1
- package/dist/value-labels-IZIQPhfk.js.map +0 -1
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { r as
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
7
|
-
import {
|
|
8
|
-
import { n as
|
|
9
|
-
|
|
1
|
+
import { o as getNumberFormat, r as formatNumber } from "./format-it1kepFG.js";
|
|
2
|
+
import { i as insets, r as innerRect } from "./layout-DqAte3H8.js";
|
|
3
|
+
import { n as sweep, t as arcNode } from "./sweep-BpRPlhs6.js";
|
|
4
|
+
import { i as padAngleForGap, n as arcCentroid, r as arcPathStable, t as DEG } from "./arc-B3V5IR0w.js";
|
|
5
|
+
import { t as h } from "./vnode-_EMUqysL.js";
|
|
6
|
+
import { n as cleanItems, t as cleanData } from "./clean-CkoQobGv.js";
|
|
7
|
+
import { n as keyOf, t as groupAttrs } from "./named-BOiBah6I.js";
|
|
8
|
+
import { n as withSlices, t as slicesLegend } from "./others-DBIGE6jr.js";
|
|
9
|
+
// src/charts/pie.ts
|
|
10
10
|
/** Angles of the visible slices, clockwise from `startAngle`. */
|
|
11
|
-
function layoutSlices(
|
|
12
|
-
const visible =
|
|
13
|
-
data,
|
|
14
|
-
index,
|
|
15
|
-
value: Math.max(0, data.value || 0)
|
|
16
|
-
})).filter((slice) => !hidden.has(keyOf(slice.data)));
|
|
11
|
+
function layoutSlices(model, hidden) {
|
|
12
|
+
const visible = model.slices.filter((slice) => !hidden.has(keyOf(slice.data)));
|
|
17
13
|
const total = visible.reduce((sum, slice) => sum + slice.value, 0);
|
|
18
|
-
let angle = (
|
|
14
|
+
let angle = (model.startAngle ?? 0) * DEG;
|
|
19
15
|
return {
|
|
20
16
|
slices: visible.map((slice) => {
|
|
21
17
|
const sweep = total > 0 ? slice.value / total * Math.PI * 2 : 0;
|
|
@@ -80,7 +76,8 @@ function renderPie(options, ctx, defaults) {
|
|
|
80
76
|
},
|
|
81
77
|
items: [item],
|
|
82
78
|
seriesIndex: slice.index,
|
|
83
|
-
|
|
79
|
+
highlight: {
|
|
80
|
+
kind: "halo",
|
|
84
81
|
d: arcPathStable({
|
|
85
82
|
...geometry(slice, outer + 2, outer + 6),
|
|
86
83
|
cornerRadius: 2
|
|
@@ -109,42 +106,44 @@ function renderPie(options, ctx, defaults) {
|
|
|
109
106
|
return position === -1 ? null : hitFor(drawn[position], position);
|
|
110
107
|
}
|
|
111
108
|
};
|
|
112
|
-
ctx.onHitTest(interaction);
|
|
113
109
|
const groups = slices.map((slice) => h("g", groupAttrs(slice.data, slice.index), arcNode("tc-slice", geometry(slice))));
|
|
114
110
|
const center = options.center;
|
|
115
111
|
const showCenter = inner > 0 && center !== false;
|
|
116
112
|
const centerValue = showCenter ? center?.value ?? value(total) : "";
|
|
117
113
|
const centerLabel = showCenter ? center?.label : void 0;
|
|
118
|
-
return
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
+
};
|
|
148
147
|
}
|
|
149
148
|
function pieTable(options, ctx) {
|
|
150
149
|
const { slices, total } = layoutSlices(options, ctx.hidden);
|
|
@@ -170,11 +169,10 @@ function pieType(name, defaults) {
|
|
|
170
169
|
return {
|
|
171
170
|
name,
|
|
172
171
|
clean: cleanData(cleanItems),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
legend: (options) => legendItems(options.data),
|
|
172
|
+
prepare: withSlices,
|
|
173
|
+
render: (options, ctx) => renderPie(options, ctx, defaults),
|
|
174
|
+
sweep,
|
|
175
|
+
legend: slicesLegend,
|
|
178
176
|
table: pieTable,
|
|
179
177
|
valueLabels: { marks: "slice" }
|
|
180
178
|
};
|
|
@@ -195,7 +193,6 @@ const donut = pieType("donut", {
|
|
|
195
193
|
inner: .62,
|
|
196
194
|
corner: 4
|
|
197
195
|
});
|
|
198
|
-
//#endregion
|
|
199
196
|
export { pie as n, donut as t };
|
|
200
197
|
|
|
201
|
-
//# 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;CACpC,MAAM,UAAU,MAAM,OAAO,QAAQ,UAAU,CAAC,OAAO,IAAI,MAAM,MAAM,IAAI,CAAC,CAAC;CAC7E,MAAM,QAAQ,QAAQ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,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,21 +1,17 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
1
|
+
const require_format = require("./format-CAE5ruy6.cjs");
|
|
2
|
+
const require_layout = require("./layout-Cfg9x1k2.cjs");
|
|
3
|
+
const require_sweep = require("./sweep-Dnp6LDBz.cjs");
|
|
4
|
+
const require_arc = require("./arc-CYhI62kO.cjs");
|
|
5
|
+
const require_vnode = require("./vnode-ClAiw28x.cjs");
|
|
6
|
+
const require_clean = require("./clean-Die2iCNc.cjs");
|
|
7
|
+
const require_named = require("./named-BBASc8dW.cjs");
|
|
8
|
+
const require_others = require("./others-WfjCsjqT.cjs");
|
|
9
|
+
// src/charts/pie.ts
|
|
10
10
|
/** Angles of the visible slices, clockwise from `startAngle`. */
|
|
11
|
-
function layoutSlices(
|
|
12
|
-
const visible =
|
|
13
|
-
data,
|
|
14
|
-
index,
|
|
15
|
-
value: Math.max(0, data.value || 0)
|
|
16
|
-
})).filter((slice) => !hidden.has(require_named.keyOf(slice.data)));
|
|
11
|
+
function layoutSlices(model, hidden) {
|
|
12
|
+
const visible = model.slices.filter((slice) => !hidden.has(require_named.keyOf(slice.data)));
|
|
17
13
|
const total = visible.reduce((sum, slice) => sum + slice.value, 0);
|
|
18
|
-
let angle = (
|
|
14
|
+
let angle = (model.startAngle ?? 0) * require_arc.DEG;
|
|
19
15
|
return {
|
|
20
16
|
slices: visible.map((slice) => {
|
|
21
17
|
const sweep = total > 0 ? slice.value / total * Math.PI * 2 : 0;
|
|
@@ -80,7 +76,8 @@ function renderPie(options, ctx, defaults) {
|
|
|
80
76
|
},
|
|
81
77
|
items: [item],
|
|
82
78
|
seriesIndex: slice.index,
|
|
83
|
-
|
|
79
|
+
highlight: {
|
|
80
|
+
kind: "halo",
|
|
84
81
|
d: require_arc.arcPathStable({
|
|
85
82
|
...geometry(slice, outer + 2, outer + 6),
|
|
86
83
|
cornerRadius: 2
|
|
@@ -109,42 +106,44 @@ function renderPie(options, ctx, defaults) {
|
|
|
109
106
|
return position === -1 ? null : hitFor(drawn[position], position);
|
|
110
107
|
}
|
|
111
108
|
};
|
|
112
|
-
ctx.onHitTest(interaction);
|
|
113
109
|
const groups = slices.map((slice) => require_vnode.h("g", require_named.groupAttrs(slice.data, slice.index), require_sweep.arcNode("tc-slice", geometry(slice))));
|
|
114
110
|
const center = options.center;
|
|
115
111
|
const showCenter = inner > 0 && center !== false;
|
|
116
112
|
const centerValue = showCenter ? center?.value ?? value(total) : "";
|
|
117
113
|
const centerLabel = showCenter ? center?.label : void 0;
|
|
118
|
-
return
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
+
};
|
|
148
147
|
}
|
|
149
148
|
function pieTable(options, ctx) {
|
|
150
149
|
const { slices, total } = layoutSlices(options, ctx.hidden);
|
|
@@ -170,11 +169,10 @@ function pieType(name, defaults) {
|
|
|
170
169
|
return {
|
|
171
170
|
name,
|
|
172
171
|
clean: require_clean.cleanData(require_clean.cleanItems),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
legend: (options) => require_named.legendItems(options.data),
|
|
172
|
+
prepare: require_others.withSlices,
|
|
173
|
+
render: (options, ctx) => renderPie(options, ctx, defaults),
|
|
174
|
+
sweep: require_sweep.sweep,
|
|
175
|
+
legend: require_others.slicesLegend,
|
|
178
176
|
table: pieTable,
|
|
179
177
|
valueLabels: { marks: "slice" }
|
|
180
178
|
};
|
|
@@ -195,7 +193,6 @@ const donut = pieType("donut", {
|
|
|
195
193
|
inner: .62,
|
|
196
194
|
corner: 4
|
|
197
195
|
});
|
|
198
|
-
//#endregion
|
|
199
196
|
Object.defineProperty(exports, "donut", {
|
|
200
197
|
enumerable: true,
|
|
201
198
|
get: function() {
|
|
@@ -209,4 +206,4 @@ Object.defineProperty(exports, "pie", {
|
|
|
209
206
|
}
|
|
210
207
|
});
|
|
211
208
|
|
|
212
|
-
//# 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,OA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O,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,OAAOM,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,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { o as ChartType } from "./chart-CbPzP5Dp.cjs";
|
|
2
|
+
import { c as NumberFormat } from "./time-B4oxWHQI.cjs";
|
|
3
|
+
import { a as InsetsInput } from "./annotations-CHafaGd4.cjs";
|
|
4
|
+
import { a as ClassValue } from "./vnode-Du2cC8Fm.cjs";
|
|
5
|
+
import { n as WithSlices, t as SliceGrouping } from "./others-ls5eKtZ4.cjs";
|
|
6
6
|
/** One slice of a pie or donut. */
|
|
7
7
|
interface PieSlice {
|
|
8
8
|
name: string;
|
|
@@ -20,7 +20,7 @@ interface PieSlice {
|
|
|
20
20
|
/** Start hidden (toggle it back from the legend). */
|
|
21
21
|
hidden?: boolean;
|
|
22
22
|
}
|
|
23
|
-
interface PieOptions {
|
|
23
|
+
interface PieOptions extends SliceGrouping {
|
|
24
24
|
data: readonly PieSlice[];
|
|
25
25
|
/** Hole size relative to the radius, `0…0.95`. Defaults to `0` (`0.62` for `donut`). */
|
|
26
26
|
innerRadius?: number;
|
|
@@ -43,6 +43,8 @@ interface PieOptions {
|
|
|
43
43
|
/** Extra space around the pie, in pixels. */
|
|
44
44
|
padding?: InsetsInput;
|
|
45
45
|
}
|
|
46
|
+
/** The chart model of a pie: its options, with the slices as drawn (the rest grouped). */
|
|
47
|
+
type PieModel = WithSlices<PieOptions>;
|
|
46
48
|
/**
|
|
47
49
|
* Pie chart: parts of a whole as slices, in data order, clockwise from the top.
|
|
48
50
|
*
|
|
@@ -50,9 +52,7 @@ interface PieOptions {
|
|
|
50
52
|
* new Chart('#el', { type: pie, data: [{ name: 'Direct', value: 42 }, { name: 'Search', value: 31 }] })
|
|
51
53
|
* ```
|
|
52
54
|
*/
|
|
53
|
-
declare const pie: ChartType<PieOptions>;
|
|
55
|
+
declare const pie: ChartType<PieOptions, PieModel>;
|
|
54
56
|
/** Donut chart: a pie with a hole showing the total (or your own `center`). */
|
|
55
|
-
declare const donut: ChartType<PieOptions>;
|
|
56
|
-
|
|
57
|
-
export { pie as i, PieSlice as n, donut as r, PieOptions as t };
|
|
58
|
-
//# sourceMappingURL=pie-5z1fDdKO.d.ts.map
|
|
57
|
+
declare const donut: ChartType<PieOptions, PieModel>;
|
|
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,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
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-vD5-g8je.cjs";
|
|
2
3
|
export { type PieOptions, type PieSlice, donut, pie };
|
package/dist/pie.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
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-BQQkvy1N.js";
|
|
2
3
|
export { type PieOptions, type PieSlice, donut, pie };
|
package/dist/pie.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { donut, pie };
|
|
1
|
+
export { t as donut, n as pie } from "./pie-Bd8wyrtY.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_layout = require("./layout-
|
|
2
|
-
|
|
1
|
+
const require_layout = require("./layout-Cfg9x1k2.cjs");
|
|
2
|
+
// src/charts/point-shapes.ts
|
|
3
3
|
/**
|
|
4
4
|
* Outlines by color slot (0-based), as x, y pairs in units of the radius,
|
|
5
5
|
* sized so the shapes weigh about the same as the circle of slot 0 (and of
|
|
@@ -126,30 +126,30 @@ function markerPath(slot, x, y, r) {
|
|
|
126
126
|
for (let i = 0; i < shape.length; i += 2) d += `${i ? "L" : "M"}${require_layout.round(x + shape[i] * r)},${require_layout.round(y + shape[i + 1] * r)}`;
|
|
127
127
|
return `${d}Z`;
|
|
128
128
|
}
|
|
129
|
-
/**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
tag: "path",
|
|
138
|
-
attrs: {
|
|
139
|
-
class: `${cls} tc-marker`,
|
|
140
|
-
d: markerPath(slot, +(attrs.cx ?? 0), +(attrs.cy ?? 0), +(attrs.r ?? 0))
|
|
141
|
-
},
|
|
142
|
-
children: [],
|
|
143
|
-
key: child.key
|
|
144
|
-
};
|
|
129
|
+
/**
|
|
130
|
+
* Inline style for the legend or tooltip swatch of slot `slot`: its marker as
|
|
131
|
+
* a CSS shape (`--tc-shape`, a `clip-path`) in a box without rounded corners;
|
|
132
|
+
* `undefined` for the slots that stay a circle.
|
|
133
|
+
*/
|
|
134
|
+
function markerClip(slot) {
|
|
135
|
+
if (!SHAPES[slot]?.length) return void 0;
|
|
136
|
+
const points = markerPath(slot, 50, 50, 35.7).slice(1, -1).replace(/,/g, "% ").replace(/L/g, "%,");
|
|
145
137
|
return {
|
|
146
|
-
|
|
147
|
-
|
|
138
|
+
"--tc-shape": slot === 1 ? "inset(10% round 1px)" : `polygon(${points}%)`,
|
|
139
|
+
"--tc-shape-radius": 0
|
|
148
140
|
};
|
|
149
141
|
}
|
|
150
|
-
/**
|
|
151
|
-
|
|
152
|
-
|
|
142
|
+
/**
|
|
143
|
+
* @deprecated Points are drawn in their shapes as the chart renders: this
|
|
144
|
+
* step leaves the content as it is. It will be removed in the next major.
|
|
145
|
+
*/
|
|
146
|
+
const shapesStep = (_config, content) => content;
|
|
147
|
+
Object.defineProperty(exports, "markerClip", {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
get: function() {
|
|
150
|
+
return markerClip;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
153
|
Object.defineProperty(exports, "markerPath", {
|
|
154
154
|
enumerable: true,
|
|
155
155
|
get: function() {
|
|
@@ -163,4 +163,4 @@ Object.defineProperty(exports, "shapesStep", {
|
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
-
//# sourceMappingURL=point-shapes-
|
|
166
|
+
//# sourceMappingURL=point-shapes-BRawRM78.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"point-shapes-BRawRM78.cjs","names":["round"],"sources":["../src/charts/point-shapes.ts"],"sourcesContent":["/**\n * Marker shapes, so the points of series do not depend on color alone\n * (color vision deficiency, grayscale print): one shape per color slot,\n * for line, radar and scatter points and the active points of the hover.\n * On with `shapes: true`, and with `patterns: true` unless `shapes` says\n * otherwise. Legend and tooltip swatches take the same shapes (`markerClip`).\n */\nimport type { PostStep } from '../features.ts'\nimport { round } from '../layout.ts'\n\n/**\n * Outlines by color slot (0-based), as x, y pairs in units of the radius,\n * sized so the shapes weigh about the same as the circle of slot 0 (and of\n * slots 9 and up).\n */\nconst SHAPES: readonly (readonly number[])[] = [\n [],\n // Square.\n [-0.9, -0.9, 0.9, -0.9, 0.9, 0.9, -0.9, 0.9],\n // Triangle.\n [0, -1.3, 1.2, 0.9, -1.2, 0.9],\n // Diamond.\n [0, -1.3, 1.3, 0, 0, 1.3, -1.3, 0],\n // Triangle, pointing down.\n [-1.2, -0.9, 1.2, -0.9, 0, 1.3],\n // Plus.\n [\n -0.4, -1.2, 0.4, -1.2, 0.4, -0.4, 1.2, -0.4, 1.2, 0.4, 0.4, 0.4, 0.4, 1.2, -0.4, 1.2, -0.4, 0.4,\n -1.2, 0.4, -1.2, -0.4, -0.4, -0.4,\n ],\n // Cross.\n [\n -0.7, -1.2, 0, -0.5, 0.7, -1.2, 1.2, -0.7, 0.5, 0, 1.2, 0.7, 0.7, 1.2, 0, 0.5, -0.7, 1.2, -1.2,\n 0.7, -0.5, 0, -1.2, -0.7,\n ],\n // Star.\n [\n 0, -1.4, 0.32, -0.44, 1.33, -0.43, 0.52, 0.17, 0.82, 1.13, 0, 0.55, -0.82, 1.13, -0.52, 0.17,\n -1.33, -0.43, -0.32, -0.44,\n ],\n]\n\n/** The path of slot `slot`'s marker of radius `r` around (`x`, `y`). */\nexport function markerPath(slot: number, x: number, y: number, r: number): string {\n const shape = SHAPES[slot] ?? []\n if (!shape.length) {\n return `M${round(x - r)},${round(y)}a${r},${r},0,1,0,${2 * r},0a${r},${r},0,1,0,${-2 * r},0Z`\n }\n let d = ''\n for (let i = 0; i < shape.length; i += 2) {\n d += `${i ? 'L' : 'M'}${round(x + (shape[i] as number) * r)},${round(y + (shape[i + 1] as number) * r)}`\n }\n return `${d}Z`\n}\n\n/**\n * Inline style for the legend or tooltip swatch of slot `slot`: its marker as\n * a CSS shape (`--tc-shape`, a `clip-path`) in a box without rounded corners;\n * `undefined` for the slots that stay a circle.\n */\nexport function markerClip(slot: number): Record<string, string | number> | undefined {\n if (!SHAPES[slot]?.length) return undefined\n // In percent of the box: a radius of 35.7% keeps the largest shape (the star) inside.\n const points = markerPath(slot, 50, 50, 35.7).slice(1, -1).replace(/,/g, '% ').replace(/L/g, '%,')\n return {\n // The square is not cut from the swatch's box but set a little into it.\n '--tc-shape': slot === 1 ? 'inset(10% round 1px)' : `polygon(${points}%)`,\n '--tc-shape-radius': 0,\n }\n}\n\n/**\n * @deprecated Points are drawn in their shapes as the chart renders: this\n * step leaves the content as it is. It will be removed in the next major.\n */\nexport const shapesStep: PostStep = (_config, content) => content\n"],"mappings":";;;;;;;AAeA,MAAM,SAAyC;CAC7C,CAAC;CAED;EAAC;EAAM;EAAM;EAAK;EAAM;EAAK;EAAK;EAAM;CAAG;CAE3C;EAAC;EAAG;EAAM;EAAK;EAAK;EAAM;CAAG;CAE7B;EAAC;EAAG;EAAM;EAAK;EAAG;EAAG;EAAK;EAAM;CAAC;CAEjC;EAAC;EAAM;EAAM;EAAK;EAAM;EAAG;CAAG;CAE9B;EACE;EAAM;EAAM;EAAK;EAAM;EAAK;EAAM;EAAK;EAAM;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAM;EAAK;EAAM;EAC5F;EAAM;EAAK;EAAM;EAAM;EAAM;CAC/B;CAEA;EACE;EAAM;EAAM;EAAG;EAAM;EAAK;EAAM;EAAK;EAAM;EAAK;EAAG;EAAK;EAAK;EAAK;EAAK;EAAG;EAAK;EAAM;EAAK;EAC1F;EAAK;EAAM;EAAG;EAAM;CACtB;CAEA;EACE;EAAG;EAAM;EAAM;EAAO;EAAM;EAAO;EAAM;EAAM;EAAM;EAAM;EAAG;EAAM;EAAO;EAAM;EAAO;EACxF;EAAO;EAAO;EAAO;CACvB;AACF;;AAGA,SAAgB,WAAW,MAAc,GAAW,GAAW,GAAmB;CAChF,MAAM,QAAQ,OAAO,SAAS,CAAC;CAC/B,IAAI,CAAC,MAAM,QACT,OAAO,IAAIA,eAAAA,MAAM,IAAI,CAAC,EAAE,GAAGA,eAAAA,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,KAAK,EAAE;CAE3F,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,GACrC,KAAK,GAAG,IAAI,MAAM,MAAMA,eAAAA,MAAM,IAAK,MAAM,KAAgB,CAAC,EAAE,GAAGA,eAAAA,MAAM,IAAK,MAAM,IAAI,KAAgB,CAAC;CAEvG,OAAO,GAAG,EAAE;AACd;;;;;;AAOA,SAAgB,WAAW,MAA2D;CACpF,IAAI,CAAC,OAAO,KAAK,EAAE,QAAQ,OAAO,KAAA;CAElC,MAAM,SAAS,WAAW,MAAM,IAAI,IAAI,IAAI,CAAC,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,QAAQ,MAAM,IAAI,CAAC,CAAC,QAAQ,MAAM,IAAI;CACjG,OAAO;EAEL,cAAc,SAAS,IAAI,yBAAyB,WAAW,OAAO;EACtE,qBAAqB;CACvB;AACF;;;;;AAMA,MAAa,cAAwB,SAAS,YAAY"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { s as round } from "./layout-DqAte3H8.js";
|
|
2
|
+
// src/charts/point-shapes.ts
|
|
3
3
|
/**
|
|
4
4
|
* Outlines by color slot (0-based), as x, y pairs in units of the radius,
|
|
5
5
|
* sized so the shapes weigh about the same as the circle of slot 0 (and of
|
|
@@ -126,30 +126,24 @@ function markerPath(slot, x, y, r) {
|
|
|
126
126
|
for (let i = 0; i < shape.length; i += 2) d += `${i ? "L" : "M"}${round(x + shape[i] * r)},${round(y + shape[i + 1] * r)}`;
|
|
127
127
|
return `${d}Z`;
|
|
128
128
|
}
|
|
129
|
-
/**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
tag: "path",
|
|
138
|
-
attrs: {
|
|
139
|
-
class: `${cls} tc-marker`,
|
|
140
|
-
d: markerPath(slot, +(attrs.cx ?? 0), +(attrs.cy ?? 0), +(attrs.r ?? 0))
|
|
141
|
-
},
|
|
142
|
-
children: [],
|
|
143
|
-
key: child.key
|
|
144
|
-
};
|
|
129
|
+
/**
|
|
130
|
+
* Inline style for the legend or tooltip swatch of slot `slot`: its marker as
|
|
131
|
+
* a CSS shape (`--tc-shape`, a `clip-path`) in a box without rounded corners;
|
|
132
|
+
* `undefined` for the slots that stay a circle.
|
|
133
|
+
*/
|
|
134
|
+
function markerClip(slot) {
|
|
135
|
+
if (!SHAPES[slot]?.length) return void 0;
|
|
136
|
+
const points = markerPath(slot, 50, 50, 35.7).slice(1, -1).replace(/,/g, "% ").replace(/L/g, "%,");
|
|
145
137
|
return {
|
|
146
|
-
|
|
147
|
-
|
|
138
|
+
"--tc-shape": slot === 1 ? "inset(10% round 1px)" : `polygon(${points}%)`,
|
|
139
|
+
"--tc-shape-radius": 0
|
|
148
140
|
};
|
|
149
141
|
}
|
|
150
|
-
/**
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
142
|
+
/**
|
|
143
|
+
* @deprecated Points are drawn in their shapes as the chart renders: this
|
|
144
|
+
* step leaves the content as it is. It will be removed in the next major.
|
|
145
|
+
*/
|
|
146
|
+
const shapesStep = (_config, content) => content;
|
|
147
|
+
export { markerPath as n, shapesStep as r, markerClip as t };
|
|
154
148
|
|
|
155
|
-
//# sourceMappingURL=point-shapes-
|
|
149
|
+
//# sourceMappingURL=point-shapes-DI6GhcI7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"point-shapes-DI6GhcI7.js","names":[],"sources":["../src/charts/point-shapes.ts"],"sourcesContent":["/**\n * Marker shapes, so the points of series do not depend on color alone\n * (color vision deficiency, grayscale print): one shape per color slot,\n * for line, radar and scatter points and the active points of the hover.\n * On with `shapes: true`, and with `patterns: true` unless `shapes` says\n * otherwise. Legend and tooltip swatches take the same shapes (`markerClip`).\n */\nimport type { PostStep } from '../features.ts'\nimport { round } from '../layout.ts'\n\n/**\n * Outlines by color slot (0-based), as x, y pairs in units of the radius,\n * sized so the shapes weigh about the same as the circle of slot 0 (and of\n * slots 9 and up).\n */\nconst SHAPES: readonly (readonly number[])[] = [\n [],\n // Square.\n [-0.9, -0.9, 0.9, -0.9, 0.9, 0.9, -0.9, 0.9],\n // Triangle.\n [0, -1.3, 1.2, 0.9, -1.2, 0.9],\n // Diamond.\n [0, -1.3, 1.3, 0, 0, 1.3, -1.3, 0],\n // Triangle, pointing down.\n [-1.2, -0.9, 1.2, -0.9, 0, 1.3],\n // Plus.\n [\n -0.4, -1.2, 0.4, -1.2, 0.4, -0.4, 1.2, -0.4, 1.2, 0.4, 0.4, 0.4, 0.4, 1.2, -0.4, 1.2, -0.4, 0.4,\n -1.2, 0.4, -1.2, -0.4, -0.4, -0.4,\n ],\n // Cross.\n [\n -0.7, -1.2, 0, -0.5, 0.7, -1.2, 1.2, -0.7, 0.5, 0, 1.2, 0.7, 0.7, 1.2, 0, 0.5, -0.7, 1.2, -1.2,\n 0.7, -0.5, 0, -1.2, -0.7,\n ],\n // Star.\n [\n 0, -1.4, 0.32, -0.44, 1.33, -0.43, 0.52, 0.17, 0.82, 1.13, 0, 0.55, -0.82, 1.13, -0.52, 0.17,\n -1.33, -0.43, -0.32, -0.44,\n ],\n]\n\n/** The path of slot `slot`'s marker of radius `r` around (`x`, `y`). */\nexport function markerPath(slot: number, x: number, y: number, r: number): string {\n const shape = SHAPES[slot] ?? []\n if (!shape.length) {\n return `M${round(x - r)},${round(y)}a${r},${r},0,1,0,${2 * r},0a${r},${r},0,1,0,${-2 * r},0Z`\n }\n let d = ''\n for (let i = 0; i < shape.length; i += 2) {\n d += `${i ? 'L' : 'M'}${round(x + (shape[i] as number) * r)},${round(y + (shape[i + 1] as number) * r)}`\n }\n return `${d}Z`\n}\n\n/**\n * Inline style for the legend or tooltip swatch of slot `slot`: its marker as\n * a CSS shape (`--tc-shape`, a `clip-path`) in a box without rounded corners;\n * `undefined` for the slots that stay a circle.\n */\nexport function markerClip(slot: number): Record<string, string | number> | undefined {\n if (!SHAPES[slot]?.length) return undefined\n // In percent of the box: a radius of 35.7% keeps the largest shape (the star) inside.\n const points = markerPath(slot, 50, 50, 35.7).slice(1, -1).replace(/,/g, '% ').replace(/L/g, '%,')\n return {\n // The square is not cut from the swatch's box but set a little into it.\n '--tc-shape': slot === 1 ? 'inset(10% round 1px)' : `polygon(${points}%)`,\n '--tc-shape-radius': 0,\n }\n}\n\n/**\n * @deprecated Points are drawn in their shapes as the chart renders: this\n * step leaves the content as it is. It will be removed in the next major.\n */\nexport const shapesStep: PostStep = (_config, content) => content\n"],"mappings":";;;;;;;AAeA,MAAM,SAAyC;CAC7C,CAAC;CAED;EAAC;EAAM;EAAM;EAAK;EAAM;EAAK;EAAK;EAAM;CAAG;CAE3C;EAAC;EAAG;EAAM;EAAK;EAAK;EAAM;CAAG;CAE7B;EAAC;EAAG;EAAM;EAAK;EAAG;EAAG;EAAK;EAAM;CAAC;CAEjC;EAAC;EAAM;EAAM;EAAK;EAAM;EAAG;CAAG;CAE9B;EACE;EAAM;EAAM;EAAK;EAAM;EAAK;EAAM;EAAK;EAAM;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAM;EAAK;EAAM;EAC5F;EAAM;EAAK;EAAM;EAAM;EAAM;CAC/B;CAEA;EACE;EAAM;EAAM;EAAG;EAAM;EAAK;EAAM;EAAK;EAAM;EAAK;EAAG;EAAK;EAAK;EAAK;EAAK;EAAG;EAAK;EAAM;EAAK;EAC1F;EAAK;EAAM;EAAG;EAAM;CACtB;CAEA;EACE;EAAG;EAAM;EAAM;EAAO;EAAM;EAAO;EAAM;EAAM;EAAM;EAAM;EAAG;EAAM;EAAO;EAAM;EAAO;EACxF;EAAO;EAAO;EAAO;CACvB;AACF;;AAGA,SAAgB,WAAW,MAAc,GAAW,GAAW,GAAmB;CAChF,MAAM,QAAQ,OAAO,SAAS,CAAC;CAC/B,IAAI,CAAC,MAAM,QACT,OAAO,IAAI,MAAM,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,KAAK,EAAE;CAE3F,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,GACrC,KAAK,GAAG,IAAI,MAAM,MAAM,MAAM,IAAK,MAAM,KAAgB,CAAC,EAAE,GAAG,MAAM,IAAK,MAAM,IAAI,KAAgB,CAAC;CAEvG,OAAO,GAAG,EAAE;AACd;;;;;;AAOA,SAAgB,WAAW,MAA2D;CACpF,IAAI,CAAC,OAAO,KAAK,EAAE,QAAQ,OAAO,KAAA;CAElC,MAAM,SAAS,WAAW,MAAM,IAAI,IAAI,IAAI,CAAC,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,QAAQ,MAAM,IAAI,CAAC,CAAC,QAAQ,MAAM,IAAI;CACjG,OAAO;EAEL,cAAc,SAAS,IAAI,yBAAyB,WAAW,OAAO;EACtE,qBAAqB;CACvB;AACF;;;;;AAMA,MAAa,cAAwB,SAAS,YAAY"}
|
package/dist/point-shapes.cjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
//#region src/point-shapes.ts
|
|
2
|
+
const require_point_shapes = require("./point-shapes-BRawRM78.cjs");
|
|
3
|
+
// src/point-shapes.ts
|
|
5
4
|
/**
|
|
6
5
|
* Standalone entry: `import '@tabler/charts/point-shapes'` enables `shapes`
|
|
7
6
|
* (a point shape per series) on the core.
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
require("./features-DEDP5CEQ.cjs").register({
|
|
9
|
+
"point-shapes": require_point_shapes.markerPath,
|
|
10
|
+
swatch: require_point_shapes.markerClip
|
|
11
|
+
});
|
|
12
|
+
exports.markerClip = require_point_shapes.markerClip;
|
|
12
13
|
exports.markerPath = require_point_shapes.markerPath;
|
|
13
14
|
exports.shapesStep = require_point_shapes.shapesStep;
|
|
14
15
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point-shapes.cjs","names":["register","markerPath","
|
|
1
|
+
{"version":3,"file":"point-shapes.cjs","names":["register","markerPath","markerClip"],"sources":["../src/point-shapes.ts"],"sourcesContent":["/**\n * Standalone entry: `import '@tabler/charts/point-shapes'` enables `shapes`\n * (a point shape per series) on the core.\n */\nimport { markerClip, markerPath, shapesStep } from './charts/point-shapes.ts'\nimport { register } from './features.ts'\n\nregister({ 'point-shapes': markerPath, swatch: markerClip })\n\nexport { markerClip, markerPath, shapesStep }\n"],"mappings":";;;;;;;A,iCAOAA,CAAAA,CAAAA,SAAS;CAAE,gBAAgBC,qBAAAA;CAAY,QAAQC,qBAAAA;AAAW,CAAC"}
|