@tabler/charts 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -4
- package/dist/{annotations-D0YQ0IoA.js → annotations-BQ8l-qHs.js} +3 -3
- package/dist/{annotations-D0YQ0IoA.js.map → annotations-BQ8l-qHs.js.map} +1 -1
- package/dist/{annotations-DdRdeBUB.cjs → annotations-CpCWA29b.cjs} +3 -3
- package/dist/{annotations-DdRdeBUB.cjs.map → annotations-CpCWA29b.cjs.map} +1 -1
- package/dist/annotations.cjs +2 -2
- package/dist/annotations.js +2 -2
- package/dist/{area-d11XePuw.d.ts → area-DEFQm_SQ.d.ts} +2 -2
- package/dist/{area-4eRs3c0K.cjs → area-DYdQ_sMV.cjs} +3 -3
- package/dist/{area-4eRs3c0K.cjs.map → area-DYdQ_sMV.cjs.map} +1 -1
- package/dist/{area-0-L1bG9B.js → area-WdtfqvhX.js} +3 -3
- package/dist/{area-0-L1bG9B.js.map → area-WdtfqvhX.js.map} +1 -1
- package/dist/{area-CJX9219z.d.cts → area-h_FvieFb.d.cts} +2 -2
- package/dist/area.cjs +1 -1
- package/dist/area.d.cts +1 -1
- package/dist/area.d.ts +1 -1
- package/dist/area.js +1 -1
- package/dist/axis-MMaVoSWB.js +235 -0
- package/dist/axis-MMaVoSWB.js.map +1 -0
- package/dist/axis-YfAerNBA.cjs +300 -0
- package/dist/axis-YfAerNBA.cjs.map +1 -0
- package/dist/{bar-BNZ3GhIw.js → bar-BOcRcArc.js} +74 -56
- package/dist/bar-BOcRcArc.js.map +1 -0
- package/dist/{bar-Da6dE_nI.cjs → bar-CVkOJ7WA.cjs} +76 -58
- package/dist/bar-CVkOJ7WA.cjs.map +1 -0
- package/dist/{bar-B5n2oq9-.js → bar-CgpC2EpX.js} +2 -2
- package/dist/{bar-B5n2oq9-.js.map → bar-CgpC2EpX.js.map} +1 -1
- package/dist/{bar-XwzM6Pb0.d.ts → bar-D9B_arKf.d.ts} +1 -1
- package/dist/{bar-BDLR4p9c.d.cts → bar-DZCQ-kyf.d.cts} +2 -2
- package/dist/{bar-LYIF8MEz.cjs → bar-wVykm1us.cjs} +2 -2
- package/dist/{bar-LYIF8MEz.cjs.map → bar-wVykm1us.cjs.map} +1 -1
- package/dist/bar.cjs +1 -1
- package/dist/bar.d.cts +1 -1
- package/dist/bar.d.ts +1 -1
- package/dist/bar.js +1 -1
- package/dist/calendar-BSvO8nRb.d.cts +106 -0
- package/dist/calendar-BXgIX5H1.js +502 -0
- package/dist/calendar-BXgIX5H1.js.map +1 -0
- package/dist/calendar-Bq3vFzPl.d.ts +106 -0
- package/dist/calendar-DAFXjV99.cjs +507 -0
- package/dist/calendar-DAFXjV99.cjs.map +1 -0
- package/dist/calendar.cjs +3 -0
- package/dist/calendar.d.cts +3 -0
- package/dist/calendar.d.ts +3 -0
- package/dist/calendar.js +1 -0
- package/dist/{candlestick-D0xKkdqd.d.ts → candlestick-B3WcLzph.d.ts} +1 -1
- package/dist/{candlestick-Dq7qp-F0.d.cts → candlestick-BcomxeVG.d.cts} +1 -1
- package/dist/{candlestick-BHQkQfxH.js → candlestick-BtT9glp9.js} +16 -14
- package/dist/{candlestick-BHQkQfxH.js.map → candlestick-BtT9glp9.js.map} +1 -1
- package/dist/{candlestick-CYCQXgky.cjs → candlestick-CSmRuZ4v.cjs} +16 -14
- package/dist/{candlestick-CYCQXgky.cjs.map → candlestick-CSmRuZ4v.cjs.map} +1 -1
- package/dist/candlestick.cjs +3 -3
- package/dist/candlestick.d.cts +1 -1
- package/dist/candlestick.d.ts +1 -1
- package/dist/candlestick.js +3 -3
- package/dist/{cartesian-CI2x6N7N.js → cartesian-BrPqb5Qn.js} +122 -248
- package/dist/cartesian-BrPqb5Qn.js.map +1 -0
- package/dist/{cartesian-DV02PsBe.cjs → cartesian-DRSXHxWe.cjs} +146 -308
- package/dist/cartesian-DRSXHxWe.cjs.map +1 -0
- package/dist/{chart-DWn9v6qw.js → chart-B6TTY4Kr.js} +94 -62
- package/dist/chart-B6TTY4Kr.js.map +1 -0
- package/dist/{chart-QilhWP8Z.d.ts → chart-CYrrUCi3.d.ts} +193 -56
- package/dist/{chart-kqFMEwDo.d.cts → chart-CbPzP5Dp.d.cts} +193 -56
- package/dist/{chart-e2VqomCI.cjs → chart-D_lyOy-M.cjs} +106 -68
- package/dist/chart-D_lyOy-M.cjs.map +1 -0
- package/dist/{core-PAX5ogLk.d.cts → core-9BnLEW4K.d.cts} +24 -20
- package/dist/{core-DRUCk67j.d.ts → core-C3qEppSm.d.ts} +7 -6
- package/dist/{core-BKRQvPAT.js → core-CQ0FaJ4G.js} +112 -65
- package/dist/core-CQ0FaJ4G.js.map +1 -0
- package/dist/{core-DIOC61up.cjs → core-D2PSked3.cjs} +113 -66
- package/dist/core-D2PSked3.cjs.map +1 -0
- package/dist/core.cjs +41 -31
- package/dist/core.d.cts +20 -17
- package/dist/core.d.ts +20 -17
- package/dist/core.js +27 -23
- package/dist/{dates-C2RzY3rE.js → dates-DLe2Ww64.js} +2 -2
- package/dist/{dates-C2RzY3rE.js.map → dates-DLe2Ww64.js.map} +1 -1
- package/dist/{dates-DurEr9WT.cjs → dates-DerXTb1J.cjs} +2 -2
- package/dist/{dates-DurEr9WT.cjs.map → dates-DerXTb1J.cjs.map} +1 -1
- package/dist/decimate.cjs +1 -1
- package/dist/decimate.js +1 -1
- package/dist/{dom-D_g13XWY.cjs → dom-C33zvtPo.cjs} +3 -7
- package/dist/dom-C33zvtPo.cjs.map +1 -0
- package/dist/{dom-CuceR8gt.js → dom-CTse6Rvd.js} +3 -7
- package/dist/dom-CTse6Rvd.js.map +1 -0
- package/dist/{export-chart-mYgEfK-L.cjs → export-chart-CPtXmZvi.cjs} +17 -12
- package/dist/export-chart-CPtXmZvi.cjs.map +1 -0
- package/dist/{export-chart-83UYH48t.js → export-chart-DoeiAyR2.js} +17 -12
- package/dist/export-chart-DoeiAyR2.js.map +1 -0
- package/dist/export.cjs +2 -2
- package/dist/export.d.cts +1 -1
- package/dist/export.d.ts +1 -1
- package/dist/export.js +2 -2
- package/dist/{fade-GGxcBdss.js → fade-CDrQjnDz.js} +56 -78
- package/dist/fade-CDrQjnDz.js.map +1 -0
- package/dist/{fade-DVTkhrFU.cjs → fade-CRqcKMWY.cjs} +56 -78
- package/dist/fade-CRqcKMWY.cjs.map +1 -0
- package/dist/{features-BMxkqCyS.js → features-B55rwpQC.js} +4 -2
- package/dist/features-B55rwpQC.js.map +1 -0
- package/dist/{features-DCXEvoya.cjs → features-DEDP5CEQ.cjs} +9 -1
- package/dist/features-DEDP5CEQ.cjs.map +1 -0
- package/dist/fit-BPyPRnsK.js +16 -0
- package/dist/fit-BPyPRnsK.js.map +1 -0
- package/dist/fit-D4MIIQQz.cjs +21 -0
- package/dist/fit-D4MIIQQz.cjs.map +1 -0
- package/dist/funnel-BdcfUkb5.d.ts +50 -0
- package/dist/funnel-CFEEulw_.cjs +244 -0
- package/dist/funnel-CFEEulw_.cjs.map +1 -0
- package/dist/funnel-CYCv8cq2.js +239 -0
- package/dist/funnel-CYCv8cq2.js.map +1 -0
- package/dist/funnel-CarOh8w_.d.cts +50 -0
- package/dist/funnel.cjs +3 -0
- package/dist/funnel.d.cts +3 -0
- package/dist/funnel.d.ts +3 -0
- package/dist/funnel.js +1 -0
- package/dist/{gauge-DXkjXNCD.cjs → gauge-6HfDcLMJ.cjs} +28 -28
- package/dist/gauge-6HfDcLMJ.cjs.map +1 -0
- package/dist/{gauge-ts0kqN1-.js → gauge-DiTk5aWO.js} +28 -28
- package/dist/gauge-DiTk5aWO.js.map +1 -0
- package/dist/{gauge-BSist7My.d.cts → gauge-Ds9k1UV2.d.cts} +1 -1
- package/dist/{gauge-0VJuAHWF.d.ts → gauge-Zy25jfps.d.ts} +1 -1
- package/dist/gauge.cjs +1 -1
- package/dist/gauge.d.cts +1 -1
- package/dist/gauge.d.ts +1 -1
- package/dist/gauge.js +1 -1
- package/dist/{heatmap-19BGJTKF.js → heatmap-C1v8bwpq.js} +35 -33
- package/dist/heatmap-C1v8bwpq.js.map +1 -0
- package/dist/{heatmap-Dp_oyEe0.d.cts → heatmap-CJ-0dfhJ.d.cts} +1 -1
- package/dist/{heatmap-CXhlrLTl.cjs → heatmap-Dcc_bsoQ.cjs} +39 -37
- package/dist/heatmap-Dcc_bsoQ.cjs.map +1 -0
- package/dist/{heatmap-59lmClj9.d.ts → heatmap-Jp5sHRTo.d.ts} +1 -1
- package/dist/heatmap.cjs +1 -1
- package/dist/heatmap.d.cts +1 -1
- package/dist/heatmap.d.ts +1 -1
- package/dist/heatmap.js +1 -1
- package/dist/{hydrate-OA6R2_Pn.js → hydrate-BB3MlR36.js} +2 -2
- package/dist/{hydrate-OA6R2_Pn.js.map → hydrate-BB3MlR36.js.map} +1 -1
- package/dist/{hydrate-CmN1k8Mo.cjs → hydrate-m0I5m6ue.cjs} +2 -2
- package/dist/{hydrate-CmN1k8Mo.cjs.map → hydrate-m0I5m6ue.cjs.map} +1 -1
- package/dist/hydrate.cjs +2 -2
- package/dist/hydrate.js +2 -2
- package/dist/index.cjs +55 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -18
- package/dist/index.d.ts +21 -18
- package/dist/index.js +41 -34
- package/dist/index.js.map +1 -1
- package/dist/interaction-DXYSjgnP.cjs +32 -0
- package/dist/interaction-DXYSjgnP.cjs.map +1 -0
- package/dist/interaction-En1KlwFO.js +21 -0
- package/dist/interaction-En1KlwFO.js.map +1 -0
- package/dist/{layout-JY2aR-yE.cjs → layout-Cfg9x1k2.cjs} +32 -1
- package/dist/layout-Cfg9x1k2.cjs.map +1 -0
- package/dist/{layout-DmrrLjwN.js → layout-DqAte3H8.js} +27 -2
- package/dist/layout-DqAte3H8.js.map +1 -0
- package/dist/{line-DtSh7HQU.d.ts → line-Bpr5uVLQ.d.ts} +1 -1
- package/dist/{line-DO66LtwH.js → line-CxR4tg1Q.js} +46 -34
- package/dist/line-CxR4tg1Q.js.map +1 -0
- package/dist/{line-Dbt6KFRK.cjs → line-YiCuhVMI.cjs} +46 -34
- package/dist/line-YiCuhVMI.cjs.map +1 -0
- package/dist/{line-_rNdeKmS.d.cts → line-vyWO030v.d.cts} +2 -3
- package/dist/line.cjs +3 -3
- package/dist/line.d.cts +1 -1
- package/dist/line.d.ts +1 -1
- package/dist/line.js +3 -3
- package/dist/log.cjs +1 -1
- package/dist/log.js +1 -1
- package/dist/map-49FcfdmJ.d.cts +156 -0
- package/dist/map-BMC61J-P.d.ts +156 -0
- package/dist/map-BqrZ80vT.cjs +818 -0
- package/dist/map-BqrZ80vT.cjs.map +1 -0
- package/dist/map-C15NC7kW.js +807 -0
- package/dist/map-C15NC7kW.js.map +1 -0
- package/dist/map.cjs +4 -0
- package/dist/map.d.cts +3 -0
- package/dist/map.d.ts +3 -0
- package/dist/map.js +1 -0
- package/dist/maps/world.cjs +875 -0
- package/dist/maps/world.cjs.map +1 -0
- package/dist/maps/world.d.cts +2 -0
- package/dist/maps/world.d.ts +2 -0
- package/dist/maps/world.js +874 -0
- package/dist/maps/world.js.map +1 -0
- package/dist/{morph-9_LJL0ra.cjs → morph-3I1Nf_tR.cjs} +2 -2
- package/dist/{morph-9_LJL0ra.cjs.map → morph-3I1Nf_tR.cjs.map} +1 -1
- package/dist/{morph-DnRxuwR-.js → morph-GfBab-b3.js} +2 -2
- package/dist/{morph-DnRxuwR-.js.map → morph-GfBab-b3.js.map} +1 -1
- package/dist/morph.cjs +2 -2
- package/dist/morph.js +2 -2
- package/dist/{others-J7NCAMA0.js → others-DBIGE6jr.js} +11 -3
- package/dist/others-DBIGE6jr.js.map +1 -0
- package/dist/others-DBO4Kjwl.d.ts +29 -0
- package/dist/{others-DWdK7vKp.cjs → others-WfjCsjqT.cjs} +14 -6
- package/dist/others-WfjCsjqT.cjs.map +1 -0
- package/dist/others-ls5eKtZ4.d.cts +31 -0
- package/dist/{parliament-Cru4IcuM.js → parliament-BKN6ikBJ.js} +30 -29
- package/dist/parliament-BKN6ikBJ.js.map +1 -0
- package/dist/{parliament-CgsVnWEe.d.cts → parliament-C7V8UJj1.d.cts} +1 -1
- package/dist/{parliament-CLCI7tUO.d.ts → parliament-Cz9n_DoK.d.ts} +1 -1
- package/dist/{parliament-x5hcFaQ3.cjs → parliament-DhxAaIZ3.cjs} +30 -29
- package/dist/parliament-DhxAaIZ3.cjs.map +1 -0
- package/dist/parliament.cjs +1 -1
- package/dist/parliament.d.cts +1 -1
- package/dist/parliament.d.ts +1 -1
- package/dist/parliament.js +1 -1
- package/dist/{patterns-CufKZYhm.js → patterns-BMUINoka.js} +2 -2
- package/dist/{patterns-CufKZYhm.js.map → patterns-BMUINoka.js.map} +1 -1
- package/dist/{patterns-D3-wQagb.cjs → patterns-Dw7OMD_2.cjs} +2 -2
- package/dist/{patterns-D3-wQagb.cjs.map → patterns-Dw7OMD_2.cjs.map} +1 -1
- package/dist/patterns.cjs +2 -2
- package/dist/patterns.d.cts +1 -1
- package/dist/patterns.d.ts +1 -1
- package/dist/patterns.js +2 -2
- package/dist/{percentage-bar-ybNS3goo.cjs → percentage-bar-BChkTRoz.cjs} +37 -35
- package/dist/percentage-bar-BChkTRoz.cjs.map +1 -0
- package/dist/{percentage-bar-B6tNOqNn.js → percentage-bar-CaInxrL8.js} +37 -35
- package/dist/percentage-bar-CaInxrL8.js.map +1 -0
- package/dist/{percentage-bar-tepMr7Hd.d.cts → percentage-bar-R1--2grK.d.cts} +10 -14
- package/dist/{percentage-bar-nhTeakD_.d.ts → percentage-bar-cSeiLdwU.d.ts} +10 -14
- package/dist/percentage-bar.cjs +1 -1
- package/dist/percentage-bar.d.cts +1 -1
- package/dist/percentage-bar.d.ts +1 -1
- package/dist/percentage-bar.js +1 -1
- package/dist/{pie-CFptILSm.d.ts → pie-BQQkvy1N.d.ts} +7 -13
- package/dist/{pie-CVsc-6qD.js → pie-Bd8wyrtY.js} +45 -44
- package/dist/pie-Bd8wyrtY.js.map +1 -0
- package/dist/{pie-BpjvSPnz.cjs → pie-BseZlCgP.cjs} +45 -44
- package/dist/pie-BseZlCgP.cjs.map +1 -0
- package/dist/{pie-BXg2gNpb.d.cts → pie-vD5-g8je.d.cts} +7 -13
- package/dist/pie.cjs +1 -1
- package/dist/pie.d.cts +1 -1
- package/dist/pie.d.ts +1 -1
- package/dist/pie.js +1 -1
- package/dist/{point-shapes--_gmdTyK.cjs → point-shapes-BRawRM78.cjs} +23 -22
- package/dist/point-shapes-BRawRM78.cjs.map +1 -0
- package/dist/{point-shapes-DD2Ektzm.js → point-shapes-DI6GhcI7.js} +18 -23
- package/dist/point-shapes-DI6GhcI7.js.map +1 -0
- package/dist/point-shapes.cjs +6 -4
- package/dist/point-shapes.cjs.map +1 -1
- package/dist/point-shapes.d.cts +2 -2
- package/dist/point-shapes.d.ts +2 -2
- package/dist/point-shapes.js +7 -5
- package/dist/point-shapes.js.map +1 -1
- package/dist/{radar-D1-lItDy.d.cts → radar-7I6hsY_h.d.cts} +1 -1
- package/dist/{radar-BR-mumDd.js → radar-D6XqkFWQ.js} +21 -22
- package/dist/radar-D6XqkFWQ.js.map +1 -0
- package/dist/{radar-HPDrIdzc.cjs → radar-DjISDnSf.cjs} +22 -23
- package/dist/radar-DjISDnSf.cjs.map +1 -0
- package/dist/{radar-BC9Skgpj.d.ts → radar-vLxilcr4.d.ts} +1 -1
- package/dist/radar.cjs +1 -1
- package/dist/radar.d.cts +1 -1
- package/dist/radar.d.ts +1 -1
- package/dist/radar.js +1 -1
- package/dist/{rect-DSVmUZrD.js → rect-CZTNvMlf.js} +2 -2
- package/dist/{rect-DSVmUZrD.js.map → rect-CZTNvMlf.js.map} +1 -1
- package/dist/{rect-D6VhynBM.cjs → rect-DPr9QRxl.cjs} +2 -2
- package/dist/{rect-D6VhynBM.cjs.map → rect-DPr9QRxl.cjs.map} +1 -1
- package/dist/{sankey-fCoo1cpz.cjs → sankey-0CSp_Er9.cjs} +72 -71
- package/dist/sankey-0CSp_Er9.cjs.map +1 -0
- package/dist/{sankey-D_v7KxnJ.d.ts → sankey-7As41Fo4.d.ts} +1 -1
- package/dist/{sankey-D6JeZfK5.js → sankey-Dp4CuLVe.js} +72 -71
- package/dist/sankey-Dp4CuLVe.js.map +1 -0
- package/dist/{sankey-Dk7jUt8x.d.cts → sankey-DqiuxUx7.d.cts} +1 -1
- package/dist/sankey.cjs +1 -1
- package/dist/sankey.d.cts +1 -1
- package/dist/sankey.d.ts +1 -1
- package/dist/sankey.js +1 -1
- package/dist/{scatter-CXEsioOJ.d.ts → scatter-BXkXGgM_.d.ts} +7 -1
- package/dist/{scatter-DVqB_fP9.cjs → scatter-Bwkblr4L.cjs} +40 -38
- package/dist/scatter-Bwkblr4L.cjs.map +1 -0
- package/dist/{scatter-C0TWjFpW.js → scatter-DCMAtt5L.js} +38 -36
- package/dist/scatter-DCMAtt5L.js.map +1 -0
- package/dist/{scatter-DZeEIfyo.d.cts → scatter-DL0zAV09.d.cts} +7 -1
- package/dist/scatter.cjs +1 -1
- package/dist/scatter.d.cts +1 -1
- package/dist/scatter.d.ts +1 -1
- package/dist/scatter.js +1 -1
- package/dist/{sparkline-cbvRkWqS.d.ts → sparkline-BElUSd0r.d.ts} +1 -1
- package/dist/{sparkline-B39NA0Mi.cjs → sparkline-BMSuEPHP.cjs} +13 -15
- package/dist/sparkline-BMSuEPHP.cjs.map +1 -0
- package/dist/{sparkline-XO_TqCNP.js → sparkline-NDmq90kP.js} +13 -15
- package/dist/sparkline-NDmq90kP.js.map +1 -0
- package/dist/{sparkline-DAP6jtzw.d.cts → sparkline-RYly7bR0.d.cts} +1 -1
- package/dist/sparkline.cjs +1 -1
- package/dist/sparkline.d.cts +1 -1
- package/dist/sparkline.d.ts +1 -1
- package/dist/sparkline.js +1 -1
- package/dist/{stack-BgPzoQmv.cjs → stack-BO4624CY.cjs} +2 -2
- package/dist/{stack-BgPzoQmv.cjs.map → stack-BO4624CY.cjs.map} +1 -1
- package/dist/{stack-Dagxq7l2.d.cts → stack-BTWYIwLO.d.cts} +1 -1
- package/dist/{stack-2H2Gfs1Q.js → stack-jVKvg2x_.js} +2 -2
- package/dist/{stack-2H2Gfs1Q.js.map → stack-jVKvg2x_.js.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/{time-axis-BjZ1bYTK.cjs → time-axis-B3VekUfX.cjs} +4 -3
- package/dist/{time-axis-BjZ1bYTK.cjs.map → time-axis-B3VekUfX.cjs.map} +1 -1
- package/dist/{time-axis-FLONo54E.js → time-axis-CLjqOakA.js} +3 -2
- package/dist/{time-axis-FLONo54E.js.map → time-axis-CLjqOakA.js.map} +1 -1
- package/dist/time.cjs +3 -3
- package/dist/time.js +3 -3
- package/dist/{treemap-BAkhmVQc.d.cts → treemap-25vHO_UK.d.cts} +12 -2
- package/dist/{treemap-BNpxFBao.d.ts → treemap-BCXUbixd.d.ts} +12 -2
- package/dist/{treemap-CQdavQ9u.js → treemap-C4glsx-g.js} +20 -25
- package/dist/treemap-C4glsx-g.js.map +1 -0
- package/dist/{treemap-BWpEUlDh.cjs → treemap-CZk8kKFD.cjs} +21 -26
- package/dist/treemap-CZk8kKFD.cjs.map +1 -0
- package/dist/treemap.cjs +1 -1
- package/dist/treemap.d.cts +1 -1
- package/dist/treemap.d.ts +1 -1
- package/dist/treemap.js +1 -1
- package/dist/{value-labels-BBuSi4i0.js → value-labels-C7GrhOXJ.js} +25 -5
- package/dist/value-labels-C7GrhOXJ.js.map +1 -0
- package/dist/{value-labels-BV9keAuL.cjs → value-labels-DzaKIWKp.cjs} +25 -5
- package/dist/value-labels-DzaKIWKp.cjs.map +1 -0
- package/dist/value-labels.cjs +2 -2
- package/dist/value-labels.d.cts +1 -1
- package/dist/value-labels.d.ts +1 -1
- package/dist/value-labels.js +2 -2
- package/package.json +93 -233
- package/dist/bar-BNZ3GhIw.js.map +0 -1
- package/dist/bar-Da6dE_nI.cjs.map +0 -1
- package/dist/cartesian-CI2x6N7N.js.map +0 -1
- package/dist/cartesian-DV02PsBe.cjs.map +0 -1
- package/dist/chart-DWn9v6qw.js.map +0 -1
- package/dist/chart-e2VqomCI.cjs.map +0 -1
- package/dist/core-BKRQvPAT.js.map +0 -1
- package/dist/core-DIOC61up.cjs.map +0 -1
- package/dist/dom-CuceR8gt.js.map +0 -1
- package/dist/dom-D_g13XWY.cjs.map +0 -1
- package/dist/export-chart-83UYH48t.js.map +0 -1
- package/dist/export-chart-mYgEfK-L.cjs.map +0 -1
- package/dist/fade-DVTkhrFU.cjs.map +0 -1
- package/dist/fade-GGxcBdss.js.map +0 -1
- package/dist/features-BMxkqCyS.js.map +0 -1
- package/dist/features-DCXEvoya.cjs.map +0 -1
- package/dist/gauge-DXkjXNCD.cjs.map +0 -1
- package/dist/gauge-ts0kqN1-.js.map +0 -1
- package/dist/heatmap-19BGJTKF.js.map +0 -1
- package/dist/heatmap-CXhlrLTl.cjs.map +0 -1
- package/dist/layout-DmrrLjwN.js.map +0 -1
- package/dist/layout-JY2aR-yE.cjs.map +0 -1
- package/dist/line-DO66LtwH.js.map +0 -1
- package/dist/line-Dbt6KFRK.cjs.map +0 -1
- package/dist/others-DWdK7vKp.cjs.map +0 -1
- package/dist/others-J7NCAMA0.js.map +0 -1
- package/dist/parliament-Cru4IcuM.js.map +0 -1
- package/dist/parliament-x5hcFaQ3.cjs.map +0 -1
- package/dist/percentage-bar-B6tNOqNn.js.map +0 -1
- package/dist/percentage-bar-ybNS3goo.cjs.map +0 -1
- package/dist/pie-BpjvSPnz.cjs.map +0 -1
- package/dist/pie-CVsc-6qD.js.map +0 -1
- package/dist/point-shapes--_gmdTyK.cjs.map +0 -1
- package/dist/point-shapes-DD2Ektzm.js.map +0 -1
- package/dist/radar-BR-mumDd.js.map +0 -1
- package/dist/radar-HPDrIdzc.cjs.map +0 -1
- package/dist/sankey-D6JeZfK5.js.map +0 -1
- package/dist/sankey-fCoo1cpz.cjs.map +0 -1
- package/dist/scatter-C0TWjFpW.js.map +0 -1
- package/dist/scatter-DVqB_fP9.cjs.map +0 -1
- package/dist/sparkline-B39NA0Mi.cjs.map +0 -1
- package/dist/sparkline-XO_TqCNP.js.map +0 -1
- package/dist/treemap-BWpEUlDh.cjs.map +0 -1
- package/dist/treemap-CQdavQ9u.js.map +0 -1
- package/dist/value-labels-BBuSi4i0.js.map +0 -1
- package/dist/value-labels-BV9keAuL.cjs.map +0 -1
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { i as formatTicks } from "./format-it1kepFG.js";
|
|
2
|
+
import { n as estimateTextWidth, s as round, t as LINE_HEIGHT } from "./layout-DqAte3H8.js";
|
|
3
|
+
import { t as h } from "./vnode-_EMUqysL.js";
|
|
4
|
+
// src/scales/ticks.ts
|
|
5
|
+
const E10 = Math.sqrt(50);
|
|
6
|
+
const E5 = Math.sqrt(10);
|
|
7
|
+
const E2 = Math.sqrt(2);
|
|
8
|
+
/**
|
|
9
|
+
* Integer tick indices `[i1, i2]` and an increment `inc`. A negative `inc`
|
|
10
|
+
* means "divide by -inc", which keeps decimal ticks exact (0.3, not
|
|
11
|
+
* 0.30000000000000004).
|
|
12
|
+
*/
|
|
13
|
+
function tickSpec(start, stop, count) {
|
|
14
|
+
const step = (stop - start) / Math.max(0, count);
|
|
15
|
+
const power = Math.floor(Math.log10(step));
|
|
16
|
+
const error = step / 10 ** power;
|
|
17
|
+
const factor = error >= E10 ? 10 : error >= E5 ? 5 : error >= E2 ? 2 : 1;
|
|
18
|
+
let i1;
|
|
19
|
+
let i2;
|
|
20
|
+
let inc;
|
|
21
|
+
if (power < 0) {
|
|
22
|
+
inc = 10 ** -power / factor;
|
|
23
|
+
i1 = Math.round(start * inc);
|
|
24
|
+
i2 = Math.round(stop * inc);
|
|
25
|
+
if (i1 / inc < start) ++i1;
|
|
26
|
+
if (i2 / inc > stop) --i2;
|
|
27
|
+
inc = -inc;
|
|
28
|
+
} else {
|
|
29
|
+
inc = 10 ** power * factor;
|
|
30
|
+
i1 = Math.round(start / inc);
|
|
31
|
+
i2 = Math.round(stop / inc);
|
|
32
|
+
if (i1 * inc < start) ++i1;
|
|
33
|
+
if (i2 * inc > stop) --i2;
|
|
34
|
+
}
|
|
35
|
+
if (i2 < i1 && count >= .5 && count < 2) return tickSpec(start, stop, count * 2);
|
|
36
|
+
return [
|
|
37
|
+
i1,
|
|
38
|
+
i2,
|
|
39
|
+
inc
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Roughly `count` evenly spaced, "nice" values (multiples of 1, 2 or 5 × 10ⁿ)
|
|
44
|
+
* between `start` and `stop`, inclusive. Order follows `start → stop`.
|
|
45
|
+
*/
|
|
46
|
+
function ticks(start, stop, count = 5) {
|
|
47
|
+
if (!(count > 0) || !Number.isFinite(start) || !Number.isFinite(stop)) return [];
|
|
48
|
+
if (start === stop) return [start];
|
|
49
|
+
const reverse = stop < start;
|
|
50
|
+
const [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);
|
|
51
|
+
if (!(i2 >= i1)) return [];
|
|
52
|
+
const n = i2 - i1 + 1;
|
|
53
|
+
const out = new Array(n);
|
|
54
|
+
for (let i = 0; i < n; i++) {
|
|
55
|
+
const index = reverse ? i2 - i : i1 + i;
|
|
56
|
+
out[i] = inc < 0 ? index / -inc : index * inc;
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Signed tick increment: positive values are the step, negative values `-k`
|
|
62
|
+
* mean a step of `1 / k`.
|
|
63
|
+
*/
|
|
64
|
+
function tickIncrement(start, stop, count) {
|
|
65
|
+
return tickSpec(start, stop, count)[2];
|
|
66
|
+
}
|
|
67
|
+
/** Distance between ticks produced by {@link ticks} for the same arguments. */
|
|
68
|
+
function tickStep(start, stop, count = 5) {
|
|
69
|
+
const reverse = stop < start;
|
|
70
|
+
const inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
|
|
71
|
+
return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Extend `[start, stop]` to round tick values, e.g. `[0.2, 9.7] → [0, 10]`.
|
|
75
|
+
* Iterates because rounding can change the ideal step; if the step does not
|
|
76
|
+
* settle (e.g. very low `count` around zero keeps doubling the domain), the
|
|
77
|
+
* domain is returned unchanged, matching d3.
|
|
78
|
+
*/
|
|
79
|
+
function niceDomain(start, stop, count = 5) {
|
|
80
|
+
if (!Number.isFinite(start) || !Number.isFinite(stop) || start === stop || !(count > 0)) return [start, stop];
|
|
81
|
+
const reverse = stop < start;
|
|
82
|
+
let lo = reverse ? stop : start;
|
|
83
|
+
let hi = reverse ? start : stop;
|
|
84
|
+
let prev;
|
|
85
|
+
for (let i = 0; i < 10; i++) {
|
|
86
|
+
const step = tickIncrement(lo, hi, count);
|
|
87
|
+
if (step === prev) return reverse ? [hi, lo] : [lo, hi];
|
|
88
|
+
if (step > 0) {
|
|
89
|
+
lo = Math.floor(lo / step) * step;
|
|
90
|
+
hi = Math.ceil(hi / step) * step;
|
|
91
|
+
} else if (step < 0) {
|
|
92
|
+
lo = Math.ceil(lo * step) / step;
|
|
93
|
+
hi = Math.floor(hi * step) / step;
|
|
94
|
+
} else break;
|
|
95
|
+
prev = step;
|
|
96
|
+
}
|
|
97
|
+
return [start, stop];
|
|
98
|
+
}
|
|
99
|
+
// src/components/axis.ts
|
|
100
|
+
/** Ticks for a linear scale, labelled with a shared precision. */
|
|
101
|
+
function linearTicks(scale, options = {}) {
|
|
102
|
+
const { count = 5, format, locale } = options;
|
|
103
|
+
const [d0, d1] = scale.domain;
|
|
104
|
+
const fmt = formatTicks(tickStep(d0, d1, count), format, locale);
|
|
105
|
+
return scale.ticks(count).map((value) => ({
|
|
106
|
+
value,
|
|
107
|
+
position: scale(value),
|
|
108
|
+
label: fmt(value)
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
/** Ticks at the center of every band. */
|
|
112
|
+
function bandTicks(scale, format = String) {
|
|
113
|
+
return scale.domain.map((key, i) => ({
|
|
114
|
+
value: key,
|
|
115
|
+
position: scale.at(i) + scale.bandwidth / 2,
|
|
116
|
+
label: format(key, i)
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
/** Whether labels are laid out along x (horizontal axes). */
|
|
120
|
+
const isHorizontal = (position) => position === "top" || position === "bottom";
|
|
121
|
+
/**
|
|
122
|
+
* Keep every n-th tick (smallest n) so labels do not overlap along the axis.
|
|
123
|
+
* The first and the last tick are always kept: when the last one does not
|
|
124
|
+
* land on the step, it replaces the last kept tick if they would collide.
|
|
125
|
+
*/
|
|
126
|
+
function thinTicks(ticks, position, fontSize, gap = 8) {
|
|
127
|
+
if (ticks.length < 2) return ticks.slice();
|
|
128
|
+
const size = (tick) => isHorizontal(position) ? estimateTextWidth(tick.label, fontSize) : fontSize * LINE_HEIGHT;
|
|
129
|
+
const sizes = ticks.map(size);
|
|
130
|
+
const fitsBetween = (i, j) => Math.abs(ticks[j].position - ticks[i].position) >= (sizes[i] + sizes[j]) / 2 + gap;
|
|
131
|
+
const last = ticks.length - 1;
|
|
132
|
+
const span = Math.abs(ticks[last].position - ticks[0].position);
|
|
133
|
+
const total = sizes.reduce((sum, size) => sum + size + gap, 0);
|
|
134
|
+
const first = span > 0 ? Math.max(1, Math.floor(total / span)) : last;
|
|
135
|
+
for (let step = first; step <= last; step++) {
|
|
136
|
+
let fits = true;
|
|
137
|
+
for (let i = step; i <= last && fits; i += step) fits = fitsBetween(i - step, i);
|
|
138
|
+
if (!fits) continue;
|
|
139
|
+
const kept = [];
|
|
140
|
+
for (let i = 0; i <= last; i += step) kept.push(i);
|
|
141
|
+
const tail = kept[kept.length - 1];
|
|
142
|
+
if (tail !== last) {
|
|
143
|
+
if (fitsBetween(tail, last)) kept.push(last);
|
|
144
|
+
else if (kept.length > 1 && fitsBetween(kept[kept.length - 2], last)) kept[kept.length - 1] = last;
|
|
145
|
+
}
|
|
146
|
+
return kept.map((i) => ticks[i]);
|
|
147
|
+
}
|
|
148
|
+
return ticks.slice(0, 1);
|
|
149
|
+
}
|
|
150
|
+
/** Pixels an axis occupies perpendicular to the plot edge (for margins). */
|
|
151
|
+
function axisSize(position, ticks, fontSize, options = {}) {
|
|
152
|
+
const { tickSize = 0, tickPadding = 8 } = options;
|
|
153
|
+
if (ticks.length === 0) return 0;
|
|
154
|
+
const labels = isHorizontal(position) ? fontSize * LINE_HEIGHT : ticks.reduce((max, t) => Math.max(max, estimateTextWidth(t.label, fontSize)), 0) + 3;
|
|
155
|
+
return Math.ceil(labels + tickSize + tickPadding);
|
|
156
|
+
}
|
|
157
|
+
/** Space between the tick labels and the axis title. */
|
|
158
|
+
const TITLE_GAP = 6;
|
|
159
|
+
/** Pixels an axis title adds to the axis (for margins): none without a title. */
|
|
160
|
+
const axisTitleSize = (title, fontSize) => title ? Math.ceil(fontSize * LINE_HEIGHT) + TITLE_GAP : 0;
|
|
161
|
+
/**
|
|
162
|
+
* Render the title of an axis as `<text class="tc-axis-title tc-axis-title-{position}">`,
|
|
163
|
+
* past the labels of `ticks` and centered on the plot: along the axis at the
|
|
164
|
+
* bottom, turned 90° beside the plot to read away from it (bottom to top on
|
|
165
|
+
* the left, top to bottom on the right).
|
|
166
|
+
*/
|
|
167
|
+
function axisTitle(position, ticks, area, title, fontSize) {
|
|
168
|
+
const reach = axisSize(position, ticks, fontSize) + TITLE_GAP;
|
|
169
|
+
const sign = position === "left" ? -1 : 1;
|
|
170
|
+
const side = reach + fontSize * LINE_HEIGHT / 2;
|
|
171
|
+
return h("text", {
|
|
172
|
+
key: `axis-title-${position}`,
|
|
173
|
+
class: `tc-axis-title tc-axis-title-${position}`,
|
|
174
|
+
transform: position === "bottom" ? `translate(${round(area.x + area.width / 2)},${round(area.y + area.height + reach)})` : `translate(${round(position === "left" ? area.x - side : area.x + area.width + side)},${round(area.y + area.height / 2)}) rotate(${sign * 90})`,
|
|
175
|
+
dy: position === "bottom" ? "0.71em" : "0.32em",
|
|
176
|
+
"text-anchor": "middle",
|
|
177
|
+
"aria-hidden": "true"
|
|
178
|
+
}, title);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Render an axis as `<g class="tc-axis tc-axis-{x|y} tc-axis-{position}">`
|
|
182
|
+
* with one `<g class="tc-tick">` per tick, keyed by value so ticks can
|
|
183
|
+
* transition when the scale changes.
|
|
184
|
+
*/
|
|
185
|
+
function axis(options) {
|
|
186
|
+
const { position, ticks, area, tickSize = 0, tickPadding = 8, line = false } = options;
|
|
187
|
+
const horizontal = isHorizontal(position);
|
|
188
|
+
const sign = position === "top" || position === "left" ? -1 : 1;
|
|
189
|
+
const offset = sign * (tickSize + tickPadding);
|
|
190
|
+
const edge = position === "top" ? area.y : position === "bottom" ? area.y + area.height : position === "left" ? area.x : area.x + area.width;
|
|
191
|
+
const label = horizontal ? {
|
|
192
|
+
y: offset,
|
|
193
|
+
dy: position === "top" ? "0em" : "0.71em",
|
|
194
|
+
"text-anchor": "middle"
|
|
195
|
+
} : {
|
|
196
|
+
x: offset,
|
|
197
|
+
dy: "0.32em",
|
|
198
|
+
"text-anchor": position === "left" ? "end" : "start"
|
|
199
|
+
};
|
|
200
|
+
const tickLine = horizontal ? { y2: sign * tickSize } : { x2: sign * tickSize };
|
|
201
|
+
return h("g", {
|
|
202
|
+
key: `axis-${position}`,
|
|
203
|
+
class: [
|
|
204
|
+
"tc-axis",
|
|
205
|
+
horizontal ? "tc-axis-x" : "tc-axis-y",
|
|
206
|
+
`tc-axis-${position}`
|
|
207
|
+
],
|
|
208
|
+
"aria-hidden": "true"
|
|
209
|
+
}, line && h("line", horizontal ? {
|
|
210
|
+
class: "tc-axis-line",
|
|
211
|
+
x1: area.x,
|
|
212
|
+
x2: area.x + area.width,
|
|
213
|
+
y1: edge,
|
|
214
|
+
y2: edge
|
|
215
|
+
} : {
|
|
216
|
+
class: "tc-axis-line",
|
|
217
|
+
x1: edge,
|
|
218
|
+
x2: edge,
|
|
219
|
+
y1: area.y,
|
|
220
|
+
y2: area.y + area.height
|
|
221
|
+
}), ticks.map((tick) => h("g", {
|
|
222
|
+
key: tick.value,
|
|
223
|
+
class: "tc-tick",
|
|
224
|
+
style: horizontal ? `transform:translate(${round(tick.position)}px,${round(edge)}px)` : `transform:translate(${round(edge)}px,${round(tick.position)}px)`
|
|
225
|
+
}, tickSize > 0 && h("line", {
|
|
226
|
+
class: "tc-tick-line",
|
|
227
|
+
...tickLine
|
|
228
|
+
}), h("text", {
|
|
229
|
+
class: "tc-tick-label",
|
|
230
|
+
...label
|
|
231
|
+
}, tick.label))));
|
|
232
|
+
}
|
|
233
|
+
export { bandTicks as a, niceDomain as c, ticks as d, axisTitleSize as i, tickIncrement as l, axisSize as n, linearTicks as o, axisTitle as r, thinTicks as s, axis as t, tickStep as u };
|
|
234
|
+
|
|
235
|
+
//# sourceMappingURL=axis-MMaVoSWB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axis-MMaVoSWB.js","names":[],"sources":["../src/scales/ticks.ts","../src/components/axis.ts"],"sourcesContent":["const E10 = Math.sqrt(50)\nconst E5 = Math.sqrt(10)\nconst E2 = Math.sqrt(2)\n\n/**\n * Integer tick indices `[i1, i2]` and an increment `inc`. A negative `inc`\n * means \"divide by -inc\", which keeps decimal ticks exact (0.3, not\n * 0.30000000000000004).\n */\nfunction tickSpec(start: number, stop: number, count: number): [number, number, number] {\n const step = (stop - start) / Math.max(0, count)\n const power = Math.floor(Math.log10(step))\n const error = step / 10 ** power\n const factor = error >= E10 ? 10 : error >= E5 ? 5 : error >= E2 ? 2 : 1\n let i1: number\n let i2: number\n let inc: number\n if (power < 0) {\n inc = 10 ** -power / factor\n i1 = Math.round(start * inc)\n i2 = Math.round(stop * inc)\n if (i1 / inc < start) ++i1\n if (i2 / inc > stop) --i2\n inc = -inc\n } else {\n inc = 10 ** power * factor\n i1 = Math.round(start / inc)\n i2 = Math.round(stop / inc)\n if (i1 * inc < start) ++i1\n if (i2 * inc > stop) --i2\n }\n if (i2 < i1 && count >= 0.5 && count < 2) return tickSpec(start, stop, count * 2)\n return [i1, i2, inc]\n}\n\n/**\n * Roughly `count` evenly spaced, \"nice\" values (multiples of 1, 2 or 5 × 10ⁿ)\n * between `start` and `stop`, inclusive. Order follows `start → stop`.\n */\nexport function ticks(start: number, stop: number, count = 5): number[] {\n if (!(count > 0) || !Number.isFinite(start) || !Number.isFinite(stop)) return []\n if (start === stop) return [start]\n const reverse = stop < start\n const [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count)\n if (!(i2 >= i1)) return []\n const n = i2 - i1 + 1\n const out = new Array<number>(n)\n for (let i = 0; i < n; i++) {\n const index = reverse ? i2 - i : i1 + i\n out[i] = inc < 0 ? index / -inc : index * inc\n }\n return out\n}\n\n/**\n * Signed tick increment: positive values are the step, negative values `-k`\n * mean a step of `1 / k`.\n */\nexport function tickIncrement(start: number, stop: number, count: number): number {\n return tickSpec(start, stop, count)[2]\n}\n\n/** Distance between ticks produced by {@link ticks} for the same arguments. */\nexport function tickStep(start: number, stop: number, count = 5): number {\n const reverse = stop < start\n const inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count)\n return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc)\n}\n\n/**\n * Extend `[start, stop]` to round tick values, e.g. `[0.2, 9.7] → [0, 10]`.\n * Iterates because rounding can change the ideal step; if the step does not\n * settle (e.g. very low `count` around zero keeps doubling the domain), the\n * domain is returned unchanged, matching d3.\n */\nexport function niceDomain(start: number, stop: number, count = 5): [number, number] {\n if (!Number.isFinite(start) || !Number.isFinite(stop) || start === stop || !(count > 0)) {\n return [start, stop]\n }\n const reverse = stop < start\n let lo = reverse ? stop : start\n let hi = reverse ? start : stop\n let prev: number | undefined\n for (let i = 0; i < 10; i++) {\n const step = tickIncrement(lo, hi, count)\n if (step === prev) return reverse ? [hi, lo] : [lo, hi]\n if (step > 0) {\n lo = Math.floor(lo / step) * step\n hi = Math.ceil(hi / step) * step\n } else if (step < 0) {\n lo = Math.ceil(lo * step) / step\n hi = Math.floor(hi * step) / step\n } else {\n break\n }\n prev = step\n }\n return [start, stop]\n}\n","import { formatTicks, type Locale, type NumberFormat } from '../format.ts'\nimport { estimateTextWidth, LINE_HEIGHT, type Rect, round } from '../layout.ts'\nimport type { BandKey, BandScale } from '../scales/band.ts'\nimport type { LinearScale } from '../scales/linear.ts'\nimport { tickStep } from '../scales/ticks.ts'\nimport { h, type VNode } from '../vnode.ts'\n\nexport type AxisPosition = 'top' | 'right' | 'bottom' | 'left'\n\n/** A single axis tick: its data value, pixel position along the axis and label. */\nexport interface Tick {\n value: number | BandKey\n position: number\n label: string\n}\n\nexport interface LinearTicksOptions {\n /** Approximate number of ticks. Defaults to `5`. */\n count?: number\n format?: NumberFormat\n locale?: Locale\n}\n\n/** Ticks for a linear scale, labelled with a shared precision. */\nexport function linearTicks(scale: LinearScale, options: LinearTicksOptions = {}): Tick[] {\n const { count = 5, format, locale } = options\n const [d0, d1] = scale.domain\n const fmt = formatTicks(tickStep(d0, d1, count), format, locale)\n return scale.ticks(count).map((value) => ({ value, position: scale(value), label: fmt(value) }))\n}\n\n/** Ticks at the center of every band. */\nexport function bandTicks(\n scale: BandScale,\n format: (key: BandKey, index: number) => string = String,\n): Tick[] {\n return scale.domain.map((key, i) => ({\n value: key,\n position: scale.at(i) + scale.bandwidth / 2,\n label: format(key, i),\n }))\n}\n\n/** Whether labels are laid out along x (horizontal axes). */\nconst isHorizontal = (position: AxisPosition): boolean =>\n position === 'top' || position === 'bottom'\n\n/**\n * Keep every n-th tick (smallest n) so labels do not overlap along the axis.\n * The first and the last tick are always kept: when the last one does not\n * land on the step, it replaces the last kept tick if they would collide.\n */\nexport function thinTicks(\n ticks: readonly Tick[],\n position: AxisPosition,\n fontSize: number,\n gap = 8,\n): Tick[] {\n if (ticks.length < 2) return ticks.slice()\n const size = (tick: Tick) =>\n isHorizontal(position) ? estimateTextWidth(tick.label, fontSize) : fontSize * LINE_HEIGHT\n const sizes = ticks.map(size)\n const fitsBetween = (i: number, j: number) =>\n Math.abs((ticks[j] as Tick).position - (ticks[i] as Tick).position) >=\n ((sizes[i] as number) + (sizes[j] as number)) / 2 + gap\n\n const last = ticks.length - 1\n // Start from the step the total label size demands, instead of trying every one.\n const span = Math.abs((ticks[last] as Tick).position - (ticks[0] as Tick).position)\n const total = sizes.reduce((sum, size) => sum + size + gap, 0)\n const first = span > 0 ? Math.max(1, Math.floor(total / span)) : last\n for (let step = first; step <= last; step++) {\n let fits = true\n for (let i = step; i <= last && fits; i += step) fits = fitsBetween(i - step, i)\n if (!fits) continue\n\n const kept: number[] = []\n for (let i = 0; i <= last; i += step) kept.push(i)\n const tail = kept[kept.length - 1] as number\n if (tail !== last) {\n if (fitsBetween(tail, last)) kept.push(last)\n else if (kept.length > 1 && fitsBetween(kept[kept.length - 2] as number, last))\n kept[kept.length - 1] = last\n }\n return kept.map((i) => ticks[i] as Tick)\n }\n return ticks.slice(0, 1)\n}\n\nexport interface AxisOptions {\n position: AxisPosition\n ticks: readonly Tick[]\n /** Plot area the axis is attached to. */\n area: Rect\n /** Length of tick marks. Defaults to `0` (labels only). */\n tickSize?: number\n /** Distance between tick marks and labels. Defaults to `8`. */\n tickPadding?: number\n /** Draw the axis line along the plot edge. Defaults to `false`. */\n line?: boolean\n}\n\n/** Pixels an axis occupies perpendicular to the plot edge (for margins). */\nexport function axisSize(\n position: AxisPosition,\n ticks: readonly Tick[],\n fontSize: number,\n options: { tickSize?: number; tickPadding?: number } = {},\n): number {\n const { tickSize = 0, tickPadding = 8 } = options\n if (ticks.length === 0) return 0\n // Beside the plot, labels are as wide as their text: a little slack covers\n // fonts wider than the estimate, so they do not touch the chart's edge.\n const labels = isHorizontal(position)\n ? fontSize * LINE_HEIGHT\n : ticks.reduce((max, t) => Math.max(max, estimateTextWidth(t.label, fontSize)), 0) + 3\n return Math.ceil(labels + tickSize + tickPadding)\n}\n\n/** Space between the tick labels and the axis title. */\nconst TITLE_GAP = 6\n\n/** Pixels an axis title adds to the axis (for margins): none without a title. */\nexport const axisTitleSize = (title: string | undefined, fontSize: number): number =>\n title ? Math.ceil(fontSize * LINE_HEIGHT) + TITLE_GAP : 0\n\n/**\n * Render the title of an axis as `<text class=\"tc-axis-title tc-axis-title-{position}\">`,\n * past the labels of `ticks` and centered on the plot: along the axis at the\n * bottom, turned 90° beside the plot to read away from it (bottom to top on\n * the left, top to bottom on the right).\n */\nexport function axisTitle(\n position: 'right' | 'bottom' | 'left',\n ticks: readonly Tick[],\n area: Rect,\n title: string,\n fontSize: number,\n): VNode {\n const reach = axisSize(position, ticks, fontSize) + TITLE_GAP\n const sign = position === 'left' ? -1 : 1\n const side = reach + (fontSize * LINE_HEIGHT) / 2\n return h(\n 'text',\n {\n key: `axis-title-${position}`,\n class: `tc-axis-title tc-axis-title-${position}`,\n transform:\n position === 'bottom'\n ? `translate(${round(area.x + area.width / 2)},${round(area.y + area.height + reach)})`\n : `translate(${round(position === 'left' ? area.x - side : area.x + area.width + side)},${round(area.y + area.height / 2)}) rotate(${sign * 90})`,\n dy: position === 'bottom' ? '0.71em' : '0.32em',\n 'text-anchor': 'middle',\n 'aria-hidden': 'true',\n },\n title,\n )\n}\n\n/**\n * Render an axis as `<g class=\"tc-axis tc-axis-{x|y} tc-axis-{position}\">`\n * with one `<g class=\"tc-tick\">` per tick, keyed by value so ticks can\n * transition when the scale changes.\n */\nexport function axis(options: AxisOptions): VNode {\n const { position, ticks, area, tickSize = 0, tickPadding = 8, line = false } = options\n const horizontal = isHorizontal(position)\n const sign = position === 'top' || position === 'left' ? -1 : 1\n const offset = sign * (tickSize + tickPadding)\n\n // Edge of the plot the axis sits on.\n const edge =\n position === 'top'\n ? area.y\n : position === 'bottom'\n ? area.y + area.height\n : position === 'left'\n ? area.x\n : area.x + area.width\n\n const label = horizontal\n ? { y: offset, dy: position === 'top' ? '0em' : '0.71em', 'text-anchor': 'middle' }\n : { x: offset, dy: '0.32em', 'text-anchor': position === 'left' ? 'end' : 'start' }\n\n const tickLine = horizontal ? { y2: sign * tickSize } : { x2: sign * tickSize }\n\n return h(\n 'g',\n {\n // Keyed, so an axis keeps its nodes when layers around it come and go.\n key: `axis-${position}`,\n class: ['tc-axis', horizontal ? 'tc-axis-x' : 'tc-axis-y', `tc-axis-${position}`],\n 'aria-hidden': 'true',\n },\n line &&\n h(\n 'line',\n horizontal\n ? { class: 'tc-axis-line', x1: area.x, x2: area.x + area.width, y1: edge, y2: edge }\n : { class: 'tc-axis-line', x1: edge, x2: edge, y1: area.y, y2: area.y + area.height },\n ),\n ticks.map((tick) =>\n h(\n 'g',\n {\n key: tick.value,\n class: 'tc-tick',\n // An inline style (not the transform attribute) so CSS can transition it.\n style: horizontal\n ? `transform:translate(${round(tick.position)}px,${round(edge)}px)`\n : `transform:translate(${round(edge)}px,${round(tick.position)}px)`,\n },\n tickSize > 0 && h('line', { class: 'tc-tick-line', ...tickLine }),\n h('text', { class: 'tc-tick-label', ...label }, tick.label),\n ),\n ),\n )\n}\n"],"mappings":";;;;AAAA,MAAM,MAAM,KAAK,KAAK,EAAE;AACxB,MAAM,KAAK,KAAK,KAAK,EAAE;AACvB,MAAM,KAAK,KAAK,KAAK,CAAC;;;;;;AAOtB,SAAS,SAAS,OAAe,MAAc,OAAyC;CACtF,MAAM,QAAQ,OAAO,SAAS,KAAK,IAAI,GAAG,KAAK;CAC/C,MAAM,QAAQ,KAAK,MAAM,KAAK,MAAM,IAAI,CAAC;CACzC,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,SAAS,SAAS,MAAM,KAAK,SAAS,KAAK,IAAI,SAAS,KAAK,IAAI;CACvE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI,QAAQ,GAAG;EACb,MAAM,MAAM,CAAC,QAAQ;EACrB,KAAK,KAAK,MAAM,QAAQ,GAAG;EAC3B,KAAK,KAAK,MAAM,OAAO,GAAG;EAC1B,IAAI,KAAK,MAAM,OAAO,EAAE;EACxB,IAAI,KAAK,MAAM,MAAM,EAAE;EACvB,MAAM,CAAC;CACT,OAAO;EACL,MA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AQ,WAAW;CAGlC,MAAM,OACJ,aAAa,QACT,KAAK,IACL,aAAa,WACX,KAAK,IAAI,KAAK,SACd,aAAa,SACX,KAAK,IACL,KAAK,IAAI,KAAK;CAExB,MAAM,QAAQ,aACV;EAAE,GAAG;EAAQ,IAAI,aAAa,QAAQ,QAAQ;EAAU,eAAe;CAAS,IAChF;EAAE,GAAG;EAAQ,IAAI;EAAU,eAAe,aAAa,SAAS,QAAQ;CAAQ;CAEpF,MAAM,WAAW,aAAa,EAAE,IAAI,OAAO,SAAS,IAAI,EAAE,IAAI,OAAO,SAAS;CAE9E,OAAO,EACL,KACA;EAEE,KAAK,QAAQ;EACb,OAAO;GAAC;GAAW,aAAa,cAAc;GAAa,WAAW;EAAU;EAChF,eAAe;CACjB,GACA,QACE,EACE,QACA,aACI;EAAE,OAAO;EAAgB,IAAI,KAAK;EAAG,IAAI,KAAK,IAAI,KAAK;EAAO,IAAI;EAAM,IAAI;CAAK,IACjF;EAAE,OAAO;EAAgB,IAAI;EAAM,IAAI;EAAM,IAAI,KAAK;EAAG,IAAI,KAAK,IAAI,KAAK;CAAO,CACxF,GACF,MAAM,KAAK,SACT,EACE,KACA;EACE,KAAK,KAAK;EACV,OAAO;EAEP,OAAO,aACH,uBAAuB,MAAM,KAAK,QAAQ,EAAE,KAAK,MAAM,IAAI,EAAE,OAC7D,uBAAuB,MAAM,IAAI,EAAE,KAAK,MAAM,KAAK,QAAQ,EAAE;CACnE,GACA,WAAW,KAAK,EAAE,QAAQ;EAAE,OAAO;EAAgB,GAAG;CAAS,CAAC,GAChE,EAAE,QAAQ;EAAE,OAAO;EAAiB,GAAG;CAAM,GAAG,KAAK,KAAK,CAC5D,CACF,CACF;AACF"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
const require_format = require("./format-CAE5ruy6.cjs");
|
|
2
|
+
const require_layout = require("./layout-Cfg9x1k2.cjs");
|
|
3
|
+
const require_vnode = require("./vnode-ClAiw28x.cjs");
|
|
4
|
+
// src/scales/ticks.ts
|
|
5
|
+
const E10 = Math.sqrt(50);
|
|
6
|
+
const E5 = Math.sqrt(10);
|
|
7
|
+
const E2 = Math.sqrt(2);
|
|
8
|
+
/**
|
|
9
|
+
* Integer tick indices `[i1, i2]` and an increment `inc`. A negative `inc`
|
|
10
|
+
* means "divide by -inc", which keeps decimal ticks exact (0.3, not
|
|
11
|
+
* 0.30000000000000004).
|
|
12
|
+
*/
|
|
13
|
+
function tickSpec(start, stop, count) {
|
|
14
|
+
const step = (stop - start) / Math.max(0, count);
|
|
15
|
+
const power = Math.floor(Math.log10(step));
|
|
16
|
+
const error = step / 10 ** power;
|
|
17
|
+
const factor = error >= E10 ? 10 : error >= E5 ? 5 : error >= E2 ? 2 : 1;
|
|
18
|
+
let i1;
|
|
19
|
+
let i2;
|
|
20
|
+
let inc;
|
|
21
|
+
if (power < 0) {
|
|
22
|
+
inc = 10 ** -power / factor;
|
|
23
|
+
i1 = Math.round(start * inc);
|
|
24
|
+
i2 = Math.round(stop * inc);
|
|
25
|
+
if (i1 / inc < start) ++i1;
|
|
26
|
+
if (i2 / inc > stop) --i2;
|
|
27
|
+
inc = -inc;
|
|
28
|
+
} else {
|
|
29
|
+
inc = 10 ** power * factor;
|
|
30
|
+
i1 = Math.round(start / inc);
|
|
31
|
+
i2 = Math.round(stop / inc);
|
|
32
|
+
if (i1 * inc < start) ++i1;
|
|
33
|
+
if (i2 * inc > stop) --i2;
|
|
34
|
+
}
|
|
35
|
+
if (i2 < i1 && count >= .5 && count < 2) return tickSpec(start, stop, count * 2);
|
|
36
|
+
return [
|
|
37
|
+
i1,
|
|
38
|
+
i2,
|
|
39
|
+
inc
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Roughly `count` evenly spaced, "nice" values (multiples of 1, 2 or 5 × 10ⁿ)
|
|
44
|
+
* between `start` and `stop`, inclusive. Order follows `start → stop`.
|
|
45
|
+
*/
|
|
46
|
+
function ticks(start, stop, count = 5) {
|
|
47
|
+
if (!(count > 0) || !Number.isFinite(start) || !Number.isFinite(stop)) return [];
|
|
48
|
+
if (start === stop) return [start];
|
|
49
|
+
const reverse = stop < start;
|
|
50
|
+
const [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);
|
|
51
|
+
if (!(i2 >= i1)) return [];
|
|
52
|
+
const n = i2 - i1 + 1;
|
|
53
|
+
const out = new Array(n);
|
|
54
|
+
for (let i = 0; i < n; i++) {
|
|
55
|
+
const index = reverse ? i2 - i : i1 + i;
|
|
56
|
+
out[i] = inc < 0 ? index / -inc : index * inc;
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Signed tick increment: positive values are the step, negative values `-k`
|
|
62
|
+
* mean a step of `1 / k`.
|
|
63
|
+
*/
|
|
64
|
+
function tickIncrement(start, stop, count) {
|
|
65
|
+
return tickSpec(start, stop, count)[2];
|
|
66
|
+
}
|
|
67
|
+
/** Distance between ticks produced by {@link ticks} for the same arguments. */
|
|
68
|
+
function tickStep(start, stop, count = 5) {
|
|
69
|
+
const reverse = stop < start;
|
|
70
|
+
const inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
|
|
71
|
+
return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Extend `[start, stop]` to round tick values, e.g. `[0.2, 9.7] → [0, 10]`.
|
|
75
|
+
* Iterates because rounding can change the ideal step; if the step does not
|
|
76
|
+
* settle (e.g. very low `count` around zero keeps doubling the domain), the
|
|
77
|
+
* domain is returned unchanged, matching d3.
|
|
78
|
+
*/
|
|
79
|
+
function niceDomain(start, stop, count = 5) {
|
|
80
|
+
if (!Number.isFinite(start) || !Number.isFinite(stop) || start === stop || !(count > 0)) return [start, stop];
|
|
81
|
+
const reverse = stop < start;
|
|
82
|
+
let lo = reverse ? stop : start;
|
|
83
|
+
let hi = reverse ? start : stop;
|
|
84
|
+
let prev;
|
|
85
|
+
for (let i = 0; i < 10; i++) {
|
|
86
|
+
const step = tickIncrement(lo, hi, count);
|
|
87
|
+
if (step === prev) return reverse ? [hi, lo] : [lo, hi];
|
|
88
|
+
if (step > 0) {
|
|
89
|
+
lo = Math.floor(lo / step) * step;
|
|
90
|
+
hi = Math.ceil(hi / step) * step;
|
|
91
|
+
} else if (step < 0) {
|
|
92
|
+
lo = Math.ceil(lo * step) / step;
|
|
93
|
+
hi = Math.floor(hi * step) / step;
|
|
94
|
+
} else break;
|
|
95
|
+
prev = step;
|
|
96
|
+
}
|
|
97
|
+
return [start, stop];
|
|
98
|
+
}
|
|
99
|
+
// src/components/axis.ts
|
|
100
|
+
/** Ticks for a linear scale, labelled with a shared precision. */
|
|
101
|
+
function linearTicks(scale, options = {}) {
|
|
102
|
+
const { count = 5, format, locale } = options;
|
|
103
|
+
const [d0, d1] = scale.domain;
|
|
104
|
+
const fmt = require_format.formatTicks(tickStep(d0, d1, count), format, locale);
|
|
105
|
+
return scale.ticks(count).map((value) => ({
|
|
106
|
+
value,
|
|
107
|
+
position: scale(value),
|
|
108
|
+
label: fmt(value)
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
/** Ticks at the center of every band. */
|
|
112
|
+
function bandTicks(scale, format = String) {
|
|
113
|
+
return scale.domain.map((key, i) => ({
|
|
114
|
+
value: key,
|
|
115
|
+
position: scale.at(i) + scale.bandwidth / 2,
|
|
116
|
+
label: format(key, i)
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
/** Whether labels are laid out along x (horizontal axes). */
|
|
120
|
+
const isHorizontal = (position) => position === "top" || position === "bottom";
|
|
121
|
+
/**
|
|
122
|
+
* Keep every n-th tick (smallest n) so labels do not overlap along the axis.
|
|
123
|
+
* The first and the last tick are always kept: when the last one does not
|
|
124
|
+
* land on the step, it replaces the last kept tick if they would collide.
|
|
125
|
+
*/
|
|
126
|
+
function thinTicks(ticks, position, fontSize, gap = 8) {
|
|
127
|
+
if (ticks.length < 2) return ticks.slice();
|
|
128
|
+
const size = (tick) => isHorizontal(position) ? require_layout.estimateTextWidth(tick.label, fontSize) : fontSize * require_layout.LINE_HEIGHT;
|
|
129
|
+
const sizes = ticks.map(size);
|
|
130
|
+
const fitsBetween = (i, j) => Math.abs(ticks[j].position - ticks[i].position) >= (sizes[i] + sizes[j]) / 2 + gap;
|
|
131
|
+
const last = ticks.length - 1;
|
|
132
|
+
const span = Math.abs(ticks[last].position - ticks[0].position);
|
|
133
|
+
const total = sizes.reduce((sum, size) => sum + size + gap, 0);
|
|
134
|
+
const first = span > 0 ? Math.max(1, Math.floor(total / span)) : last;
|
|
135
|
+
for (let step = first; step <= last; step++) {
|
|
136
|
+
let fits = true;
|
|
137
|
+
for (let i = step; i <= last && fits; i += step) fits = fitsBetween(i - step, i);
|
|
138
|
+
if (!fits) continue;
|
|
139
|
+
const kept = [];
|
|
140
|
+
for (let i = 0; i <= last; i += step) kept.push(i);
|
|
141
|
+
const tail = kept[kept.length - 1];
|
|
142
|
+
if (tail !== last) {
|
|
143
|
+
if (fitsBetween(tail, last)) kept.push(last);
|
|
144
|
+
else if (kept.length > 1 && fitsBetween(kept[kept.length - 2], last)) kept[kept.length - 1] = last;
|
|
145
|
+
}
|
|
146
|
+
return kept.map((i) => ticks[i]);
|
|
147
|
+
}
|
|
148
|
+
return ticks.slice(0, 1);
|
|
149
|
+
}
|
|
150
|
+
/** Pixels an axis occupies perpendicular to the plot edge (for margins). */
|
|
151
|
+
function axisSize(position, ticks, fontSize, options = {}) {
|
|
152
|
+
const { tickSize = 0, tickPadding = 8 } = options;
|
|
153
|
+
if (ticks.length === 0) return 0;
|
|
154
|
+
const labels = isHorizontal(position) ? fontSize * require_layout.LINE_HEIGHT : ticks.reduce((max, t) => Math.max(max, require_layout.estimateTextWidth(t.label, fontSize)), 0) + 3;
|
|
155
|
+
return Math.ceil(labels + tickSize + tickPadding);
|
|
156
|
+
}
|
|
157
|
+
/** Space between the tick labels and the axis title. */
|
|
158
|
+
const TITLE_GAP = 6;
|
|
159
|
+
/** Pixels an axis title adds to the axis (for margins): none without a title. */
|
|
160
|
+
const axisTitleSize = (title, fontSize) => title ? Math.ceil(fontSize * require_layout.LINE_HEIGHT) + TITLE_GAP : 0;
|
|
161
|
+
/**
|
|
162
|
+
* Render the title of an axis as `<text class="tc-axis-title tc-axis-title-{position}">`,
|
|
163
|
+
* past the labels of `ticks` and centered on the plot: along the axis at the
|
|
164
|
+
* bottom, turned 90° beside the plot to read away from it (bottom to top on
|
|
165
|
+
* the left, top to bottom on the right).
|
|
166
|
+
*/
|
|
167
|
+
function axisTitle(position, ticks, area, title, fontSize) {
|
|
168
|
+
const reach = axisSize(position, ticks, fontSize) + TITLE_GAP;
|
|
169
|
+
const sign = position === "left" ? -1 : 1;
|
|
170
|
+
const side = reach + fontSize * require_layout.LINE_HEIGHT / 2;
|
|
171
|
+
return require_vnode.h("text", {
|
|
172
|
+
key: `axis-title-${position}`,
|
|
173
|
+
class: `tc-axis-title tc-axis-title-${position}`,
|
|
174
|
+
transform: position === "bottom" ? `translate(${require_layout.round(area.x + area.width / 2)},${require_layout.round(area.y + area.height + reach)})` : `translate(${require_layout.round(position === "left" ? area.x - side : area.x + area.width + side)},${require_layout.round(area.y + area.height / 2)}) rotate(${sign * 90})`,
|
|
175
|
+
dy: position === "bottom" ? "0.71em" : "0.32em",
|
|
176
|
+
"text-anchor": "middle",
|
|
177
|
+
"aria-hidden": "true"
|
|
178
|
+
}, title);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Render an axis as `<g class="tc-axis tc-axis-{x|y} tc-axis-{position}">`
|
|
182
|
+
* with one `<g class="tc-tick">` per tick, keyed by value so ticks can
|
|
183
|
+
* transition when the scale changes.
|
|
184
|
+
*/
|
|
185
|
+
function axis(options) {
|
|
186
|
+
const { position, ticks, area, tickSize = 0, tickPadding = 8, line = false } = options;
|
|
187
|
+
const horizontal = isHorizontal(position);
|
|
188
|
+
const sign = position === "top" || position === "left" ? -1 : 1;
|
|
189
|
+
const offset = sign * (tickSize + tickPadding);
|
|
190
|
+
const edge = position === "top" ? area.y : position === "bottom" ? area.y + area.height : position === "left" ? area.x : area.x + area.width;
|
|
191
|
+
const label = horizontal ? {
|
|
192
|
+
y: offset,
|
|
193
|
+
dy: position === "top" ? "0em" : "0.71em",
|
|
194
|
+
"text-anchor": "middle"
|
|
195
|
+
} : {
|
|
196
|
+
x: offset,
|
|
197
|
+
dy: "0.32em",
|
|
198
|
+
"text-anchor": position === "left" ? "end" : "start"
|
|
199
|
+
};
|
|
200
|
+
const tickLine = horizontal ? { y2: sign * tickSize } : { x2: sign * tickSize };
|
|
201
|
+
return require_vnode.h("g", {
|
|
202
|
+
key: `axis-${position}`,
|
|
203
|
+
class: [
|
|
204
|
+
"tc-axis",
|
|
205
|
+
horizontal ? "tc-axis-x" : "tc-axis-y",
|
|
206
|
+
`tc-axis-${position}`
|
|
207
|
+
],
|
|
208
|
+
"aria-hidden": "true"
|
|
209
|
+
}, line && require_vnode.h("line", horizontal ? {
|
|
210
|
+
class: "tc-axis-line",
|
|
211
|
+
x1: area.x,
|
|
212
|
+
x2: area.x + area.width,
|
|
213
|
+
y1: edge,
|
|
214
|
+
y2: edge
|
|
215
|
+
} : {
|
|
216
|
+
class: "tc-axis-line",
|
|
217
|
+
x1: edge,
|
|
218
|
+
x2: edge,
|
|
219
|
+
y1: area.y,
|
|
220
|
+
y2: area.y + area.height
|
|
221
|
+
}), ticks.map((tick) => require_vnode.h("g", {
|
|
222
|
+
key: tick.value,
|
|
223
|
+
class: "tc-tick",
|
|
224
|
+
style: horizontal ? `transform:translate(${require_layout.round(tick.position)}px,${require_layout.round(edge)}px)` : `transform:translate(${require_layout.round(edge)}px,${require_layout.round(tick.position)}px)`
|
|
225
|
+
}, tickSize > 0 && require_vnode.h("line", {
|
|
226
|
+
class: "tc-tick-line",
|
|
227
|
+
...tickLine
|
|
228
|
+
}), require_vnode.h("text", {
|
|
229
|
+
class: "tc-tick-label",
|
|
230
|
+
...label
|
|
231
|
+
}, tick.label))));
|
|
232
|
+
}
|
|
233
|
+
Object.defineProperty(exports, "axis", {
|
|
234
|
+
enumerable: true,
|
|
235
|
+
get: function() {
|
|
236
|
+
return axis;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
Object.defineProperty(exports, "axisSize", {
|
|
240
|
+
enumerable: true,
|
|
241
|
+
get: function() {
|
|
242
|
+
return axisSize;
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
Object.defineProperty(exports, "axisTitle", {
|
|
246
|
+
enumerable: true,
|
|
247
|
+
get: function() {
|
|
248
|
+
return axisTitle;
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
Object.defineProperty(exports, "axisTitleSize", {
|
|
252
|
+
enumerable: true,
|
|
253
|
+
get: function() {
|
|
254
|
+
return axisTitleSize;
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
Object.defineProperty(exports, "bandTicks", {
|
|
258
|
+
enumerable: true,
|
|
259
|
+
get: function() {
|
|
260
|
+
return bandTicks;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
Object.defineProperty(exports, "linearTicks", {
|
|
264
|
+
enumerable: true,
|
|
265
|
+
get: function() {
|
|
266
|
+
return linearTicks;
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
Object.defineProperty(exports, "niceDomain", {
|
|
270
|
+
enumerable: true,
|
|
271
|
+
get: function() {
|
|
272
|
+
return niceDomain;
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
Object.defineProperty(exports, "thinTicks", {
|
|
276
|
+
enumerable: true,
|
|
277
|
+
get: function() {
|
|
278
|
+
return thinTicks;
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
Object.defineProperty(exports, "tickIncrement", {
|
|
282
|
+
enumerable: true,
|
|
283
|
+
get: function() {
|
|
284
|
+
return tickIncrement;
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
Object.defineProperty(exports, "tickStep", {
|
|
288
|
+
enumerable: true,
|
|
289
|
+
get: function() {
|
|
290
|
+
return tickStep;
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
Object.defineProperty(exports, "ticks", {
|
|
294
|
+
enumerable: true,
|
|
295
|
+
get: function() {
|
|
296
|
+
return ticks;
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
//# sourceMappingURL=axis-YfAerNBA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axis-YfAerNBA.cjs","names":["formatTicks","estimateTextWidth","LINE_HEIGHT","h","round"],"sources":["../src/scales/ticks.ts","../src/components/axis.ts"],"sourcesContent":["const E10 = Math.sqrt(50)\nconst E5 = Math.sqrt(10)\nconst E2 = Math.sqrt(2)\n\n/**\n * Integer tick indices `[i1, i2]` and an increment `inc`. A negative `inc`\n * means \"divide by -inc\", which keeps decimal ticks exact (0.3, not\n * 0.30000000000000004).\n */\nfunction tickSpec(start: number, stop: number, count: number): [number, number, number] {\n const step = (stop - start) / Math.max(0, count)\n const power = Math.floor(Math.log10(step))\n const error = step / 10 ** power\n const factor = error >= E10 ? 10 : error >= E5 ? 5 : error >= E2 ? 2 : 1\n let i1: number\n let i2: number\n let inc: number\n if (power < 0) {\n inc = 10 ** -power / factor\n i1 = Math.round(start * inc)\n i2 = Math.round(stop * inc)\n if (i1 / inc < start) ++i1\n if (i2 / inc > stop) --i2\n inc = -inc\n } else {\n inc = 10 ** power * factor\n i1 = Math.round(start / inc)\n i2 = Math.round(stop / inc)\n if (i1 * inc < start) ++i1\n if (i2 * inc > stop) --i2\n }\n if (i2 < i1 && count >= 0.5 && count < 2) return tickSpec(start, stop, count * 2)\n return [i1, i2, inc]\n}\n\n/**\n * Roughly `count` evenly spaced, \"nice\" values (multiples of 1, 2 or 5 × 10ⁿ)\n * between `start` and `stop`, inclusive. Order follows `start → stop`.\n */\nexport function ticks(start: number, stop: number, count = 5): number[] {\n if (!(count > 0) || !Number.isFinite(start) || !Number.isFinite(stop)) return []\n if (start === stop) return [start]\n const reverse = stop < start\n const [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count)\n if (!(i2 >= i1)) return []\n const n = i2 - i1 + 1\n const out = new Array<number>(n)\n for (let i = 0; i < n; i++) {\n const index = reverse ? i2 - i : i1 + i\n out[i] = inc < 0 ? index / -inc : index * inc\n }\n return out\n}\n\n/**\n * Signed tick increment: positive values are the step, negative values `-k`\n * mean a step of `1 / k`.\n */\nexport function tickIncrement(start: number, stop: number, count: number): number {\n return tickSpec(start, stop, count)[2]\n}\n\n/** Distance between ticks produced by {@link ticks} for the same arguments. */\nexport function tickStep(start: number, stop: number, count = 5): number {\n const reverse = stop < start\n const inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count)\n return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc)\n}\n\n/**\n * Extend `[start, stop]` to round tick values, e.g. `[0.2, 9.7] → [0, 10]`.\n * Iterates because rounding can change the ideal step; if the step does not\n * settle (e.g. very low `count` around zero keeps doubling the domain), the\n * domain is returned unchanged, matching d3.\n */\nexport function niceDomain(start: number, stop: number, count = 5): [number, number] {\n if (!Number.isFinite(start) || !Number.isFinite(stop) || start === stop || !(count > 0)) {\n return [start, stop]\n }\n const reverse = stop < start\n let lo = reverse ? stop : start\n let hi = reverse ? start : stop\n let prev: number | undefined\n for (let i = 0; i < 10; i++) {\n const step = tickIncrement(lo, hi, count)\n if (step === prev) return reverse ? [hi, lo] : [lo, hi]\n if (step > 0) {\n lo = Math.floor(lo / step) * step\n hi = Math.ceil(hi / step) * step\n } else if (step < 0) {\n lo = Math.ceil(lo * step) / step\n hi = Math.floor(hi * step) / step\n } else {\n break\n }\n prev = step\n }\n return [start, stop]\n}\n","import { formatTicks, type Locale, type NumberFormat } from '../format.ts'\nimport { estimateTextWidth, LINE_HEIGHT, type Rect, round } from '../layout.ts'\nimport type { BandKey, BandScale } from '../scales/band.ts'\nimport type { LinearScale } from '../scales/linear.ts'\nimport { tickStep } from '../scales/ticks.ts'\nimport { h, type VNode } from '../vnode.ts'\n\nexport type AxisPosition = 'top' | 'right' | 'bottom' | 'left'\n\n/** A single axis tick: its data value, pixel position along the axis and label. */\nexport interface Tick {\n value: number | BandKey\n position: number\n label: string\n}\n\nexport interface LinearTicksOptions {\n /** Approximate number of ticks. Defaults to `5`. */\n count?: number\n format?: NumberFormat\n locale?: Locale\n}\n\n/** Ticks for a linear scale, labelled with a shared precision. */\nexport function linearTicks(scale: LinearScale, options: LinearTicksOptions = {}): Tick[] {\n const { count = 5, format, locale } = options\n const [d0, d1] = scale.domain\n const fmt = formatTicks(tickStep(d0, d1, count), format, locale)\n return scale.ticks(count).map((value) => ({ value, position: scale(value), label: fmt(value) }))\n}\n\n/** Ticks at the center of every band. */\nexport function bandTicks(\n scale: BandScale,\n format: (key: BandKey, index: number) => string = String,\n): Tick[] {\n return scale.domain.map((key, i) => ({\n value: key,\n position: scale.at(i) + scale.bandwidth / 2,\n label: format(key, i),\n }))\n}\n\n/** Whether labels are laid out along x (horizontal axes). */\nconst isHorizontal = (position: AxisPosition): boolean =>\n position === 'top' || position === 'bottom'\n\n/**\n * Keep every n-th tick (smallest n) so labels do not overlap along the axis.\n * The first and the last tick are always kept: when the last one does not\n * land on the step, it replaces the last kept tick if they would collide.\n */\nexport function thinTicks(\n ticks: readonly Tick[],\n position: AxisPosition,\n fontSize: number,\n gap = 8,\n): Tick[] {\n if (ticks.length < 2) return ticks.slice()\n const size = (tick: Tick) =>\n isHorizontal(position) ? estimateTextWidth(tick.label, fontSize) : fontSize * LINE_HEIGHT\n const sizes = ticks.map(size)\n const fitsBetween = (i: number, j: number) =>\n Math.abs((ticks[j] as Tick).position - (ticks[i] as Tick).position) >=\n ((sizes[i] as number) + (sizes[j] as number)) / 2 + gap\n\n const last = ticks.length - 1\n // Start from the step the total label size demands, instead of trying every one.\n const span = Math.abs((ticks[last] as Tick).position - (ticks[0] as Tick).position)\n const total = sizes.reduce((sum, size) => sum + size + gap, 0)\n const first = span > 0 ? Math.max(1, Math.floor(total / span)) : last\n for (let step = first; step <= last; step++) {\n let fits = true\n for (let i = step; i <= last && fits; i += step) fits = fitsBetween(i - step, i)\n if (!fits) continue\n\n const kept: number[] = []\n for (let i = 0; i <= last; i += step) kept.push(i)\n const tail = kept[kept.length - 1] as number\n if (tail !== last) {\n if (fitsBetween(tail, last)) kept.push(last)\n else if (kept.length > 1 && fitsBetween(kept[kept.length - 2] as number, last))\n kept[kept.length - 1] = last\n }\n return kept.map((i) => ticks[i] as Tick)\n }\n return ticks.slice(0, 1)\n}\n\nexport interface AxisOptions {\n position: AxisPosition\n ticks: readonly Tick[]\n /** Plot area the axis is attached to. */\n area: Rect\n /** Length of tick marks. Defaults to `0` (labels only). */\n tickSize?: number\n /** Distance between tick marks and labels. Defaults to `8`. */\n tickPadding?: number\n /** Draw the axis line along the plot edge. Defaults to `false`. */\n line?: boolean\n}\n\n/** Pixels an axis occupies perpendicular to the plot edge (for margins). */\nexport function axisSize(\n position: AxisPosition,\n ticks: readonly Tick[],\n fontSize: number,\n options: { tickSize?: number; tickPadding?: number } = {},\n): number {\n const { tickSize = 0, tickPadding = 8 } = options\n if (ticks.length === 0) return 0\n // Beside the plot, labels are as wide as their text: a little slack covers\n // fonts wider than the estimate, so they do not touch the chart's edge.\n const labels = isHorizontal(position)\n ? fontSize * LINE_HEIGHT\n : ticks.reduce((max, t) => Math.max(max, estimateTextWidth(t.label, fontSize)), 0) + 3\n return Math.ceil(labels + tickSize + tickPadding)\n}\n\n/** Space between the tick labels and the axis title. */\nconst TITLE_GAP = 6\n\n/** Pixels an axis title adds to the axis (for margins): none without a title. */\nexport const axisTitleSize = (title: string | undefined, fontSize: number): number =>\n title ? Math.ceil(fontSize * LINE_HEIGHT) + TITLE_GAP : 0\n\n/**\n * Render the title of an axis as `<text class=\"tc-axis-title tc-axis-title-{position}\">`,\n * past the labels of `ticks` and centered on the plot: along the axis at the\n * bottom, turned 90° beside the plot to read away from it (bottom to top on\n * the left, top to bottom on the right).\n */\nexport function axisTitle(\n position: 'right' | 'bottom' | 'left',\n ticks: readonly Tick[],\n area: Rect,\n title: string,\n fontSize: number,\n): VNode {\n const reach = axisSize(position, ticks, fontSize) + TITLE_GAP\n const sign = position === 'left' ? -1 : 1\n const side = reach + (fontSize * LINE_HEIGHT) / 2\n return h(\n 'text',\n {\n key: `axis-title-${position}`,\n class: `tc-axis-title tc-axis-title-${position}`,\n transform:\n position === 'bottom'\n ? `translate(${round(area.x + area.width / 2)},${round(area.y + area.height + reach)})`\n : `translate(${round(position === 'left' ? area.x - side : area.x + area.width + side)},${round(area.y + area.height / 2)}) rotate(${sign * 90})`,\n dy: position === 'bottom' ? '0.71em' : '0.32em',\n 'text-anchor': 'middle',\n 'aria-hidden': 'true',\n },\n title,\n )\n}\n\n/**\n * Render an axis as `<g class=\"tc-axis tc-axis-{x|y} tc-axis-{position}\">`\n * with one `<g class=\"tc-tick\">` per tick, keyed by value so ticks can\n * transition when the scale changes.\n */\nexport function axis(options: AxisOptions): VNode {\n const { position, ticks, area, tickSize = 0, tickPadding = 8, line = false } = options\n const horizontal = isHorizontal(position)\n const sign = position === 'top' || position === 'left' ? -1 : 1\n const offset = sign * (tickSize + tickPadding)\n\n // Edge of the plot the axis sits on.\n const edge =\n position === 'top'\n ? area.y\n : position === 'bottom'\n ? area.y + area.height\n : position === 'left'\n ? area.x\n : area.x + area.width\n\n const label = horizontal\n ? { y: offset, dy: position === 'top' ? '0em' : '0.71em', 'text-anchor': 'middle' }\n : { x: offset, dy: '0.32em', 'text-anchor': position === 'left' ? 'end' : 'start' }\n\n const tickLine = horizontal ? { y2: sign * tickSize } : { x2: sign * tickSize }\n\n return h(\n 'g',\n {\n // Keyed, so an axis keeps its nodes when layers around it come and go.\n key: `axis-${position}`,\n class: ['tc-axis', horizontal ? 'tc-axis-x' : 'tc-axis-y', `tc-axis-${position}`],\n 'aria-hidden': 'true',\n },\n line &&\n h(\n 'line',\n horizontal\n ? { class: 'tc-axis-line', x1: area.x, x2: area.x + area.width, y1: edge, y2: edge }\n : { class: 'tc-axis-line', x1: edge, x2: edge, y1: area.y, y2: area.y + area.height },\n ),\n ticks.map((tick) =>\n h(\n 'g',\n {\n key: tick.value,\n class: 'tc-tick',\n // An inline style (not the transform attribute) so CSS can transition it.\n style: horizontal\n ? `transform:translate(${round(tick.position)}px,${round(edge)}px)`\n : `transform:translate(${round(edge)}px,${round(tick.position)}px)`,\n },\n tickSize > 0 && h('line', { class: 'tc-tick-line', ...tickLine }),\n h('text', { class: 'tc-tick-label', ...label }, tick.label),\n ),\n ),\n )\n}\n"],"mappings":";;;;AAAA,MAAM,MAAM,KAAK,KAAK,EAAE;AACxB,MAAM,KAAK,KAAK,KAAK,EAAE;AACvB,MAAM,KAAK,KAAK,KAAK,CAAC;;;;;;AAOtB,SAAS,SAAS,OAAe,MAAc,OAAyC;CACtF,MAAM,QAAQ,OAAO,SAAS,KAAK,IAAI,GAAG,KAAK;CAC/C,MAAM,QAAQ,KAAK,MAAM,KAAK,MAAM,IAAI,CAAC;CACzC,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,SAAS,SAAS,MAAM,KAAK,SAAS,KAAK,IAAI,SAAS,KAAK,IAAI;CACvE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI,QAAQ,GAAG;EACb,MAAM,MAAM,CAAC,QAAQ;EACrB,KAAK,KAAK,MAAM,QAAQ,GAAG;EAC3B,KAAK,KAAK,MAAM,OAAO,GAAG;EAC1B,IAAI,KAAK,MAAM,OAAO,EAAE;EACxB,IAAI,KAAK,MAAM,MAAM,EAAE;EACvB,MAAM,CAAC;CACT,OAAO;EACL,MAAM,MAAM,QAAQ;EACpB,KAAK,KAAK,MAAM,QAAQ,GAAG;EAC3B,KAAK,KAAK,MAAM,OAAO,GAAG;EAC1B,IAAI,KAAK,MAAM,OAAO,EAAE;EACxB,IAAI,K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