@tabler/charts 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -16
- package/dist/{annotations-CpCWA29b.cjs → annotations--m-HzMBM.cjs} +86 -10
- package/dist/annotations--m-HzMBM.cjs.map +1 -0
- package/dist/{annotations-B02GR_KU.d.ts → annotations-CCDUC1lW.d.ts} +16 -30
- package/dist/{annotations-CHafaGd4.d.cts → annotations-CqZM1z9R.d.cts} +16 -30
- package/dist/{annotations-BQ8l-qHs.js → annotations-DGITy6th.js} +86 -10
- package/dist/annotations-DGITy6th.js.map +1 -0
- package/dist/annotations.cjs +1 -1
- package/dist/annotations.d.cts +1 -1
- package/dist/annotations.d.ts +1 -1
- package/dist/annotations.js +1 -1
- package/dist/{area-WdtfqvhX.js → area-BN0uE9R0.js} +4 -3
- package/dist/area-BN0uE9R0.js.map +1 -0
- package/dist/{area-h_FvieFb.d.cts → area-D6LNLk3r.d.cts} +2 -2
- package/dist/{area-DEFQm_SQ.d.ts → area-DEFL-Yun.d.ts} +2 -2
- package/dist/{area-DYdQ_sMV.cjs → area-D_N8b4Ng.cjs} +4 -3
- package/dist/area-D_N8b4Ng.cjs.map +1 -0
- package/dist/area.cjs +1 -1
- package/dist/area.d.cts +1 -1
- package/dist/area.d.ts +1 -1
- package/dist/area.js +1 -1
- package/dist/{axis-YfAerNBA.cjs → axis-BzBkkC5X.cjs} +12 -7
- package/dist/axis-BzBkkC5X.cjs.map +1 -0
- package/dist/{axis-MMaVoSWB.js → axis-C5obgdJt.js} +12 -7
- package/dist/axis-C5obgdJt.js.map +1 -0
- package/dist/{bar-CVkOJ7WA.cjs → bar-BrmfXugT.cjs} +5 -4
- package/dist/bar-BrmfXugT.cjs.map +1 -0
- package/dist/{bar-D9B_arKf.d.ts → bar-Bs_rPqgR.d.ts} +1 -1
- package/dist/{bar-DZCQ-kyf.d.cts → bar-CEt8YRxf.d.cts} +2 -2
- package/dist/{bar-BOcRcArc.js → bar-D_KKd2fL.js} +5 -4
- package/dist/bar-D_KKd2fL.js.map +1 -0
- package/dist/bar.cjs +1 -1
- package/dist/bar.d.cts +1 -1
- package/dist/bar.d.ts +1 -1
- package/dist/bar.js +1 -1
- package/dist/{calendar-BSvO8nRb.d.cts → calendar-B7843sQu.d.cts} +2 -2
- package/dist/{calendar-DAFXjV99.cjs → calendar-BG_q_NC_.cjs} +2 -2
- package/dist/{calendar-DAFXjV99.cjs.map → calendar-BG_q_NC_.cjs.map} +1 -1
- package/dist/{calendar-BXgIX5H1.js → calendar-CF3gfDQk.js} +2 -2
- package/dist/{calendar-BXgIX5H1.js.map → calendar-CF3gfDQk.js.map} +1 -1
- package/dist/{calendar-Bq3vFzPl.d.ts → calendar-D10_ki1S.d.ts} +2 -2
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.cts +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +1 -1
- package/dist/{candlestick-BtT9glp9.js → candlestick-B1onjo1o.js} +3 -2
- package/dist/candlestick-B1onjo1o.js.map +1 -0
- package/dist/{candlestick-BcomxeVG.d.cts → candlestick-B7YXUVVh.d.cts} +4 -3
- package/dist/{candlestick-CSmRuZ4v.cjs → candlestick-BwrFKak_.cjs} +3 -2
- package/dist/candlestick-BwrFKak_.cjs.map +1 -0
- package/dist/{candlestick-B3WcLzph.d.ts → candlestick-XpqJvarq.d.ts} +4 -3
- package/dist/candlestick.cjs +2 -2
- package/dist/candlestick.d.cts +1 -1
- package/dist/candlestick.d.ts +1 -1
- package/dist/candlestick.js +2 -2
- package/dist/{cartesian-DRSXHxWe.cjs → cartesian-B9CrasFJ.cjs} +49 -7
- package/dist/cartesian-B9CrasFJ.cjs.map +1 -0
- package/dist/{cartesian-BrPqb5Qn.js → cartesian-COglz544.js} +45 -9
- package/dist/cartesian-COglz544.js.map +1 -0
- package/dist/{chart-B6TTY4Kr.js → chart-B97FBRCd.js} +22 -12
- package/dist/chart-B97FBRCd.js.map +1 -0
- package/dist/{chart-CYrrUCi3.d.ts → chart-CE9EVbfV.d.ts} +240 -62
- package/dist/{chart-CbPzP5Dp.d.cts → chart-Dz4geQZy.d.cts} +240 -62
- package/dist/{chart-D_lyOy-M.cjs → chart-GUmmjJ7S.cjs} +27 -11
- package/dist/chart-GUmmjJ7S.cjs.map +1 -0
- package/dist/{core-CQ0FaJ4G.js → core-7fgM3su0.js} +84 -16
- package/dist/core-7fgM3su0.js.map +1 -0
- package/dist/{core-C3qEppSm.d.ts → core-BUQzLsRJ.d.ts} +21 -6
- package/dist/{core-D2PSked3.cjs → core-BZTrsPxc.cjs} +93 -13
- package/dist/core-BZTrsPxc.cjs.map +1 -0
- package/dist/{core-9BnLEW4K.d.cts → core-Ck5uHcW8.d.cts} +40 -23
- package/dist/core.cjs +20 -16
- package/dist/core.d.cts +23 -21
- package/dist/core.d.ts +23 -21
- package/dist/core.js +18 -17
- package/dist/{dates-DerXTb1J.cjs → dates-0YNY49KQ.cjs} +2 -2
- package/dist/{dates-DerXTb1J.cjs.map → dates-0YNY49KQ.cjs.map} +1 -1
- package/dist/{dates-DLe2Ww64.js → dates-CKDRgpin.js} +2 -2
- package/dist/{dates-DLe2Ww64.js.map → dates-CKDRgpin.js.map} +1 -1
- package/dist/end-labels-B3oRvjxw.js +114 -0
- package/dist/end-labels-B3oRvjxw.js.map +1 -0
- package/dist/end-labels-CS-fnpp-.cjs +119 -0
- package/dist/end-labels-CS-fnpp-.cjs.map +1 -0
- package/dist/end-labels.cjs +11 -0
- package/dist/end-labels.cjs.map +1 -0
- package/dist/end-labels.d.cts +6 -0
- package/dist/end-labels.d.ts +6 -0
- package/dist/end-labels.js +11 -0
- package/dist/end-labels.js.map +1 -0
- package/dist/{export-chart-DoeiAyR2.js → export-chart-BOH_nfcH.js} +76 -4
- package/dist/export-chart-BOH_nfcH.js.map +1 -0
- package/dist/{export-chart-CPtXmZvi.cjs → export-chart-Be4T9J3m.cjs} +81 -3
- package/dist/export-chart-Be4T9J3m.cjs.map +1 -0
- package/dist/export.cjs +4 -2
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +4 -3
- package/dist/export.d.ts +4 -3
- package/dist/export.js +4 -3
- package/dist/export.js.map +1 -1
- package/dist/features-B55rwpQC.js.map +1 -1
- package/dist/features-DEDP5CEQ.cjs.map +1 -1
- package/dist/{funnel-CarOh8w_.d.cts → funnel-B9ridzNx.d.cts} +2 -2
- package/dist/{funnel-BdcfUkb5.d.ts → funnel-FogM8flk.d.ts} +2 -2
- package/dist/funnel.d.cts +1 -1
- package/dist/funnel.d.ts +1 -1
- package/dist/{gauge-Ds9k1UV2.d.cts → gauge-BScJ7U6O.d.cts} +2 -2
- package/dist/{gauge-Zy25jfps.d.ts → gauge-D78oq1Lx.d.ts} +2 -2
- package/dist/gauge.d.cts +1 -1
- package/dist/gauge.d.ts +1 -1
- package/dist/heat-Bsqq4zw9.js +38 -0
- package/dist/heat-Bsqq4zw9.js.map +1 -0
- package/dist/heat-DYsivvDq.cjs +49 -0
- package/dist/heat-DYsivvDq.cjs.map +1 -0
- package/dist/{heatmap-Dcc_bsoQ.cjs → heatmap-Dyzrd4Fd.cjs} +3 -3
- package/dist/{heatmap-Dcc_bsoQ.cjs.map → heatmap-Dyzrd4Fd.cjs.map} +1 -1
- package/dist/{heatmap-C1v8bwpq.js → heatmap-J7fxG7MM.js} +3 -3
- package/dist/{heatmap-C1v8bwpq.js.map → heatmap-J7fxG7MM.js.map} +1 -1
- package/dist/{heatmap-CJ-0dfhJ.d.cts → heatmap-Jvwo7iFW.d.cts} +2 -2
- package/dist/{heatmap-Jp5sHRTo.d.ts → heatmap-mFCnP6aB.d.ts} +2 -2
- package/dist/heatmap.cjs +1 -1
- package/dist/heatmap.d.cts +1 -1
- package/dist/heatmap.d.ts +1 -1
- package/dist/heatmap.js +1 -1
- package/dist/index.cjs +37 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -21
- package/dist/index.d.ts +23 -21
- package/dist/index.js +34 -27
- package/dist/index.js.map +1 -1
- package/dist/interaction-DXYSjgnP.cjs.map +1 -1
- package/dist/interaction-En1KlwFO.js.map +1 -1
- package/dist/layout-CYerDebD.d.cts +29 -0
- package/dist/layout-CYerDebD.d.ts +29 -0
- package/dist/{line-CxR4tg1Q.js → line-CXH0L10d.js} +43 -8
- package/dist/line-CXH0L10d.js.map +1 -0
- package/dist/{line-vyWO030v.d.cts → line-Cu9ctpbv.d.cts} +9 -2
- package/dist/{line-YiCuhVMI.cjs → line-DHbYCQy4.cjs} +43 -8
- package/dist/line-DHbYCQy4.cjs.map +1 -0
- package/dist/{line-Bpr5uVLQ.d.ts → line-TkzA7wMK.d.ts} +8 -1
- package/dist/line.cjs +1 -1
- package/dist/line.d.cts +1 -1
- package/dist/line.d.ts +1 -1
- package/dist/line.js +1 -1
- package/dist/{map-49FcfdmJ.d.cts → map-BirylCmT.d.cts} +2 -2
- package/dist/{map-C15NC7kW.js → map-CYp6x-uS.js} +3 -26
- package/dist/map-CYp6x-uS.js.map +1 -0
- package/dist/{map-BqrZ80vT.cjs → map-ChwSgooH.cjs} +4 -27
- package/dist/map-ChwSgooH.cjs.map +1 -0
- package/dist/{map-BMC61J-P.d.ts → map-DNqog2Xs.d.ts} +2 -2
- package/dist/map.cjs +1 -1
- package/dist/map.d.cts +1 -1
- package/dist/map.d.ts +1 -1
- package/dist/map.js +1 -1
- package/dist/maps/world.d.cts +1 -1
- package/dist/maps/world.d.ts +1 -1
- package/dist/{others-ls5eKtZ4.d.cts → others-CuNdpvjd.d.cts} +1 -1
- package/dist/{parliament-Cz9n_DoK.d.ts → parliament-CHdf13XU.d.ts} +2 -2
- package/dist/{parliament-C7V8UJj1.d.cts → parliament-CsYgh4N2.d.cts} +2 -2
- package/dist/parliament.d.cts +1 -1
- package/dist/parliament.d.ts +1 -1
- package/dist/{patterns-Dw7OMD_2.cjs → patterns-BPN1c9qe.cjs} +2 -2
- package/dist/{patterns-Dw7OMD_2.cjs.map → patterns-BPN1c9qe.cjs.map} +1 -1
- package/dist/{patterns-BMUINoka.js → patterns-CVrLrJXg.js} +2 -2
- package/dist/{patterns-BMUINoka.js.map → patterns-CVrLrJXg.js.map} +1 -1
- package/dist/patterns.cjs +1 -1
- package/dist/patterns.d.cts +1 -1
- package/dist/patterns.d.ts +1 -1
- package/dist/patterns.js +1 -1
- package/dist/{percentage-bar-cSeiLdwU.d.ts → percentage-bar-CSAbzDOn.d.ts} +2 -2
- package/dist/{percentage-bar-R1--2grK.d.cts → percentage-bar-UZHCRvlK.d.cts} +3 -3
- package/dist/percentage-bar.d.cts +1 -1
- package/dist/percentage-bar.d.ts +1 -1
- package/dist/{pie-vD5-g8je.d.cts → pie-AFedsDcF.d.cts} +12 -3
- package/dist/{pie-Bd8wyrtY.js → pie-Ch6Bx0ih.js} +54 -39
- package/dist/pie-Ch6Bx0ih.js.map +1 -0
- package/dist/{pie-BseZlCgP.cjs → pie-Cll1OrVZ.cjs} +54 -39
- package/dist/pie-Cll1OrVZ.cjs.map +1 -0
- package/dist/{pie-BQQkvy1N.d.ts → pie-Cn2H3pz8.d.ts} +11 -2
- package/dist/pie.cjs +1 -1
- package/dist/pie.d.cts +1 -1
- package/dist/pie.d.ts +1 -1
- package/dist/pie.js +1 -1
- package/dist/point-shapes.d.cts +1 -1
- package/dist/point-shapes.d.ts +1 -1
- package/dist/{radar-D6XqkFWQ.js → radar-Bg-IiIWB.js} +3 -3
- package/dist/{radar-D6XqkFWQ.js.map → radar-Bg-IiIWB.js.map} +1 -1
- package/dist/{radar-vLxilcr4.d.ts → radar-DEer2jjd.d.ts} +2 -2
- package/dist/{radar-7I6hsY_h.d.cts → radar-DxmjXhMc.d.cts} +2 -2
- package/dist/{radar-DjISDnSf.cjs → radar-wDyX17S3.cjs} +3 -3
- package/dist/{radar-DjISDnSf.cjs.map → radar-wDyX17S3.cjs.map} +1 -1
- package/dist/radar.cjs +1 -1
- package/dist/radar.d.cts +1 -1
- package/dist/radar.d.ts +1 -1
- package/dist/radar.js +1 -1
- package/dist/range-bar-BnKjJP89.cjs +348 -0
- package/dist/range-bar-BnKjJP89.cjs.map +1 -0
- package/dist/range-bar-C4cRaaQE.d.ts +123 -0
- package/dist/range-bar-D32dIQOY.d.cts +123 -0
- package/dist/range-bar-Dx6ce0J1.js +343 -0
- package/dist/range-bar-Dx6ce0J1.js.map +1 -0
- package/dist/range-bar.cjs +3 -0
- package/dist/range-bar.d.cts +3 -0
- package/dist/range-bar.d.ts +3 -0
- package/dist/range-bar.js +1 -0
- package/dist/{sankey-DqiuxUx7.d.cts → sankey-D-8ATwBT.d.cts} +2 -2
- package/dist/{sankey-7As41Fo4.d.ts → sankey-DpYJsOI4.d.ts} +2 -2
- package/dist/sankey.d.cts +1 -1
- package/dist/sankey.d.ts +1 -1
- package/dist/{scatter-DCMAtt5L.js → scatter-0Z7K_YUz.js} +65 -19
- package/dist/scatter-0Z7K_YUz.js.map +1 -0
- package/dist/{scatter-BXkXGgM_.d.ts → scatter-BAL5K9_4.d.ts} +22 -9
- package/dist/{scatter-DL0zAV09.d.cts → scatter-BUGbnRzM.d.cts} +22 -9
- package/dist/{scatter-Bwkblr4L.cjs → scatter-CZ8do3Up.cjs} +65 -19
- package/dist/scatter-CZ8do3Up.cjs.map +1 -0
- package/dist/scatter.cjs +1 -1
- package/dist/scatter.d.cts +2 -2
- package/dist/scatter.d.ts +2 -2
- package/dist/scatter.js +1 -1
- package/dist/slice-labels-1TBq7p3q.d.cts +28 -0
- package/dist/slice-labels-C9ucsBVW.js +88 -0
- package/dist/slice-labels-C9ucsBVW.js.map +1 -0
- package/dist/slice-labels-CbFiy46l.cjs +93 -0
- package/dist/slice-labels-CbFiy46l.cjs.map +1 -0
- package/dist/slice-labels-Cm5CyV7B.d.ts +28 -0
- package/dist/slice-labels.cjs +11 -0
- package/dist/slice-labels.cjs.map +1 -0
- package/dist/slice-labels.d.cts +6 -0
- package/dist/slice-labels.d.ts +6 -0
- package/dist/slice-labels.js +11 -0
- package/dist/slice-labels.js.map +1 -0
- package/dist/{sparkline-BElUSd0r.d.ts → sparkline-CtoBJe-a.d.ts} +2 -2
- package/dist/{sparkline-BMSuEPHP.cjs → sparkline-DjR-V6BI.cjs} +2 -2
- package/dist/{sparkline-BMSuEPHP.cjs.map → sparkline-DjR-V6BI.cjs.map} +1 -1
- package/dist/{sparkline-RYly7bR0.d.cts → sparkline-DwHJfeZz.d.cts} +2 -2
- package/dist/{sparkline-NDmq90kP.js → sparkline-_dxwtdli.js} +2 -2
- package/dist/{sparkline-NDmq90kP.js.map → sparkline-_dxwtdli.js.map} +1 -1
- package/dist/sparkline.cjs +1 -1
- package/dist/sparkline.d.cts +1 -1
- package/dist/sparkline.d.ts +1 -1
- package/dist/sparkline.js +1 -1
- package/dist/{stack-BTWYIwLO.d.cts → stack-CcmyALx0.d.cts} +1 -1
- package/dist/{stack-jVKvg2x_.js → stack-CyVlS7Fr.js} +2 -2
- package/dist/{stack-jVKvg2x_.js.map → stack-CyVlS7Fr.js.map} +1 -1
- package/dist/{stack-BO4624CY.cjs → stack-DBhmYNat.cjs} +2 -2
- package/dist/{stack-BO4624CY.cjs.map → stack-DBhmYNat.cjs.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/{time-axis-B3VekUfX.cjs → time-axis-CVKjQKSS.cjs} +3 -3
- package/dist/{time-axis-B3VekUfX.cjs.map → time-axis-CVKjQKSS.cjs.map} +1 -1
- package/dist/{time-axis-CLjqOakA.js → time-axis-CkmbAw4Z.js} +3 -3
- package/dist/{time-axis-CLjqOakA.js.map → time-axis-CkmbAw4Z.js.map} +1 -1
- package/dist/time.cjs +2 -2
- package/dist/time.js +2 -2
- package/dist/{treemap-25vHO_UK.d.cts → treemap-C2maqerU.d.cts} +26 -4
- package/dist/{treemap-BCXUbixd.d.ts → treemap-D_zbubo3.d.ts} +26 -4
- package/dist/{treemap-CZk8kKFD.cjs → treemap-PulGXZv0.cjs} +38 -8
- package/dist/treemap-PulGXZv0.cjs.map +1 -0
- package/dist/{treemap-C4glsx-g.js → treemap-lbYxb-7h.js} +38 -8
- package/dist/treemap-lbYxb-7h.js.map +1 -0
- package/dist/treemap.cjs +1 -1
- package/dist/treemap.d.cts +1 -1
- package/dist/treemap.d.ts +1 -1
- package/dist/treemap.js +1 -1
- package/dist/{value-labels-C7GrhOXJ.js → value-labels-B0VeheyE.js} +5 -4
- package/dist/value-labels-B0VeheyE.js.map +1 -0
- package/dist/{value-labels-DzaKIWKp.cjs → value-labels-Dcyk3GIY.cjs} +5 -4
- package/dist/value-labels-Dcyk3GIY.cjs.map +1 -0
- package/dist/value-labels.cjs +1 -1
- package/dist/value-labels.d.cts +1 -1
- package/dist/value-labels.d.ts +1 -1
- package/dist/value-labels.js +1 -1
- package/dist/zoom.cjs +810 -0
- package/dist/zoom.cjs.map +1 -0
- package/dist/zoom.d.cts +34 -0
- package/dist/zoom.d.ts +34 -0
- package/dist/zoom.js +806 -0
- package/dist/zoom.js.map +1 -0
- package/package.json +27 -2
- package/dist/annotations-BQ8l-qHs.js.map +0 -1
- package/dist/annotations-CpCWA29b.cjs.map +0 -1
- package/dist/area-DYdQ_sMV.cjs.map +0 -1
- package/dist/area-WdtfqvhX.js.map +0 -1
- package/dist/axis-MMaVoSWB.js.map +0 -1
- package/dist/axis-YfAerNBA.cjs.map +0 -1
- package/dist/bar-BOcRcArc.js.map +0 -1
- package/dist/bar-CVkOJ7WA.cjs.map +0 -1
- package/dist/candlestick-BtT9glp9.js.map +0 -1
- package/dist/candlestick-CSmRuZ4v.cjs.map +0 -1
- package/dist/cartesian-BrPqb5Qn.js.map +0 -1
- package/dist/cartesian-DRSXHxWe.cjs.map +0 -1
- package/dist/chart-B6TTY4Kr.js.map +0 -1
- package/dist/chart-D_lyOy-M.cjs.map +0 -1
- package/dist/core-CQ0FaJ4G.js.map +0 -1
- package/dist/core-D2PSked3.cjs.map +0 -1
- package/dist/export-chart-CPtXmZvi.cjs.map +0 -1
- package/dist/export-chart-DoeiAyR2.js.map +0 -1
- package/dist/line-CxR4tg1Q.js.map +0 -1
- package/dist/line-YiCuhVMI.cjs.map +0 -1
- package/dist/map-BqrZ80vT.cjs.map +0 -1
- package/dist/map-C15NC7kW.js.map +0 -1
- package/dist/pie-Bd8wyrtY.js.map +0 -1
- package/dist/pie-BseZlCgP.cjs.map +0 -1
- package/dist/scatter-Bwkblr4L.cjs.map +0 -1
- package/dist/scatter-DCMAtt5L.js.map +0 -1
- package/dist/treemap-C4glsx-g.js.map +0 -1
- package/dist/treemap-CZk8kKFD.cjs.map +0 -1
- package/dist/value-labels-C7GrhOXJ.js.map +0 -1
- package/dist/value-labels-DzaKIWKp.cjs.map +0 -1
package/dist/sparkline.cjs
CHANGED
package/dist/sparkline.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Standalone entry: `import { sparkline } from '@tabler/charts/sparkline'`. */
|
|
2
|
-
import { n as sparkline, t as SparklineOptions } from "./sparkline-
|
|
2
|
+
import { n as sparkline, t as SparklineOptions } from "./sparkline-DwHJfeZz.cjs";
|
|
3
3
|
export { type SparklineOptions, sparkline };
|
package/dist/sparkline.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Standalone entry: `import { sparkline } from '@tabler/charts/sparkline'`. */
|
|
2
|
-
import { n as sparkline, t as SparklineOptions } from "./sparkline-
|
|
2
|
+
import { n as sparkline, t as SparklineOptions } from "./sparkline-CtoBJe-a.js";
|
|
3
3
|
export { type SparklineOptions, sparkline };
|
package/dist/sparkline.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as sparkline } from "./sparkline-
|
|
1
|
+
export { t as sparkline } from "./sparkline-_dxwtdli.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as seriesKey } from "./cartesian-
|
|
1
|
+
import { m as seriesKey } from "./cartesian-COglz544.js";
|
|
2
2
|
// src/charts/stack.ts
|
|
3
3
|
/**
|
|
4
4
|
* Stack series per category: positive values grow up from zero and
|
|
@@ -62,4 +62,4 @@ function stackBounds(stacks) {
|
|
|
62
62
|
}
|
|
63
63
|
export { stackSeries as n, stackBounds as t };
|
|
64
64
|
|
|
65
|
-
//# sourceMappingURL=stack-
|
|
65
|
+
//# sourceMappingURL=stack-CyVlS7Fr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-
|
|
1
|
+
{"version":3,"file":"stack-CyVlS7Fr.js","names":[],"sources":["../src/charts/stack.ts"],"sourcesContent":["import { type Series, seriesKey } from './cartesian.ts'\n\n/** Stack series on top of each other; `'percent'` normalizes every category to 100%. */\nexport type StackMode = boolean | 'percent'\n\n/** A stacked segment from `y0` to `y1` (in data units). */\nexport interface Segment {\n y0: number\n y1: number\n}\n\nexport interface StackOptions {\n /** Normalize each category by the sum of absolute values. */\n percent?: boolean\n /** Count missing values as zero (areas) instead of leaving no segment (bars). */\n nullAsZero?: boolean\n /** Keys of hidden series, which get no segment and do not stack. */\n hidden?: ReadonlySet<string>\n}\n\n/**\n * Stack series per category: positive values grow up from zero and\n * negative values down from zero, each on their own running total (like\n * d3's diverging offset), so gains and losses never interleave. Returns one\n * array per series with a segment per category, or `null` for no segment.\n */\nexport function stackSeries(\n series: readonly Series[],\n count: number,\n options: StackOptions = {},\n): (Segment | null)[][] {\n const { percent = false, nullAsZero = false, hidden } = options\n const visible = series.map((s) => !hidden?.has(seriesKey(s)))\n const out = series.map(() => new Array<Segment | null>(count).fill(null))\n\n for (let i = 0; i < count; i++) {\n let total = 0\n if (percent) {\n series.forEach((s, j) => {\n const v = s.values[i]\n if (visible[j] && v != null) total += Math.abs(v)\n })\n }\n let up = 0\n let down = 0\n let lastUp: Segment | undefined\n let lastDown: Segment | undefined\n for (let j = 0; j < series.length; j++) {\n const s = series[j] as Series\n if (!visible[j]) continue\n const raw = s.values[i]\n const valid = raw != null\n if (!valid && !nullAsZero) continue\n let v = valid ? (raw as number) : 0\n if (percent) v = total === 0 ? 0 : v / total\n const row = out[j] as (Segment | null)[]\n if (v < 0) {\n const segment: Segment = { y0: down, y1: down + v }\n row[i] = segment\n down += v\n lastDown = segment\n } else {\n const segment: Segment = { y0: up, y1: up + v }\n row[i] = segment\n up += v\n lastUp = segment\n }\n }\n // Shares must end exactly at ±100%: floating point drift (1.0000000000000002)\n // would otherwise make nice() stretch the axis to 120%, or leave a hairline gap.\n if (percent) {\n if (lastUp && Math.abs(up - 1) < 1e-9) lastUp.y1 = 1\n if (lastDown && Math.abs(down + 1) < 1e-9) lastDown.y1 = -1\n }\n }\n return out\n}\n\n/** Every segment boundary, for the value domain. */\nexport function stackBounds(stacks: readonly (Segment | null)[][]): number[] {\n const values: number[] = []\n for (const row of stacks) {\n for (const segment of row) if (segment) values.push(segment.y0, segment.y1)\n }\n return values\n}\n"],"mappings":";;;;;;;;AA0BA,SAAgB,YACd,QACA,OACA,UAAwB,CAAC,GACH;CACtB,MAAM,EAAE,UAAU,OAAO,aAAa,OAAO,WAAW;CACxD,MAAM,UAAU,OAAO,KAAK,MAAM,CAAC,QAAQ,IAAI,UAAU,CAAC,CAAC,CAAC;CAC5D,MAAM,MAAM,OAAO,UAAU,IAAI,MAAsB,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC;CAExE,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KAAK;EAC9B,IAAI,QAAQ;EACZ,IAAI,SACF,OAAO,SAAS,GAAG,MAAM;GACvB,MAAM,IAAI,EAAE,OAAO;GACnB,IAAI,QAAQ,MAAM,KAAK,MAAM,SAAS,KAAK,IAAI,CAAC;EAClD,CAAC;EAEH,IAAI,KAAK;EACT,IAAI,OAAO;EACX,IAAI;EACJ,IAAI;EACJ,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;GACtC,MAAM,IAAI,OAAO;GACjB,IAAI,CAAC,QAAQ,IAAI;GACjB,MAAM,MAAM,EAAE,OAAO;GACrB,MAAM,QAAQ,OAAO;GACrB,IAAI,CAAC,SAAS,CAAC,YAAY;GAC3B,IAAI,IAAI,QAAS,MAAiB;GAClC,IAAI,SAAS,IAAI,UAAU,IAAI,IAAI,IAAI;GACvC,MAAM,MAAM,IAAI;GAChB,IAAI,IAAI,GAAG;IACT,MAAM,UAAmB;KAAE,IAAI;KAAM,IAAI,OAAO;IAAE;IAClD,IAAI,KAAK;IACT,QAAQ;IACR,WAAW;GACb,OAAO;IACL,MAAM,UAAmB;KAAE,IAAI;KAAI,IAAI,KAAK;IAAE;IAC9C,IAAI,KAAK;IACT,MAAM;IACN,SAAS;GACX;EACF;EAGA,IAAI,SAAS;GACX,IAAI,UAAU,KAAK,IAAI,KAAK,CAAC,IAAI,MAAM,OAAO,KAAK;GACnD,IAAI,YAAY,KAAK,IAAI,OAAO,CAAC,IAAI,MAAM,SAAS,KAAK;EAC3D;CACF;CACA,OAAO;AACT;;AAGA,SAAgB,YAAY,QAAiD;CAC3E,MAAM,SAAmB,CAAC;CAC1B,KAAK,MAAM,OAAO,QAChB,KAAK,MAAM,WAAW,KAAK,IAAI,SAAS,OAAO,KAAK,QAAQ,IAAI,QAAQ,EAAE;CAE5E,OAAO;AACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_cartesian = require("./cartesian-
|
|
1
|
+
const require_cartesian = require("./cartesian-B9CrasFJ.cjs");
|
|
2
2
|
// src/charts/stack.ts
|
|
3
3
|
/**
|
|
4
4
|
* Stack series per category: positive values grow up from zero and
|
|
@@ -73,4 +73,4 @@ Object.defineProperty(exports, "stackSeries", {
|
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
//# sourceMappingURL=stack-
|
|
76
|
+
//# sourceMappingURL=stack-DBhmYNat.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-
|
|
1
|
+
{"version":3,"file":"stack-DBhmYNat.cjs","names":["seriesKey"],"sources":["../src/charts/stack.ts"],"sourcesContent":["import { type Series, seriesKey } from './cartesian.ts'\n\n/** Stack series on top of each other; `'percent'` normalizes every category to 100%. */\nexport type StackMode = boolean | 'percent'\n\n/** A stacked segment from `y0` to `y1` (in data units). */\nexport interface Segment {\n y0: number\n y1: number\n}\n\nexport interface StackOptions {\n /** Normalize each category by the sum of absolute values. */\n percent?: boolean\n /** Count missing values as zero (areas) instead of leaving no segment (bars). */\n nullAsZero?: boolean\n /** Keys of hidden series, which get no segment and do not stack. */\n hidden?: ReadonlySet<string>\n}\n\n/**\n * Stack series per category: positive values grow up from zero and\n * negative values down from zero, each on their own running total (like\n * d3's diverging offset), so gains and losses never interleave. Returns one\n * array per series with a segment per category, or `null` for no segment.\n */\nexport function stackSeries(\n series: readonly Series[],\n count: number,\n options: StackOptions = {},\n): (Segment | null)[][] {\n const { percent = false, nullAsZero = false, hidden } = options\n const visible = series.map((s) => !hidden?.has(seriesKey(s)))\n const out = series.map(() => new Array<Segment | null>(count).fill(null))\n\n for (let i = 0; i < count; i++) {\n let total = 0\n if (percent) {\n series.forEach((s, j) => {\n const v = s.values[i]\n if (visible[j] && v != null) total += Math.abs(v)\n })\n }\n let up = 0\n let down = 0\n let lastUp: Segment | undefined\n let lastDown: Segment | undefined\n for (let j = 0; j < series.length; j++) {\n const s = series[j] as Series\n if (!visible[j]) continue\n const raw = s.values[i]\n const valid = raw != null\n if (!valid && !nullAsZero) continue\n let v = valid ? (raw as number) : 0\n if (percent) v = total === 0 ? 0 : v / total\n const row = out[j] as (Segment | null)[]\n if (v < 0) {\n const segment: Segment = { y0: down, y1: down + v }\n row[i] = segment\n down += v\n lastDown = segment\n } else {\n const segment: Segment = { y0: up, y1: up + v }\n row[i] = segment\n up += v\n lastUp = segment\n }\n }\n // Shares must end exactly at ±100%: floating point drift (1.0000000000000002)\n // would otherwise make nice() stretch the axis to 120%, or leave a hairline gap.\n if (percent) {\n if (lastUp && Math.abs(up - 1) < 1e-9) lastUp.y1 = 1\n if (lastDown && Math.abs(down + 1) < 1e-9) lastDown.y1 = -1\n }\n }\n return out\n}\n\n/** Every segment boundary, for the value domain. */\nexport function stackBounds(stacks: readonly (Segment | null)[][]): number[] {\n const values: number[] = []\n for (const row of stacks) {\n for (const segment of row) if (segment) values.push(segment.y0, segment.y1)\n }\n return values\n}\n"],"mappings":";;;;;;;;AA0BA,SAAgB,YACd,QACA,OACA,UAAwB,CAAC,GACH;CACtB,MAAM,EAAE,UAAU,OAAO,aAAa,OAAO,WAAW;CACxD,MAAM,UAAU,OAAO,KAAK,MAAM,CAAC,QAAQ,IAAIA,kBAAAA,UAAU,CAAC,CAAC,CAAC;CAC5D,MAAM,MAAM,OAAO,UAAU,IAAI,MAAsB,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC;CAExE,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KAAK;EAC9B,IAAI,QAAQ;EACZ,IAAI,SACF,OAAO,SAAS,GAAG,MAAM;GACvB,MAAM,IAAI,EAAE,OAAO;GACnB,IAAI,QAAQ,MAAM,KAAK,MAAM,SAAS,KAAK,IAAI,CAAC;EAClD,CAAC;EAEH,IAAI,KAAK;EACT,IAAI,OAAO;EACX,IAAI;EACJ,IAAI;EACJ,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;GACtC,MAAM,IAAI,OAAO;GACjB,IAAI,CAAC,QAAQ,IAAI;GACjB,MAAM,MAAM,EAAE,OAAO;GACrB,MAAM,QAAQ,OAAO;GACrB,IAAI,CAAC,SAAS,CAAC,YAAY;GAC3B,IAAI,IAAI,QAAS,MAAiB;GAClC,IAAI,SAAS,IAAI,UAAU,IAAI,IAAI,IAAI;GACvC,MAAM,MAAM,IAAI;GAChB,IAAI,IAAI,GAAG;IACT,MAAM,UAAmB;KAAE,IAAI;KAAM,IAAI,OAAO;IAAE;IAClD,IAAI,KAAK;IACT,QAAQ;IACR,WAAW;GACb,OAAO;IACL,MAAM,UAAmB;KAAE,IAAI;KAAI,IAAI,KAAK;IAAE;IAC9C,IAAI,KAAK;IACT,MAAM;IACN,SAAS;GACX;EACF;EAGA,IAAI,SAAS;GACX,IAAI,UAAU,KAAK,IAAI,KAAK,CAAC,IAAI,MAAM,OAAO,KAAK;GACnD,IAAI,YAAY,KAAK,IAAI,OAAO,CAAC,IAAI,MAAM,SAAS,KAAK;EAC3D;CACF;CACA,OAAO;AACT;;AAGA,SAAgB,YAAY,QAAiD;CAC3E,MAAM,SAAmB,CAAC;CAC1B,KAAK,MAAM,OAAO,QAChB,KAAK,MAAM,WAAW,KAAK,IAAI,SAAS,OAAO,KAAK,QAAQ,IAAI,QAAQ,EAAE;CAE5E,OAAO;AACT"}
|
package/dist/style.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! @tabler/charts | MIT */
|
|
2
|
-
:where(:root),:where([data-theme=light]){--tc-color-1:var(--tblr-primary,#2a78d6);--tc-color-2:var(--tblr-orange,#eb6834);--tc-color-3:var(--tblr-teal,#1baf7a);--tc-color-4:var(--tblr-yellow,#eda100);--tc-color-5:var(--tblr-pink,#e87ba4);--tc-color-6:var(--tblr-green,#008300);--tc-color-7:var(--tblr-indigo,#4a3aa7);--tc-color-8:var(--tblr-red,#e34948);--tc-color-other:var(--tblr-secondary,#8a8983);--tc-surface:var(--tblr-bg-surface,#fff);--tc-text-color:var(--tblr-body-color,#0b0b0b);--tc-text-muted:var(--tblr-secondary,#6f6e69);--tc-grid-color:var(--tblr-border-color-translucent,#e1e0d9);--tc-baseline-color:var(--tblr-border-color,#c3c2b7);--tc-hover-color:rgba(var(--tblr-emphasis-color-rgb,11, 11, 11), .04);--tc-tooltip-bg:var(--tblr-dark,#0b0b0b);--tc-tooltip-color:#fff;--tc-tooltip-muted:#ffffffb3;--tc-tooltip-border:#ffffff1f;--tc-tooltip-shadow:var(--tblr-box-shadow,0 4px 16px #0b0b0b1f);--tc-tooltip-radius:var(--tblr-border-radius,6px);--tc-tooltip-light-bg:#fff;--tc-tooltip-light-color:#0b0b0b;--tc-tooltip-light-muted:#6f6e69;--tc-tooltip-light-border:#0b0b0b1a;--tc-focus-color:var(--tc-color-1);--tc-font-family:var(--tblr-body-font-family,inherit);--tc-font-size:12px;--tc-stroke-width:2px;--tc-grid-width:1px;--tc-area-opacity:.1;--tc-area-gradient-start:.24;--tc-area-gradient-end:0;--tc-pie-value-size:1.75em;--tc-bubble-opacity:.7;--tc-point-ring:2px;--tc-duration:.4s;--tc-duration-fast:.12s;--tc-easing:cubic-bezier(.4, 0, .2, 1)}@media (prefers-color-scheme:dark){:where(:root:not([data-theme=light])){--tc-color-1:var(--tblr-primary,#3987e5);--tc-color-2:var(--tblr-orange,#d95926);--tc-color-3:var(--tblr-teal,#199e70);--tc-color-4:var(--tblr-yellow,#c98500);--tc-color-5:var(--tblr-pink,#d55181);--tc-color-6:var(--tblr-green,#008300);--tc-color-7:var(--tblr-indigo,#9085e9);--tc-color-8:var(--tblr-red,#e66767);--tc-color-other:var(--tblr-secondary,#7c7b76);--tc-surface:var(--tblr-bg-surface,#1a1a19);--tc-text-color:var(--tblr-body-color,#fff);--tc-text-muted:var(--tblr-secondary,#a3a29c);--tc-grid-color:var(--tblr-border-color-translucent,#2c2c2a);--tc-baseline-color:var(--tblr-border-color,#4a4a46);--tc-hover-color:rgba(var(--tblr-emphasis-color-rgb,255, 255, 255), .06);--tc-tooltip-bg:var(--tblr-dark,#262625);--tc-tooltip-shadow:var(--tblr-box-shadow,0 4px 16px #0006);--tc-focus-color:var(--tc-color-1)}}:where([data-theme=dark]){--tc-color-1:var(--tblr-primary,#3987e5);--tc-color-2:var(--tblr-orange,#d95926);--tc-color-3:var(--tblr-teal,#199e70);--tc-color-4:var(--tblr-yellow,#c98500);--tc-color-5:var(--tblr-pink,#d55181);--tc-color-6:var(--tblr-green,#008300);--tc-color-7:var(--tblr-indigo,#9085e9);--tc-color-8:var(--tblr-red,#e66767);--tc-color-other:var(--tblr-secondary,#7c7b76);--tc-surface:var(--tblr-bg-surface,#1a1a19);--tc-text-color:var(--tblr-body-color,#fff);--tc-text-muted:var(--tblr-secondary,#a3a29c);--tc-grid-color:var(--tblr-border-color-translucent,#2c2c2a);--tc-baseline-color:var(--tblr-border-color,#4a4a46);--tc-hover-color:rgba(var(--tblr-emphasis-color-rgb,255, 255, 255), .06);--tc-tooltip-bg:var(--tblr-dark,#262625);--tc-tooltip-shadow:var(--tblr-box-shadow,0 4px 16px #0006);--tc-focus-color:var(--tc-color-1)}.tc-chart{max-width:100%;height:auto;font-family:var(--tc-font-family);font-size:var(--tc-font-size);letter-spacing:normal;word-spacing:normal;text-transform:none;color:var(--tc-text-color);-webkit-tap-highlight-color:transparent;direction:ltr;display:block;overflow:visible}.tc-chart :where(text){font:inherit}.tc-series{--tc-series-color:var(--tc-color-other);--tc-series-pattern:var(--tc-pattern-other);--tc-pattern-dash:1 3;--tc-pattern-ink:var(--tc-pattern-color,var(--tc-surface));--tc-swatch-pattern:repeating-linear-gradient(45deg, var(--tc-pattern-ink) 0 1px, #0000 0 3px)}.tc-series-1{--tc-series-color:var(--tc-color-1);--tc-series-pattern:var(--tc-pattern-1);--tc-pattern-dash:none;--tc-swatch-pattern:repeating-linear-gradient(45deg, var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-2{--tc-series-color:var(--tc-color-2);--tc-series-pattern:var(--tc-pattern-2);--tc-pattern-dash:6 3;--tc-swatch-pattern:radial-gradient(var(--tc-pattern-ink) .8px, #0000 1.2px) 0 0 / 4px 4px}.tc-series-3{--tc-series-color:var(--tc-color-3);--tc-series-pattern:var(--tc-pattern-3);--tc-pattern-dash:2 3;--tc-swatch-pattern:repeating-linear-gradient(-45deg, var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-4{--tc-series-color:var(--tc-color-4);--tc-series-pattern:var(--tc-pattern-4);--tc-pattern-dash:10 3 2 3;--tc-swatch-pattern:repeating-linear-gradient(var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-5{--tc-series-color:var(--tc-color-5);--tc-series-pattern:var(--tc-pattern-5);--tc-pattern-dash:4 4;--tc-swatch-pattern:repeating-linear-gradient(45deg, var(--tc-pattern-ink) 0 1px, #0000 0 4px), repeating-linear-gradient(-45deg, var(--tc-pattern-ink) 0 1px, #0000 0 4px)}.tc-series-6{--tc-series-color:var(--tc-color-6);--tc-series-pattern:var(--tc-pattern-6);--tc-pattern-dash:12 4;--tc-swatch-pattern:repeating-linear-gradient(90deg, var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-7{--tc-series-color:var(--tc-color-7);--tc-series-pattern:var(--tc-pattern-7);--tc-pattern-dash:2 2 6 2;--tc-swatch-pattern:repeating-linear-gradient(var(--tc-pattern-ink) 0 1px, #0000 0 4px), repeating-linear-gradient(90deg, var(--tc-pattern-ink) 0 1px, #0000 0 4px)}.tc-series-8{--tc-series-color:var(--tc-color-8);--tc-series-pattern:var(--tc-pattern-8);--tc-pattern-dash:8 2 2 2;--tc-swatch-pattern:linear-gradient(90deg, #0000 50%, var(--tc-series-color) 0) 0 0 / 4px 4px, repeating-linear-gradient(var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-tick-label{fill:var(--tc-text-muted);font-variant-numeric:tabular-nums}.tc-axis-title{fill:var(--tc-text-muted)}.tc-grid-line,.tc-grid-line-zero,.tc-axis-line,.tc-tick-line,.tc-crosshair,.tc-sparkline-zero,.tc-radar-ring,.tc-radar-spoke{stroke:var(--tc-baseline-color);stroke-width:var(--tc-grid-width);shape-rendering:crispedges;vector-effect:non-scaling-stroke}.tc-grid-line,.tc-sparkline-zero,.tc-radar-ring,.tc-radar-spoke{stroke:var(--tc-grid-color)}.tc-grid-line-zero{stroke:var(--tc-baseline-color)}.tc-line{fill:none;stroke:var(--tc-series-color);stroke-width:var(--tc-series-width,var(--tc-stroke-width));stroke-dasharray:var(--tc-series-dash,none);stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke}.tc-area{fill:var(--tc-series-color);fill-opacity:var(--tc-area-opacity);stroke:none}.tc-pie-slices{--tc-pie-gap:0px}.tc-slice{fill:var(--tc-series-color);stroke:var(--tc-surface);stroke-width:var(--tc-pie-gap);stroke-linejoin:round}.tc-pie-track,.tc-gauge-track{fill:var(--tc-grid-color)}.tc-gauge-arc{fill:var(--tc-series-color)}.tc-pie-value,.tc-gauge-value,.tc-parliament-value{font-size:var(--tc-pie-value-size);fill:var(--tc-text-color);font-variant-numeric:tabular-nums;font-weight:600}.tc-pie-label,.tc-gauge-label,.tc-parliament-label{fill:var(--tc-text-muted)}.tc-seat{fill:var(--tc-series-color);transition:transform var(--tc-duration) var(--tc-easing), r var(--tc-duration) var(--tc-easing)}.tc-seat-vacant{fill:var(--tc-grid-color)}.tc-chart-parliament .tc-hover-mark{opacity:.25}.tc-segment{fill:var(--tc-series-color);transition:var(--tc-duration) var(--tc-easing);transition-property:x,width}.tc-percentage-bar-track{fill:var(--tc-grid-color)}.tc-tile{fill:var(--tc-series-color);fill-opacity:var(--tc-treemap-opacity,1);transition:var(--tc-duration) var(--tc-easing);transition-property:x,y,width,height}.tc-treemap-value{font-weight:400}.tc-funnel-stage{fill:var(--tc-funnel-color,var(--tc-color-1));transition:d var(--tc-duration) var(--tc-easing)}@supports (color:color-mix(in oklab, red 50%, blue)){.tc-funnel-stage{fill:color-mix(in oklab, var(--tc-funnel-color,var(--tc-color-1)) var(--tc-funnel-shade,100%), var(--tc-surface))}}.tc-funnel-name,.tc-funnel-share{fill:var(--tc-text-muted)}.tc-funnel-value{fill:var(--tc-text-color);font-weight:600}.tc-funnel-value,.tc-funnel-share{font-variant-numeric:tabular-nums}.tc-sankey-node{fill:var(--tc-series-color)}.tc-sankey-link{fill:var(--tc-series-color);fill-opacity:var(--tc-area-opacity);stroke:none}.tc-chart-sankey{--tc-area-opacity:.35}.tc-sankey-value{font-size:.92em}.tc-chart-sankey .tc-hover-mark{opacity:.5}.tc-radar-ring,.tc-radar-spoke,.tc-chart-radar .tc-crosshair{fill:none;shape-rendering:auto}.tc-area-gradient{fill-opacity:1}.tc-fade-start{stop-color:#fff;stop-opacity:var(--tc-area-gradient-start)}.tc-fade-end{stop-color:#fff;stop-opacity:var(--tc-area-gradient-end)}.tc-chart-sparkline{--tc-stroke-width:1.5px;--tc-area-gradient-start:.3}.tc-bubble{fill-opacity:var(--tc-bubble-opacity)}.tc-point{fill:var(--tc-series-color);stroke:var(--tc-surface);stroke-width:var(--tc-point-ring);paint-order:stroke;transition:cx var(--tc-duration) var(--tc-easing), cy var(--tc-duration) var(--tc-easing)}.tc-point-min,.tc-point-max{fill:var(--tc-text-muted)}.tc-annotation{--tc-annotation-color:var(--tc-text-muted)}.tc-annotation-line{stroke:var(--tc-annotation-color);stroke-width:1px;stroke-dasharray:4 3;shape-rendering:crispedges;vector-effect:non-scaling-stroke}.tc-annotation-band{fill:var(--tc-annotation-color);fill-opacity:.1}.tc-annotation-label{fill:var(--tc-annotation-color);font-weight:500}.tc-annotation-label,.tc-radar-value{paint-order:stroke;stroke:var(--tc-surface);stroke-width:3px;stroke-linejoin:round;font-size:.92em}.tc-annotations{pointer-events:none}.tc-value-label,.tc-treemap-label{fill:var(--tc-text-color);font-variant-numeric:tabular-nums;paint-order:stroke;stroke:var(--tc-surface);stroke-width:3px;stroke-linejoin:round;transition:transform var(--tc-duration) var(--tc-easing);animation:tc-fade-in var(--tc-duration) var(--tc-easing);font-weight:500}.tc-marker{transition:d var(--tc-duration) var(--tc-easing)}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){background:var(--tc-series-color);border-radius:var(--tc-shape-radius,50%);width:10px;height:10px;clip-path:var(--tc-shape,none)}.tc-pattern-bg{fill:var(--tc-series-color)}.tc-pattern-ink{fill:none;stroke:var(--tc-pattern-ink);stroke-width:1.5px;stroke-linecap:round}.tc-patterned :is(.tc-bar,.tc-area,.tc-slice,.tc-gauge-arc,.tc-bubble){fill:var(--tc-series-pattern,var(--tc-series-color))}.tc-patterned .tc-area{fill-opacity:max(var(--tc-area-opacity), .4)}.tc-patterned .tc-line{stroke-dasharray:var(--tc-series-dash,var(--tc-pattern-dash))}:has(>.tc-patterned)>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){background:var(--tc-swatch-pattern), var(--tc-series-color)}@keyframes tc-reveal{0%{clip-path:inset(0 var(--tc-reveal,100% 0 0))}to{clip-path:inset(0)}}@keyframes tc-grow{0%{transform:scaleY(0)}}@keyframes tc-grow-x{0%{transform:scaleX(0)}}@keyframes tc-fade-in{0%{opacity:0}}.tc-line,.tc-area,.tc-bar,.tc-radar-ring,.tc-dots{transition:d var(--tc-duration) var(--tc-easing)}.tc-slice,.tc-gauge-arc,.tc-gauge-track{transition:none var(--tc-duration)}.tc-rtl{--tc-reveal:0 0 100%}.tc-chart-line .tc-series-list,.tc-chart-area .tc-series-list{animation:tc-reveal calc(var(--tc-duration) * 2) var(--tc-easing)}.tc-series-list .tc-series,.tc-areas .tc-series,.tc-sankey-links .tc-sankey-link,.tc-sankey-nodes .tc-series,.tc-parliament-seats .tc-series,.tc-parliament-seats .tc-seat,.tc-series-list .tc-point,.tc-heatmap-cells,.tc-calendar-cells,.tc-map-regions,.tc-treemap-tiles,.tc-percentage-bar,.tc-funnel-stages,.tc-candles,.tc-tick,.tc-grid-line{animation:tc-fade-in var(--tc-duration) var(--tc-easing)}.tc-bar{fill:var(--tc-series-color);transform-box:fill-box;transform-origin:50% 100%;animation:tc-grow var(--tc-duration) var(--tc-easing)}.tc-bar-negative{transform-origin:50% 0}.tc-cell{fill:var(--tc-cell-fill,var(--tc-heat-color,var(--tc-color-1)));transition:fill var(--tc-duration) var(--tc-easing)}@supports (color:color-mix(in oklab, red 50%, blue)){.tc-cell{fill:var(--tc-cell-fill,color-mix(in oklab, var(--tc-heat-color,var(--tc-color-1)) var(--tc-heat,100%), var(--tc-heat-empty,var(--tc-grid-color))))}}.tc-heatmap-row.tc-series{--tc-heat-color:var(--tc-series-color)}.tc-cell-empty{fill:var(--tc-heat-empty,var(--tc-grid-color));opacity:.5}.tc-region{stroke:var(--tc-surface);stroke-width:.5px;vector-effect:non-scaling-stroke}.tc-region-empty{fill:var(--tc-heat-empty,var(--tc-grid-color))}.tc-region-point,.tc-map-marker{stroke-width:2px}.tc-map-marker{fill:var(--tc-map-marker-color,var(--tc-color-1));stroke:var(--tc-surface)}.tc-region-selected{stroke:var(--tc-text-color);stroke-width:1.5px}.tc-map-selectable .tc-region{cursor:pointer}.tc-chart-map[data-zoom]{touch-action:none;cursor:grab;user-select:none}.tc-chart-map[data-zoom=drag]{cursor:grabbing}.tc-map-zoom{z-index:10;background:var(--tc-surface);border:1px solid var(--tc-grid-color);border-radius:6px;position:absolute;top:0;right:0}.tc-download~.tc-map-zoom{top:28px}.tc-map-zoom svg{fill:none;stroke:currentColor;stroke-width:2px;stroke-linecap:round}.tc-map-zoom :disabled{opacity:.4;pointer-events:none}.tc-map-line{fill:none;stroke:var(--tc-map-line-color,var(--tc-color-1));stroke-width:1.5px;stroke-dasharray:4;animation:tc-map-line calc(var(--tc-duration) * 3) linear infinite}@keyframes tc-map-line{to{stroke-dashoffset:-8px}}.tc-candle{--tc-candle-color:var(--tc-up-color,var(--tc-color-6))}.tc-candle-down{--tc-candle-color:var(--tc-negative-color,var(--tc-color-8))}.tc-candle-body{fill:var(--tc-candle-color);transition:d var(--tc-duration) var(--tc-easing), fill var(--tc-duration) var(--tc-easing)}.tc-candle-wick{fill:none;stroke:var(--tc-candle-color);stroke-width:1px;vector-effect:non-scaling-stroke;transition:d var(--tc-duration) var(--tc-easing), stroke var(--tc-duration) var(--tc-easing)}.tc-tristate-loss{fill:var(--tc-negative-color,var(--tc-color-8))}.tc-tristate-draw{fill:var(--tc-baseline-color)}.tc-bar-horizontal{transform-origin:0;animation-name:tc-grow-x}.tc-bar-horizontal.tc-bar-negative,.tc-rtl .tc-bar-horizontal{transform-origin:100%}.tc-rtl .tc-bar-horizontal.tc-bar-negative{transform-origin:0}.tc-tick,.tc-grid-line{transition:transform var(--tc-duration) var(--tc-easing)}@keyframes tc-pie-in{0%{opacity:0;transform:scale(.85)}}.tc-pie-slices,.tc-gauge-rings,.tc-parliament-seats,.tc-radar-series{animation:tc-pie-in calc(var(--tc-duration) * 1.5) var(--tc-easing)}.tc-hover .tc-point{transition:none;animation:none}.tc-static,.tc-chart[data-resizing]{--tc-duration:0s}:where(.tc-container){position:relative}.tc-hover{pointer-events:none}.tc-hover-band{fill:var(--tc-hover-color)}.tc-hover-mark{fill:var(--tc-series-color);opacity:.35}.tc-chart-heatmap .tc-hover-mark,.tc-chart-calendar .tc-hover-mark,.tc-chart-map .tc-hover-mark,.tc-chart-treemap .tc-hover-mark,.tc-chart-percentage-bar .tc-hover-mark{fill:none;stroke:var(--tc-text-color);stroke-width:2px;opacity:.6}.tc-tooltip{z-index:10;pointer-events:none;opacity:0;min-width:120px;max-width:min(280px,100%);font-family:var(--tc-font-family);font-size:var(--tc-font-size);overflow-wrap:anywhere;color:var(--tc-tooltip-color);background:var(--tc-tooltip-bg);border:1px solid var(--tc-tooltip-border);border-radius:var(--tc-tooltip-radius);box-shadow:var(--tc-tooltip-shadow);transition:opacity var(--tc-duration-fast) var(--tc-easing);padding:8px 10px;line-height:1.4;position:absolute;top:0;left:0}.tc-tooltip-light{--tc-tooltip-bg:var(--tc-tooltip-light-bg);--tc-tooltip-color:var(--tc-tooltip-light-color);--tc-tooltip-muted:var(--tc-tooltip-light-muted);--tc-tooltip-border:var(--tc-tooltip-light-border)}.tc-tooltip .tc-series{--tc-pattern-ink:var(--tc-pattern-color,var(--tc-tooltip-bg))}.tc-tooltip[data-visible]{opacity:1;transition:opacity var(--tc-duration-fast) var(--tc-easing), transform var(--tc-duration-fast) var(--tc-easing)}.tc-tooltip-title{margin-bottom:4px;font-weight:600}.tc-tooltip-item{align-items:center;gap:8px;display:flex}.tc-tooltip-swatch,.tc-legend-swatch{background:var(--tc-series-color);border-radius:50%;flex:none;width:8px;height:8px}.tc-tooltip-name{color:var(--tc-tooltip-muted);flex:1}.tc-tooltip-value{white-space:nowrap;font-variant-numeric:tabular-nums;font-weight:500}.tc-tooltip-footer{border-top:1px solid var(--tc-tooltip-border);margin-top:4px;padding-top:4px}.tc-tooltip-item-active .tc-tooltip-name{color:var(--tc-tooltip-color)}.tc-legend{font-family:var(--tc-font-family);font-size:var(--tc-font-size);margin-bottom:8px;line-height:1.4}.tc-legend[data-position=bottom]{margin:8px 0 0}:where(.tc-legend-beside){grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:16px;display:grid}:where(.tc-legend-beside.tc-legend-start){grid-template-columns:auto minmax(0,1fr)}:where(.tc-legend-beside)>:not(.tc-legend,svg.tc-chart){grid-column:1/-1}.tc-legend:is([data-position=left],[data-position=right]){justify-self:start;max-width:16em;margin:0}.tc-legend:is([data-position=left],[data-position=right]) .tc-legend-items{flex-flow:column}.tc-legend-items{flex-wrap:wrap;gap:4px 12px;display:flex}.tc-legend-item{appearance:none;font:inherit;text-align:start;color:var(--tc-text-color);cursor:pointer;transition:color var(--tc-duration-fast) var(--tc-easing);background:0 0;border:0;border-radius:4px;align-items:center;gap:6px;margin:0;padding:2px 4px;display:inline-flex}.tc-legend-item:hover{background:var(--tc-hover-color)}.tc-legend-item:focus-visible{outline:2px solid var(--tc-focus-color);outline-offset:1px}.tc-legend-item-hidden{color:var(--tc-text-muted)}.tc-legend-item-hidden .tc-legend-swatch{box-shadow:inset 0 0 0 1.5px var(--tc-series-color);background:0 0}.tc-download{z-index:11;font-family:var(--tc-font-family);font-size:var(--tc-font-size);line-height:1.4;position:absolute;top:0;right:0}.tc-download-toggle,.tc-download-item{appearance:none;font:inherit;color:var(--tc-text-muted);cursor:pointer;background:0 0;border:0;border-radius:4px;align-items:center;margin:0;display:flex}.tc-download-toggle{justify-content:center;width:24px;height:24px;padding:0}.tc-download-toggle:hover,.tc-download-toggle[aria-expanded=true],.tc-download-item:hover{color:var(--tc-text-color);background:var(--tc-hover-color)}.tc-download-toggle:focus-visible,.tc-download-item:focus-visible{outline:2px solid var(--tc-focus-color);outline-offset:1px}.tc-download-menu{min-width:80px;color:var(--tc-text-color);background:var(--tc-surface);border:1px solid var(--tc-grid-color);border-radius:var(--tc-tooltip-radius);box-shadow:var(--tc-tooltip-shadow);margin-top:2px;padding:4px;position:absolute;top:100%;right:0}.tc-download[dir=rtl],[dir=rtl]>*>.tc-download-menu{left:0;right:auto}.tc-download-item{text-align:start;white-space:nowrap;width:100%;padding:4px 8px}.tc-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.tc-chart:focus{outline:none}.tc-chart:focus-visible{outline:2px solid var(--tc-focus-color);outline-offset:2px;border-radius:2px}.tc-table-wrap:not(.tc-sr-only){margin-top:12px;overflow-x:auto}.tc-table{border-collapse:collapse;width:100%;font-family:var(--tc-font-family);font-size:var(--tc-font-size);font-variant-numeric:tabular-nums;color:var(--tc-text-color)}.tc-table caption{text-align:start;margin-bottom:4px;font-weight:600}.tc-table th,.tc-table td{text-align:end;border-bottom:1px solid var(--tc-grid-color);padding:4px 8px}.tc-table th[scope=row],.tc-table thead th:first-child{text-align:start}.tc-table thead th{color:var(--tc-text-muted);border-bottom-color:var(--tc-baseline-color);font-weight:600}@media (prefers-reduced-motion:reduce){.tc-chart,.tc-tooltip{--tc-duration:0s;--tc-duration-fast:0s}}@media (forced-colors:active){.tc-value-label,.tc-treemap-label{fill:canvastext;stroke:canvas}.tc-tick-label,.tc-axis-title,.tc-funnel-labels{fill:canvastext}.tc-grid-line,.tc-radar-ring,.tc-radar-spoke{stroke:graytext}.tc-grid-line-zero,.tc-axis-line,.tc-tick-line,.tc-line{stroke:canvastext}.tc-area{fill:graytext}.tc-bar,.tc-funnel-stage,.tc-point{fill:canvastext;stroke:canvas}.tc-crosshair{stroke:highlight}.tc-tooltip{border-color:canvastext}.tc-legend-swatch{background:canvastext}.tc-legend-item-hidden .tc-legend-swatch{background:0 0;box-shadow:inset 0 0 0 1.5px canvastext}.tc-pattern-bg{fill:canvas}.tc-pattern-ink{stroke:canvastext}:is(.tc-patterned,.tc-patterns-auto) :is(.tc-bar,.tc-area,.tc-slice,.tc-gauge-arc,.tc-bubble){fill:var(--tc-series-pattern,CanvasText);fill-opacity:1;stroke:canvastext;stroke-width:1px}.tc-patterns-auto .tc-line{stroke-dasharray:var(--tc-series-dash,var(--tc-pattern-dash))}:has(>:is(.tc-patterned,.tc-patterns-auto))>:is(.tc-legend,.tc-tooltip) .tc-series{--tc-pattern-color:CanvasText;--tc-series-color:Canvas}:has(>:is(.tc-patterned,.tc-patterns-auto))>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){forced-color-adjust:none;background:var(--tc-swatch-pattern), Canvas;box-shadow:inset 0 0 0 1px canvastext}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){box-shadow:none;background:canvastext}}
|
|
2
|
+
:where(:root),:where([data-theme=light]){--tc-color-1:var(--tblr-chart-1,var(--tblr-primary,#2a78d6));--tc-color-2:var(--tblr-chart-2,var(--tblr-orange,#eb6834));--tc-color-3:var(--tblr-chart-3,var(--tblr-teal,#1baf7a));--tc-color-4:var(--tblr-chart-4,var(--tblr-yellow,#eda100));--tc-color-5:var(--tblr-chart-5,var(--tblr-pink,#e87ba4));--tc-color-6:var(--tblr-cyan,#008300);--tc-color-7:var(--tblr-indigo,#4a3aa7);--tc-color-8:var(--tblr-red,#e34948);--tc-color-other:var(--tblr-secondary,#8a8983);--tc-surface:var(--tblr-bg-surface,#fff);--tc-text-color:var(--tblr-body-color,#0b0b0b);--tc-text-muted:var(--tblr-secondary,#6f6e69);--tc-grid-color:var(--tblr-border-color-translucent,#e1e0d9);--tc-baseline-color:var(--tblr-border-color,#c3c2b7);--tc-hover-color:rgba(var(--tblr-emphasis-color-rgb,11, 11, 11), .04);--tc-tooltip-bg:var(--tblr-dark,#0b0b0b);--tc-tooltip-color:#fff;--tc-tooltip-muted:#ffffffb3;--tc-tooltip-border:#ffffff1f;--tc-tooltip-shadow:var(--tblr-box-shadow,0 4px 16px #0b0b0b1f);--tc-tooltip-radius:var(--tblr-border-radius,6px);--tc-tooltip-light-bg:#fff;--tc-tooltip-light-color:#0b0b0b;--tc-tooltip-light-muted:#6f6e69;--tc-tooltip-light-border:#0b0b0b1a;--tc-focus-color:var(--tc-color-1);--tc-font-family:var(--tblr-body-font-family,inherit);--tc-font-size:12px;--tc-stroke-width:2px;--tc-grid-width:1px;--tc-area-opacity:.1;--tc-area-gradient-start:.24;--tc-area-gradient-end:0;--tc-pie-value-size:1.75em;--tc-bubble-opacity:.7;--tc-point-ring:2px;--tc-duration:.4s;--tc-duration-fast:.12s;--tc-easing:cubic-bezier(.4, 0, .2, 1)}@media (prefers-color-scheme:dark){:where(:root:not([data-theme=light])){--tc-color-1:var(--tblr-chart-1,var(--tblr-primary,#3987e5));--tc-color-2:var(--tblr-chart-2,var(--tblr-orange,#d95926));--tc-color-3:var(--tblr-chart-3,var(--tblr-teal,#199e70));--tc-color-4:var(--tblr-chart-4,var(--tblr-yellow,#c98500));--tc-color-5:var(--tblr-chart-5,var(--tblr-pink,#d55181));--tc-color-6:var(--tblr-cyan,#008300);--tc-color-7:var(--tblr-indigo,#9085e9);--tc-color-8:var(--tblr-red,#e66767);--tc-color-other:var(--tblr-secondary,#7c7b76);--tc-surface:var(--tblr-bg-surface,#1a1a19);--tc-text-color:var(--tblr-body-color,#fff);--tc-text-muted:var(--tblr-secondary,#a3a29c);--tc-grid-color:var(--tblr-border-color-translucent,#2c2c2a);--tc-baseline-color:var(--tblr-border-color,#4a4a46);--tc-hover-color:rgba(var(--tblr-emphasis-color-rgb,255, 255, 255), .06);--tc-tooltip-bg:var(--tblr-dark,#262625);--tc-tooltip-shadow:var(--tblr-box-shadow,0 4px 16px #0006);--tc-focus-color:var(--tc-color-1)}}:where([data-theme=dark]){--tc-color-1:var(--tblr-chart-1,var(--tblr-primary,#3987e5));--tc-color-2:var(--tblr-chart-2,var(--tblr-orange,#d95926));--tc-color-3:var(--tblr-chart-3,var(--tblr-teal,#199e70));--tc-color-4:var(--tblr-chart-4,var(--tblr-yellow,#c98500));--tc-color-5:var(--tblr-chart-5,var(--tblr-pink,#d55181));--tc-color-6:var(--tblr-cyan,#008300);--tc-color-7:var(--tblr-indigo,#9085e9);--tc-color-8:var(--tblr-red,#e66767);--tc-color-other:var(--tblr-secondary,#7c7b76);--tc-surface:var(--tblr-bg-surface,#1a1a19);--tc-text-color:var(--tblr-body-color,#fff);--tc-text-muted:var(--tblr-secondary,#a3a29c);--tc-grid-color:var(--tblr-border-color-translucent,#2c2c2a);--tc-baseline-color:var(--tblr-border-color,#4a4a46);--tc-hover-color:rgba(var(--tblr-emphasis-color-rgb,255, 255, 255), .06);--tc-tooltip-bg:var(--tblr-dark,#262625);--tc-tooltip-shadow:var(--tblr-box-shadow,0 4px 16px #0006);--tc-focus-color:var(--tc-color-1)}.tc-chart{max-width:100%;height:auto;font-family:var(--tc-font-family);font-size:var(--tc-font-size);letter-spacing:normal;word-spacing:normal;text-transform:none;color:var(--tc-text-color);-webkit-tap-highlight-color:transparent;direction:ltr;display:block;overflow:visible}.tc-chart :where(text){font:inherit}.tc-series{--tc-series-color:var(--tc-color-other);--tc-series-pattern:var(--tc-pattern-other);--tc-pattern-dash:1 3;--tc-pattern-ink:var(--tc-pattern-color,var(--tc-surface));--tc-swatch-pattern:repeating-linear-gradient(45deg, var(--tc-pattern-ink) 0 1px, #0000 0 3px)}.tc-series-1{--tc-series-color:var(--tc-color-1);--tc-series-pattern:var(--tc-pattern-1);--tc-pattern-dash:none;--tc-swatch-pattern:repeating-linear-gradient(45deg, var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-2{--tc-series-color:var(--tc-color-2);--tc-series-pattern:var(--tc-pattern-2);--tc-pattern-dash:6 3;--tc-swatch-pattern:radial-gradient(var(--tc-pattern-ink) .8px, #0000 1.2px) 0 0 / 4px 4px}.tc-series-3{--tc-series-color:var(--tc-color-3);--tc-series-pattern:var(--tc-pattern-3);--tc-pattern-dash:2 3;--tc-swatch-pattern:repeating-linear-gradient(-45deg, var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-4{--tc-series-color:var(--tc-color-4);--tc-series-pattern:var(--tc-pattern-4);--tc-pattern-dash:10 3 2 3;--tc-swatch-pattern:repeating-linear-gradient(var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-5{--tc-series-color:var(--tc-color-5);--tc-series-pattern:var(--tc-pattern-5);--tc-pattern-dash:4 4;--tc-swatch-pattern:repeating-linear-gradient(45deg, var(--tc-pattern-ink) 0 1px, #0000 0 4px), repeating-linear-gradient(-45deg, var(--tc-pattern-ink) 0 1px, #0000 0 4px)}.tc-series-6{--tc-series-color:var(--tc-color-6);--tc-series-pattern:var(--tc-pattern-6);--tc-pattern-dash:12 4;--tc-swatch-pattern:repeating-linear-gradient(90deg, var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-series-7{--tc-series-color:var(--tc-color-7);--tc-series-pattern:var(--tc-pattern-7);--tc-pattern-dash:2 2 6 2;--tc-swatch-pattern:repeating-linear-gradient(var(--tc-pattern-ink) 0 1px, #0000 0 4px), repeating-linear-gradient(90deg, var(--tc-pattern-ink) 0 1px, #0000 0 4px)}.tc-series-8{--tc-series-color:var(--tc-color-8);--tc-series-pattern:var(--tc-pattern-8);--tc-pattern-dash:8 2 2 2;--tc-swatch-pattern:linear-gradient(90deg, #0000 50%, var(--tc-series-color) 0) 0 0 / 4px 4px, repeating-linear-gradient(var(--tc-pattern-ink) 0 1.5px, #0000 0 4px)}.tc-tick-label{fill:var(--tc-text-muted);font-variant-numeric:tabular-nums}.tc-axis-title{fill:var(--tc-text-muted)}.tc-grid-line,.tc-grid-line-zero,.tc-axis-line,.tc-tick-line,.tc-crosshair,.tc-sparkline-zero,.tc-radar-ring,.tc-radar-spoke{stroke:var(--tc-baseline-color);stroke-width:var(--tc-grid-width);shape-rendering:crispedges;vector-effect:non-scaling-stroke}.tc-grid-line,.tc-sparkline-zero,.tc-radar-ring,.tc-radar-spoke{stroke:var(--tc-grid-color)}.tc-grid-line-zero{stroke:var(--tc-baseline-color)}.tc-line{fill:none;stroke:var(--tc-series-color);stroke-width:var(--tc-series-width,var(--tc-stroke-width));stroke-dasharray:var(--tc-series-dash,none);stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke}.tc-area{fill:var(--tc-series-color);fill-opacity:var(--tc-area-opacity);stroke:none}.tc-pie-slices{--tc-pie-gap:0px}.tc-slice{fill:var(--tc-series-color);stroke:var(--tc-surface);stroke-width:var(--tc-pie-gap);stroke-linejoin:round}.tc-pie-track,.tc-gauge-track{fill:var(--tc-grid-color)}.tc-gauge-arc{fill:var(--tc-series-color)}.tc-pie-value,.tc-gauge-value,.tc-parliament-value{font-size:var(--tc-pie-value-size);fill:var(--tc-text-color);font-variant-numeric:tabular-nums;font-weight:600}.tc-pie-label,.tc-gauge-label,.tc-parliament-label{fill:var(--tc-text-muted)}.tc-seat{fill:var(--tc-series-color);transition:transform var(--tc-duration) var(--tc-easing), r var(--tc-duration) var(--tc-easing)}.tc-seat-vacant{fill:var(--tc-grid-color)}.tc-chart-parliament .tc-hover-mark{opacity:.25}.tc-segment{fill:var(--tc-series-color);transition:var(--tc-duration) var(--tc-easing);transition-property:x,width}.tc-percentage-bar-track{fill:var(--tc-grid-color)}.tc-tile{fill:var(--tc-series-color);fill-opacity:var(--tc-treemap-opacity,1);transition:var(--tc-duration) var(--tc-easing);transition-property:x,y,width,height}.tc-tile-shaded{fill:var(--tc-cell-fill,var(--tc-heat-color,var(--tc-color-1)));transition-property:x,y,width,height,fill}@supports (color:color-mix(in oklab, red 50%, blue)){.tc-tile-shaded{fill:var(--tc-cell-fill,color-mix(in oklab, var(--tc-heat-color,var(--tc-color-1)) var(--tc-heat,100%), var(--tc-heat-empty,var(--tc-grid-color))))}}.tc-treemap-value{font-weight:400}.tc-funnel-stage{fill:var(--tc-funnel-color,var(--tc-color-1));transition:d var(--tc-duration) var(--tc-easing)}@supports (color:color-mix(in oklab, red 50%, blue)){.tc-funnel-stage{fill:color-mix(in oklab, var(--tc-funnel-color,var(--tc-color-1)) var(--tc-funnel-shade,100%), var(--tc-surface))}}.tc-funnel-name,.tc-funnel-share{fill:var(--tc-text-muted)}.tc-funnel-value{fill:var(--tc-text-color);font-weight:600}.tc-funnel-value,.tc-funnel-share{font-variant-numeric:tabular-nums}.tc-sankey-node{fill:var(--tc-series-color)}.tc-sankey-link{fill:var(--tc-series-color);fill-opacity:var(--tc-area-opacity);stroke:none}.tc-chart-sankey{--tc-area-opacity:.35}.tc-sankey-value{font-size:.92em}.tc-chart-sankey .tc-hover-mark{opacity:.5}.tc-radar-ring,.tc-radar-spoke,.tc-chart-radar .tc-crosshair{fill:none;shape-rendering:auto}.tc-area-gradient{fill-opacity:1}.tc-fade-start{stop-color:#fff;stop-opacity:var(--tc-area-gradient-start)}.tc-fade-end{stop-color:#fff;stop-opacity:var(--tc-area-gradient-end)}.tc-chart-sparkline{--tc-stroke-width:1.5px;--tc-area-gradient-start:.3}.tc-bubble{fill-opacity:var(--tc-bubble-opacity)}.tc-point{fill:var(--tc-series-color);stroke:var(--tc-surface);stroke-width:var(--tc-point-ring);paint-order:stroke;transition:cx var(--tc-duration) var(--tc-easing), cy var(--tc-duration) var(--tc-easing)}.tc-point-min,.tc-point-max{fill:var(--tc-text-muted)}.tc-annotation{--tc-annotation-color:var(--tc-text-muted)}.tc-annotation-line{stroke:var(--tc-annotation-color);stroke-width:1px;stroke-dasharray:var(--tc-annotation-dash,4 3);shape-rendering:crispedges;vector-effect:non-scaling-stroke}.tc-annotation-dot{fill:var(--tc-annotation-color);stroke:var(--tc-surface);stroke-width:1.5px}.tc-annotation-band{fill:var(--tc-annotation-color);fill-opacity:.1}.tc-annotation-label{fill:var(--tc-annotation-color);font-weight:500}.tc-annotation-label,.tc-radar-value{paint-order:stroke;stroke:var(--tc-surface);stroke-width:3px;stroke-linejoin:round;font-size:.92em}.tc-annotation-label-bg{fill:var(--tc-surface)}.tc-annotations{pointer-events:none}.tc-value-label,.tc-treemap-label{fill:var(--tc-text-color);font-variant-numeric:tabular-nums;paint-order:stroke;stroke:var(--tc-surface);stroke-width:3px;stroke-linejoin:round;transition:transform var(--tc-duration) var(--tc-easing);animation:tc-fade-in var(--tc-duration) var(--tc-easing);font-weight:500}.tc-end-label-text{fill:var(--tc-text-color);transition:transform var(--tc-duration) var(--tc-easing)}.tc-end-label-value{font-variant-numeric:tabular-nums;font-weight:600}.tc-end-label-line{fill:none;stroke:var(--tc-series-color);stroke-width:1px;transition:d var(--tc-duration) var(--tc-easing)}.tc-slice-label-text{fill:var(--tc-text-color);transition:transform var(--tc-duration) var(--tc-easing)}.tc-slice-label-name{font-weight:600}.tc-slice-label-line{fill:none;stroke:var(--tc-baseline-color);stroke-width:1px;transition:d var(--tc-duration) var(--tc-easing)}.tc-marker{transition:d var(--tc-duration) var(--tc-easing)}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){background:var(--tc-series-color);border-radius:var(--tc-shape-radius,50%);width:10px;height:10px;clip-path:var(--tc-shape,none)}.tc-pattern-bg{fill:var(--tc-series-color)}.tc-pattern-ink{fill:none;stroke:var(--tc-pattern-ink);stroke-width:1.5px;stroke-linecap:round}.tc-patterned :is(.tc-bar,.tc-area,.tc-slice,.tc-gauge-arc,.tc-bubble){fill:var(--tc-series-pattern,var(--tc-series-color))}.tc-patterned .tc-area{fill-opacity:max(var(--tc-area-opacity), .4)}.tc-patterned .tc-line{stroke-dasharray:var(--tc-series-dash,var(--tc-pattern-dash))}:has(>.tc-patterned)>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){background:var(--tc-swatch-pattern), var(--tc-series-color)}@keyframes tc-reveal{0%{clip-path:inset(0 var(--tc-reveal,100% 0 0))}to{clip-path:inset(0)}}@keyframes tc-grow{0%{transform:scaleY(0)}}@keyframes tc-grow-x{0%{transform:scaleX(0)}}@keyframes tc-fade-in{0%{opacity:0}}.tc-line,.tc-area,.tc-bar,.tc-radar-ring,.tc-dots{transition:d var(--tc-duration) var(--tc-easing)}.tc-slice,.tc-gauge-arc,.tc-gauge-track{transition:none var(--tc-duration)}.tc-rtl{--tc-reveal:0 0 100%}.tc-chart-line .tc-series-list,.tc-chart-area .tc-series-list{animation:tc-reveal calc(var(--tc-duration) * 2) var(--tc-easing)}.tc-series-list .tc-series,.tc-areas .tc-series,.tc-sankey-links .tc-sankey-link,.tc-sankey-nodes .tc-series,.tc-parliament-seats .tc-series,.tc-parliament-seats .tc-seat,.tc-series-list .tc-point,.tc-heatmap-cells,.tc-calendar-cells,.tc-map-regions,.tc-treemap-tiles,.tc-percentage-bar,.tc-funnel-stages,.tc-candles,.tc-tick,.tc-grid-line{animation:tc-fade-in var(--tc-duration) var(--tc-easing)}.tc-bar{fill:var(--tc-series-color);transform-box:fill-box;transform-origin:50% 100%;animation:tc-grow var(--tc-duration) var(--tc-easing)}.tc-bar-negative{transform-origin:50% 0}.tc-cell{fill:var(--tc-cell-fill,var(--tc-heat-color,var(--tc-color-1)));transition:fill var(--tc-duration) var(--tc-easing)}@supports (color:color-mix(in oklab, red 50%, blue)){.tc-cell{fill:var(--tc-cell-fill,color-mix(in oklab, var(--tc-heat-color,var(--tc-color-1)) var(--tc-heat,100%), var(--tc-heat-empty,var(--tc-grid-color))))}}.tc-heatmap-row.tc-series{--tc-heat-color:var(--tc-series-color)}.tc-cell-empty{fill:var(--tc-heat-empty,var(--tc-grid-color));opacity:.5}.tc-region{stroke:var(--tc-surface);stroke-width:.5px;vector-effect:non-scaling-stroke}.tc-region-empty{fill:var(--tc-heat-empty,var(--tc-grid-color))}.tc-region-point,.tc-map-marker{stroke-width:2px}.tc-map-marker{fill:var(--tc-map-marker-color,var(--tc-color-1));stroke:var(--tc-surface)}.tc-region-selected{stroke:var(--tc-text-color);stroke-width:1.5px}.tc-map-selectable .tc-region{cursor:pointer}.tc-chart-map[data-zoom]{touch-action:none;cursor:grab;user-select:none}.tc-chart-map[data-zoom=drag]{cursor:grabbing}.tc-map-zoom,.tc-zoom{z-index:10;background:var(--tc-surface);border:1px solid var(--tc-grid-color);border-radius:6px;position:absolute;top:0;right:0}.tc-download~.tc-map-zoom{top:28px}.tc-map-zoom svg,.tc-zoom svg{fill:none;stroke:currentColor;stroke-width:2px;stroke-linecap:round}.tc-map-zoom :disabled,.tc-zoom :disabled{opacity:.4;pointer-events:none}.tc-chart[data-zoom-axis]{user-select:none}.tc-chart[data-zoom-axis=x]{touch-action:pan-y}.tc-chart[data-zoom-axis=y]{touch-action:pan-x}.tc-zoom-selection,.tc-brush-selection{fill:var(--tc-focus-color);fill-opacity:.12;stroke:var(--tc-focus-color);stroke-opacity:.4}.tc-zoom-selection{pointer-events:none}.tc-brush-selection{cursor:grab}.tc-brush-handle{fill:var(--tc-focus-color);rx:2px;cursor:ew-resize}[data-zoom-axis=y] .tc-brush-handle{cursor:ns-resize}.tc-zoom{display:flex}.tc-download~.tc-zoom{right:28px}.tc-zoom[dir=rtl]{left:0;right:auto}.tc-download~.tc-zoom[dir=rtl]{left:28px}.tc-map-line{fill:none;stroke:var(--tc-map-line-color,var(--tc-color-1));stroke-width:1.5px;stroke-dasharray:4;animation:tc-map-line calc(var(--tc-duration) * 3) linear infinite}@keyframes tc-map-line{to{stroke-dashoffset:-8px}}.tc-candle{--tc-candle-color:var(--tc-up-color,var(--tc-color-6))}.tc-candle-down{--tc-candle-color:var(--tc-negative-color,var(--tc-color-8))}.tc-candle-body{fill:var(--tc-candle-color);transition:d var(--tc-duration) var(--tc-easing), fill var(--tc-duration) var(--tc-easing)}.tc-candle-wick{fill:none;stroke:var(--tc-candle-color);stroke-width:1px;vector-effect:non-scaling-stroke;transition:d var(--tc-duration) var(--tc-easing), stroke var(--tc-duration) var(--tc-easing)}.tc-tristate-loss{fill:var(--tc-negative-color,var(--tc-color-8))}.tc-tristate-draw{fill:var(--tc-baseline-color)}.tc-bar-horizontal{transform-origin:0;animation-name:tc-grow-x}.tc-bar-horizontal.tc-bar-negative,.tc-rtl .tc-bar-horizontal{transform-origin:100%}.tc-rtl .tc-bar-horizontal.tc-bar-negative{transform-origin:0}.tc-tick,.tc-grid-line{transition:transform var(--tc-duration) var(--tc-easing)}@keyframes tc-pie-in{0%{opacity:0;transform:scale(.85)}}.tc-pie-slices,.tc-gauge-rings,.tc-parliament-seats,.tc-radar-series{animation:tc-pie-in calc(var(--tc-duration) * 1.5) var(--tc-easing)}.tc-hover .tc-point{transition:none;animation:none}.tc-static,.tc-chart[data-resizing]{--tc-duration:0s}:where(.tc-container){position:relative}.tc-hover{pointer-events:none}.tc-hover-band{fill:var(--tc-hover-color)}.tc-crosshair-tag{fill:var(--tc-tooltip-bg)}.tc-crosshair-label{fill:var(--tc-tooltip-color);font-variant-numeric:tabular-nums}.tc-hover-mark{fill:var(--tc-series-color);opacity:.35}.tc-chart-heatmap .tc-hover-mark,.tc-chart-calendar .tc-hover-mark,.tc-chart-map .tc-hover-mark,.tc-chart-treemap .tc-hover-mark,.tc-chart-percentage-bar .tc-hover-mark{fill:none;stroke:var(--tc-text-color);stroke-width:2px;opacity:.6}.tc-tooltip{z-index:10;pointer-events:none;opacity:0;min-width:120px;max-width:min(280px,100%);font-family:var(--tc-font-family);font-size:var(--tc-font-size);overflow-wrap:anywhere;color:var(--tc-tooltip-color);background:var(--tc-tooltip-bg);border:1px solid var(--tc-tooltip-border);border-radius:var(--tc-tooltip-radius);box-shadow:var(--tc-tooltip-shadow);transition:opacity var(--tc-duration-fast) var(--tc-easing);padding:8px 10px;line-height:1.4;position:absolute;top:0;left:0}.tc-tooltip-light{--tc-tooltip-bg:var(--tc-tooltip-light-bg);--tc-tooltip-color:var(--tc-tooltip-light-color);--tc-tooltip-muted:var(--tc-tooltip-light-muted);--tc-tooltip-border:var(--tc-tooltip-light-border)}.tc-tooltip .tc-series{--tc-pattern-ink:var(--tc-pattern-color,var(--tc-tooltip-bg))}.tc-tooltip[data-visible]{opacity:1;transition:opacity var(--tc-duration-fast) var(--tc-easing), transform var(--tc-duration-fast) var(--tc-easing)}.tc-tooltip-title{margin-bottom:4px;font-weight:600}.tc-tooltip-item{align-items:center;gap:8px;display:flex}.tc-tooltip-swatch,.tc-legend-swatch{background:var(--tc-series-color);border-radius:50%;flex:none;width:8px;height:8px}.tc-tooltip-name{color:var(--tc-tooltip-muted);flex:1}.tc-tooltip-value{white-space:nowrap;font-variant-numeric:tabular-nums;font-weight:500}.tc-tooltip-footer{border-top:1px solid var(--tc-tooltip-border);margin-top:4px;padding-top:4px}.tc-tooltip-item-active .tc-tooltip-name{color:var(--tc-tooltip-color)}.tc-legend{font-family:var(--tc-font-family);font-size:var(--tc-font-size);margin-bottom:8px;line-height:1.4}.tc-legend[data-position=bottom]{margin:8px 0 0}:where(.tc-legend-beside){grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:16px;display:grid}:where(.tc-legend-beside.tc-legend-start){grid-template-columns:auto minmax(0,1fr)}:where(.tc-legend-beside)>:not(.tc-legend,svg.tc-chart){grid-column:1/-1}.tc-legend:is([data-position=left],[data-position=right]){justify-self:start;max-width:16em;margin:0}.tc-legend:is([data-position=left],[data-position=right]) .tc-legend-items{flex-flow:column}.tc-legend-items{flex-wrap:wrap;gap:4px 12px;display:flex}.tc-legend-item{appearance:none;font:inherit;text-align:start;color:var(--tc-text-color);cursor:pointer;transition:color var(--tc-duration-fast) var(--tc-easing);background:0 0;border:0;border-radius:4px;align-items:center;gap:6px;margin:0;padding:2px 4px;display:inline-flex}.tc-legend-item:hover{background:var(--tc-hover-color)}.tc-legend-item:focus-visible{outline:2px solid var(--tc-focus-color);outline-offset:1px}.tc-legend-item-hidden{color:var(--tc-text-muted)}.tc-legend-item-hidden .tc-legend-swatch{box-shadow:inset 0 0 0 1.5px var(--tc-series-color);background:0 0}.tc-download{z-index:11;font-family:var(--tc-font-family);font-size:var(--tc-font-size);line-height:1.4;position:absolute;top:0;right:0}.tc-download-toggle,.tc-download-item{appearance:none;font:inherit;color:var(--tc-text-muted);cursor:pointer;background:0 0;border:0;border-radius:4px;align-items:center;margin:0;display:flex}.tc-download-toggle{justify-content:center;width:24px;height:24px;padding:0}.tc-download-toggle:hover,.tc-download-toggle[aria-expanded=true],.tc-download-item:hover{color:var(--tc-text-color);background:var(--tc-hover-color)}.tc-download-toggle:focus-visible,.tc-download-item:focus-visible{outline:2px solid var(--tc-focus-color);outline-offset:1px}.tc-download-menu{min-width:80px;color:var(--tc-text-color);background:var(--tc-surface);border:1px solid var(--tc-grid-color);border-radius:var(--tc-tooltip-radius);box-shadow:var(--tc-tooltip-shadow);margin-top:2px;padding:4px;position:absolute;top:100%;right:0}.tc-download[dir=rtl],[dir=rtl]>*>.tc-download-menu{left:0;right:auto}.tc-download-item{text-align:start;white-space:nowrap;width:100%;padding:4px 8px}.tc-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.tc-chart:focus{outline:none}.tc-chart:focus-visible{outline:2px solid var(--tc-focus-color);outline-offset:2px;border-radius:2px}.tc-table-wrap:not(.tc-sr-only){margin-top:12px;overflow-x:auto}.tc-table{border-collapse:collapse;width:100%;font-family:var(--tc-font-family);font-size:var(--tc-font-size);font-variant-numeric:tabular-nums;color:var(--tc-text-color)}.tc-table caption{text-align:start;margin-bottom:4px;font-weight:600}.tc-table th,.tc-table td{text-align:end;border-bottom:1px solid var(--tc-grid-color);padding:4px 8px}.tc-table th[scope=row],.tc-table thead th:first-child{text-align:start}.tc-table thead th{color:var(--tc-text-muted);border-bottom-color:var(--tc-baseline-color);font-weight:600}@media (prefers-reduced-motion:reduce){.tc-chart,.tc-tooltip{--tc-duration:0s;--tc-duration-fast:0s}}@media (forced-colors:active){.tc-value-label,.tc-treemap-label{fill:canvastext;stroke:canvas}.tc-end-label-text,.tc-slice-label-text{fill:canvastext}.tc-slice-label-line{stroke:graytext}.tc-tick-label,.tc-axis-title,.tc-funnel-labels{fill:canvastext}.tc-grid-line,.tc-radar-ring,.tc-radar-spoke{stroke:graytext}.tc-grid-line-zero,.tc-axis-line,.tc-tick-line,.tc-line{stroke:canvastext}.tc-area{fill:graytext}.tc-bar,.tc-funnel-stage,.tc-point{fill:canvastext;stroke:canvas}.tc-crosshair{stroke:highlight}.tc-tooltip{border-color:canvastext}.tc-legend-swatch{background:canvastext}.tc-legend-item-hidden .tc-legend-swatch{background:0 0;box-shadow:inset 0 0 0 1.5px canvastext}.tc-pattern-bg{fill:canvas}.tc-pattern-ink{stroke:canvastext}:is(.tc-patterned,.tc-patterns-auto) :is(.tc-bar,.tc-area,.tc-slice,.tc-gauge-arc,.tc-bubble){fill:var(--tc-series-pattern,CanvasText);fill-opacity:1;stroke:canvastext;stroke-width:1px}.tc-patterns-auto .tc-line{stroke-dasharray:var(--tc-series-dash,var(--tc-pattern-dash))}:has(>:is(.tc-patterned,.tc-patterns-auto))>:is(.tc-legend,.tc-tooltip) .tc-series{--tc-pattern-color:CanvasText;--tc-series-color:Canvas}:has(>:is(.tc-patterned,.tc-patterns-auto))>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){forced-color-adjust:none;background:var(--tc-swatch-pattern), Canvas;box-shadow:inset 0 0 0 1px canvastext}:has(>svg .tc-marker)>:is(.tc-legend,.tc-tooltip) :is(.tc-legend-swatch,.tc-tooltip-swatch){box-shadow:none;background:canvastext}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_format = require("./format-CAE5ruy6.cjs");
|
|
2
2
|
const require_extent = require("./extent-DuYDcvM9.cjs");
|
|
3
|
-
const require_axis = require("./axis-
|
|
4
|
-
const require_cartesian = require("./cartesian-
|
|
3
|
+
const require_axis = require("./axis-BzBkkC5X.cjs");
|
|
4
|
+
const require_cartesian = require("./cartesian-B9CrasFJ.cjs");
|
|
5
5
|
// src/scales/time.ts
|
|
6
6
|
const SECOND = 1e3;
|
|
7
7
|
const MINUTE = 60 * SECOND;
|
|
@@ -379,4 +379,4 @@ Object.defineProperty(exports, "timePointScale", {
|
|
|
379
379
|
}
|
|
380
380
|
});
|
|
381
381
|
|
|
382
|
-
//# sourceMappingURL=time-axis-
|
|
382
|
+
//# sourceMappingURL=time-axis-CVKjQKSS.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-axis-B3VekUfX.cjs","names":["tickStep","getDateFormat","extent","toMs"],"sources":["../src/scales/time.ts","../src/charts/time-axis.ts"],"sourcesContent":["import { getDateFormat, type Locale } from '../format.ts'\nimport type { BandKey, BandScale } from './band.ts'\nimport { extent } from './extent.ts'\nimport { tickStep } from './ticks.ts'\n\n/** A point in time: a `Date` or a timestamp in milliseconds. */\nexport type TimeValue = Date | number\n\nexport interface TimeScaleOptions {\n /** Align ticks to UTC instead of local time (use it for SSR). Defaults to `false`. */\n utc?: boolean\n /** Clamp output to the range. */\n clamp?: boolean\n}\n\n/** Continuous scale mapping time to a pixel range, with calendar-aware ticks. */\nexport interface TimeScale {\n (value: TimeValue): number\n readonly domain: readonly [number, number]\n readonly range: readonly [number, number]\n readonly utc: boolean\n /** Map a pixel back to a time. */\n invert(pixel: number): Date\n /** Tick dates at calendar boundaries, roughly `count` of them. */\n ticks(count?: number): Date[]\n /** A formatter suited to the tick interval chosen for `count`. */\n tickFormat(count?: number, locale?: Locale): (date: Date) => string\n /** A copy with the domain extended to tick boundaries. */\n nice(count?: number): TimeScale\n}\n\ntype Unit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'\n\ninterface Interval {\n unit: Unit\n step: number\n /** Approximate duration, for choosing an interval. */\n ms: number\n}\n\nconst SECOND = 1000\nconst MINUTE = 60 * SECOND\nconst HOUR = 60 * MINUTE\nconst DAY = 24 * HOUR\nconst WEEK = 7 * DAY\nconst MONTH = 30 * DAY\nconst YEAR = 365 * DAY\n\nconst INTERVALS: Interval[] = [\n { unit: 'second', step: 1, ms: SECOND },\n { unit: 'second', step: 5, ms: 5 * SECOND },\n { unit: 'second', step: 15, ms: 15 * SECOND },\n { unit: 'second', step: 30, ms: 30 * SECOND },\n { unit: 'minute', step: 1, ms: MINUTE },\n { unit: 'minute', step: 5, ms: 5 * MINUTE },\n { unit: 'minute', step: 15, ms: 15 * MINUTE },\n { unit: 'minute', step: 30, ms: 30 * MINUTE },\n { unit: 'hour', step: 1, ms: HOUR },\n { unit: 'hour', step: 3, ms: 3 * HOUR },\n { unit: 'hour', step: 6, ms: 6 * HOUR },\n { unit: 'hour', step: 12, ms: 12 * HOUR },\n { unit: 'day', step: 1, ms: DAY },\n { unit: 'day', step: 2, ms: 2 * DAY },\n { unit: 'week', step: 1, ms: WEEK },\n { unit: 'month', step: 1, ms: MONTH },\n { unit: 'month', step: 3, ms: 3 * MONTH },\n { unit: 'year', step: 1, ms: YEAR },\n]\n\n/** Calendar arithmetic in local time or UTC. */\nfunction calendar(utc: boolean) {\n const get = (d: Date, unit: Unit): number => {\n switch (unit) {\n case 'year':\n return utc ? d.getUTCFullYear() : d.getFullYear()\n case 'month':\n return utc ? d.getUTCMonth() : d.getMonth()\n case 'day':\n case 'week':\n return utc ? d.getUTCDate() : d.getDate()\n case 'hour':\n return utc ? d.getUTCHours() : d.getHours()\n case 'minute':\n return utc ? d.getUTCMinutes() : d.getMinutes()\n default:\n return utc ? d.getUTCSeconds() : d.getSeconds()\n }\n }\n const make = (y: number, mo: number, d: number, h = 0, mi = 0, s = 0): Date =>\n utc ? new Date(Date.UTC(y, mo, d, h, mi, s)) : new Date(y, mo, d, h, mi, s)\n const weekday = (d: Date): number => (utc ? d.getUTCDay() : d.getDay())\n\n /** Start of the interval containing `date` (weeks start on Monday). */\n const floor = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(Math.floor(y / step) * step, 0, 1)\n case 'month':\n return make(y, Math.floor(mo / step) * step, 1)\n case 'week':\n return make(y, mo, d - ((weekday(date) + 6) % 7))\n case 'day':\n return make(y, mo, Math.floor((d - 1) / step) * step + 1)\n case 'hour':\n return make(y, mo, d, Math.floor(get(date, 'hour') / step) * step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), Math.floor(get(date, 'minute') / step) * step)\n default:\n return make(\n y,\n mo,\n d,\n get(date, 'hour'),\n get(date, 'minute'),\n Math.floor(get(date, 'second') / step) * step,\n )\n }\n }\n\n /** `date` moved forward by one interval. */\n const next = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(y + step, 0, 1)\n case 'month':\n return make(y, mo + step, 1)\n case 'week':\n return make(y, mo, d + 7 * step)\n case 'day': {\n // Day steps restart at the first of each month, so ticks land on the 1st.\n const n = make(y, mo, d + step)\n return get(n, 'month') === mo ? n : make(y, mo + 1, 1)\n }\n case 'hour':\n return make(y, mo, d, get(date, 'hour') + step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute') + step)\n default:\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute'), get(date, 'second') + step)\n }\n }\n\n /** Whether `date` sits on the boundary of the unit above `unit`. */\n const boundary = (date: Date, unit: Unit): boolean => {\n switch (unit) {\n case 'second':\n return get(date, 'second') === 0\n case 'minute':\n return get(date, 'minute') === 0 && get(date, 'second') === 0\n case 'hour':\n return get(date, 'hour') === 0 && get(date, 'minute') === 0\n case 'day':\n case 'week':\n return get(date, 'day') === 1\n case 'month':\n return get(date, 'month') === 0\n default:\n return false\n }\n }\n\n return { floor, next, boundary }\n}\n\n/** Pick the interval whose duration is closest to `span / count`. */\nfunction chooseInterval(span: number, count: number): Interval {\n const target = Math.abs(span) / Math.max(1, count)\n let i = 0\n while (i < INTERVALS.length && (INTERVALS[i] as Interval).ms < target) i++\n if (i === INTERVALS.length) {\n // Beyond one year: multiples of years.\n const years = Math.max(1, tickStep(0, target / YEAR, 1))\n return { unit: 'year', step: years, ms: years * YEAR }\n }\n if (i === 0) return INTERVALS[0] as Interval\n const lo = INTERVALS[i - 1] as Interval\n const hi = INTERVALS[i] as Interval\n return target / lo.ms < hi.ms / target ? lo : hi\n}\n\nconst toMs = (value: TimeValue): number => (value instanceof Date ? value.getTime() : value)\n\n/** Intl options for each tick unit, and for the boundary of the unit above it. */\nconst FORMATS: Record<Unit, [Intl.DateTimeFormatOptions, Intl.DateTimeFormatOptions | null]> = {\n second: [\n { hour: 'numeric', minute: '2-digit', second: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n minute: [\n { hour: 'numeric', minute: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n hour: [\n { hour: 'numeric', minute: '2-digit' },\n { month: 'short', day: 'numeric' },\n ],\n day: [{ month: 'short', day: 'numeric' }, null],\n week: [{ month: 'short', day: 'numeric' }, null],\n month: [{ month: 'short' }, { year: 'numeric' }],\n year: [{ year: 'numeric' }, null],\n}\n\n/**\n * Create a time scale over `[start, end]`.\n *\n * ```ts\n * const x = time([new Date(2026, 0, 1), new Date(2026, 2, 31)], [0, 600])\n * x.ticks() // first of each month, or every week, depending on the range\n * x.tickFormat() // e.g. \"Jan\", \"Feb\"\n * ```\n */\nexport function time(\n domain: readonly [TimeValue, TimeValue],\n range: readonly [number, number],\n options: TimeScaleOptions = {},\n): TimeScale {\n const utc = options.utc === true\n const d0 = toMs(domain[0])\n const d1 = toMs(domain[1])\n const [r0, r1] = range\n const span = d1 - d0\n const k = span === 0 ? 0 : (r1 - r0) / span\n const cal = calendar(utc)\n const clamp = options.clamp === true\n const rMin = Math.min(r0, r1)\n const rMax = Math.max(r0, r1)\n\n const scale = (value: TimeValue): number => {\n if (span === 0) return (r0 + r1) / 2\n const px = r0 + (toMs(value) - d0) * k\n return clamp ? Math.min(rMax, Math.max(rMin, px)) : px\n }\n\n const interval = (count = 5): Interval => chooseInterval(span, count)\n\n return Object.assign(scale, {\n domain: [d0, d1] as const,\n range: [r0, r1] as const,\n utc,\n invert(pixel: number): Date {\n return new Date(span === 0 || r1 === r0 ? d0 : d0 + (pixel - r0) / k)\n },\n ticks(count = 5): Date[] {\n if (!Number.isFinite(d0) || !Number.isFinite(d1)) return []\n const lo = Math.min(d0, d1)\n const hi = Math.max(d0, d1)\n if (lo === hi) return [new Date(lo)]\n const step = interval(count)\n const out: Date[] = []\n let t = cal.floor(new Date(lo), step)\n if (t.getTime() < lo) t = cal.next(t, step)\n while (t.getTime() <= hi && out.length < 1000) {\n out.push(t)\n t = cal.next(t, step)\n }\n return d1 < d0 ? out.reverse() : out\n },\n tickFormat(count = 5, locale?: Locale): (date: Date) => string {\n const { unit } = interval(count)\n const [primary, above] = FORMATS[unit]\n const tz = utc ? { timeZone: 'UTC' } : {}\n const main = getDateFormat(locale, { ...primary, ...tz })\n const upper = above ? getDateFormat(locale, { ...above, ...tz }) : null\n return (date) => (upper && cal.boundary(date, unit) ? upper : main).format(date)\n },\n nice(count = 5): TimeScale {\n if (span === 0 || !Number.isFinite(span)) return time(domain, range, options)\n const step = interval(count)\n const lo = cal.floor(new Date(Math.min(d0, d1)), step)\n let hi = cal.floor(new Date(Math.max(d0, d1)), step)\n if (hi.getTime() < Math.max(d0, d1)) hi = cal.next(hi, step)\n return time(d1 < d0 ? [hi, lo] : [lo, hi], range, options)\n },\n })\n}\n\n/**\n * A point scale over time for category charts: each category sits at its\n * real distance in time. Conforms to `BandScale` (zero bandwidth), so line\n * and area charts and their hit testing work unchanged. `stamps` must be\n * ascending; `keys` are the categories' keys.\n */\nexport function timePointScale(\n stamps: readonly number[],\n keys: readonly BandKey[],\n range: readonly [number, number],\n utc: boolean,\n): { scale: BandScale; time: TimeScale } {\n // Spreading large arrays into Math.min/max overflows the stack, so scan.\n const [lo, hi] = extent(stamps) ?? [0, 1]\n const valid = stamps.filter((t) => Number.isFinite(t))\n const t = time([lo, hi], range, { utc })\n const positions = stamps.map((ms) => t(ms))\n const at = (i: number): number => positions[i] ?? range[0]\n const scale = Object.assign((key: BandKey) => positions[keys.indexOf(key)], {\n domain: keys.slice(),\n range,\n bandwidth: 0,\n step: valid.length > 1 ? (range[1] - range[0]) / (valid.length - 1) : 0,\n at,\n center: (key: BandKey) => positions[keys.indexOf(key)],\n indexAt(pixel: number): number {\n // Stamps are sorted, so the nearest position is found by binary search.\n if (positions.length === 0) return -1\n // (They run down the pixels on a reversed range.)\n const down = range[1] < range[0]\n let a = 0\n let b = positions.length - 1\n while (a < b) {\n const mid = (a + b) >> 1\n if ((positions[mid] as number) < pixel !== down) a = mid + 1\n else b = mid\n }\n const prev = a - 1\n return prev >= 0 &&\n Math.abs(pixel - (positions[prev] as number)) < Math.abs((positions[a] as number) - pixel)\n ? prev\n : a\n },\n })\n return { scale: scale as BandScale, time: t }\n}\n","import type { Tick } from '../components/axis.ts'\nimport type { Locale } from '../format.ts'\nimport type { BandKey } from '../scales/band.ts'\nimport { type TimeScale, timePointScale } from '../scales/time.ts'\nimport { type CategoryAxis, type CategoryAxisOptions, type Label, toMs } from './cartesian.ts'\n\n/**\n * A time category axis: points at their real distance in time, ticks on\n * calendar boundaries labelled for the span (or with `x.format`).\n */\nexport function timeAxis(\n labels: readonly Label[],\n keys: readonly BandKey[],\n options: CategoryAxisOptions,\n count: number,\n locale: Locale,\n): CategoryAxis {\n const stamps = labels.map(toMs)\n const points = (range: readonly [number, number]) =>\n timePointScale(stamps, keys, range, options.utc === true)\n const probe = points([0, 1]).time\n const { format } = options\n const label = format ? (d: Date) => format(d, -1) : probe.tickFormat(count, locale)\n let time: TimeScale = probe\n return {\n // Time ticks come from the scale; their labels are what sits at the edges.\n edges: probe.ticks(count).map(label),\n scale(range) {\n const scaled = points(range)\n time = scaled.time\n return scaled.scale\n },\n ticks: (): Tick[] =>\n time.ticks(count).map((d) => ({ value: d.getTime(), position: time(d), label: label(d) })),\n get time() {\n return time\n },\n }\n}\n"],"mappings":";;;;;AAwCA,MAAM,SAAS;AACf,MAAM,SAAS,KAAK;AACpB,MAAM,OAAO,KAAK;AAClB,MAAM,M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D,MAAM,QAAQ,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC7B,MAAM,EAAE,WAAW;CACnB,MAAM,QAAQ,UAAU,MAAY,OAAO,GAAG,EAAE,IAAI,MAAM,WAAW,OAAO,MAAM;CAClF,IAAI,OAAkB;CACtB,OAAO;EAEL,OAAO,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,KAAK;EACnC,MAAM,OAAO;GACX,MAAM,SAAS,OAAO,KAAK;GAC3B,OAAO,OAAO;GACd,OAAO,OAAO;EAChB;EACA,aACE,KAAK,MAAM,KAAK,CAAC,CAAC,KAAK,OAAO;GAAE,OAAO,EAAE,QAAQ;GAAG,UAAU,KAAK,CAAC;GAAG,OAAO,MAAM,CAAC;EAAE,EAAE;EAC3F,IAAI,OAAO;GACT,OAAO;EACT;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"time-axis-CVKjQKSS.cjs","names":["tickStep","getDateFormat","extent","toMs"],"sources":["../src/scales/time.ts","../src/charts/time-axis.ts"],"sourcesContent":["import { getDateFormat, type Locale } from '../format.ts'\nimport type { BandKey, BandScale } from './band.ts'\nimport { extent } from './extent.ts'\nimport { tickStep } from './ticks.ts'\n\n/** A point in time: a `Date` or a timestamp in milliseconds. */\nexport type TimeValue = Date | number\n\nexport interface TimeScaleOptions {\n /** Align ticks to UTC instead of local time (use it for SSR). Defaults to `false`. */\n utc?: boolean\n /** Clamp output to the range. */\n clamp?: boolean\n}\n\n/** Continuous scale mapping time to a pixel range, with calendar-aware ticks. */\nexport interface TimeScale {\n (value: TimeValue): number\n readonly domain: readonly [number, number]\n readonly range: readonly [number, number]\n readonly utc: boolean\n /** Map a pixel back to a time. */\n invert(pixel: number): Date\n /** Tick dates at calendar boundaries, roughly `count` of them. */\n ticks(count?: number): Date[]\n /** A formatter suited to the tick interval chosen for `count`. */\n tickFormat(count?: number, locale?: Locale): (date: Date) => string\n /** A copy with the domain extended to tick boundaries. */\n nice(count?: number): TimeScale\n}\n\ntype Unit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'\n\ninterface Interval {\n unit: Unit\n step: number\n /** Approximate duration, for choosing an interval. */\n ms: number\n}\n\nconst SECOND = 1000\nconst MINUTE = 60 * SECOND\nconst HOUR = 60 * MINUTE\nconst DAY = 24 * HOUR\nconst WEEK = 7 * DAY\nconst MONTH = 30 * DAY\nconst YEAR = 365 * DAY\n\nconst INTERVALS: Interval[] = [\n { unit: 'second', step: 1, ms: SECOND },\n { unit: 'second', step: 5, ms: 5 * SECOND },\n { unit: 'second', step: 15, ms: 15 * SECOND },\n { unit: 'second', step: 30, ms: 30 * SECOND },\n { unit: 'minute', step: 1, ms: MINUTE },\n { unit: 'minute', step: 5, ms: 5 * MINUTE },\n { unit: 'minute', step: 15, ms: 15 * MINUTE },\n { unit: 'minute', step: 30, ms: 30 * MINUTE },\n { unit: 'hour', step: 1, ms: HOUR },\n { unit: 'hour', step: 3, ms: 3 * HOUR },\n { unit: 'hour', step: 6, ms: 6 * HOUR },\n { unit: 'hour', step: 12, ms: 12 * HOUR },\n { unit: 'day', step: 1, ms: DAY },\n { unit: 'day', step: 2, ms: 2 * DAY },\n { unit: 'week', step: 1, ms: WEEK },\n { unit: 'month', step: 1, ms: MONTH },\n { unit: 'month', step: 3, ms: 3 * MONTH },\n { unit: 'year', step: 1, ms: YEAR },\n]\n\n/** Calendar arithmetic in local time or UTC. */\nfunction calendar(utc: boolean) {\n const get = (d: Date, unit: Unit): number => {\n switch (unit) {\n case 'year':\n return utc ? d.getUTCFullYear() : d.getFullYear()\n case 'month':\n return utc ? d.getUTCMonth() : d.getMonth()\n case 'day':\n case 'week':\n return utc ? d.getUTCDate() : d.getDate()\n case 'hour':\n return utc ? d.getUTCHours() : d.getHours()\n case 'minute':\n return utc ? d.getUTCMinutes() : d.getMinutes()\n default:\n return utc ? d.getUTCSeconds() : d.getSeconds()\n }\n }\n const make = (y: number, mo: number, d: number, h = 0, mi = 0, s = 0): Date =>\n utc ? new Date(Date.UTC(y, mo, d, h, mi, s)) : new Date(y, mo, d, h, mi, s)\n const weekday = (d: Date): number => (utc ? d.getUTCDay() : d.getDay())\n\n /** Start of the interval containing `date` (weeks start on Monday). */\n const floor = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(Math.floor(y / step) * step, 0, 1)\n case 'month':\n return make(y, Math.floor(mo / step) * step, 1)\n case 'week':\n return make(y, mo, d - ((weekday(date) + 6) % 7))\n case 'day':\n return make(y, mo, Math.floor((d - 1) / step) * step + 1)\n case 'hour':\n return make(y, mo, d, Math.floor(get(date, 'hour') / step) * step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), Math.floor(get(date, 'minute') / step) * step)\n default:\n return make(\n y,\n mo,\n d,\n get(date, 'hour'),\n get(date, 'minute'),\n Math.floor(get(date, 'second') / step) * step,\n )\n }\n }\n\n /** `date` moved forward by one interval. */\n const next = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(y + step, 0, 1)\n case 'month':\n return make(y, mo + step, 1)\n case 'week':\n return make(y, mo, d + 7 * step)\n case 'day': {\n // Day steps restart at the first of each month, so ticks land on the 1st.\n const n = make(y, mo, d + step)\n return get(n, 'month') === mo ? n : make(y, mo + 1, 1)\n }\n case 'hour':\n return make(y, mo, d, get(date, 'hour') + step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute') + step)\n default:\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute'), get(date, 'second') + step)\n }\n }\n\n /** Whether `date` sits on the boundary of the unit above `unit`. */\n const boundary = (date: Date, unit: Unit): boolean => {\n switch (unit) {\n case 'second':\n return get(date, 'second') === 0\n case 'minute':\n return get(date, 'minute') === 0 && get(date, 'second') === 0\n case 'hour':\n return get(date, 'hour') === 0 && get(date, 'minute') === 0\n case 'day':\n case 'week':\n return get(date, 'day') === 1\n case 'month':\n return get(date, 'month') === 0\n default:\n return false\n }\n }\n\n return { floor, next, boundary }\n}\n\n/** Pick the interval whose duration is closest to `span / count`. */\nfunction chooseInterval(span: number, count: number): Interval {\n const target = Math.abs(span) / Math.max(1, count)\n let i = 0\n while (i < INTERVALS.length && (INTERVALS[i] as Interval).ms < target) i++\n if (i === INTERVALS.length) {\n // Beyond one year: multiples of years.\n const years = Math.max(1, tickStep(0, target / YEAR, 1))\n return { unit: 'year', step: years, ms: years * YEAR }\n }\n if (i === 0) return INTERVALS[0] as Interval\n const lo = INTERVALS[i - 1] as Interval\n const hi = INTERVALS[i] as Interval\n return target / lo.ms < hi.ms / target ? lo : hi\n}\n\nconst toMs = (value: TimeValue): number => (value instanceof Date ? value.getTime() : value)\n\n/** Intl options for each tick unit, and for the boundary of the unit above it. */\nconst FORMATS: Record<Unit, [Intl.DateTimeFormatOptions, Intl.DateTimeFormatOptions | null]> = {\n second: [\n { hour: 'numeric', minute: '2-digit', second: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n minute: [\n { hour: 'numeric', minute: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n hour: [\n { hour: 'numeric', minute: '2-digit' },\n { month: 'short', day: 'numeric' },\n ],\n day: [{ month: 'short', day: 'numeric' }, null],\n week: [{ month: 'short', day: 'numeric' }, null],\n month: [{ month: 'short' }, { year: 'numeric' }],\n year: [{ year: 'numeric' }, null],\n}\n\n/**\n * Create a time scale over `[start, end]`.\n *\n * ```ts\n * const x = time([new Date(2026, 0, 1), new Date(2026, 2, 31)], [0, 600])\n * x.ticks() // first of each month, or every week, depending on the range\n * x.tickFormat() // e.g. \"Jan\", \"Feb\"\n * ```\n */\nexport function time(\n domain: readonly [TimeValue, TimeValue],\n range: readonly [number, number],\n options: TimeScaleOptions = {},\n): TimeScale {\n const utc = options.utc === true\n const d0 = toMs(domain[0])\n const d1 = toMs(domain[1])\n const [r0, r1] = range\n const span = d1 - d0\n const k = span === 0 ? 0 : (r1 - r0) / span\n const cal = calendar(utc)\n const clamp = options.clamp === true\n const rMin = Math.min(r0, r1)\n const rMax = Math.max(r0, r1)\n\n const scale = (value: TimeValue): number => {\n if (span === 0) return (r0 + r1) / 2\n const px = r0 + (toMs(value) - d0) * k\n return clamp ? Math.min(rMax, Math.max(rMin, px)) : px\n }\n\n const interval = (count = 5): Interval => chooseInterval(span, count)\n\n return Object.assign(scale, {\n domain: [d0, d1] as const,\n range: [r0, r1] as const,\n utc,\n invert(pixel: number): Date {\n return new Date(span === 0 || r1 === r0 ? d0 : d0 + (pixel - r0) / k)\n },\n ticks(count = 5): Date[] {\n if (!Number.isFinite(d0) || !Number.isFinite(d1)) return []\n const lo = Math.min(d0, d1)\n const hi = Math.max(d0, d1)\n if (lo === hi) return [new Date(lo)]\n const step = interval(count)\n const out: Date[] = []\n let t = cal.floor(new Date(lo), step)\n if (t.getTime() < lo) t = cal.next(t, step)\n while (t.getTime() <= hi && out.length < 1000) {\n out.push(t)\n t = cal.next(t, step)\n }\n return d1 < d0 ? out.reverse() : out\n },\n tickFormat(count = 5, locale?: Locale): (date: Date) => string {\n const { unit } = interval(count)\n const [primary, above] = FORMATS[unit]\n const tz = utc ? { timeZone: 'UTC' } : {}\n const main = getDateFormat(locale, { ...primary, ...tz })\n const upper = above ? getDateFormat(locale, { ...above, ...tz }) : null\n return (date) => (upper && cal.boundary(date, unit) ? upper : main).format(date)\n },\n nice(count = 5): TimeScale {\n if (span === 0 || !Number.isFinite(span)) return time(domain, range, options)\n const step = interval(count)\n const lo = cal.floor(new Date(Math.min(d0, d1)), step)\n let hi = cal.floor(new Date(Math.max(d0, d1)), step)\n if (hi.getTime() < Math.max(d0, d1)) hi = cal.next(hi, step)\n return time(d1 < d0 ? [hi, lo] : [lo, hi], range, options)\n },\n })\n}\n\n/**\n * A point scale over time for category charts: each category sits at its\n * real distance in time. Conforms to `BandScale` (zero bandwidth), so line\n * and area charts and their hit testing work unchanged. `stamps` must be\n * ascending; `keys` are the categories' keys.\n */\nexport function timePointScale(\n stamps: readonly number[],\n keys: readonly BandKey[],\n range: readonly [number, number],\n utc: boolean,\n): { scale: BandScale; time: TimeScale } {\n // Spreading large arrays into Math.min/max overflows the stack, so scan.\n const [lo, hi] = extent(stamps) ?? [0, 1]\n const valid = stamps.filter((t) => Number.isFinite(t))\n const t = time([lo, hi], range, { utc })\n const positions = stamps.map((ms) => t(ms))\n const at = (i: number): number => positions[i] ?? range[0]\n const scale = Object.assign((key: BandKey) => positions[keys.indexOf(key)], {\n domain: keys.slice(),\n range,\n bandwidth: 0,\n step: valid.length > 1 ? (range[1] - range[0]) / (valid.length - 1) : 0,\n at,\n center: (key: BandKey) => positions[keys.indexOf(key)],\n indexAt(pixel: number): number {\n // Stamps are sorted, so the nearest position is found by binary search.\n if (positions.length === 0) return -1\n // (They run down the pixels on a reversed range.)\n const down = range[1] < range[0]\n let a = 0\n let b = positions.length - 1\n while (a < b) {\n const mid = (a + b) >> 1\n if ((positions[mid] as number) < pixel !== down) a = mid + 1\n else b = mid\n }\n const prev = a - 1\n return prev >= 0 &&\n Math.abs(pixel - (positions[prev] as number)) < Math.abs((positions[a] as number) - pixel)\n ? prev\n : a\n },\n })\n return { scale: scale as BandScale, time: t }\n}\n","import type { Tick } from '../components/axis.ts'\nimport type { Locale } from '../format.ts'\nimport type { BandKey } from '../scales/band.ts'\nimport { type TimeScale, timePointScale } from '../scales/time.ts'\nimport { type CategoryAxis, type CategoryAxisOptions, type Label, toMs } from './cartesian.ts'\n\n/**\n * A time category axis: points at their real distance in time, ticks on\n * calendar boundaries labelled for the span (or with `x.format`).\n */\nexport function timeAxis(\n labels: readonly Label[],\n keys: readonly BandKey[],\n options: CategoryAxisOptions,\n count: number,\n locale: Locale,\n): CategoryAxis {\n const stamps = labels.map(toMs)\n const points = (range: readonly [number, number]) =>\n timePointScale(stamps, keys, range, options.utc === true)\n const probe = points([0, 1]).time\n const { format } = options\n const label = format ? (d: Date) => format(d, -1) : probe.tickFormat(count, locale)\n let time: TimeScale = probe\n return {\n // Time ticks come from the scale; their labels are what sits at the edges.\n edges: probe.ticks(count).map(label),\n scale(range) {\n const scaled = points(range)\n time = scaled.time\n return scaled.scale\n },\n ticks: (): Tick[] =>\n time.ticks(count).map((d) => ({ value: d.getTime(), position: time(d), label: label(d) })),\n get time() {\n return time\n },\n }\n}\n"],"mappings":";;;;;AAwCA,MAAM,SAAS;AACf,MAAM,SAAS,KAAK;AACpB,MAAM,OAAO,KAAK;AAClB,MAAM,MAAM,KAAK;AACjB,MAAM,OAAO,IAAI;AACjB,MAAM,QAAQ,KAAK;AACnB,MAAM,OAAO,MAAM;AAEnB,MAAM,YAAwB;CAC5B;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI;CAAO;CACtC;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI,IAAI;CAAO;CAC1C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI;CAAO;CACtC;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI,IAAI;CAAO;CAC1C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI;CAAK;CAClC;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI,IAAI;CAAK;CACtC;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI,IAAI;CAAK;CACtC;EAAE,MAAM;EAAQ,MAAM;EAAI,IAAI,KAAK;CAAK;CACxC;EAAE,MAAM;EAAO,MAAM;EAAG,IAAI;CAAI;CAChC;EAAE,MAAM;EAAO,MAAM;EAAG,IAAI,IAAI;CAAI;CACpC;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI;CAAK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MAAM,OAAO,IAAI;IACjB,OAAO,QAAQ,KACb,KAAK,IAAI,QAAS,UAAU,KAAgB,IAAI,KAAK,IAAK,UAAU,KAAgB,KAAK,IACvF,OACA;GACN;EACF,CACoB;EAAgB,MAAM;CAAE;AAC9C;;;;;;AC7TA,SAAgB,SACd,QACA,MACA,SACA,OACA,QACc;CACd,MAAM,SAAS,OAAO,IAAIC,kBAAAA,IAAI;CAC9B,MAAM,UAAU,UACd,eAAe,QAAQ,MAAM,OAAO,QAAQ,QAAQ,IAAI;CAC1D,MAAM,QAAQ,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC7B,MAAM,EAAE,WAAW;CACnB,MAAM,QAAQ,UAAU,MAAY,OAAO,GAAG,EAAE,IAAI,MAAM,WAAW,OAAO,MAAM;CAClF,IAAI,OAAkB;CACtB,OAAO;EAEL,OAAO,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,KAAK;EACnC,MAAM,OAAO;GACX,MAAM,SAAS,OAAO,KAAK;GAC3B,OAAO,OAAO;GACd,OAAO,OAAO;EAChB;EACA,aACE,KAAK,MAAM,KAAK,CAAC,CAAC,KAAK,OAAO;GAAE,OAAO,EAAE,QAAQ;GAAG,UAAU,KAAK,CAAC;GAAG,OAAO,MAAM,CAAC;EAAE,EAAE;EAC3F,IAAI,OAAO;GACT,OAAO;EACT;CACF;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as getDateFormat } from "./format-it1kepFG.js";
|
|
2
2
|
import { t as extent } from "./extent-DOV8rs-6.js";
|
|
3
|
-
import { u as tickStep } from "./axis-
|
|
4
|
-
import { y as toMs$1 } from "./cartesian-
|
|
3
|
+
import { u as tickStep } from "./axis-C5obgdJt.js";
|
|
4
|
+
import { y as toMs$1 } from "./cartesian-COglz544.js";
|
|
5
5
|
// src/scales/time.ts
|
|
6
6
|
const SECOND = 1e3;
|
|
7
7
|
const MINUTE = 60 * SECOND;
|
|
@@ -362,4 +362,4 @@ function timeAxis(labels, keys, options, count, locale) {
|
|
|
362
362
|
}
|
|
363
363
|
export { time as n, timePointScale as r, timeAxis as t };
|
|
364
364
|
|
|
365
|
-
//# sourceMappingURL=time-axis-
|
|
365
|
+
//# sourceMappingURL=time-axis-CkmbAw4Z.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-axis-CLjqOakA.js","names":["toMs"],"sources":["../src/scales/time.ts","../src/charts/time-axis.ts"],"sourcesContent":["import { getDateFormat, type Locale } from '../format.ts'\nimport type { BandKey, BandScale } from './band.ts'\nimport { extent } from './extent.ts'\nimport { tickStep } from './ticks.ts'\n\n/** A point in time: a `Date` or a timestamp in milliseconds. */\nexport type TimeValue = Date | number\n\nexport interface TimeScaleOptions {\n /** Align ticks to UTC instead of local time (use it for SSR). Defaults to `false`. */\n utc?: boolean\n /** Clamp output to the range. */\n clamp?: boolean\n}\n\n/** Continuous scale mapping time to a pixel range, with calendar-aware ticks. */\nexport interface TimeScale {\n (value: TimeValue): number\n readonly domain: readonly [number, number]\n readonly range: readonly [number, number]\n readonly utc: boolean\n /** Map a pixel back to a time. */\n invert(pixel: number): Date\n /** Tick dates at calendar boundaries, roughly `count` of them. */\n ticks(count?: number): Date[]\n /** A formatter suited to the tick interval chosen for `count`. */\n tickFormat(count?: number, locale?: Locale): (date: Date) => string\n /** A copy with the domain extended to tick boundaries. */\n nice(count?: number): TimeScale\n}\n\ntype Unit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'\n\ninterface Interval {\n unit: Unit\n step: number\n /** Approximate duration, for choosing an interval. */\n ms: number\n}\n\nconst SECOND = 1000\nconst MINUTE = 60 * SECOND\nconst HOUR = 60 * MINUTE\nconst DAY = 24 * HOUR\nconst WEEK = 7 * DAY\nconst MONTH = 30 * DAY\nconst YEAR = 365 * DAY\n\nconst INTERVALS: Interval[] = [\n { unit: 'second', step: 1, ms: SECOND },\n { unit: 'second', step: 5, ms: 5 * SECOND },\n { unit: 'second', step: 15, ms: 15 * SECOND },\n { unit: 'second', step: 30, ms: 30 * SECOND },\n { unit: 'minute', step: 1, ms: MINUTE },\n { unit: 'minute', step: 5, ms: 5 * MINUTE },\n { unit: 'minute', step: 15, ms: 15 * MINUTE },\n { unit: 'minute', step: 30, ms: 30 * MINUTE },\n { unit: 'hour', step: 1, ms: HOUR },\n { unit: 'hour', step: 3, ms: 3 * HOUR },\n { unit: 'hour', step: 6, ms: 6 * HOUR },\n { unit: 'hour', step: 12, ms: 12 * HOUR },\n { unit: 'day', step: 1, ms: DAY },\n { unit: 'day', step: 2, ms: 2 * DAY },\n { unit: 'week', step: 1, ms: WEEK },\n { unit: 'month', step: 1, ms: MONTH },\n { unit: 'month', step: 3, ms: 3 * MONTH },\n { unit: 'year', step: 1, ms: YEAR },\n]\n\n/** Calendar arithmetic in local time or UTC. */\nfunction calendar(utc: boolean) {\n const get = (d: Date, unit: Unit): number => {\n switch (unit) {\n case 'year':\n return utc ? d.getUTCFullYear() : d.getFullYear()\n case 'month':\n return utc ? d.getUTCMonth() : d.getMonth()\n case 'day':\n case 'week':\n return utc ? d.getUTCDate() : d.getDate()\n case 'hour':\n return utc ? d.getUTCHours() : d.getHours()\n case 'minute':\n return utc ? d.getUTCMinutes() : d.getMinutes()\n default:\n return utc ? d.getUTCSeconds() : d.getSeconds()\n }\n }\n const make = (y: number, mo: number, d: number, h = 0, mi = 0, s = 0): Date =>\n utc ? new Date(Date.UTC(y, mo, d, h, mi, s)) : new Date(y, mo, d, h, mi, s)\n const weekday = (d: Date): number => (utc ? d.getUTCDay() : d.getDay())\n\n /** Start of the interval containing `date` (weeks start on Monday). */\n const floor = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(Math.floor(y / step) * step, 0, 1)\n case 'month':\n return make(y, Math.floor(mo / step) * step, 1)\n case 'week':\n return make(y, mo, d - ((weekday(date) + 6) % 7))\n case 'day':\n return make(y, mo, Math.floor((d - 1) / step) * step + 1)\n case 'hour':\n return make(y, mo, d, Math.floor(get(date, 'hour') / step) * step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), Math.floor(get(date, 'minute') / step) * step)\n default:\n return make(\n y,\n mo,\n d,\n get(date, 'hour'),\n get(date, 'minute'),\n Math.floor(get(date, 'second') / step) * step,\n )\n }\n }\n\n /** `date` moved forward by one interval. */\n const next = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(y + step, 0, 1)\n case 'month':\n return make(y, mo + step, 1)\n case 'week':\n return make(y, mo, d + 7 * step)\n case 'day': {\n // Day steps restart at the first of each month, so ticks land on the 1st.\n const n = make(y, mo, d + step)\n return get(n, 'month') === mo ? n : make(y, mo + 1, 1)\n }\n case 'hour':\n return make(y, mo, d, get(date, 'hour') + step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute') + step)\n default:\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute'), get(date, 'second') + step)\n }\n }\n\n /** Whether `date` sits on the boundary of the unit above `unit`. */\n const boundary = (date: Date, unit: Unit): boolean => {\n switch (unit) {\n case 'second':\n return get(date, 'second') === 0\n case 'minute':\n return get(date, 'minute') === 0 && get(date, 'second') === 0\n case 'hour':\n return get(date, 'hour') === 0 && get(date, 'minute') === 0\n case 'day':\n case 'week':\n return get(date, 'day') === 1\n case 'month':\n return get(date, 'month') === 0\n default:\n return false\n }\n }\n\n return { floor, next, boundary }\n}\n\n/** Pick the interval whose duration is closest to `span / count`. */\nfunction chooseInterval(span: number, count: number): Interval {\n const target = Math.abs(span) / Math.max(1, count)\n let i = 0\n while (i < INTERVALS.length && (INTERVALS[i] as Interval).ms < target) i++\n if (i === INTERVALS.length) {\n // Beyond one year: multiples of years.\n const years = Math.max(1, tickStep(0, target / YEAR, 1))\n return { unit: 'year', step: years, ms: years * YEAR }\n }\n if (i === 0) return INTERVALS[0] as Interval\n const lo = INTERVALS[i - 1] as Interval\n const hi = INTERVALS[i] as Interval\n return target / lo.ms < hi.ms / target ? lo : hi\n}\n\nconst toMs = (value: TimeValue): number => (value instanceof Date ? value.getTime() : value)\n\n/** Intl options for each tick unit, and for the boundary of the unit above it. */\nconst FORMATS: Record<Unit, [Intl.DateTimeFormatOptions, Intl.DateTimeFormatOptions | null]> = {\n second: [\n { hour: 'numeric', minute: '2-digit', second: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n minute: [\n { hour: 'numeric', minute: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n hour: [\n { hour: 'numeric', minute: '2-digit' },\n { month: 'short', day: 'numeric' },\n ],\n day: [{ month: 'short', day: 'numeric' }, null],\n week: [{ month: 'short', day: 'numeric' }, null],\n month: [{ month: 'short' }, { year: 'numeric' }],\n year: [{ year: 'numeric' }, null],\n}\n\n/**\n * Create a time scale over `[start, end]`.\n *\n * ```ts\n * const x = time([new Date(2026, 0, 1), new Date(2026, 2, 31)], [0, 600])\n * x.ticks() // first of each month, or every week, depending on the range\n * x.tickFormat() // e.g. \"Jan\", \"Feb\"\n * ```\n */\nexport function time(\n domain: readonly [TimeValue, TimeValue],\n range: readonly [number, number],\n options: TimeScaleOptions = {},\n): TimeScale {\n const utc = options.utc === true\n const d0 = toMs(domain[0])\n const d1 = toMs(domain[1])\n const [r0, r1] = range\n const span = d1 - d0\n const k = span === 0 ? 0 : (r1 - r0) / span\n const cal = calendar(utc)\n const clamp = options.clamp === true\n const rMin = Math.min(r0, r1)\n const rMax = Math.max(r0, r1)\n\n const scale = (value: TimeValue): number => {\n if (span === 0) return (r0 + r1) / 2\n const px = r0 + (toMs(value) - d0) * k\n return clamp ? Math.min(rMax, Math.max(rMin, px)) : px\n }\n\n const interval = (count = 5): Interval => chooseInterval(span, count)\n\n return Object.assign(scale, {\n domain: [d0, d1] as const,\n range: [r0, r1] as const,\n utc,\n invert(pixel: number): Date {\n return new Date(span === 0 || r1 === r0 ? d0 : d0 + (pixel - r0) / k)\n },\n ticks(count = 5): Date[] {\n if (!Number.isFinite(d0) || !Number.isFinite(d1)) return []\n const lo = Math.min(d0, d1)\n const hi = Math.max(d0, d1)\n if (lo === hi) return [new Date(lo)]\n const step = interval(count)\n const out: Date[] = []\n let t = cal.floor(new Date(lo), step)\n if (t.getTime() < lo) t = cal.next(t, step)\n while (t.getTime() <= hi && out.length < 1000) {\n out.push(t)\n t = cal.next(t, step)\n }\n return d1 < d0 ? out.reverse() : out\n },\n tickFormat(count = 5, locale?: Locale): (date: Date) => string {\n const { unit } = interval(count)\n const [primary, above] = FORMATS[unit]\n const tz = utc ? { timeZone: 'UTC' } : {}\n const main = getDateFormat(locale, { ...primary, ...tz })\n const upper = above ? getDateFormat(locale, { ...above, ...tz }) : null\n return (date) => (upper && cal.boundary(date, unit) ? upper : main).format(date)\n },\n nice(count = 5): TimeScale {\n if (span === 0 || !Number.isFinite(span)) return time(domain, range, options)\n const step = interval(count)\n const lo = cal.floor(new Date(Math.min(d0, d1)), step)\n let hi = cal.floor(new Date(Math.max(d0, d1)), step)\n if (hi.getTime() < Math.max(d0, d1)) hi = cal.next(hi, step)\n return time(d1 < d0 ? [hi, lo] : [lo, hi], range, options)\n },\n })\n}\n\n/**\n * A point scale over time for category charts: each category sits at its\n * real distance in time. Conforms to `BandScale` (zero bandwidth), so line\n * and area charts and their hit testing work unchanged. `stamps` must be\n * ascending; `keys` are the categories' keys.\n */\nexport function timePointScale(\n stamps: readonly number[],\n keys: readonly BandKey[],\n range: readonly [number, number],\n utc: boolean,\n): { scale: BandScale; time: TimeScale } {\n // Spreading large arrays into Math.min/max overflows the stack, so scan.\n const [lo, hi] = extent(stamps) ?? [0, 1]\n const valid = stamps.filter((t) => Number.isFinite(t))\n const t = time([lo, hi], range, { utc })\n const positions = stamps.map((ms) => t(ms))\n const at = (i: number): number => positions[i] ?? range[0]\n const scale = Object.assign((key: BandKey) => positions[keys.indexOf(key)], {\n domain: keys.slice(),\n range,\n bandwidth: 0,\n step: valid.length > 1 ? (range[1] - range[0]) / (valid.length - 1) : 0,\n at,\n center: (key: BandKey) => positions[keys.indexOf(key)],\n indexAt(pixel: number): number {\n // Stamps are sorted, so the nearest position is found by binary search.\n if (positions.length === 0) return -1\n // (They run down the pixels on a reversed range.)\n const down = range[1] < range[0]\n let a = 0\n let b = positions.length - 1\n while (a < b) {\n const mid = (a + b) >> 1\n if ((positions[mid] as number) < pixel !== down) a = mid + 1\n else b = mid\n }\n const prev = a - 1\n return prev >= 0 &&\n Math.abs(pixel - (positions[prev] as number)) < Math.abs((positions[a] as number) - pixel)\n ? prev\n : a\n },\n })\n return { scale: scale as BandScale, time: t }\n}\n","import type { Tick } from '../components/axis.ts'\nimport type { Locale } from '../format.ts'\nimport type { BandKey } from '../scales/band.ts'\nimport { type TimeScale, timePointScale } from '../scales/time.ts'\nimport { type CategoryAxis, type CategoryAxisOptions, type Label, toMs } from './cartesian.ts'\n\n/**\n * A time category axis: points at their real distance in time, ticks on\n * calendar boundaries labelled for the span (or with `x.format`).\n */\nexport function timeAxis(\n labels: readonly Label[],\n keys: readonly BandKey[],\n options: CategoryAxisOptions,\n count: number,\n locale: Locale,\n): CategoryAxis {\n const stamps = labels.map(toMs)\n const points = (range: readonly [number, number]) =>\n timePointScale(stamps, keys, range, options.utc === true)\n const probe = points([0, 1]).time\n const { format } = options\n const label = format ? (d: Date) => format(d, -1) : probe.tickFormat(count, locale)\n let time: TimeScale = probe\n return {\n // Time ticks come from the scale; their labels are what sits at the edges.\n edges: probe.ticks(count).map(label),\n scale(range) {\n const scaled = points(range)\n time = scaled.time\n return scaled.scale\n },\n ticks: (): Tick[] =>\n time.ticks(count).map((d) => ({ value: d.getTime(), position: time(d), label: label(d) })),\n get time() {\n return time\n },\n }\n}\n"],"mappings":";;;;;AAwCA,MAAM,SAAS;AACf,MAAM,SAAS,KAAK;AACpB,MAAM,OAAO,KAAK;AAClB,MAAM,MAAM,KAAK;AACjB,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CAC7B,MAAM,EAAE,WAAW;CACnB,MAAM,QAAQ,UAAU,MAAY,OAAO,GAAG,EAAE,IAAI,MAAM,WAAW,OAAO,MAAM;CAClF,IAAI,OAAkB;CACtB,OAAO;EAEL,OAAO,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,KAAK;EACnC,MAAM,OAAO;GACX,MAAM,SAAS,OAAO,KAAK;GAC3B,OAAO,OAAO;GACd,OAAO,OAAO;EAChB;EACA,aACE,KAAK,MAAM,KAAK,CAAC,CAAC,KAAK,OAAO;GAAE,OAAO,EAAE,QAAQ;GAAG,UAAU,KAAK,CAAC;GAAG,OAAO,MAAM,CAAC;EAAE,EAAE;EAC3F,IAAI,OAAO;GACT,OAAO;EACT;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"time-axis-CkmbAw4Z.js","names":["toMs"],"sources":["../src/scales/time.ts","../src/charts/time-axis.ts"],"sourcesContent":["import { getDateFormat, type Locale } from '../format.ts'\nimport type { BandKey, BandScale } from './band.ts'\nimport { extent } from './extent.ts'\nimport { tickStep } from './ticks.ts'\n\n/** A point in time: a `Date` or a timestamp in milliseconds. */\nexport type TimeValue = Date | number\n\nexport interface TimeScaleOptions {\n /** Align ticks to UTC instead of local time (use it for SSR). Defaults to `false`. */\n utc?: boolean\n /** Clamp output to the range. */\n clamp?: boolean\n}\n\n/** Continuous scale mapping time to a pixel range, with calendar-aware ticks. */\nexport interface TimeScale {\n (value: TimeValue): number\n readonly domain: readonly [number, number]\n readonly range: readonly [number, number]\n readonly utc: boolean\n /** Map a pixel back to a time. */\n invert(pixel: number): Date\n /** Tick dates at calendar boundaries, roughly `count` of them. */\n ticks(count?: number): Date[]\n /** A formatter suited to the tick interval chosen for `count`. */\n tickFormat(count?: number, locale?: Locale): (date: Date) => string\n /** A copy with the domain extended to tick boundaries. */\n nice(count?: number): TimeScale\n}\n\ntype Unit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'\n\ninterface Interval {\n unit: Unit\n step: number\n /** Approximate duration, for choosing an interval. */\n ms: number\n}\n\nconst SECOND = 1000\nconst MINUTE = 60 * SECOND\nconst HOUR = 60 * MINUTE\nconst DAY = 24 * HOUR\nconst WEEK = 7 * DAY\nconst MONTH = 30 * DAY\nconst YEAR = 365 * DAY\n\nconst INTERVALS: Interval[] = [\n { unit: 'second', step: 1, ms: SECOND },\n { unit: 'second', step: 5, ms: 5 * SECOND },\n { unit: 'second', step: 15, ms: 15 * SECOND },\n { unit: 'second', step: 30, ms: 30 * SECOND },\n { unit: 'minute', step: 1, ms: MINUTE },\n { unit: 'minute', step: 5, ms: 5 * MINUTE },\n { unit: 'minute', step: 15, ms: 15 * MINUTE },\n { unit: 'minute', step: 30, ms: 30 * MINUTE },\n { unit: 'hour', step: 1, ms: HOUR },\n { unit: 'hour', step: 3, ms: 3 * HOUR },\n { unit: 'hour', step: 6, ms: 6 * HOUR },\n { unit: 'hour', step: 12, ms: 12 * HOUR },\n { unit: 'day', step: 1, ms: DAY },\n { unit: 'day', step: 2, ms: 2 * DAY },\n { unit: 'week', step: 1, ms: WEEK },\n { unit: 'month', step: 1, ms: MONTH },\n { unit: 'month', step: 3, ms: 3 * MONTH },\n { unit: 'year', step: 1, ms: YEAR },\n]\n\n/** Calendar arithmetic in local time or UTC. */\nfunction calendar(utc: boolean) {\n const get = (d: Date, unit: Unit): number => {\n switch (unit) {\n case 'year':\n return utc ? d.getUTCFullYear() : d.getFullYear()\n case 'month':\n return utc ? d.getUTCMonth() : d.getMonth()\n case 'day':\n case 'week':\n return utc ? d.getUTCDate() : d.getDate()\n case 'hour':\n return utc ? d.getUTCHours() : d.getHours()\n case 'minute':\n return utc ? d.getUTCMinutes() : d.getMinutes()\n default:\n return utc ? d.getUTCSeconds() : d.getSeconds()\n }\n }\n const make = (y: number, mo: number, d: number, h = 0, mi = 0, s = 0): Date =>\n utc ? new Date(Date.UTC(y, mo, d, h, mi, s)) : new Date(y, mo, d, h, mi, s)\n const weekday = (d: Date): number => (utc ? d.getUTCDay() : d.getDay())\n\n /** Start of the interval containing `date` (weeks start on Monday). */\n const floor = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(Math.floor(y / step) * step, 0, 1)\n case 'month':\n return make(y, Math.floor(mo / step) * step, 1)\n case 'week':\n return make(y, mo, d - ((weekday(date) + 6) % 7))\n case 'day':\n return make(y, mo, Math.floor((d - 1) / step) * step + 1)\n case 'hour':\n return make(y, mo, d, Math.floor(get(date, 'hour') / step) * step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), Math.floor(get(date, 'minute') / step) * step)\n default:\n return make(\n y,\n mo,\n d,\n get(date, 'hour'),\n get(date, 'minute'),\n Math.floor(get(date, 'second') / step) * step,\n )\n }\n }\n\n /** `date` moved forward by one interval. */\n const next = (date: Date, { unit, step }: Interval): Date => {\n const y = get(date, 'year')\n const mo = get(date, 'month')\n const d = get(date, 'day')\n switch (unit) {\n case 'year':\n return make(y + step, 0, 1)\n case 'month':\n return make(y, mo + step, 1)\n case 'week':\n return make(y, mo, d + 7 * step)\n case 'day': {\n // Day steps restart at the first of each month, so ticks land on the 1st.\n const n = make(y, mo, d + step)\n return get(n, 'month') === mo ? n : make(y, mo + 1, 1)\n }\n case 'hour':\n return make(y, mo, d, get(date, 'hour') + step)\n case 'minute':\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute') + step)\n default:\n return make(y, mo, d, get(date, 'hour'), get(date, 'minute'), get(date, 'second') + step)\n }\n }\n\n /** Whether `date` sits on the boundary of the unit above `unit`. */\n const boundary = (date: Date, unit: Unit): boolean => {\n switch (unit) {\n case 'second':\n return get(date, 'second') === 0\n case 'minute':\n return get(date, 'minute') === 0 && get(date, 'second') === 0\n case 'hour':\n return get(date, 'hour') === 0 && get(date, 'minute') === 0\n case 'day':\n case 'week':\n return get(date, 'day') === 1\n case 'month':\n return get(date, 'month') === 0\n default:\n return false\n }\n }\n\n return { floor, next, boundary }\n}\n\n/** Pick the interval whose duration is closest to `span / count`. */\nfunction chooseInterval(span: number, count: number): Interval {\n const target = Math.abs(span) / Math.max(1, count)\n let i = 0\n while (i < INTERVALS.length && (INTERVALS[i] as Interval).ms < target) i++\n if (i === INTERVALS.length) {\n // Beyond one year: multiples of years.\n const years = Math.max(1, tickStep(0, target / YEAR, 1))\n return { unit: 'year', step: years, ms: years * YEAR }\n }\n if (i === 0) return INTERVALS[0] as Interval\n const lo = INTERVALS[i - 1] as Interval\n const hi = INTERVALS[i] as Interval\n return target / lo.ms < hi.ms / target ? lo : hi\n}\n\nconst toMs = (value: TimeValue): number => (value instanceof Date ? value.getTime() : value)\n\n/** Intl options for each tick unit, and for the boundary of the unit above it. */\nconst FORMATS: Record<Unit, [Intl.DateTimeFormatOptions, Intl.DateTimeFormatOptions | null]> = {\n second: [\n { hour: 'numeric', minute: '2-digit', second: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n minute: [\n { hour: 'numeric', minute: '2-digit' },\n { hour: 'numeric', minute: '2-digit' },\n ],\n hour: [\n { hour: 'numeric', minute: '2-digit' },\n { month: 'short', day: 'numeric' },\n ],\n day: [{ month: 'short', day: 'numeric' }, null],\n week: [{ month: 'short', day: 'numeric' }, null],\n month: [{ month: 'short' }, { year: 'numeric' }],\n year: [{ year: 'numeric' }, null],\n}\n\n/**\n * Create a time scale over `[start, end]`.\n *\n * ```ts\n * const x = time([new Date(2026, 0, 1), new Date(2026, 2, 31)], [0, 600])\n * x.ticks() // first of each month, or every week, depending on the range\n * x.tickFormat() // e.g. \"Jan\", \"Feb\"\n * ```\n */\nexport function time(\n domain: readonly [TimeValue, TimeValue],\n range: readonly [number, number],\n options: TimeScaleOptions = {},\n): TimeScale {\n const utc = options.utc === true\n const d0 = toMs(domain[0])\n const d1 = toMs(domain[1])\n const [r0, r1] = range\n const span = d1 - d0\n const k = span === 0 ? 0 : (r1 - r0) / span\n const cal = calendar(utc)\n const clamp = options.clamp === true\n const rMin = Math.min(r0, r1)\n const rMax = Math.max(r0, r1)\n\n const scale = (value: TimeValue): number => {\n if (span === 0) return (r0 + r1) / 2\n const px = r0 + (toMs(value) - d0) * k\n return clamp ? Math.min(rMax, Math.max(rMin, px)) : px\n }\n\n const interval = (count = 5): Interval => chooseInterval(span, count)\n\n return Object.assign(scale, {\n domain: [d0, d1] as const,\n range: [r0, r1] as const,\n utc,\n invert(pixel: number): Date {\n return new Date(span === 0 || r1 === r0 ? d0 : d0 + (pixel - r0) / k)\n },\n ticks(count = 5): Date[] {\n if (!Number.isFinite(d0) || !Number.isFinite(d1)) return []\n const lo = Math.min(d0, d1)\n const hi = Math.max(d0, d1)\n if (lo === hi) return [new Date(lo)]\n const step = interval(count)\n const out: Date[] = []\n let t = cal.floor(new Date(lo), step)\n if (t.getTime() < lo) t = cal.next(t, step)\n while (t.getTime() <= hi && out.length < 1000) {\n out.push(t)\n t = cal.next(t, step)\n }\n return d1 < d0 ? out.reverse() : out\n },\n tickFormat(count = 5, locale?: Locale): (date: Date) => string {\n const { unit } = interval(count)\n const [primary, above] = FORMATS[unit]\n const tz = utc ? { timeZone: 'UTC' } : {}\n const main = getDateFormat(locale, { ...primary, ...tz })\n const upper = above ? getDateFormat(locale, { ...above, ...tz }) : null\n return (date) => (upper && cal.boundary(date, unit) ? upper : main).format(date)\n },\n nice(count = 5): TimeScale {\n if (span === 0 || !Number.isFinite(span)) return time(domain, range, options)\n const step = interval(count)\n const lo = cal.floor(new Date(Math.min(d0, d1)), step)\n let hi = cal.floor(new Date(Math.max(d0, d1)), step)\n if (hi.getTime() < Math.max(d0, d1)) hi = cal.next(hi, step)\n return time(d1 < d0 ? [hi, lo] : [lo, hi], range, options)\n },\n })\n}\n\n/**\n * A point scale over time for category charts: each category sits at its\n * real distance in time. Conforms to `BandScale` (zero bandwidth), so line\n * and area charts and their hit testing work unchanged. `stamps` must be\n * ascending; `keys` are the categories' keys.\n */\nexport function timePointScale(\n stamps: readonly number[],\n keys: readonly BandKey[],\n range: readonly [number, number],\n utc: boolean,\n): { scale: BandScale; time: TimeScale } {\n // Spreading large arrays into Math.min/max overflows the stack, so scan.\n const [lo, hi] = extent(stamps) ?? [0, 1]\n const valid = stamps.filter((t) => Number.isFinite(t))\n const t = time([lo, hi], range, { utc })\n const positions = stamps.map((ms) => t(ms))\n const at = (i: number): number => positions[i] ?? range[0]\n const scale = Object.assign((key: BandKey) => positions[keys.indexOf(key)], {\n domain: keys.slice(),\n range,\n bandwidth: 0,\n step: valid.length > 1 ? (range[1] - range[0]) / (valid.length - 1) : 0,\n at,\n center: (key: BandKey) => positions[keys.indexOf(key)],\n indexAt(pixel: number): number {\n // Stamps are sorted, so the nearest position is found by binary search.\n if (positions.length === 0) return -1\n // (They run down the pixels on a reversed range.)\n const down = range[1] < range[0]\n let a = 0\n let b = positions.length - 1\n while (a < b) {\n const mid = (a + b) >> 1\n if ((positions[mid] as number) < pixel !== down) a = mid + 1\n else b = mid\n }\n const prev = a - 1\n return prev >= 0 &&\n Math.abs(pixel - (positions[prev] as number)) < Math.abs((positions[a] as number) - pixel)\n ? prev\n : a\n },\n })\n return { scale: scale as BandScale, time: t }\n}\n","import type { Tick } from '../components/axis.ts'\nimport type { Locale } from '../format.ts'\nimport type { BandKey } from '../scales/band.ts'\nimport { type TimeScale, timePointScale } from '../scales/time.ts'\nimport { type CategoryAxis, type CategoryAxisOptions, type Label, toMs } from './cartesian.ts'\n\n/**\n * A time category axis: points at their real distance in time, ticks on\n * calendar boundaries labelled for the span (or with `x.format`).\n */\nexport function timeAxis(\n labels: readonly Label[],\n keys: readonly BandKey[],\n options: CategoryAxisOptions,\n count: number,\n locale: Locale,\n): CategoryAxis {\n const stamps = labels.map(toMs)\n const points = (range: readonly [number, number]) =>\n timePointScale(stamps, keys, range, options.utc === true)\n const probe = points([0, 1]).time\n const { format } = options\n const label = format ? (d: Date) => format(d, -1) : probe.tickFormat(count, locale)\n let time: TimeScale = probe\n return {\n // Time ticks come from the scale; their labels are what sits at the edges.\n edges: probe.ticks(count).map(label),\n scale(range) {\n const scaled = points(range)\n time = scaled.time\n return scaled.scale\n },\n ticks: (): Tick[] =>\n time.ticks(count).map((d) => ({ value: d.getTime(), position: time(d), label: label(d) })),\n get time() {\n return time\n },\n }\n}\n"],"mappings":";;;;;AAwCA,MAAM,SAAS;AACf,MAAM,SAAS,KAAK;AACpB,MAAM,OAAO,KAAK;AAClB,MAAM,MAAM,KAAK;AACjB,MAAM,OAAO,IAAI;AACjB,MAAM,QAAQ,KAAK;AACnB,MAAM,OAAO,MAAM;AAEnB,MAAM,YAAwB;CAC5B;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI;CAAO;CACtC;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI,IAAI;CAAO;CAC1C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI;CAAO;CACtC;EAAE,MAAM;EAAU,MAAM;EAAG,IAAI,IAAI;CAAO;CAC1C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAU,MAAM;EAAI,IAAI,KAAK;CAAO;CAC5C;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI;CAAK;CAClC;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI,IAAI;CAAK;CACtC;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI,IAAI;CAAK;CACtC;EAAE,MAAM;EAAQ,MAAM;EAAI,IAAI,KAAK;CAAK;CACxC;EAAE,MAAM;EAAO,MAAM;EAAG,IAAI;CAAI;CAChC;EAAE,MAAM;EAAO,MAAM;EAAG,IAAI,IAAI;CAAI;CACpC;EAAE,MAAM;EAAQ,MAAM;EAAG,IAAI;CAAK;CAClC;EAAE,MAAM;EAAS,MAAM;EAAG,IAAI;CAAM;CACpC;EAAE,MAAM;EAAS,MAA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,IACvF,OACA;GACN;EACF,CACoB;EAAgB,MAAM;CAAE;AAC9C;;;;;;AC7TA,SAAgB,SACd,QACA,MACA,SACA,OACA,QACc;CACd,MAAM,SAAS,OAAO,IAAIA,MAAI;CAC9B,MAAM,UAAU,UACd,eAAe,QAAQ,MAAM,OAAO,QAAQ,QAAQ,IAAI;CAC1D,MAAM,QAAQ,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC7B,MAAM,EAAE,WAAW;CACnB,MAAM,QAAQ,UAAU,MAAY,OAAO,GAAG,EAAE,IAAI,MAAM,WAAW,OAAO,MAAM;CAClF,IAAI,OAAkB;CACtB,OAAO;EAEL,OAAO,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,KAAK;EACnC,MAAM,OAAO;GACX,MAAM,SAAS,OAAO,KAAK;GAC3B,OAAO,OAAO;GACd,OAAO,OAAO;EAChB;EACA,aACE,KAAK,MAAM,KAAK,CAAC,CAAC,KAAK,OAAO;GAAE,OAAO,EAAE,QAAQ;GAAG,UAAU,KAAK,CAAC;GAAG,OAAO,MAAM,CAAC;EAAE,EAAE;EAC3F,IAAI,OAAO;GACT,OAAO;EACT;CACF;AACF"}
|
package/dist/time.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_dates = require("./dates-
|
|
3
|
-
const require_time_axis = require("./time-axis-
|
|
2
|
+
const require_dates = require("./dates-0YNY49KQ.cjs");
|
|
3
|
+
const require_time_axis = require("./time-axis-CVKjQKSS.cjs");
|
|
4
4
|
// src/time.ts
|
|
5
5
|
/**
|
|
6
6
|
* Registers the time axis (`x: { type: 'time' }`):
|
package/dist/time.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as dateLabels } from "./dates-
|
|
2
|
-
import { n as time, r as timePointScale, t as timeAxis } from "./time-axis-
|
|
1
|
+
import { t as dateLabels } from "./dates-CKDRgpin.js";
|
|
2
|
+
import { n as time, r as timePointScale, t as timeAxis } from "./time-axis-CkmbAw4Z.js";
|
|
3
3
|
import { i as register } from "./features-B55rwpQC.js";
|
|
4
4
|
// src/time.ts
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as ChartType } from "./chart-
|
|
1
|
+
import { o as ChartType } from "./chart-Dz4geQZy.cjs";
|
|
2
2
|
import { c as NumberFormat } from "./time-B4oxWHQI.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { n as InsetsInput } from "./layout-CYerDebD.cjs";
|
|
4
4
|
import { a as ClassValue } from "./vnode-Du2cC8Fm.cjs";
|
|
5
5
|
/** A tile of a treemap, or a group of them. */
|
|
6
6
|
interface TreemapNode {
|
|
@@ -14,16 +14,36 @@ interface TreemapNode {
|
|
|
14
14
|
/**
|
|
15
15
|
* Custom color; overrides the palette slot via `--tc-series-color`.
|
|
16
16
|
* Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.
|
|
17
|
+
* Not used when the tiles are shaded by value.
|
|
17
18
|
*/
|
|
18
19
|
color?: string;
|
|
19
20
|
/** Extra classes on the group (top level) or the tile. */
|
|
20
21
|
class?: ClassValue;
|
|
21
|
-
/** Start hidden (top level; toggle it back from the legend). */
|
|
22
|
+
/** Start hidden (top level; toggle it back from the legend, which there is none of when shaded by value). */
|
|
22
23
|
hidden?: boolean;
|
|
23
24
|
}
|
|
24
25
|
interface TreemapOptions {
|
|
25
26
|
/** Tiles, or groups of tiles; each top-level entry takes a palette color and a legend entry. */
|
|
26
27
|
data: readonly TreemapNode[];
|
|
28
|
+
/**
|
|
29
|
+
* `'value'` shades every tile in one hue, `--tc-heat-color`, lighter as
|
|
30
|
+
* the value drops (as a heatmap does), with no legend; `'series'` (the
|
|
31
|
+
* default) gives each top-level entry its palette color.
|
|
32
|
+
*/
|
|
33
|
+
colorBy?: "series" | "value";
|
|
34
|
+
/**
|
|
35
|
+
* A continuous scale through two or more colors (any CSS color, including
|
|
36
|
+
* `var(--tc-…)`), from `min` to `max`; the tiles are then colored by value
|
|
37
|
+
* whatever `colorBy` says. Values that could inject CSS are ignored, as
|
|
38
|
+
* for the colors of the nodes.
|
|
39
|
+
*/
|
|
40
|
+
colors?: readonly string[];
|
|
41
|
+
/** Value shown with the lightest shade (or the first color). Defaults to `0`. */
|
|
42
|
+
min?: number;
|
|
43
|
+
/** Value shown with the full color (or the last color). Defaults to the largest tile. */
|
|
44
|
+
max?: number;
|
|
45
|
+
/** Value placed on the middle color of `colors`. Defaults to halfway. */
|
|
46
|
+
mid?: number;
|
|
27
47
|
/** Space between tiles in pixels. Defaults to `2`. */
|
|
28
48
|
gap?: number;
|
|
29
49
|
/** Corner radius of the tiles. Defaults to `3`. */
|
|
@@ -49,7 +69,9 @@ type TreemapModel = TreemapOptions & {
|
|
|
49
69
|
* Treemap: parts of a whole as tiles, each as large as its value, laid out
|
|
50
70
|
* as close to squares as they go with the largest in the top left corner.
|
|
51
71
|
* Entries with `children` are groups: their tiles stay together and share
|
|
52
|
-
* the group's color.
|
|
72
|
+
* the group's color. `colorBy: 'value'` shades the tiles in one hue instead
|
|
73
|
+
* (`--tc-heat-color`), lighter as the value drops, and `colors` sets a scale
|
|
74
|
+
* of colors for it.
|
|
53
75
|
*
|
|
54
76
|
* ```ts
|
|
55
77
|
* new Chart('#el', {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as ChartType } from "./chart-
|
|
1
|
+
import { o as ChartType } from "./chart-CE9EVbfV.js";
|
|
2
2
|
import { c as NumberFormat } from "./time-DRIDgv2a.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as InsetsInput } from "./layout-CYerDebD.js";
|
|
4
4
|
import { a as ClassValue } from "./vnode-Du2cC8Fm.js";
|
|
5
5
|
/** A tile of a treemap, or a group of them. */
|
|
6
6
|
interface TreemapNode {
|
|
@@ -14,16 +14,36 @@ interface TreemapNode {
|
|
|
14
14
|
/**
|
|
15
15
|
* Custom color; overrides the palette slot via `--tc-series-color`.
|
|
16
16
|
* Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.
|
|
17
|
+
* Not used when the tiles are shaded by value.
|
|
17
18
|
*/
|
|
18
19
|
color?: string;
|
|
19
20
|
/** Extra classes on the group (top level) or the tile. */
|
|
20
21
|
class?: ClassValue;
|
|
21
|
-
/** Start hidden (top level; toggle it back from the legend). */
|
|
22
|
+
/** Start hidden (top level; toggle it back from the legend, which there is none of when shaded by value). */
|
|
22
23
|
hidden?: boolean;
|
|
23
24
|
}
|
|
24
25
|
interface TreemapOptions {
|
|
25
26
|
/** Tiles, or groups of tiles; each top-level entry takes a palette color and a legend entry. */
|
|
26
27
|
data: readonly TreemapNode[];
|
|
28
|
+
/**
|
|
29
|
+
* `'value'` shades every tile in one hue, `--tc-heat-color`, lighter as
|
|
30
|
+
* the value drops (as a heatmap does), with no legend; `'series'` (the
|
|
31
|
+
* default) gives each top-level entry its palette color.
|
|
32
|
+
*/
|
|
33
|
+
colorBy?: "series" | "value";
|
|
34
|
+
/**
|
|
35
|
+
* A continuous scale through two or more colors (any CSS color, including
|
|
36
|
+
* `var(--tc-…)`), from `min` to `max`; the tiles are then colored by value
|
|
37
|
+
* whatever `colorBy` says. Values that could inject CSS are ignored, as
|
|
38
|
+
* for the colors of the nodes.
|
|
39
|
+
*/
|
|
40
|
+
colors?: readonly string[];
|
|
41
|
+
/** Value shown with the lightest shade (or the first color). Defaults to `0`. */
|
|
42
|
+
min?: number;
|
|
43
|
+
/** Value shown with the full color (or the last color). Defaults to the largest tile. */
|
|
44
|
+
max?: number;
|
|
45
|
+
/** Value placed on the middle color of `colors`. Defaults to halfway. */
|
|
46
|
+
mid?: number;
|
|
27
47
|
/** Space between tiles in pixels. Defaults to `2`. */
|
|
28
48
|
gap?: number;
|
|
29
49
|
/** Corner radius of the tiles. Defaults to `3`. */
|
|
@@ -49,7 +69,9 @@ type TreemapModel = TreemapOptions & {
|
|
|
49
69
|
* Treemap: parts of a whole as tiles, each as large as its value, laid out
|
|
50
70
|
* as close to squares as they go with the largest in the top left corner.
|
|
51
71
|
* Entries with `children` are groups: their tiles stay together and share
|
|
52
|
-
* the group's color.
|
|
72
|
+
* the group's color. `colorBy: 'value'` shades the tiles in one hue instead
|
|
73
|
+
* (`--tc-heat-color`), lighter as the value drops, and `colors` sets a scale
|
|
74
|
+
* of colors for it.
|
|
53
75
|
*
|
|
54
76
|
* ```ts
|
|
55
77
|
* new Chart('#el', {
|