@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bar-BOcRcArc.js","names":[],"sources":["../src/charts/horizontal.ts","../src/charts/bar.ts"],"sourcesContent":["import type { RenderContext } from '../chart.ts'\nimport { axisSize, axisTitleSize, bandTicks, type Tick, thinTicks } from '../components/axis.ts'\nimport { estimateTextWidth, plotFrame } from '../layout.ts'\nimport { type BandKey, band } from '../scales/band.ts'\nimport {\n type CartesianLayout,\n type CartesianLayoutOptions,\n type CartesianOptions,\n EDGE,\n finishLayout,\n type Label,\n labelFormatter,\n labelKey,\n resolveLabels,\n TICK_SPACING_X,\n valueAxis,\n} from './cartesian.ts'\n\n/**\n * Cartesian layout with categories along y (labels on the left) and values\n * along x (labels at the bottom), for horizontal bars. Only bar charts use\n * it, so it lives outside `cartesianLayout()` and stays out of other bundles.\n */\nexport function horizontalLayout(\n options: CartesianOptions,\n ctx: RenderContext,\n layout: CartesianLayoutOptions,\n): CartesianLayout {\n const yOptions = options.y ?? {}\n const xOptions = options.x ?? {}\n const { fontSize, width } = ctx\n const overhang = layout.overhang ?? 0\n const labels = resolveLabels(options.data)\n const format = labelFormatter(options, ctx)\n const value = valueAxis(options, ctx, layout, Math.round(width / TICK_SPACING_X))\n const probeValues = value.probe\n const showValues = yOptions.show !== false\n const showCategories = xOptions.show !== false && labels.length > 0\n\n const probeCategories: Tick[] = labels.map((label, i) => ({\n value: labelKey(label),\n position: 0,\n label: format(label, i),\n }))\n const edgeLabel = (tick: Tick | undefined) =>\n showValues && tick ? Math.ceil(estimateTextWidth(tick.label, fontSize) / 2) : 0\n\n const { area, side, range } = plotFrame(ctx, options.padding, (pad) => ({\n top: pad.top + Math.max(overhang, EDGE / 2),\n bottom:\n pad.bottom +\n Math.max(\n (showValues ? axisSize('bottom', probeValues, fontSize) : 0) +\n axisTitleSize(yOptions.title, fontSize),\n overhang,\n EDGE / 2,\n ),\n start:\n pad.start +\n Math.max(\n (showCategories ? axisSize('left', probeCategories, fontSize) : 0) +\n axisTitleSize(xOptions.title, fontSize),\n edgeLabel(probeValues[0]),\n overhang,\n EDGE,\n ),\n end: pad.end + Math.max(edgeLabel(probeValues[probeValues.length - 1]), overhang, EDGE),\n }))\n\n const keys = labels.map(labelKey)\n const x = band(keys, [area.y, area.y + area.height], {\n paddingInner: layout.paddingInner ?? 0.3,\n paddingOuter: layout.paddingOuter ?? 0.15,\n })\n // Values grow away from the categories, from the start side.\n const y = value.scale(range())\n const yTicks = thinTicks(value.ticks(y), 'bottom', fontSize)\n const xTicks = showCategories\n ? thinTicks(\n bandTicks(x, (_: BandKey, i) => format(labels[i] as Label, i)),\n 'left',\n fontSize,\n )\n : []\n\n // The value axis runs along x here, categories along y.\n return finishLayout(\n options,\n ctx,\n side,\n overhang,\n { area, labels, x, y, horizontal: true, xTicks, yTicks },\n keys,\n )\n}\n","import type { ChartType } from '../chart.ts'\nimport { feature } from '../features.ts'\nimport { barPath, hbarPath } from '../shapes/bar.ts'\nimport type { Curve, Point } from '../shapes/path.ts'\nimport { h } from '../vnode.ts'\nimport {\n type CartesianLayoutOptions,\n type CartesianOptions,\n cartesianLayout,\n categoryInteraction,\n labelKey,\n plottable,\n resolveLabels,\n seriesAttrs,\n seriesAxes,\n seriesKey,\n seriesLegend,\n seriesScale,\n seriesTable,\n} from './cartesian.ts'\nimport { cleanData, cleanSeries } from './clean.ts'\nimport { horizontalLayout } from './horizontal.ts'\nimport { type Segment, type StackMode, stackBounds, stackSeries } from './stack.ts'\n\nexport interface BarOptions extends CartesianOptions {\n /** Corner radius of the data end of each bar (or stack). Defaults to `4`. */\n radius?: number\n /** Maximum bar thickness in pixels; leftover band space stays empty. Defaults to `24`. */\n maxBarWidth?: number\n /** Gap between bars of a group, or between stacked segments, in pixels. Defaults to `2`. */\n gap?: number\n /** Share of each category left empty between groups, `0…1`. Defaults to `0.3`. */\n groupPadding?: number\n /**\n * Stack series in one bar per category instead of side by side; `'percent'`\n * shows each category as 100%. Negative values stack down from zero.\n */\n stacked?: StackMode\n /**\n * `'horizontal'` lays categories out along y with bars growing right\n * (left for negative values). The `x` / `y` options keep describing the\n * category / value axis. Defaults to `'vertical'`.\n */\n orientation?: 'vertical' | 'horizontal'\n /** Interpolation of series drawn as lines (`series.type`). Defaults to `'monotone'`. */\n curve?: Curve\n}\n\n/**\n * Bar chart: vertical bars per category, grouped side by side or stacked,\n * growing from zero (negative values grow down).\n *\n * ```ts\n * new Chart('#el', {\n * type: bar,\n * data: { labels: ['Q1', 'Q2'], series: [{ name: '2025', values: [3, 5] }] },\n * stacked: true,\n * })\n * ```\n */\nexport const bar: ChartType<BarOptions> = {\n name: 'bar',\n clean: cleanData(cleanSeries),\n render(options, ctx) {\n const {\n radius = 4,\n maxBarWidth = 24,\n gap = 2,\n groupPadding = 0.3,\n stacked = false,\n orientation = 'vertical',\n curve = 'monotone',\n } = options\n const horizontal = orientation === 'horizontal'\n const { series } = options.data\n const count = resolveLabels(options.data).length\n // Series drawn as lines sit on top of the bars and stay out of the stacks.\n const isLine = (index: number) => (series[index]?.type ?? 'bar') !== 'bar'\n const lineKeys = series.filter((_, index) => isLine(index)).map(seriesKey)\n const axisOf = seriesAxes(options)\n const onY2 = (index: number) => axisOf(series[index]).second\n // Bars on the second axis stand beside the stack, in a column of their own.\n const apart = series.filter((_, index) => isLine(index) || onY2(index)).map(seriesKey)\n const stackHidden = apart.length ? new Set([...ctx.hidden, ...apart]) : ctx.hidden\n const stacks = stacked\n ? stackSeries(series, count, { percent: stacked === 'percent', hidden: stackHidden })\n : null\n const inStack = (index: number) => !!stacks && !isLine(index) && !onY2(index)\n\n const layoutOptions: CartesianLayoutOptions = {\n scale: 'band',\n zero: true,\n paddingInner: groupPadding,\n paddingOuter: groupPadding / 2,\n // Bars and areas on the second axis grow from zero too, lines need not.\n zero2: series.some((s, index) => onY2(index) && s.type !== 'line'),\n ...(stacks\n ? {\n values: [\n ...stackBounds(stacks),\n ...series.flatMap((s, index) => (isLine(index) && !onY2(index) ? s.values : [])),\n ],\n }\n : {}),\n ...(stacked === 'percent' ? { tickFormat: { style: 'percent' } } : {}),\n }\n const layout = horizontal\n ? horizontalLayout(options, ctx, layoutOptions)\n : cartesianLayout(options, ctx, layoutOptions)\n const { x, labels } = layout\n const scaleOf = (index: number) => seriesScale(layout, series[index])\n\n // The column of each bar series in its group: a stack takes one column\n // for all its series. Hidden series keep their color slot but give up their place.\n const slots = new Map<number, number>()\n let used = 0\n let stackColumn = -1\n series.forEach((s, index) => {\n if (ctx.hidden.has(seriesKey(s)) || isLine(index)) return\n if (!inStack(index)) slots.set(index, used++)\n else {\n if (stackColumn < 0) stackColumn = used++\n slots.set(index, stackColumn)\n }\n })\n const order = [...slots.keys()]\n const columns = Math.max(1, used)\n\n const barWidth = Math.max(\n 0,\n Math.min(maxBarWidth, (x.bandwidth - gap * (columns - 1)) / columns),\n )\n const groupWidth = barWidth * columns + gap * (columns - 1)\n const offset = (x.bandwidth - groupWidth) / 2\n // Grouped bars follow the categories: from the right when those are reversed.\n const slotAt = (slot: number) => (x.range[1] < x.range[0] ? columns - 1 - slot : slot)\n const barLeft = (seriesIndex: number, i: number) =>\n x.at(i) + offset + slotAt(slots.get(seriesIndex) ?? 0) * (barWidth + gap)\n\n /** Data extent of a bar: from zero to the value, or its stacked segment. */\n const segment = (seriesIndex: number, i: number): Segment | null => {\n if (inStack(seriesIndex)) return stacks?.[seriesIndex]?.[i] ?? null\n const s = series[seriesIndex]\n const v = s?.values[i]\n return plottable(v, axisOf(s).axis) ? { y0: 0, y1: v } : null\n }\n\n // In a stack only the outermost segment of each sign gets rounded.\n const outer = labels.map((_, i) => {\n let up = -1\n let down = -1\n for (const index of order) {\n if (!inStack(index)) continue\n const seg = segment(index, i)\n if (!seg) continue\n if (seg.y1 > seg.y0) up = index\n else if (seg.y1 < seg.y0) down = index\n }\n return { up, down }\n })\n\n const interaction = categoryInteraction(\n layout,\n options,\n ctx,\n (seriesIndex, i, v) => {\n const y = scaleOf(seriesIndex)\n if (isLine(seriesIndex)) {\n const across = x.at(i) + x.bandwidth / 2\n return horizontal ? { x: y(v), y: across } : { x: across, y: y(v) }\n }\n const left = barLeft(seriesIndex, i)\n const seg = segment(seriesIndex, i)\n const end = y(seg?.y1 ?? 0)\n const base = y(seg?.y0 ?? 0)\n // The bar's box, for value labels inside it.\n const lo = Math.min(end, base)\n const length = Math.abs(end - base)\n return horizontal\n ? {\n x: end,\n y: left + barWidth / 2,\n box: { x: lo, y: left, width: length, height: barWidth },\n }\n : {\n x: left + barWidth / 2,\n y: end,\n box: { x: left, y: lo, width: barWidth, height: length },\n }\n },\n (px, py, i) => {\n // Pointer position across the categories and along the values.\n const across = horizontal ? py : px\n const along = horizontal ? px : py\n // The column under the pointer, gaps included, so thin bars are easy to hit.\n const column = slotAt(\n Math.floor((across - (x.at(i) + offset) + gap / 2) / (barWidth + gap)),\n )\n if (column === stackColumn) {\n // The segment under the pointer, within the stack (gaps included).\n return order.find((index) => {\n if (!inStack(index)) return false\n const seg = segment(index, i)\n if (!seg) return false\n const y = scaleOf(index)\n const a = y(seg.y0)\n const b = y(seg.y1)\n return along >= Math.min(a, b) - gap / 2 && along <= Math.max(a, b) + gap / 2\n })\n }\n const seriesIndex = order.find((index) => slots.get(index) === column)\n return seriesIndex !== undefined && segment(seriesIndex, i) ? seriesIndex : undefined\n },\n )\n\n const groups = series.map(\n (s, index) =>\n slots.has(index) &&\n h(\n 'g',\n seriesAttrs(s, index),\n labels.map((label, i) => {\n const seg = segment(index, i)\n if (!seg) return null\n const y = scaleOf(index)\n const negative = seg.y1 < seg.y0\n // Leave a surface-colored gap where this segment sits on another one,\n // on the side it grows to (in pixels: up, right, or left when mirrored).\n const away = Math.sign(y(seg.y1) - y(seg.y0))\n const inner = seg.y0 === 0 ? 0 : away * gap\n const rounded = !inStack(index) || (negative ? outer[i]?.down : outer[i]?.up) === index\n const draw = horizontal ? hbarPath : barPath\n return h('path', {\n key: labelKey(label),\n class: ['tc-bar', negative && 'tc-bar-negative', horizontal && 'tc-bar-horizontal'],\n d: draw(\n barLeft(index, i),\n barWidth,\n y(seg.y0) + inner,\n y(seg.y1),\n rounded ? radius : 0,\n ),\n })\n }),\n ),\n )\n\n // Lines through the band centers, drawn after (over) every bar. The path\n // generators come with the line module, so plain bar charts do not ship them.\n const paths = lineKeys.length ? feature('line') : null\n const lines = series.map((s, index) => {\n if (!paths) return null\n if (!isLine(index) || ctx.hidden.has(seriesKey(s))) return null\n const y = scaleOf(index)\n const axis = axisOf(s).axis\n const baseline = y(Math.min(Math.max(0, y.domain[0]), y.domain[1]))\n const points = labels.map((_, i): Point => {\n const v = s.values[i]\n if (!plottable(v, axis)) return null\n const center = x.at(i) + x.bandwidth / 2\n return horizontal ? [y(v), center] : [center, y(v)]\n })\n // Areas need a vertical baseline; sideways they fall back to a line.\n const filled = s.type === 'area' && !horizontal\n return h(\n 'g',\n seriesAttrs(s, index),\n filled && h('path', { class: 'tc-area', d: paths.areaPath(points, baseline, { curve }) }),\n h('path', { class: 'tc-line', d: paths.linePath(points, { curve }) }),\n )\n })\n\n const content = [\n h('defs', { key: 'defs' }, layout.clip.def),\n layout.background,\n // Layers are keyed: an annotation band or a grid that comes and goes must not\n // shift the series list onto another node (that would recreate every series).\n h(\n 'g',\n { key: 'series', class: 'tc-series-list', 'clip-path': layout.clip.url },\n groups,\n lines,\n ),\n layout.foreground,\n ]\n return { content, interaction }\n },\n legend: (options) => seriesLegend(options.data),\n table: (options, ctx, limit) => seriesTable(options, ctx, limit),\n}\n"],"mappings":";;;;;;;;;;;;;;AAuBA,SAAgB,iBACd,SACA,KACA,QACiB;CACjB,MAAM,WAAW,QAAQ,KAAK,CAAC;CAC/B,MAAM,WAAW,QAAQ,KAAK,CAAC;CAC/B,MAAM,EAAE,UAAU,UAAU;CAC5B,MAAM,WAAW,OAAO,YAAY;CACpC,MAAM,SAAS,cAAc,QAAQ,IAAI;CACzC,MAAM,SAAS,eAAe,SAAS,GAAG;CAC1C,MAAM,QAAQ,UAAU,SAAS,KAAK,QAAQ,KAAK,MAAM,QAAA,EAAsB,CAAC;CAChF,MAAM,cAAc,MAAM;CAC1B,MAAM,aAAa,SAAS,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IAC1C,OAAO;IAGP,EACE,KACA;KAAE,KAAK;KAAU,OAAO;KAAkB,aAAa,OAAO,KAAK;IAAI,GACvE,QACA,KACF;IACA,OAAO;GAEM;GAAG;EAAY;CAChC;CACA,SAAS,YAAY,aAAa,QAAQ,IAAI;CAC9C,QAAQ,SAAS,KAAK,UAAU,YAAY,SAAS,KAAK,KAAK;AACjE"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const require_clean = require("./clean-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
1
|
+
const require_features = require("./features-DEDP5CEQ.cjs");
|
|
2
|
+
const require_bar = require("./bar-wVykm1us.cjs");
|
|
3
|
+
const require_vnode = require("./vnode-ClAiw28x.cjs");
|
|
4
|
+
const require_cartesian = require("./cartesian-DRSXHxWe.cjs");
|
|
5
|
+
const require_clean = require("./clean-Die2iCNc.cjs");
|
|
6
|
+
const require_axis = require("./axis-YfAerNBA.cjs");
|
|
7
|
+
const require_layout = require("./layout-Cfg9x1k2.cjs");
|
|
8
|
+
const require_stack = require("./stack-BO4624CY.cjs");
|
|
9
|
+
// src/charts/horizontal.ts
|
|
9
10
|
/**
|
|
10
11
|
* Cartesian layout with categories along y (labels on the left) and values
|
|
11
12
|
* along x (labels at the bottom), for horizontal bars. Only bar charts use
|
|
@@ -14,9 +15,8 @@ const require_bar = require("./bar-DGuUN3nc.cjs");
|
|
|
14
15
|
function horizontalLayout(options, ctx, layout) {
|
|
15
16
|
const yOptions = options.y ?? {};
|
|
16
17
|
const xOptions = options.x ?? {};
|
|
17
|
-
const { fontSize, width
|
|
18
|
+
const { fontSize, width } = ctx;
|
|
18
19
|
const overhang = layout.overhang ?? 0;
|
|
19
|
-
const pad = require_layout.insets(options.padding);
|
|
20
20
|
const labels = require_cartesian.resolveLabels(options.data);
|
|
21
21
|
const format = require_cartesian.labelFormatter(options, ctx);
|
|
22
22
|
const value = require_cartesian.valueAxis(options, ctx, layout, Math.round(width / 80));
|
|
@@ -29,22 +29,21 @@ function horizontalLayout(options, ctx, layout) {
|
|
|
29
29
|
label: format(label, i)
|
|
30
30
|
}));
|
|
31
31
|
const edgeLabel = (tick) => showValues && tick ? Math.ceil(require_layout.estimateTextWidth(tick.label, fontSize) / 2) : 0;
|
|
32
|
-
const
|
|
32
|
+
const { area, side, range } = require_layout.plotFrame(ctx, options.padding, (pad) => ({
|
|
33
33
|
top: pad.top + Math.max(overhang, 4),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
const area = require_layout.innerRect(width, height, margins);
|
|
34
|
+
bottom: pad.bottom + Math.max((showValues ? require_axis.axisSize("bottom", probeValues, fontSize) : 0) + require_axis.axisTitleSize(yOptions.title, fontSize), overhang, 4),
|
|
35
|
+
start: pad.start + Math.max((showCategories ? require_axis.axisSize("left", probeCategories, fontSize) : 0) + require_axis.axisTitleSize(xOptions.title, fontSize), edgeLabel(probeValues[0]), overhang, 8),
|
|
36
|
+
end: pad.end + Math.max(edgeLabel(probeValues[probeValues.length - 1]), overhang, 8)
|
|
37
|
+
}));
|
|
39
38
|
const keys = labels.map(require_cartesian.labelKey);
|
|
40
39
|
const x = require_cartesian.band(keys, [area.y, area.y + area.height], {
|
|
41
40
|
paddingInner: layout.paddingInner ?? .3,
|
|
42
41
|
paddingOuter: layout.paddingOuter ?? .15
|
|
43
42
|
});
|
|
44
|
-
const y = value.scale(
|
|
45
|
-
const yTicks =
|
|
46
|
-
const xTicks = showCategories ?
|
|
47
|
-
return require_cartesian.finishLayout(options, ctx, overhang, {
|
|
43
|
+
const y = value.scale(range());
|
|
44
|
+
const yTicks = require_axis.thinTicks(value.ticks(y), "bottom", fontSize);
|
|
45
|
+
const xTicks = showCategories ? require_axis.thinTicks(require_axis.bandTicks(x, (_, i) => format(labels[i], i)), "left", fontSize) : [];
|
|
46
|
+
return require_cartesian.finishLayout(options, ctx, side, overhang, {
|
|
48
47
|
area,
|
|
49
48
|
labels,
|
|
50
49
|
x,
|
|
@@ -54,8 +53,7 @@ function horizontalLayout(options, ctx, layout) {
|
|
|
54
53
|
yTicks
|
|
55
54
|
}, keys);
|
|
56
55
|
}
|
|
57
|
-
|
|
58
|
-
//#region src/charts/bar.ts
|
|
56
|
+
// src/charts/bar.ts
|
|
59
57
|
/**
|
|
60
58
|
* Bar chart: vertical bars per category, grouped side by side or stacked,
|
|
61
59
|
* growing from zero (negative values grow down).
|
|
@@ -78,36 +76,51 @@ const bar = {
|
|
|
78
76
|
const count = require_cartesian.resolveLabels(options.data).length;
|
|
79
77
|
const isLine = (index) => (series[index]?.type ?? "bar") !== "bar";
|
|
80
78
|
const lineKeys = series.filter((_, index) => isLine(index)).map(require_cartesian.seriesKey);
|
|
81
|
-
const
|
|
79
|
+
const axisOf = require_cartesian.seriesAxes(options);
|
|
80
|
+
const onY2 = (index) => axisOf(series[index]).second;
|
|
81
|
+
const apart = series.filter((_, index) => isLine(index) || onY2(index)).map(require_cartesian.seriesKey);
|
|
82
|
+
const stackHidden = apart.length ? /* @__PURE__ */ new Set([...ctx.hidden, ...apart]) : ctx.hidden;
|
|
82
83
|
const stacks = stacked ? require_stack.stackSeries(series, count, {
|
|
83
84
|
percent: stacked === "percent",
|
|
84
85
|
hidden: stackHidden
|
|
85
86
|
}) : null;
|
|
87
|
+
const inStack = (index) => !!stacks && !isLine(index) && !onY2(index);
|
|
86
88
|
const layoutOptions = {
|
|
87
89
|
scale: "band",
|
|
88
90
|
zero: true,
|
|
89
91
|
paddingInner: groupPadding,
|
|
90
92
|
paddingOuter: groupPadding / 2,
|
|
91
|
-
|
|
93
|
+
zero2: series.some((s, index) => onY2(index) && s.type !== "line"),
|
|
94
|
+
...stacks ? { values: [...require_stack.stackBounds(stacks), ...series.flatMap((s, index) => isLine(index) && !onY2(index) ? s.values : [])] } : {},
|
|
92
95
|
...stacked === "percent" ? { tickFormat: { style: "percent" } } : {}
|
|
93
96
|
};
|
|
94
97
|
const layout = horizontal ? horizontalLayout(options, ctx, layoutOptions) : require_cartesian.cartesianLayout(options, ctx, layoutOptions);
|
|
95
|
-
const { x,
|
|
98
|
+
const { x, labels } = layout;
|
|
99
|
+
const scaleOf = (index) => require_cartesian.seriesScale(layout, series[index]);
|
|
96
100
|
const slots = /* @__PURE__ */ new Map();
|
|
101
|
+
let used = 0;
|
|
102
|
+
let stackColumn = -1;
|
|
97
103
|
series.forEach((s, index) => {
|
|
98
|
-
if (
|
|
104
|
+
if (ctx.hidden.has(require_cartesian.seriesKey(s)) || isLine(index)) return;
|
|
105
|
+
if (!inStack(index)) slots.set(index, used++);
|
|
106
|
+
else {
|
|
107
|
+
if (stackColumn < 0) stackColumn = used++;
|
|
108
|
+
slots.set(index, stackColumn);
|
|
109
|
+
}
|
|
99
110
|
});
|
|
100
111
|
const order = [...slots.keys()];
|
|
101
|
-
const columns =
|
|
102
|
-
const barWidth = Math.max(0, Math.min(maxBarWidth, (x.bandwidth -
|
|
103
|
-
const groupWidth = barWidth * columns +
|
|
112
|
+
const columns = Math.max(1, used);
|
|
113
|
+
const barWidth = Math.max(0, Math.min(maxBarWidth, (x.bandwidth - gap * (columns - 1)) / columns));
|
|
114
|
+
const groupWidth = barWidth * columns + gap * (columns - 1);
|
|
104
115
|
const offset = (x.bandwidth - groupWidth) / 2;
|
|
105
|
-
const
|
|
116
|
+
const slotAt = (slot) => x.range[1] < x.range[0] ? columns - 1 - slot : slot;
|
|
117
|
+
const barLeft = (seriesIndex, i) => x.at(i) + offset + slotAt(slots.get(seriesIndex) ?? 0) * (barWidth + gap);
|
|
106
118
|
/** Data extent of a bar: from zero to the value, or its stacked segment. */
|
|
107
119
|
const segment = (seriesIndex, i) => {
|
|
108
|
-
if (
|
|
109
|
-
const
|
|
110
|
-
|
|
120
|
+
if (inStack(seriesIndex)) return stacks?.[seriesIndex]?.[i] ?? null;
|
|
121
|
+
const s = series[seriesIndex];
|
|
122
|
+
const v = s?.values[i];
|
|
123
|
+
return require_cartesian.plottable(v, axisOf(s).axis) ? {
|
|
111
124
|
y0: 0,
|
|
112
125
|
y1: v
|
|
113
126
|
} : null;
|
|
@@ -116,6 +129,7 @@ const bar = {
|
|
|
116
129
|
let up = -1;
|
|
117
130
|
let down = -1;
|
|
118
131
|
for (const index of order) {
|
|
132
|
+
if (!inStack(index)) continue;
|
|
119
133
|
const seg = segment(index, i);
|
|
120
134
|
if (!seg) continue;
|
|
121
135
|
if (seg.y1 > seg.y0) up = index;
|
|
@@ -126,7 +140,8 @@ const bar = {
|
|
|
126
140
|
down
|
|
127
141
|
};
|
|
128
142
|
});
|
|
129
|
-
|
|
143
|
+
const interaction = require_cartesian.categoryInteraction(layout, options, ctx, (seriesIndex, i, v) => {
|
|
144
|
+
const y = scaleOf(seriesIndex);
|
|
130
145
|
if (isLine(seriesIndex)) {
|
|
131
146
|
const across = x.at(i) + x.bandwidth / 2;
|
|
132
147
|
return horizontal ? {
|
|
@@ -165,28 +180,27 @@ const bar = {
|
|
|
165
180
|
}, (px, py, i) => {
|
|
166
181
|
const across = horizontal ? py : px;
|
|
167
182
|
const along = horizontal ? px : py;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const slot = Math.floor((across - (x.at(i) + offset) + gap / 2) / (barWidth + gap));
|
|
180
|
-
const seriesIndex = order[slot];
|
|
183
|
+
const column = slotAt(Math.floor((across - (x.at(i) + offset) + gap / 2) / (barWidth + gap)));
|
|
184
|
+
if (column === stackColumn) return order.find((index) => {
|
|
185
|
+
if (!inStack(index)) return false;
|
|
186
|
+
const seg = segment(index, i);
|
|
187
|
+
if (!seg) return false;
|
|
188
|
+
const y = scaleOf(index);
|
|
189
|
+
const a = y(seg.y0);
|
|
190
|
+
const b = y(seg.y1);
|
|
191
|
+
return along >= Math.min(a, b) - gap / 2 && along <= Math.max(a, b) + gap / 2;
|
|
192
|
+
});
|
|
193
|
+
const seriesIndex = order.find((index) => slots.get(index) === column);
|
|
181
194
|
return seriesIndex !== void 0 && segment(seriesIndex, i) ? seriesIndex : void 0;
|
|
182
|
-
})
|
|
195
|
+
});
|
|
183
196
|
const groups = series.map((s, index) => slots.has(index) && require_vnode.h("g", require_cartesian.seriesAttrs(s, index), labels.map((label, i) => {
|
|
184
197
|
const seg = segment(index, i);
|
|
185
198
|
if (!seg) return null;
|
|
199
|
+
const y = scaleOf(index);
|
|
186
200
|
const negative = seg.y1 < seg.y0;
|
|
187
|
-
const away = (
|
|
201
|
+
const away = Math.sign(y(seg.y1) - y(seg.y0));
|
|
188
202
|
const inner = seg.y0 === 0 ? 0 : away * gap;
|
|
189
|
-
const rounded = !
|
|
203
|
+
const rounded = !inStack(index) || (negative ? outer[i]?.down : outer[i]?.up) === index;
|
|
190
204
|
const draw = horizontal ? require_bar.hbarPath : require_bar.barPath;
|
|
191
205
|
return require_vnode.h("path", {
|
|
192
206
|
key: require_cartesian.labelKey(label),
|
|
@@ -199,13 +213,15 @@ const bar = {
|
|
|
199
213
|
});
|
|
200
214
|
})));
|
|
201
215
|
const paths = lineKeys.length ? require_features.feature("line") : null;
|
|
202
|
-
const baseline = y(Math.min(Math.max(0, y.domain[0]), y.domain[1]));
|
|
203
216
|
const lines = series.map((s, index) => {
|
|
204
217
|
if (!paths) return null;
|
|
205
218
|
if (!isLine(index) || ctx.hidden.has(require_cartesian.seriesKey(s))) return null;
|
|
219
|
+
const y = scaleOf(index);
|
|
220
|
+
const axis = axisOf(s).axis;
|
|
221
|
+
const baseline = y(Math.min(Math.max(0, y.domain[0]), y.domain[1]));
|
|
206
222
|
const points = labels.map((_, i) => {
|
|
207
223
|
const v = s.values[i];
|
|
208
|
-
if (!require_cartesian.plottable(v,
|
|
224
|
+
if (!require_cartesian.plottable(v, axis)) return null;
|
|
209
225
|
const center = x.at(i) + x.bandwidth / 2;
|
|
210
226
|
return horizontal ? [y(v), center] : [center, y(v)];
|
|
211
227
|
});
|
|
@@ -218,21 +234,23 @@ const bar = {
|
|
|
218
234
|
d: paths.linePath(points, { curve })
|
|
219
235
|
}));
|
|
220
236
|
});
|
|
221
|
-
return
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
237
|
+
return {
|
|
238
|
+
content: [
|
|
239
|
+
require_vnode.h("defs", { key: "defs" }, layout.clip.def),
|
|
240
|
+
layout.background,
|
|
241
|
+
require_vnode.h("g", {
|
|
242
|
+
key: "series",
|
|
243
|
+
class: "tc-series-list",
|
|
244
|
+
"clip-path": layout.clip.url
|
|
245
|
+
}, groups, lines),
|
|
246
|
+
layout.foreground
|
|
247
|
+
],
|
|
248
|
+
interaction
|
|
249
|
+
};
|
|
231
250
|
},
|
|
232
251
|
legend: (options) => require_cartesian.seriesLegend(options.data),
|
|
233
252
|
table: (options, ctx, limit) => require_cartesian.seriesTable(options, ctx, limit)
|
|
234
253
|
};
|
|
235
|
-
//#endregion
|
|
236
254
|
Object.defineProperty(exports, "bar", {
|
|
237
255
|
enumerable: true,
|
|
238
256
|
get: function() {
|
|
@@ -240,4 +258,4 @@ Object.defineProperty(exports, "bar", {
|
|
|
240
258
|
}
|
|
241
259
|
});
|
|
242
260
|
|
|
243
|
-
//# sourceMappingURL=bar-
|
|
261
|
+
//# sourceMappingURL=bar-CVkOJ7WA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bar-CVkOJ7WA.cjs","names":["resolveLabels","labelFormatter","valueAxis","labelKey","estimateTextWidth","plotFrame","axisSize","axisTitleSize","band","thinTicks","bandTicks","finishLayout","cleanData","cleanSeries","resolveLabels","seriesKey","seriesAxes","stackSeries","stackBounds","cartesianLayout","seriesScale","plottable","categoryInteraction","h","seriesAttrs","hbarPath","barPath","labelKey","feature","seriesLegend","seriesTable"],"sources":["../src/charts/horizontal.ts","../src/charts/bar.ts"],"sourcesContent":["import type { RenderContext } from '../chart.ts'\nimport { axisSize, axisTitleSize, bandTicks, type Tick, thinTicks } from '../components/axis.ts'\nimport { estimateTextWidth, plotFrame } from '../layout.ts'\nimport { type BandKey, band } from '../scales/band.ts'\nimport {\n type CartesianLayout,\n type CartesianLayoutOptions,\n type CartesianOptions,\n EDGE,\n finishLayout,\n type Label,\n labelFormatter,\n labelKey,\n resolveLabels,\n TICK_SPACING_X,\n valueAxis,\n} from './cartesian.ts'\n\n/**\n * Cartesian layout with categories along y (labels on the left) and values\n * along x (labels at the bottom), for horizontal bars. Only bar charts use\n * it, so it lives outside `cartesianLayout()` and stays out of other bundles.\n */\nexport function horizontalLayout(\n options: CartesianOptions,\n ctx: RenderContext,\n layout: CartesianLayoutOptions,\n): CartesianLayout {\n const yOptions = options.y ?? {}\n const xOptions = options.x ?? {}\n const { fontSize, width } = ctx\n const overhang = layout.overhang ?? 0\n const labels = resolveLabels(options.data)\n const format = labelFormatter(options, ctx)\n const value = valueAxis(options, ctx, layout, Math.round(width / TICK_SPACING_X))\n const probeValues = value.probe\n const showValues = yOptions.show !== false\n const showCategories = xOptions.show !== false && labels.length > 0\n\n const probeCategories: Tick[] = labels.map((label, i) => ({\n value: labelKey(label),\n position: 0,\n label: format(label, i),\n }))\n const edgeLabel = (tick: Tick | undefined) =>\n showValues && tick ? Math.ceil(estimateTextWidth(tick.label, fontSize) / 2) : 0\n\n const { area, side, range } = plotFrame(ctx, options.padding, (pad) => ({\n top: pad.top + Math.max(overhang, EDGE / 2),\n bottom:\n pad.bottom +\n Math.max(\n (showValues ? axisSize('bottom', probeValues, fontSize) : 0) +\n axisTitleSize(yOptions.title, fontSize),\n overhang,\n EDGE / 2,\n ),\n start:\n pad.start +\n Math.max(\n (showCategories ? axisSize('left', probeCategories, fontSize) : 0) +\n axisTitleSize(xOptions.title, fontSize),\n edgeLabel(probeValues[0]),\n overhang,\n EDGE,\n ),\n end: pad.end + Math.max(edgeLabel(probeValues[probeValues.length - 1]), overhang, EDGE),\n }))\n\n const keys = labels.map(labelKey)\n const x = band(keys, [area.y, area.y + area.height], {\n paddingInner: layout.paddingInner ?? 0.3,\n paddingOuter: layout.paddingOuter ?? 0.15,\n })\n // Values grow away from the categories, from the start side.\n const y = value.scale(range())\n const yTicks = thinTicks(value.ticks(y), 'bottom', fontSize)\n const xTicks = showCategories\n ? thinTicks(\n bandTicks(x, (_: BandKey, i) => format(labels[i] as Label, i)),\n 'left',\n fontSize,\n )\n : []\n\n // The value axis runs along x here, categories along y.\n return finishLayout(\n options,\n ctx,\n side,\n overhang,\n { area, labels, x, y, horizontal: true, xTicks, yTicks },\n keys,\n )\n}\n","import type { ChartType } from '../chart.ts'\nimport { feature } from '../features.ts'\nimport { barPath, hbarPath } from '../shapes/bar.ts'\nimport type { Curve, Point } from '../shapes/path.ts'\nimport { h } from '../vnode.ts'\nimport {\n type CartesianLayoutOptions,\n type CartesianOptions,\n cartesianLayout,\n categoryInteraction,\n labelKey,\n plottable,\n resolveLabels,\n seriesAttrs,\n seriesAxes,\n seriesKey,\n seriesLegend,\n seriesScale,\n seriesTable,\n} from './cartesian.ts'\nimport { cleanData, cleanSeries } from './clean.ts'\nimport { horizontalLayout } from './horizontal.ts'\nimport { type Segment, type StackMode, stackBounds, stackSeries } from './stack.ts'\n\nexport interface BarOptions extends CartesianOptions {\n /** Corner radius of the data end of each bar (or stack). Defaults to `4`. */\n radius?: number\n /** Maximum bar thickness in pixels; leftover band space stays empty. Defaults to `24`. */\n maxBarWidth?: number\n /** Gap between bars of a group, or between stacked segments, in pixels. Defaults to `2`. */\n gap?: number\n /** Share of each category left empty between groups, `0…1`. Defaults to `0.3`. */\n groupPadding?: number\n /**\n * Stack series in one bar per category instead of side by side; `'percent'`\n * shows each category as 100%. Negative values stack down from zero.\n */\n stacked?: StackMode\n /**\n * `'horizontal'` lays categories out along y with bars growing right\n * (left for negative values). The `x` / `y` options keep describing the\n * category / value axis. Defaults to `'vertical'`.\n */\n orientation?: 'vertical' | 'horizontal'\n /** Interpolation of series drawn as lines (`series.type`). Defaults to `'monotone'`. */\n curve?: Curve\n}\n\n/**\n * Bar chart: vertical bars per category, grouped side by side or stacked,\n * growing from zero (negative values grow down).\n *\n * ```ts\n * new Chart('#el', {\n * type: bar,\n * data: { labels: ['Q1', 'Q2'], series: [{ name: '2025', values: [3, 5] }] },\n * stacked: true,\n * })\n * ```\n */\nexport const bar: ChartType<BarOptions> = {\n name: 'bar',\n clean: cleanData(cleanSeries),\n render(options, ctx) {\n const {\n radius = 4,\n maxBarWidth = 24,\n gap = 2,\n groupPadding = 0.3,\n stacked = false,\n orientation = 'vertical',\n curve = 'monotone',\n } = options\n const horizontal = orientation === 'horizontal'\n const { series } = options.data\n const count = resolveLabels(options.data).length\n // Series drawn as lines sit on top of the bars and stay out of the stacks.\n const isLine = (index: number) => (series[index]?.type ?? 'bar') !== 'bar'\n const lineKeys = series.filter((_, index) => isLine(index)).map(seriesKey)\n const axisOf = seriesAxes(options)\n const onY2 = (index: number) => axisOf(series[index]).second\n // Bars on the second axis stand beside the stack, in a column of their own.\n const apart = series.filter((_, index) => isLine(index) || onY2(index)).map(seriesKey)\n const stackHidden = apart.length ? new Set([...ctx.hidden, ...apart]) : ctx.hidden\n const stacks = stacked\n ? stackSeries(series, count, { percent: stacked === 'percent', hidden: stackHidden })\n : null\n const inStack = (index: number) => !!stacks && !isLine(index) && !onY2(index)\n\n const layoutOptions: CartesianLayoutOptions = {\n scale: 'band',\n zero: true,\n paddingInner: groupPadding,\n paddingOuter: groupPadding / 2,\n // Bars and areas on the second axis grow from zero too, lines need not.\n zero2: series.some((s, index) => onY2(index) && s.type !== 'line'),\n ...(stacks\n ? {\n values: [\n ...stackBounds(stacks),\n ...series.flatMap((s, index) => (isLine(index) && !onY2(index) ? s.values : [])),\n ],\n }\n : {}),\n ...(stacked === 'percent' ? { tickFormat: { style: 'percent' } } : {}),\n }\n const layout = horizontal\n ? horizontalLayout(options, ctx, layoutOptions)\n : cartesianLayout(options, ctx, layoutOptions)\n const { x, labels } = layout\n const scaleOf = (index: number) => seriesScale(layout, series[index])\n\n // The column of each bar series in its group: a stack takes one column\n // for all its series. Hidden series keep their color slot but give up their place.\n const slots = new Map<number, number>()\n let used = 0\n let stackColumn = -1\n series.forEach((s, index) => {\n if (ctx.hidden.has(seriesKey(s)) || isLine(index)) return\n if (!inStack(index)) slots.set(index, used++)\n else {\n if (stackColumn < 0) stackColumn = used++\n slots.set(index, stackColumn)\n }\n })\n const order = [...slots.keys()]\n const columns = Math.max(1, used)\n\n const barWidth = Math.max(\n 0,\n Math.min(maxBarWidth, (x.bandwidth - gap * (columns - 1)) / columns),\n )\n const groupWidth = barWidth * columns + gap * (columns - 1)\n const offset = (x.bandwidth - groupWidth) / 2\n // Grouped bars follow the categories: from the right when those are reversed.\n const slotAt = (slot: number) => (x.range[1] < x.range[0] ? columns - 1 - slot : slot)\n const barLeft = (seriesIndex: number, i: number) =>\n x.at(i) + offset + slotAt(slots.get(seriesIndex) ?? 0) * (barWidth + gap)\n\n /** Data extent of a bar: from zero to the value, or its stacked segment. */\n const segment = (seriesIndex: number, i: number): Segment | null => {\n if (inStack(seriesIndex)) return stacks?.[seriesIndex]?.[i] ?? null\n const s = series[seriesIndex]\n const v = s?.values[i]\n return plottable(v, axisOf(s).axis) ? { y0: 0, y1: v } : null\n }\n\n // In a stack only the outermost segment of each sign gets rounded.\n const outer = labels.map((_, i) => {\n let up = -1\n let down = -1\n for (const index of order) {\n if (!inStack(index)) continue\n const seg = segment(index, i)\n if (!seg) continue\n if (seg.y1 > seg.y0) up = index\n else if (seg.y1 < seg.y0) down = index\n }\n return { up, down }\n })\n\n const interaction = categoryInteraction(\n layout,\n options,\n ctx,\n (seriesIndex, i, v) => {\n const y = scaleOf(seriesIndex)\n if (isLine(seriesIndex)) {\n const across = x.at(i) + x.bandwidth / 2\n return horizontal ? { x: y(v), y: across } : { x: across, y: y(v) }\n }\n const left = barLeft(seriesIndex, i)\n const seg = segment(seriesIndex, i)\n const end = y(seg?.y1 ?? 0)\n const base = y(seg?.y0 ?? 0)\n // The bar's box, for value labels inside it.\n const lo = Math.min(end, base)\n const length = Math.abs(end - base)\n return horizontal\n ? {\n x: end,\n y: left + barWidth / 2,\n box: { x: lo, y: left, width: length, height: barWidth },\n }\n : {\n x: left + barWidth / 2,\n y: end,\n box: { x: left, y: lo, width: barWidth, height: length },\n }\n },\n (px, py, i) => {\n // Pointer position across the categories and along the values.\n const across = horizontal ? py : px\n const along = horizontal ? px : py\n // The column under the pointer, gaps included, so thin bars are easy to hit.\n const column = slotAt(\n Math.floor((across - (x.at(i) + offset) + gap / 2) / (barWidth + gap)),\n )\n if (column === stackColumn) {\n // The segment under the pointer, within the stack (gaps included).\n return order.find((index) => {\n if (!inStack(index)) return false\n const seg = segment(index, i)\n if (!seg) return false\n const y = scaleOf(index)\n const a = y(seg.y0)\n const b = y(seg.y1)\n return along >= Math.min(a, b) - gap / 2 && along <= Math.max(a, b) + gap / 2\n })\n }\n const seriesIndex = order.find((index) => slots.get(index) === column)\n return seriesIndex !== undefined && segment(seriesIndex, i) ? seriesIndex : undefined\n },\n )\n\n const groups = series.map(\n (s, index) =>\n slots.has(index) &&\n h(\n 'g',\n seriesAttrs(s, index),\n labels.map((label, i) => {\n const seg = segment(index, i)\n if (!seg) return null\n const y = scaleOf(index)\n const negative = seg.y1 < seg.y0\n // Leave a surface-colored gap where this segment sits on another one,\n // on the side it grows to (in pixels: up, right, or left when mirrored).\n const away = Math.sign(y(seg.y1) - y(seg.y0))\n const inner = seg.y0 === 0 ? 0 : away * gap\n const rounded = !inStack(index) || (negative ? outer[i]?.down : outer[i]?.up) === index\n const draw = horizontal ? hbarPath : barPath\n return h('path', {\n key: labelKey(label),\n class: ['tc-bar', negative && 'tc-bar-negative', horizontal && 'tc-bar-horizontal'],\n d: draw(\n barLeft(index, i),\n barWidth,\n y(seg.y0) + inner,\n y(seg.y1),\n rounded ? radius : 0,\n ),\n })\n }),\n ),\n )\n\n // Lines through the band centers, drawn after (over) every bar. The path\n // generators come with the line module, so plain bar charts do not ship them.\n const paths = lineKeys.length ? feature('line') : null\n const lines = series.map((s, index) => {\n if (!paths) return null\n if (!isLine(index) || ctx.hidden.has(seriesKey(s))) return null\n const y = scaleOf(index)\n const axis = axisOf(s).axis\n const baseline = y(Math.min(Math.max(0, y.domain[0]), y.domain[1]))\n const points = labels.map((_, i): Point => {\n const v = s.values[i]\n if (!plottable(v, axis)) return null\n const center = x.at(i) + x.bandwidth / 2\n return horizontal ? [y(v), center] : [center, y(v)]\n })\n // Areas need a vertical baseline; sideways they fall back to a line.\n const filled = s.type === 'area' && !horizontal\n return h(\n 'g',\n seriesAttrs(s, index),\n filled && h('path', { class: 'tc-area', d: paths.areaPath(points, baseline, { curve }) }),\n h('path', { class: 'tc-line', d: paths.linePath(points, { curve }) }),\n )\n })\n\n const content = [\n h('defs', { key: 'defs' }, layout.clip.def),\n layout.background,\n // Layers are keyed: an annotation band or a grid that comes and goes must not\n // shift the series list onto another node (that would recreate every series).\n h(\n 'g',\n { key: 'series', class: 'tc-series-list', 'clip-path': layout.clip.url },\n groups,\n lines,\n ),\n layout.foreground,\n ]\n return { content, interaction }\n },\n legend: (options) => seriesLegend(options.data),\n table: (options, ctx, limit) => seriesTable(options, ctx, limit),\n}\n"],"mappings":";;;;;;;;;;;;;;AAuBA,SAAgB,iBACd,SACA,KACA,QACiB;CACjB,MAAM,WAAW,QAAQ,KAAK,CAAC;CAC/B,MAAM,WAAW,QAAQ,KAAK,CAAC;CAC/B,MAAM,EAAE,UAAU,UAAU;CAC5B,MAAM,WAAW,OAAO,YAAY;CACpC,MAAM,SAASA,kBAAAA,cAAc,QAAQ,IAAI;CACzC,MAAM,SAASC,kBAAAA,eAAe,SAAS,GAAG;CAC1C,MAAM,QAAQC,kBAAAA,UAAU,SAAS,KAAK,QAAQ,KAAK,MAAM,QAAA,EAAsB,CAAC;CAChF,MAAM,cAAc,M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;GACrC,OAAOE,cAAAA,EACL,KACAC,kBAAAA,YAAY,GAAG,KAAK,GACpB,UAAUD,cAAAA,EAAE,QAAQ;IAAE,OAAO;IAAW,GAAG,MAAM,SAAS,QAAQ,UAAU,EAAE,MAAM,CAAC;GAAE,CAAC,GACxFA,cAAAA,EAAE,QAAQ;IAAE,OAAO;IAAW,GAAG,MAAM,SAAS,QAAQ,EAAE,MAAM,CAAC;GAAE,CAAC,CACtE;EACF,CAAC;EAeD,OAAO;GAAE,SAAA;IAZPA,cAAAA,EAAE,QAAQ,EAAE,KAAK,OAAO,GAAG,OAAO,KAAK,GAAG;IAC1C,OAAO;IAGPA,cAAAA,EACE,KACA;KAAE,KAAK;KAAU,OAAO;KAAkB,aAAa,OAAO,KAAK;IAAI,GACvE,QACA,KACF;IACA,OAAO;GAEM;GAAG;EAAY;CAChC;CACA,SAAS,YAAYM,kBAAAA,aAAa,QAAQ,IAAI;CAC9C,QAAQ,SAAS,KAAK,UAAUC,kBAAAA,YAAY,SAAS,KAAK,KAAK;AACjE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { s as round$1 } from "./layout-DqAte3H8.js";
|
|
2
|
+
// src/shapes/bar.ts
|
|
3
3
|
/** Rounded for path data, without a `-0`. */
|
|
4
4
|
const round = (value) => {
|
|
5
5
|
const rounded = round$1(value);
|
|
@@ -50,7 +50,6 @@ function hbarPath(y, height, baseline, value, radius = 0) {
|
|
|
50
50
|
const rr = round(r);
|
|
51
51
|
return `M${b},${y0}L${edge},${y0}A${rr},${rr},0,0,${sweep},${v},${round(y + r)}L${v},${round(y + hgt - r)}A${rr},${rr},0,0,${sweep},${edge},${y1}L${b},${y1}Z`;
|
|
52
52
|
}
|
|
53
|
-
//#endregion
|
|
54
53
|
export { hbarPath as n, barPath as t };
|
|
55
54
|
|
|
56
|
-
//# sourceMappingURL=bar-
|
|
55
|
+
//# sourceMappingURL=bar-CgpC2EpX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-
|
|
1
|
+
{"version":3,"file":"bar-CgpC2EpX.js","names":["to2"],"sources":["../src/shapes/bar.ts"],"sourcesContent":["import { round as to2 } from '../layout.ts'\n\n/** Rounded for path data, without a `-0`. */\nconst round = (value: number): number => {\n const rounded = to2(value)\n return rounded === 0 ? 0 : rounded\n}\n\n/**\n * Path of a vertical bar from `baseline` to `value` (both y in pixels),\n * `x`…`x + width` wide. Only the data end is rounded, with `radius` clamped\n * to half the width and to the bar height; the baseline end stays square.\n * Works for bars growing up (value above baseline) and down (negative values).\n * Square corners are zero-radius arcs and every side is an `L`, so every\n * bar path, vertical or horizontal, has the same commands and CSS can\n * transition `d` between rounded and square (stacking) and between\n * orientations.\n */\nexport function barPath(\n x: number,\n width: number,\n baseline: number,\n value: number,\n radius = 0,\n): string {\n const w = Math.max(0, width)\n const height = Math.abs(baseline - value)\n const r = Math.max(0, Math.min(radius, w / 2, height))\n const x0 = round(x)\n const x1 = round(x + w)\n const b = round(baseline)\n const v = round(value)\n\n const up = value <= baseline\n const edge = round(up ? value + r : value - r)\n const sweep = up ? 1 : 0\n const rr = round(r)\n return (\n `M${x0},${b}L${x0},${edge}` +\n `A${rr},${rr},0,0,${sweep},${round(x + r)},${v}` +\n `L${round(x + w - r)},${v}` +\n `A${rr},${rr},0,0,${sweep},${x1},${edge}` +\n `L${x1},${b}Z`\n )\n}\n\n/**\n * Path of a horizontal bar from `baseline` to `value` (both x in pixels),\n * `y`…`y + height` tall. Only the data end is rounded, with `radius` clamped\n * to half the height and to the bar length; the baseline end stays square.\n * Works for bars growing right (positive values) and left (negative values).\n * Same commands as `barPath`, so a chart can morph between orientations.\n */\nexport function hbarPath(\n y: number,\n height: number,\n baseline: number,\n value: number,\n radius = 0,\n): string {\n const hgt = Math.max(0, height)\n const length = Math.abs(value - baseline)\n const r = Math.max(0, Math.min(radius, hgt / 2, length))\n const y0 = round(y)\n const y1 = round(y + hgt)\n const b = round(baseline)\n const v = round(value)\n\n const right = value >= baseline\n const edge = round(right ? value - r : value + r)\n const sweep = right ? 1 : 0\n const rr = round(r)\n return (\n `M${b},${y0}L${edge},${y0}` +\n `A${rr},${rr},0,0,${sweep},${v},${round(y + r)}` +\n `L${v},${round(y + hgt - r)}` +\n `A${rr},${rr},0,0,${sweep},${edge},${y1}` +\n `L${b},${y1}Z`\n )\n}\n"],"mappings":";;;AAGA,MAAM,SAAS,UAA0B;CACvC,MAAM,UAAUA,QAAI,KAAK;CACzB,OAAO,YAAY,IAAI,IAAI;AAC7B;;;;;;;;;;;AAYA,SAAgB,QACd,GACA,OACA,UACA,OACA,SAAS,GACD;CACR,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK;CAC3B,MAAM,SAAS,KAAK,IAAI,WAAW,KAAK;CACxC,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,QAAQ,IAAI,GAAG,MAAM,CAAC;CACrD,MAAM,KAAK,MAAM,CAAC;CAClB,MAAM,KAAK,MAAM,IAAI,CAAC;CACtB,MAAM,IAAI,MAAM,QAAQ;CACxB,MAAM,IAAI,MAAM,KAAK;CAErB,MAAM,KAAK,SAAS;CACpB,MAAM,OAAO,MAAM,KAAK,QAAQ,IAAI,QAAQ,CAAC;CAC7C,MAAM,QAAQ,KAAK,IAAI;CACvB,MAAM,KAAK,MAAM,CAAC;CAClB,OACE,IAAI,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,KAAA,GACjB,GAAG,GAAG,GAAG,OAAO,MAAM,GAAG,MAAM,IAAI,CAAC,EAAE,GAAG,EAAA,GACzC,MAAM,IAAI,IAAI,CAAC,EAAE,GAAG,EAAA,GACpB,GAAG,GAAG,GAAG,OAAO,MAAM,GAAG,GAAG,GAAG,KAAA,GAC/B,GAAG,GAAG,EAAE;AAEhB;;;;;;;;AASA,SAAgB,SACd,GACA,QACA,UACA,OACA,SAAS,GACD;CACR,MAAM,MAAM,KAAK,IAAI,GAAG,MAAM;CAC9B,MAAM,SAAS,KAAK,IAAI,QAAQ,QAAQ;CACxC,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,QAAQ,MAAM,GAAG,MAAM,CAAC;CACvD,MAAM,KAAK,MAAM,CAAC;CAClB,MAAM,KAAK,MAAM,IAAI,GAAG;CACxB,MAAM,IAAI,MAAM,QAAQ;CACxB,MAAM,IAAI,MAAM,KAAK;CAErB,MAAM,QAAQ,SAAS;CACvB,MAAM,OAAO,MAAM,QAAQ,QAAQ,IAAI,QAAQ,CAAC;CAChD,MAAM,QAAQ,QAAQ,IAAI;CAC1B,MAAM,KAAK,MAAM,CAAC;CAClB,OACE,IAAI,EAAE,GAAG,GAAG,GAAG,KAAK,GAAG,GAAA,GACnB,GAAG,GAAG,GAAG,OAAO,MAAM,GAAG,EAAE,GAAG,MAAM,IAAI,CAAC,EAAA,GACzC,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,EAAA,GACtB,GAAG,GAAG,GAAG,OAAO,MAAM,GAAG,KAAK,GAAG,GAAA,GACjC,EAAE,GAAG,GAAG;AAEhB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Curve } from "./path-
|
|
3
|
-
import { t as StackMode } from "./stack-
|
|
4
|
-
//#region src/charts/bar.d.ts
|
|
1
|
+
import { o as ChartType, ot as CartesianOptions } from "./chart-CYrrUCi3.js";
|
|
2
|
+
import { t as Curve } from "./path-YeUiOfG8.js";
|
|
3
|
+
import { t as StackMode } from "./stack-DR0eQTsB.js";
|
|
5
4
|
interface BarOptions extends CartesianOptions {
|
|
6
5
|
/** Corner radius of the data end of each bar (or stack). Defaults to `4`. */
|
|
7
6
|
radius?: number;
|
|
@@ -38,6 +37,4 @@ interface BarOptions extends CartesianOptions {
|
|
|
38
37
|
* ```
|
|
39
38
|
*/
|
|
40
39
|
declare const bar: ChartType<BarOptions>;
|
|
41
|
-
|
|
42
|
-
export { bar as n, BarOptions as t };
|
|
43
|
-
//# sourceMappingURL=bar-BBM8RhoL.d.ts.map
|
|
40
|
+
export { bar as n, BarOptions as t };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as Curve } from "./path-
|
|
3
|
-
import { t as StackMode } from "./stack-
|
|
4
|
-
//#region src/charts/bar.d.ts
|
|
1
|
+
import { o as ChartType, ut as CartesianOptions } from "./chart-CbPzP5Dp.cjs";
|
|
2
|
+
import { t as Curve } from "./path-YeUiOfG8.cjs";
|
|
3
|
+
import { t as StackMode } from "./stack-BTWYIwLO.cjs";
|
|
5
4
|
interface BarOptions extends CartesianOptions {
|
|
6
5
|
/** Corner radius of the data end of each bar (or stack). Defaults to `4`. */
|
|
7
6
|
radius?: number;
|
|
@@ -38,6 +37,4 @@ interface BarOptions extends CartesianOptions {
|
|
|
38
37
|
* ```
|
|
39
38
|
*/
|
|
40
39
|
declare const bar: ChartType<BarOptions>;
|
|
41
|
-
|
|
42
|
-
export { bar as n, BarOptions as t };
|
|
43
|
-
//# sourceMappingURL=bar-CRKLDg98.d.cts.map
|
|
40
|
+
export { bar as n, BarOptions as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_layout = require("./layout-
|
|
2
|
-
|
|
1
|
+
const require_layout = require("./layout-Cfg9x1k2.cjs");
|
|
2
|
+
// src/shapes/bar.ts
|
|
3
3
|
/** Rounded for path data, without a `-0`. */
|
|
4
4
|
const round = (value) => {
|
|
5
5
|
const rounded = require_layout.round(value);
|
|
@@ -50,7 +50,6 @@ function hbarPath(y, height, baseline, value, radius = 0) {
|
|
|
50
50
|
const rr = round(r);
|
|
51
51
|
return `M${b},${y0}L${edge},${y0}A${rr},${rr},0,0,${sweep},${v},${round(y + r)}L${v},${round(y + hgt - r)}A${rr},${rr},0,0,${sweep},${edge},${y1}L${b},${y1}Z`;
|
|
52
52
|
}
|
|
53
|
-
//#endregion
|
|
54
53
|
Object.defineProperty(exports, "barPath", {
|
|
55
54
|
enumerable: true,
|
|
56
55
|
get: function() {
|
|
@@ -64,4 +63,4 @@ Object.defineProperty(exports, "hbarPath", {
|
|
|
64
63
|
}
|
|
65
64
|
});
|
|
66
65
|
|
|
67
|
-
//# sourceMappingURL=bar-
|
|
66
|
+
//# sourceMappingURL=bar-wVykm1us.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar-
|
|
1
|
+
{"version":3,"file":"bar-wVykm1us.cjs","names":["to2"],"sources":["../src/shapes/bar.ts"],"sourcesContent":["import { round as to2 } from '../layout.ts'\n\n/** Rounded for path data, without a `-0`. */\nconst round = (value: number): number => {\n const rounded = to2(value)\n return rounded === 0 ? 0 : rounded\n}\n\n/**\n * Path of a vertical bar from `baseline` to `value` (both y in pixels),\n * `x`…`x + width` wide. Only the data end is rounded, with `radius` clamped\n * to half the width and to the bar height; the baseline end stays square.\n * Works for bars growing up (value above baseline) and down (negative values).\n * Square corners are zero-radius arcs and every side is an `L`, so every\n * bar path, vertical or horizontal, has the same commands and CSS can\n * transition `d` between rounded and square (stacking) and between\n * orientations.\n */\nexport function barPath(\n x: number,\n width: number,\n baseline: number,\n value: number,\n radius = 0,\n): string {\n const w = Math.max(0, width)\n const height = Math.abs(baseline - value)\n const r = Math.max(0, Math.min(radius, w / 2, height))\n const x0 = round(x)\n const x1 = round(x + w)\n const b = round(baseline)\n const v = round(value)\n\n const up = value <= baseline\n const edge = round(up ? value + r : value - r)\n const sweep = up ? 1 : 0\n const rr = round(r)\n return (\n `M${x0},${b}L${x0},${edge}` +\n `A${rr},${rr},0,0,${sweep},${round(x + r)},${v}` +\n `L${round(x + w - r)},${v}` +\n `A${rr},${rr},0,0,${sweep},${x1},${edge}` +\n `L${x1},${b}Z`\n )\n}\n\n/**\n * Path of a horizontal bar from `baseline` to `value` (both x in pixels),\n * `y`…`y + height` tall. Only the data end is rounded, with `radius` clamped\n * to half the height and to the bar length; the baseline end stays square.\n * Works for bars growing right (positive values) and left (negative values).\n * Same commands as `barPath`, so a chart can morph between orientations.\n */\nexport function hbarPath(\n y: number,\n height: number,\n baseline: number,\n value: number,\n radius = 0,\n): string {\n const hgt = Math.max(0, height)\n const length = Math.abs(value - baseline)\n const r = Math.max(0, Math.min(radius, hgt / 2, length))\n const y0 = round(y)\n const y1 = round(y + hgt)\n const b = round(baseline)\n const v = round(value)\n\n const right = value >= baseline\n const edge = round(right ? value - r : value + r)\n const sweep = right ? 1 : 0\n const rr = round(r)\n return (\n `M${b},${y0}L${edge},${y0}` +\n `A${rr},${rr},0,0,${sweep},${v},${round(y + r)}` +\n `L${v},${round(y + hgt - r)}` +\n `A${rr},${rr},0,0,${sweep},${edge},${y1}` +\n `L${b},${y1}Z`\n )\n}\n"],"mappings":";;;AAGA,MAAM,SAAS,UAA0B;CACvC,MAAM,UAAUA,eAAAA,MAAI,KAAK;CACzB,OAAO,YAAY,IAAI,IAAI;AAC7B;;;;;;;;;;;AAYA,SAAgB,QACd,GACA,OACA,UACA,OACA,SAAS,GACD;CACR,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK;CAC3B,MAAM,SAAS,KAAK,IAAI,WAAW,KAAK;CACxC,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,QAAQ,IAAI,GAAG,MAAM,CAAC;CACrD,MAAM,KAAK,MAAM,CAAC;CAClB,MAAM,KAAK,MAAM,IAAI,CAAC;CACtB,MAAM,IAAI,MAAM,QAAQ;CACxB,MAAM,IAAI,MAAM,KAAK;CAErB,MAAM,KAAK,SAAS;CACpB,MAAM,OAAO,MAAM,KAAK,QAAQ,IAAI,QAAQ,CAAC;CAC7C,MAAM,QAAQ,KAAK,IAAI;CACvB,MAAM,KAAK,MAAM,CAAC;CAClB,OACE,IAAI,GAAG,GAAG,EAAE,GAAG,GAAG,GAAG,KAAA,GACjB,GAAG,GAAG,GAAG,OAAO,MAAM,GAAG,MAAM,IAAI,CAAC,EAAE,GAAG,EAAA,GACzC,MAAM,IAAI,IAAI,CAAC,EAAE,GAAG,EAAA,GACpB,GAAG,GAAG,GAAG,OAAO,MAAM,GAAG,GAAG,GAAG,KAAA,GAC/B,GAAG,GAAG,EAAE;AAEhB;;;;;;;;AASA,SAAgB,SACd,GACA,QACA,UACA,OACA,SAAS,GACD;CACR,MAAM,MAAM,KAAK,IAAI,GAAG,MAAM;CAC9B,MAAM,SAAS,KAAK,IAAI,QAAQ,QAAQ;CACxC,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,QAAQ,MAAM,GAAG,MAAM,CAAC;CACvD,MAAM,KAAK,MAAM,CAAC;CAClB,MAAM,KAAK,MAAM,IAAI,GAAG;CACxB,MAAM,IAAI,MAAM,QAAQ;CACxB,MAAM,IAAI,MAAM,KAAK;CAErB,MAAM,QAAQ,SAAS;CACvB,MAAM,OAAO,MAAM,QAAQ,QAAQ,IAAI,QAAQ,CAAC;CAChD,MAAM,QAAQ,QAAQ,IAAI;CAC1B,MAAM,KAAK,MAAM,CAAC;CAClB,OACE,IAAI,EAAE,GAAG,GAAG,GAAG,KAAK,GAAG,GAAA,GACnB,GAAG,GAAG,GAAG,OAAO,MAAM,GAAG,EAAE,GAAG,MAAM,IAAI,CAAC,EAAA,GACzC,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,EAAA,GACtB,GAAG,GAAG,GAAG,OAAO,MAAM,GAAG,KAAK,GAAG,GAAA,GACjC,EAAE,GAAG,GAAG;AAEhB"}
|
package/dist/bar.cjs
CHANGED
package/dist/bar.d.cts
CHANGED
package/dist/bar.d.ts
CHANGED
package/dist/bar.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { bar };
|
|
1
|
+
export { t as bar } from "./bar-BOcRcArc.js";
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { o as ChartType } from "./chart-CbPzP5Dp.cjs";
|
|
2
|
+
import { c as NumberFormat, o as DateFormat } from "./time-B4oxWHQI.cjs";
|
|
3
|
+
import { a as InsetsInput } from "./annotations-CHafaGd4.cjs";
|
|
4
|
+
import { a as ClassValue } from "./vnode-Du2cC8Fm.cjs";
|
|
5
|
+
/** One day's value. Several entries on the same day add up. */
|
|
6
|
+
interface CalendarEntry {
|
|
7
|
+
/** The day: a `Date`, a timestamp, or anything `new Date()` reads (`'2026-10-26'`). */
|
|
8
|
+
date: Date | string | number;
|
|
9
|
+
/** `null` leaves the day empty (drawn faded, like a day without data). */
|
|
10
|
+
value: number | null;
|
|
11
|
+
}
|
|
12
|
+
/** A kind of activity (commits, reviews …), with its own legend entry. */
|
|
13
|
+
interface CalendarSeries {
|
|
14
|
+
name: string;
|
|
15
|
+
values: readonly CalendarEntry[];
|
|
16
|
+
/** Stable identity for keyed updates. Defaults to `name`. */
|
|
17
|
+
id?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Custom color of the legend and tooltip swatch. Values that could inject
|
|
20
|
+
* CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.
|
|
21
|
+
*/
|
|
22
|
+
color?: string;
|
|
23
|
+
/** Extra classes on the legend entry. */
|
|
24
|
+
class?: ClassValue;
|
|
25
|
+
/** Start hidden (toggle it back from the legend). */
|
|
26
|
+
hidden?: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface CalendarData {
|
|
29
|
+
series: readonly CalendarSeries[];
|
|
30
|
+
}
|
|
31
|
+
interface CalendarOptions {
|
|
32
|
+
/** Days and their values, as one list or as several series that add up (the legend filters them). */
|
|
33
|
+
data: CalendarData | readonly CalendarEntry[];
|
|
34
|
+
/** First day shown (at most ten years before `to`). Defaults to the first day in the data, or the start of the `weeks` window. */
|
|
35
|
+
from?: Date | string | number;
|
|
36
|
+
/** Last day shown. Defaults to the last day in the data. */
|
|
37
|
+
to?: Date | string | number;
|
|
38
|
+
/** Number of week columns ending with the week of `to`, when `from` is not set (e.g. `12`). */
|
|
39
|
+
weeks?: number;
|
|
40
|
+
/** First day of the week: `0` Sunday … `6` Saturday. Defaults to `1` (Monday). */
|
|
41
|
+
weekStart?: number;
|
|
42
|
+
/** Read the dates in UTC instead of local time. */
|
|
43
|
+
utc?: boolean;
|
|
44
|
+
/** Value shown as empty. Defaults to the smaller of `0` and the data minimum. */
|
|
45
|
+
min?: number;
|
|
46
|
+
/** Value shown with the full color. Defaults to the data maximum. */
|
|
47
|
+
max?: number;
|
|
48
|
+
/** Number of shades between empty and the full color (the steps of the scale). Defaults to `4`. */
|
|
49
|
+
levels?: number;
|
|
50
|
+
/**
|
|
51
|
+
* A scale through two or more colors (any CSS color, including
|
|
52
|
+
* `var(--tc-…)`) from `min` to `max` in `levels` steps, instead of one hue.
|
|
53
|
+
* `'diverging'` is two hues around a neutral middle, for values with a sign
|
|
54
|
+
* (changes, balances): the middle sits on `mid`, `0` by default, and the
|
|
55
|
+
* two ends are equally far from it unless `min` or `max` is set.
|
|
56
|
+
* Values that could inject CSS are ignored, as for series colors.
|
|
57
|
+
*/
|
|
58
|
+
colors?: "diverging" | readonly string[];
|
|
59
|
+
/** Value placed on the middle color of `colors`. Defaults to `0` for `'diverging'`, else halfway. */
|
|
60
|
+
mid?: number;
|
|
61
|
+
/** Space between cells in pixels, drawn as surface. Defaults to `2`. */
|
|
62
|
+
gap?: number;
|
|
63
|
+
/** Corner radius of the cells. Defaults to `2`. */
|
|
64
|
+
radius?: number;
|
|
65
|
+
/** Format of the values (tooltip, table). */
|
|
66
|
+
format?: NumberFormat;
|
|
67
|
+
/** Format of the day in the tooltip and the table. Defaults to e.g. "Oct 26, 2026". */
|
|
68
|
+
dateFormat?: DateFormat;
|
|
69
|
+
/** Month names above the columns where a month begins. */
|
|
70
|
+
x?: {
|
|
71
|
+
show?: boolean;
|
|
72
|
+
format?: (date: Date) => string;
|
|
73
|
+
};
|
|
74
|
+
/** Weekday names on the left. */
|
|
75
|
+
y?: {
|
|
76
|
+
show?: boolean;
|
|
77
|
+
format?: (date: Date) => string;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* The low-to-high scale below the grid: `false` hides it, an object names
|
|
81
|
+
* its ends (defaults `'Less'` and `'More'`; with `colors`, the values at the ends).
|
|
82
|
+
*/
|
|
83
|
+
scale?: boolean | {
|
|
84
|
+
low?: string;
|
|
85
|
+
high?: string;
|
|
86
|
+
};
|
|
87
|
+
/** Extra space around the grid, in pixels. */
|
|
88
|
+
padding?: InsetsInput;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Calendar: a contribution-style heatmap of days, one column per week and
|
|
92
|
+
* one row per weekday, shaded in `levels` steps of one hue by the day's
|
|
93
|
+
* value (`--tc-heat-color`), with month and weekday names and a low-to-high
|
|
94
|
+
* scale; `colors` shades through a scale of colors instead, `'diverging'`
|
|
95
|
+
* for values with a sign. Several series add up per day and the legend filters them.
|
|
96
|
+
*
|
|
97
|
+
* ```ts
|
|
98
|
+
* new Chart('#el', {
|
|
99
|
+
* type: calendar,
|
|
100
|
+
* data: [{ date: '2026-10-26', value: 3 }, { date: '2026-10-27', value: 0 }],
|
|
101
|
+
* weeks: 12,
|
|
102
|
+
* })
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
declare const calendar: ChartType<CalendarOptions>;
|
|
106
|
+
export { calendar as a, CalendarSeries as i, CalendarEntry as n, CalendarOptions as r, CalendarData as t };
|