@tabler/charts 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -4
- package/dist/{annotations-Bp7HwtF5.d.ts → annotations-B02GR_KU.d.ts} +3 -8
- package/dist/{annotations-BszTTjf9.js → annotations-BQ8l-qHs.js} +6 -7
- package/dist/{annotations-BszTTjf9.js.map → annotations-BQ8l-qHs.js.map} +1 -1
- package/dist/{annotations-lyt0I3HU.d.cts → annotations-CHafaGd4.d.cts} +3 -8
- package/dist/{annotations-DpETO8dE.cjs → annotations-CpCWA29b.cjs} +6 -7
- package/dist/{annotations-DpETO8dE.cjs.map → annotations-CpCWA29b.cjs.map} +1 -1
- package/dist/annotations.cjs +3 -5
- package/dist/annotations.cjs.map +1 -1
- package/dist/annotations.d.cts +2 -1
- package/dist/annotations.d.ts +2 -1
- package/dist/annotations.js +3 -4
- package/dist/{arc-a1tRTEw7.js → arc-B3V5IR0w.js} +2 -3
- package/dist/{arc-a1tRTEw7.js.map → arc-B3V5IR0w.js.map} +1 -1
- package/dist/{arc-BXpLrt9b.cjs → arc-CYhI62kO.cjs} +2 -3
- package/dist/{arc-BXpLrt9b.cjs.map → arc-CYhI62kO.cjs.map} +1 -1
- package/dist/{area-CF__HOwL.d.ts → area-DEFQm_SQ.d.ts} +3 -6
- package/dist/{area-sHCE3pg5.cjs → area-DYdQ_sMV.cjs} +5 -6
- package/dist/{area-sHCE3pg5.cjs.map → area-DYdQ_sMV.cjs.map} +1 -1
- package/dist/{area-DQsLERhx.js → area-WdtfqvhX.js} +5 -6
- package/dist/{area-DQsLERhx.js.map → area-WdtfqvhX.js.map} +1 -1
- package/dist/{area-DIxaAbYZ.d.cts → area-h_FvieFb.d.cts} +3 -6
- package/dist/area.cjs +1 -1
- package/dist/area.d.cts +2 -1
- package/dist/area.d.ts +2 -1
- package/dist/area.js +1 -2
- package/dist/axis-MMaVoSWB.js +235 -0
- package/dist/axis-MMaVoSWB.js.map +1 -0
- package/dist/axis-YfAerNBA.cjs +300 -0
- package/dist/axis-YfAerNBA.cjs.map +1 -0
- package/dist/{band-DTcNDAFO.d.ts → band-CNKvdnTC.d.cts} +1 -4
- package/dist/{band-DTcNDAFO.d.cts → band-CNKvdnTC.d.ts} +1 -4
- package/dist/{bar-jZEoao74.js → bar-BOcRcArc.js} +80 -62
- package/dist/bar-BOcRcArc.js.map +1 -0
- package/dist/{bar-C-7zR2qp.cjs → bar-CVkOJ7WA.cjs} +82 -64
- package/dist/bar-CVkOJ7WA.cjs.map +1 -0
- package/dist/{bar-DM16NUvV.js → bar-CgpC2EpX.js} +3 -4
- package/dist/{bar-DM16NUvV.js.map → bar-CgpC2EpX.js.map} +1 -1
- package/dist/{bar-BBM8RhoL.d.ts → bar-D9B_arKf.d.ts} +4 -7
- package/dist/{bar-CRKLDg98.d.cts → bar-DZCQ-kyf.d.cts} +4 -7
- package/dist/{bar-DGuUN3nc.cjs → bar-wVykm1us.cjs} +3 -4
- package/dist/{bar-DGuUN3nc.cjs.map → bar-wVykm1us.cjs.map} +1 -1
- package/dist/bar.cjs +1 -1
- package/dist/bar.d.cts +2 -1
- package/dist/bar.d.ts +2 -1
- package/dist/bar.js +1 -2
- package/dist/calendar-BSvO8nRb.d.cts +106 -0
- package/dist/calendar-BXgIX5H1.js +502 -0
- package/dist/calendar-BXgIX5H1.js.map +1 -0
- package/dist/calendar-Bq3vFzPl.d.ts +106 -0
- package/dist/calendar-DAFXjV99.cjs +507 -0
- package/dist/calendar-DAFXjV99.cjs.map +1 -0
- package/dist/calendar.cjs +3 -0
- package/dist/calendar.d.cts +3 -0
- package/dist/calendar.d.ts +3 -0
- package/dist/calendar.js +1 -0
- package/dist/{candlestick-D_vV0_XZ.d.ts → candlestick-B3WcLzph.d.ts} +3 -6
- package/dist/{candlestick-__pXl_pV.d.cts → candlestick-BcomxeVG.d.cts} +3 -6
- package/dist/{candlestick-DuXwAFID.js → candlestick-BtT9glp9.js} +19 -18
- package/dist/{candlestick-DuXwAFID.js.map → candlestick-BtT9glp9.js.map} +1 -1
- package/dist/{candlestick-B5r1w3kc.cjs → candlestick-CSmRuZ4v.cjs} +19 -18
- package/dist/{candlestick-B5r1w3kc.cjs.map → candlestick-CSmRuZ4v.cjs.map} +1 -1
- package/dist/candlestick.cjs +4 -5
- package/dist/candlestick.d.cts +1 -1
- package/dist/candlestick.d.ts +1 -1
- package/dist/candlestick.js +4 -6
- package/dist/{cartesian-Cr0AF0nG.js → cartesian-BrPqb5Qn.js} +138 -264
- package/dist/cartesian-BrPqb5Qn.js.map +1 -0
- package/dist/{cartesian-BoDfgBCV.cjs → cartesian-DRSXHxWe.cjs} +162 -324
- package/dist/cartesian-DRSXHxWe.cjs.map +1 -0
- package/dist/{chart-BF2CK9I_.js → chart-B6TTY4Kr.js} +120 -77
- package/dist/chart-B6TTY4Kr.js.map +1 -0
- package/dist/{chart-DyN7bcx8.d.ts → chart-CYrrUCi3.d.ts} +222 -102
- package/dist/{chart-D7ooEFnk.d.cts → chart-CbPzP5Dp.d.cts} +248 -102
- package/dist/{chart-CowF_lWY.cjs → chart-D_lyOy-M.cjs} +132 -83
- package/dist/chart-D_lyOy-M.cjs.map +1 -0
- package/dist/{circle-BQMuAfls.cjs → circle-Bwxy5j7B.cjs} +2 -3
- package/dist/{circle-BQMuAfls.cjs.map → circle-Bwxy5j7B.cjs.map} +1 -1
- package/dist/{circle-Z7YfCoCM.js → circle-YRDaOBpk.js} +2 -3
- package/dist/{circle-Z7YfCoCM.js.map → circle-YRDaOBpk.js.map} +1 -1
- package/dist/{clean-o1vDEhFV.js → clean-CkoQobGv.js} +3 -4
- package/dist/{clean-o1vDEhFV.js.map → clean-CkoQobGv.js.map} +1 -1
- package/dist/{clean-Byl6kzf0.cjs → clean-Die2iCNc.cjs} +8 -3
- package/dist/{clean-Byl6kzf0.cjs.map → clean-Die2iCNc.cjs.map} +1 -1
- package/dist/{core-D1vO1LrC.d.cts → core-9BnLEW4K.d.cts} +31 -72
- package/dist/{core-DcbemzGf.d.ts → core-C3qEppSm.d.ts} +10 -46
- package/dist/{core-CegR_j55.js → core-CQ0FaJ4G.js} +138 -99
- package/dist/core-CQ0FaJ4G.js.map +1 -0
- package/dist/{core-RzS9IQO5.cjs → core-D2PSked3.cjs} +139 -100
- package/dist/core-D2PSked3.cjs.map +1 -0
- package/dist/core.cjs +47 -33
- package/dist/core.d.cts +26 -21
- package/dist/core.d.ts +26 -21
- package/dist/core.js +31 -25
- package/dist/{dates-CG-FvioW.js → dates-DLe2Ww64.js} +4 -5
- package/dist/{dates-CG-FvioW.js.map → dates-DLe2Ww64.js.map} +1 -1
- package/dist/{dates-Btm7Zm6W.cjs → dates-DerXTb1J.cjs} +4 -5
- package/dist/{dates-Btm7Zm6W.cjs.map → dates-DerXTb1J.cjs.map} +1 -1
- package/dist/{decimate-tLhDk1ys.cjs → decimate-BS3x8g-f.cjs} +2 -3
- package/dist/{decimate-tLhDk1ys.cjs.map → decimate-BS3x8g-f.cjs.map} +1 -1
- package/dist/{decimate-BGg9XgF0.d.ts → decimate-BxxYBJJk.d.cts} +2 -5
- package/dist/{decimate-C87cl_Sp.js → decimate-CapfgiDY.js} +2 -3
- package/dist/{decimate-C87cl_Sp.js.map → decimate-CapfgiDY.js.map} +1 -1
- package/dist/{decimate-CNSpgGa5.d.cts → decimate-Du87fMLG.d.ts} +2 -5
- package/dist/decimate.cjs +3 -4
- package/dist/decimate.d.cts +1 -1
- package/dist/decimate.d.ts +1 -1
- package/dist/decimate.js +3 -4
- package/dist/{dom-CLF868Qs.cjs → dom-C33zvtPo.cjs} +5 -11
- package/dist/dom-C33zvtPo.cjs.map +1 -0
- package/dist/{dom-vP3IcMak.js → dom-CTse6Rvd.js} +5 -11
- package/dist/dom-CTse6Rvd.js.map +1 -0
- package/dist/{export-chart-BhhYgksr.cjs → export-chart-CPtXmZvi.cjs} +18 -14
- package/dist/export-chart-CPtXmZvi.cjs.map +1 -0
- package/dist/{export-chart-9w8t3rjZ.js → export-chart-DoeiAyR2.js} +18 -14
- package/dist/export-chart-DoeiAyR2.js.map +1 -0
- package/dist/export.cjs +3 -5
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +8 -1
- package/dist/export.d.ts +8 -1
- package/dist/export.js +3 -4
- package/dist/{extent-BAMZo0Nq.js → extent-DOV8rs-6.js} +2 -3
- package/dist/{extent-BAMZo0Nq.js.map → extent-DOV8rs-6.js.map} +1 -1
- package/dist/{extent-DsFWvAHJ.cjs → extent-DuYDcvM9.cjs} +2 -3
- package/dist/{extent-DsFWvAHJ.cjs.map → extent-DuYDcvM9.cjs.map} +1 -1
- package/dist/{fade-D3NxH5Qg.js → fade-CDrQjnDz.js} +59 -83
- package/dist/fade-CDrQjnDz.js.map +1 -0
- package/dist/{fade-Cs74puQS.cjs → fade-CRqcKMWY.cjs} +59 -83
- package/dist/fade-CRqcKMWY.cjs.map +1 -0
- package/dist/{features-wASyHGic.js → features-B55rwpQC.js} +5 -4
- package/dist/features-B55rwpQC.js.map +1 -0
- package/dist/{features-BclHgg2W.cjs → features-DEDP5CEQ.cjs} +10 -3
- package/dist/features-DEDP5CEQ.cjs.map +1 -0
- package/dist/fit-BPyPRnsK.js +16 -0
- package/dist/fit-BPyPRnsK.js.map +1 -0
- package/dist/fit-D4MIIQQz.cjs +21 -0
- package/dist/fit-D4MIIQQz.cjs.map +1 -0
- package/dist/{format-B0yKXBTH.cjs → format-CAE5ruy6.cjs} +2 -3
- package/dist/{format-B0yKXBTH.cjs.map → format-CAE5ruy6.cjs.map} +1 -1
- package/dist/{format-lStwuc1L.js → format-it1kepFG.js} +2 -3
- package/dist/{format-lStwuc1L.js.map → format-it1kepFG.js.map} +1 -1
- package/dist/funnel-BdcfUkb5.d.ts +50 -0
- package/dist/funnel-CFEEulw_.cjs +244 -0
- package/dist/funnel-CFEEulw_.cjs.map +1 -0
- package/dist/funnel-CYCv8cq2.js +239 -0
- package/dist/funnel-CYCv8cq2.js.map +1 -0
- package/dist/funnel-CarOh8w_.d.cts +50 -0
- package/dist/funnel.cjs +3 -0
- package/dist/funnel.d.cts +3 -0
- package/dist/funnel.d.ts +3 -0
- package/dist/funnel.js +1 -0
- package/dist/{gauge-D-FYhuds.cjs → gauge-6HfDcLMJ.cjs} +35 -36
- package/dist/gauge-6HfDcLMJ.cjs.map +1 -0
- package/dist/{gauge-Dh423FHh.js → gauge-DiTk5aWO.js} +35 -36
- package/dist/gauge-DiTk5aWO.js.map +1 -0
- package/dist/{gauge-zpia05t2.d.ts → gauge-Ds9k1UV2.d.cts} +5 -8
- package/dist/{gauge-DP_EB2z3.d.cts → gauge-Zy25jfps.d.ts} +5 -8
- package/dist/gauge.cjs +1 -1
- package/dist/gauge.d.cts +2 -1
- package/dist/gauge.d.ts +2 -1
- package/dist/gauge.js +1 -2
- package/dist/{heatmap-DSZ2bVIa.js → heatmap-C1v8bwpq.js} +43 -43
- package/dist/heatmap-C1v8bwpq.js.map +1 -0
- package/dist/{heatmap-BectCEeE.d.ts → heatmap-CJ-0dfhJ.d.cts} +4 -7
- package/dist/{heatmap-BK18EBgJ.cjs → heatmap-Dcc_bsoQ.cjs} +47 -47
- package/dist/heatmap-Dcc_bsoQ.cjs.map +1 -0
- package/dist/{heatmap-CCso6m61.d.cts → heatmap-Jp5sHRTo.d.ts} +4 -7
- package/dist/heatmap.cjs +1 -1
- package/dist/heatmap.d.cts +2 -1
- package/dist/heatmap.d.ts +2 -1
- package/dist/heatmap.js +1 -2
- package/dist/{hydrate-DDNIHYv_.js → hydrate-BB3MlR36.js} +3 -4
- package/dist/{hydrate-DDNIHYv_.js.map → hydrate-BB3MlR36.js.map} +1 -1
- package/dist/{hydrate-CzfxLfTv.d.ts → hydrate-BtAZf_5K.d.cts} +2 -5
- package/dist/{hydrate-CTTmQy0x.d.cts → hydrate-OjM1pIUG.d.ts} +2 -5
- package/dist/{hydrate-CxwTXDqO.cjs → hydrate-m0I5m6ue.cjs} +3 -4
- package/dist/hydrate-m0I5m6ue.cjs.map +1 -0
- package/dist/hydrate.cjs +3 -4
- package/dist/hydrate.cjs.map +1 -1
- package/dist/hydrate.d.cts +1 -1
- package/dist/hydrate.d.ts +1 -1
- package/dist/hydrate.js +3 -4
- package/dist/index.cjs +72 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -28
- package/dist/index.d.ts +28 -28
- package/dist/index.js +52 -44
- package/dist/index.js.map +1 -1
- package/dist/interaction-DXYSjgnP.cjs +32 -0
- package/dist/interaction-DXYSjgnP.cjs.map +1 -0
- package/dist/interaction-En1KlwFO.js +21 -0
- package/dist/interaction-En1KlwFO.js.map +1 -0
- package/dist/{layout-CtMBhNd9.cjs → layout-Cfg9x1k2.cjs} +45 -3
- package/dist/layout-Cfg9x1k2.cjs.map +1 -0
- package/dist/{layout-B3hiqVEw.js → layout-DqAte3H8.js} +34 -4
- package/dist/layout-DqAte3H8.js.map +1 -0
- package/dist/{line-CN4uZ9ZX.d.ts → line-Bpr5uVLQ.d.ts} +4 -7
- package/dist/{line-B3Ed6u7j.js → line-CxR4tg1Q.js} +49 -38
- package/dist/line-CxR4tg1Q.js.map +1 -0
- package/dist/{line-fQbtP_jL.cjs → line-YiCuhVMI.cjs} +49 -38
- package/dist/line-YiCuhVMI.cjs.map +1 -0
- package/dist/{line-W7VD_qs1.d.cts → line-vyWO030v.d.cts} +4 -7
- package/dist/line.cjs +4 -5
- package/dist/line.cjs.map +1 -1
- package/dist/line.d.cts +1 -1
- package/dist/line.d.ts +1 -1
- package/dist/line.js +4 -6
- package/dist/{log-CaofN3-n.d.ts → log-CI41TmcU.d.cts} +1 -6
- package/dist/{log-CaofN3-n.d.cts → log-CI41TmcU.d.ts} +1 -6
- package/dist/{log-axis-83rSpvL5.cjs → log-axis-DdRNyAq8.cjs} +6 -8
- package/dist/{log-axis-83rSpvL5.cjs.map → log-axis-DdRNyAq8.cjs.map} +1 -1
- package/dist/{log-axis-B_uvvOFc.js → log-axis-DhthtHFk.js} +6 -8
- package/dist/{log-axis-B_uvvOFc.js.map → log-axis-DhthtHFk.js.map} +1 -1
- package/dist/log.cjs +3 -5
- package/dist/log.cjs.map +1 -1
- package/dist/log.d.cts +1 -1
- package/dist/log.d.ts +1 -1
- package/dist/log.js +3 -4
- package/dist/map-49FcfdmJ.d.cts +156 -0
- package/dist/map-BMC61J-P.d.ts +156 -0
- package/dist/map-BqrZ80vT.cjs +818 -0
- package/dist/map-BqrZ80vT.cjs.map +1 -0
- package/dist/map-C15NC7kW.js +807 -0
- package/dist/map-C15NC7kW.js.map +1 -0
- package/dist/map.cjs +4 -0
- package/dist/map.d.cts +3 -0
- package/dist/map.d.ts +3 -0
- package/dist/map.js +1 -0
- package/dist/maps/world.cjs +875 -0
- package/dist/maps/world.cjs.map +1 -0
- package/dist/maps/world.d.cts +2 -0
- package/dist/maps/world.d.ts +2 -0
- package/dist/maps/world.js +874 -0
- package/dist/maps/world.js.map +1 -0
- package/dist/{morph-CqYDu1bY.cjs → morph-3I1Nf_tR.cjs} +4 -5
- package/dist/morph-3I1Nf_tR.cjs.map +1 -0
- package/dist/{morph-BMxz3X2b.d.ts → morph-Dh7gJkV4.d.cts} +1 -4
- package/dist/{morph-BMxz3X2b.d.cts → morph-Dh7gJkV4.d.ts} +1 -4
- package/dist/{morph-Bgg-24l8.js → morph-GfBab-b3.js} +4 -5
- package/dist/{morph-Bgg-24l8.js.map → morph-GfBab-b3.js.map} +1 -1
- package/dist/morph.cjs +3 -4
- package/dist/morph.cjs.map +1 -1
- package/dist/morph.d.cts +1 -1
- package/dist/morph.d.ts +1 -1
- package/dist/morph.js +3 -4
- package/dist/{named-BWWb5LQJ.cjs → named-BBASc8dW.cjs} +2 -3
- package/dist/{named-BWWb5LQJ.cjs.map → named-BBASc8dW.cjs.map} +1 -1
- package/dist/{named-DE15TOgh.js → named-BOiBah6I.js} +2 -3
- package/dist/{named-DE15TOgh.js.map → named-BOiBah6I.js.map} +1 -1
- package/dist/others-DBIGE6jr.js +57 -0
- package/dist/others-DBIGE6jr.js.map +1 -0
- package/dist/others-DBO4Kjwl.d.ts +29 -0
- package/dist/others-WfjCsjqT.cjs +68 -0
- package/dist/others-WfjCsjqT.cjs.map +1 -0
- package/dist/others-ls5eKtZ4.d.cts +31 -0
- package/dist/{parliament-Dw0sOERi.js → parliament-BKN6ikBJ.js} +36 -36
- package/dist/parliament-BKN6ikBJ.js.map +1 -0
- package/dist/{parliament-1Zv2Xh0D.d.ts → parliament-C7V8UJj1.d.cts} +5 -8
- package/dist/{parliament-DdrLVZwt.d.cts → parliament-Cz9n_DoK.d.ts} +5 -8
- package/dist/{parliament-CpWnoEvG.cjs → parliament-DhxAaIZ3.cjs} +36 -36
- package/dist/parliament-DhxAaIZ3.cjs.map +1 -0
- package/dist/parliament.cjs +1 -1
- package/dist/parliament.d.cts +2 -1
- package/dist/parliament.d.ts +2 -1
- package/dist/parliament.js +1 -2
- package/dist/{path-CwB28da0.d.ts → path-YeUiOfG8.d.cts} +1 -4
- package/dist/{path-CwB28da0.d.cts → path-YeUiOfG8.d.ts} +1 -4
- package/dist/{patterns-DtgcnA8o.js → patterns-BMUINoka.js} +4 -5
- package/dist/{patterns-DtgcnA8o.js.map → patterns-BMUINoka.js.map} +1 -1
- package/dist/{patterns-LfcQAWCy.cjs → patterns-Dw7OMD_2.cjs} +4 -5
- package/dist/{patterns-LfcQAWCy.cjs.map → patterns-Dw7OMD_2.cjs.map} +1 -1
- package/dist/patterns.cjs +3 -5
- package/dist/patterns.cjs.map +1 -1
- package/dist/patterns.d.cts +5 -1
- package/dist/patterns.d.ts +5 -1
- package/dist/patterns.js +3 -4
- package/dist/percentage-bar-BChkTRoz.cjs +164 -0
- package/dist/percentage-bar-BChkTRoz.cjs.map +1 -0
- package/dist/percentage-bar-CaInxrL8.js +159 -0
- package/dist/percentage-bar-CaInxrL8.js.map +1 -0
- package/dist/percentage-bar-R1--2grK.d.cts +58 -0
- package/dist/percentage-bar-cSeiLdwU.d.ts +58 -0
- package/dist/percentage-bar.cjs +3 -0
- package/dist/percentage-bar.d.cts +3 -0
- package/dist/percentage-bar.d.ts +3 -0
- package/dist/percentage-bar.js +1 -0
- package/dist/{pie-BF9yI5mE.d.cts → pie-BQQkvy1N.d.ts} +11 -11
- package/dist/{pie-DzUXDTcn.js → pie-Bd8wyrtY.js} +52 -55
- package/dist/pie-Bd8wyrtY.js.map +1 -0
- package/dist/{pie-BxTZt6Go.cjs → pie-BseZlCgP.cjs} +52 -55
- package/dist/pie-BseZlCgP.cjs.map +1 -0
- package/dist/{pie-5z1fDdKO.d.ts → pie-vD5-g8je.d.cts} +11 -11
- package/dist/pie.cjs +1 -1
- package/dist/pie.d.cts +2 -1
- package/dist/pie.d.ts +2 -1
- package/dist/pie.js +1 -2
- package/dist/{point-shapes-CGl4dugc.cjs → point-shapes-BRawRM78.cjs} +24 -24
- package/dist/point-shapes-BRawRM78.cjs.map +1 -0
- package/dist/{point-shapes-DI84NNpI.js → point-shapes-DI6GhcI7.js} +19 -25
- package/dist/point-shapes-DI6GhcI7.js.map +1 -0
- package/dist/point-shapes.cjs +7 -6
- package/dist/point-shapes.cjs.map +1 -1
- package/dist/point-shapes.d.cts +6 -2
- package/dist/point-shapes.d.ts +6 -2
- package/dist/point-shapes.js +8 -7
- package/dist/point-shapes.js.map +1 -1
- package/dist/{radar-1-EryihA.d.ts → radar-7I6hsY_h.d.cts} +4 -7
- package/dist/{radar-CYPab_I4.js → radar-D6XqkFWQ.js} +25 -27
- package/dist/radar-D6XqkFWQ.js.map +1 -0
- package/dist/{radar-CoGUNNSb.cjs → radar-DjISDnSf.cjs} +26 -28
- package/dist/radar-DjISDnSf.cjs.map +1 -0
- package/dist/{radar-DBW4O0Vt.d.cts → radar-vLxilcr4.d.ts} +4 -7
- package/dist/radar.cjs +1 -1
- package/dist/radar.d.cts +2 -1
- package/dist/radar.d.ts +2 -1
- package/dist/radar.js +1 -2
- package/dist/rect-CZTNvMlf.js +11 -0
- package/dist/rect-CZTNvMlf.js.map +1 -0
- package/dist/rect-DPr9QRxl.cjs +16 -0
- package/dist/rect-DPr9QRxl.cjs.map +1 -0
- package/dist/{sankey-Bacx4fVe.cjs → sankey-0CSp_Er9.cjs} +100 -95
- package/dist/sankey-0CSp_Er9.cjs.map +1 -0
- package/dist/{sankey-OV_WoPrl.d.ts → sankey-7As41Fo4.d.ts} +4 -7
- package/dist/{sankey-B4PNKusJ.js → sankey-Dp4CuLVe.js} +100 -95
- package/dist/sankey-Dp4CuLVe.js.map +1 -0
- package/dist/{sankey-DuGI3Qc5.d.cts → sankey-DqiuxUx7.d.cts} +4 -7
- package/dist/sankey.cjs +1 -1
- package/dist/sankey.d.cts +2 -1
- package/dist/sankey.d.ts +2 -1
- package/dist/sankey.js +1 -2
- package/dist/{scatter-DbxLyZX0.d.cts → scatter-BXkXGgM_.d.ts} +14 -9
- package/dist/{scatter-DgMN9zRy.cjs → scatter-Bwkblr4L.cjs} +47 -42
- package/dist/scatter-Bwkblr4L.cjs.map +1 -0
- package/dist/{scatter-kgtgR318.js → scatter-DCMAtt5L.js} +45 -40
- package/dist/scatter-DCMAtt5L.js.map +1 -0
- package/dist/{scatter-BqzgJqdX.d.ts → scatter-DL0zAV09.d.cts} +14 -9
- package/dist/scatter.cjs +1 -1
- package/dist/scatter.d.cts +2 -1
- package/dist/scatter.d.ts +2 -1
- package/dist/scatter.js +1 -2
- package/dist/{sparkline-BfyO_oNM.d.ts → sparkline-BElUSd0r.d.ts} +5 -8
- package/dist/{sparkline-BS9-hltA.cjs → sparkline-BMSuEPHP.cjs} +22 -23
- package/dist/sparkline-BMSuEPHP.cjs.map +1 -0
- package/dist/{sparkline-BQzt27Fr.js → sparkline-NDmq90kP.js} +22 -23
- package/dist/sparkline-NDmq90kP.js.map +1 -0
- package/dist/{sparkline-CWlJDKyh.d.cts → sparkline-RYly7bR0.d.cts} +5 -8
- package/dist/sparkline.cjs +1 -1
- package/dist/sparkline.d.cts +2 -1
- package/dist/sparkline.d.ts +2 -1
- package/dist/sparkline.js +1 -2
- package/dist/{stack-DVhJWaki.cjs → stack-BO4624CY.cjs} +3 -4
- package/dist/{stack-DVhJWaki.cjs.map → stack-BO4624CY.cjs.map} +1 -1
- package/dist/{stack-CpR6RGKd.d.ts → stack-BTWYIwLO.d.cts} +2 -4
- package/dist/{stack-CpR6RGKd.d.cts → stack-DR0eQTsB.d.ts} +1 -4
- package/dist/{stack-DRbwTeF3.js → stack-jVKvg2x_.js} +3 -4
- package/dist/{stack-DRbwTeF3.js.map → stack-jVKvg2x_.js.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/{sweep-CbfR7--d.js → sweep-BpRPlhs6.js} +5 -6
- package/dist/{sweep-CbfR7--d.js.map → sweep-BpRPlhs6.js.map} +1 -1
- package/dist/{sweep-DaTEDDuC.cjs → sweep-Dnp6LDBz.cjs} +5 -6
- package/dist/sweep-Dnp6LDBz.cjs.map +1 -0
- package/dist/{time-CNVnt-B2.d.cts → time-B4oxWHQI.d.cts} +2 -7
- package/dist/{time-CHjiY9Q4.d.ts → time-DRIDgv2a.d.ts} +2 -7
- package/dist/{time-axis-VSX34_Tb.cjs → time-axis-B3VekUfX.cjs} +11 -11
- package/dist/{time-axis-VSX34_Tb.cjs.map → time-axis-B3VekUfX.cjs.map} +1 -1
- package/dist/{time-axis-Bc9eHX1r.js → time-axis-CLjqOakA.js} +10 -10
- package/dist/{time-axis-Bc9eHX1r.js.map → time-axis-CLjqOakA.js.map} +1 -1
- package/dist/time.cjs +4 -6
- package/dist/time.cjs.map +1 -1
- package/dist/time.d.cts +1 -1
- package/dist/time.d.ts +1 -1
- package/dist/time.js +4 -5
- package/dist/treemap-25vHO_UK.d.cts +65 -0
- package/dist/treemap-BCXUbixd.d.ts +65 -0
- package/dist/treemap-C4glsx-g.js +293 -0
- package/dist/treemap-C4glsx-g.js.map +1 -0
- package/dist/treemap-CZk8kKFD.cjs +298 -0
- package/dist/treemap-CZk8kKFD.cjs.map +1 -0
- package/dist/treemap.cjs +3 -0
- package/dist/treemap.d.cts +3 -0
- package/dist/treemap.d.ts +3 -0
- package/dist/treemap.js +1 -0
- package/dist/{tween-BCYd0RTY.js → tween-BdQqUmmv.js} +2 -3
- package/dist/{tween-BCYd0RTY.js.map → tween-BdQqUmmv.js.map} +1 -1
- package/dist/{tween-CIGBlryn.cjs → tween-c3aOmfKE.cjs} +2 -3
- package/dist/{tween-CIGBlryn.cjs.map → tween-c3aOmfKE.cjs.map} +1 -1
- package/dist/{value-labels-IZIQPhfk.js → value-labels-C7GrhOXJ.js} +30 -10
- package/dist/value-labels-C7GrhOXJ.js.map +1 -0
- package/dist/{value-labels-B0WJoJ7x.cjs → value-labels-DzaKIWKp.cjs} +30 -10
- package/dist/value-labels-DzaKIWKp.cjs.map +1 -0
- package/dist/value-labels.cjs +3 -5
- package/dist/value-labels.cjs.map +1 -1
- package/dist/value-labels.d.cts +5 -1
- package/dist/value-labels.d.ts +5 -1
- package/dist/value-labels.js +3 -4
- package/dist/{vnode-CkQ27Cxe.cjs → vnode-ClAiw28x.cjs} +2 -3
- package/dist/{vnode-CkQ27Cxe.cjs.map → vnode-ClAiw28x.cjs.map} +1 -1
- package/dist/{vnode-BUflsBsa.d.ts → vnode-Du2cC8Fm.d.cts} +1 -4
- package/dist/{vnode-BUflsBsa.d.cts → vnode-Du2cC8Fm.d.ts} +1 -4
- package/dist/{vnode-tCWItoUH.js → vnode-_EMUqysL.js} +2 -3
- package/dist/{vnode-tCWItoUH.js.map → vnode-_EMUqysL.js.map} +1 -1
- package/package.json +94 -214
- package/dist/bar-C-7zR2qp.cjs.map +0 -1
- package/dist/bar-jZEoao74.js.map +0 -1
- package/dist/cartesian-BoDfgBCV.cjs.map +0 -1
- package/dist/cartesian-Cr0AF0nG.js.map +0 -1
- package/dist/chart-BF2CK9I_.js.map +0 -1
- package/dist/chart-CowF_lWY.cjs.map +0 -1
- package/dist/core-CegR_j55.js.map +0 -1
- package/dist/core-RzS9IQO5.cjs.map +0 -1
- package/dist/dom-CLF868Qs.cjs.map +0 -1
- package/dist/dom-vP3IcMak.js.map +0 -1
- package/dist/export-chart-9w8t3rjZ.js.map +0 -1
- package/dist/export-chart-BhhYgksr.cjs.map +0 -1
- package/dist/fade-Cs74puQS.cjs.map +0 -1
- package/dist/fade-D3NxH5Qg.js.map +0 -1
- package/dist/features-BclHgg2W.cjs.map +0 -1
- package/dist/features-wASyHGic.js.map +0 -1
- package/dist/gauge-D-FYhuds.cjs.map +0 -1
- package/dist/gauge-Dh423FHh.js.map +0 -1
- package/dist/heatmap-BK18EBgJ.cjs.map +0 -1
- package/dist/heatmap-DSZ2bVIa.js.map +0 -1
- package/dist/hydrate-CxwTXDqO.cjs.map +0 -1
- package/dist/layout-B3hiqVEw.js.map +0 -1
- package/dist/layout-CtMBhNd9.cjs.map +0 -1
- package/dist/line-B3Ed6u7j.js.map +0 -1
- package/dist/line-fQbtP_jL.cjs.map +0 -1
- package/dist/morph-CqYDu1bY.cjs.map +0 -1
- package/dist/parliament-CpWnoEvG.cjs.map +0 -1
- package/dist/parliament-Dw0sOERi.js.map +0 -1
- package/dist/pie-BxTZt6Go.cjs.map +0 -1
- package/dist/pie-DzUXDTcn.js.map +0 -1
- package/dist/point-shapes-CGl4dugc.cjs.map +0 -1
- package/dist/point-shapes-DI84NNpI.js.map +0 -1
- package/dist/radar-CYPab_I4.js.map +0 -1
- package/dist/radar-CoGUNNSb.cjs.map +0 -1
- package/dist/sankey-B4PNKusJ.js.map +0 -1
- package/dist/sankey-Bacx4fVe.cjs.map +0 -1
- package/dist/scatter-DgMN9zRy.cjs.map +0 -1
- package/dist/scatter-kgtgR318.js.map +0 -1
- package/dist/sparkline-BQzt27Fr.js.map +0 -1
- package/dist/sparkline-BS9-hltA.cjs.map +0 -1
- package/dist/sweep-DaTEDDuC.cjs.map +0 -1
- package/dist/value-labels-B0WJoJ7x.cjs.map +0 -1
- package/dist/value-labels-IZIQPhfk.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const require_clean = require("./clean-
|
|
5
|
-
|
|
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
|
+
const require_clean = require("./clean-Die2iCNc.cjs");
|
|
5
|
+
// src/charts/sankey.ts
|
|
6
6
|
/** Space between a node and its label. */
|
|
7
7
|
const LABEL_GAP = 8;
|
|
8
8
|
/** Largest share of the width one side's labels may take. */
|
|
@@ -108,7 +108,8 @@ function layout(options, ctx) {
|
|
|
108
108
|
const { width, height, fontSize, locale } = ctx;
|
|
109
109
|
const nodeWidth = Math.max(1, options.nodeWidth ?? 12);
|
|
110
110
|
const nodePadding = Math.max(0, options.nodePadding ?? 16);
|
|
111
|
-
const
|
|
111
|
+
const { rtl } = ctx;
|
|
112
|
+
const area = require_layout.innerRect(width, height, require_layout.mirrorSides(require_layout.insets(options.padding), rtl));
|
|
112
113
|
const { nodes, links, columns } = graph(options.data, ctx.hidden, options.align !== "left");
|
|
113
114
|
const format = require_format.formatDetail(options.format, locale);
|
|
114
115
|
const texts = nodes.map((n) => [n.data.name, format(n.value)]);
|
|
@@ -140,7 +141,8 @@ function layout(options, ctx) {
|
|
|
140
141
|
const total = col.reduce((s, n) => s + n.value * k, 0) + (col.length - 1) * pad;
|
|
141
142
|
let y = plot.y + (plot.height - total) / 2;
|
|
142
143
|
for (const n of col) {
|
|
143
|
-
|
|
144
|
+
const x = plot.x + (columns > 1 ? c * step : (plot.width - nodeWidth) / 2);
|
|
145
|
+
n.x = rtl ? width - x - nodeWidth : x;
|
|
144
146
|
n.y = y;
|
|
145
147
|
n.height = n.value * k;
|
|
146
148
|
y += n.height + pad;
|
|
@@ -159,30 +161,33 @@ function layout(options, ctx) {
|
|
|
159
161
|
y += link.data.value * k;
|
|
160
162
|
}
|
|
161
163
|
}
|
|
164
|
+
const labels = nodes.map((n, i) => {
|
|
165
|
+
const [name, value] = texts[i];
|
|
166
|
+
const side = n.column === 0 && columns > 1 ? "left" : "right";
|
|
167
|
+
const room = side === "left" ? left : n.column === columns - 1 ? right : step - nodeWidth - 16;
|
|
168
|
+
const col = byColumn[n.column];
|
|
169
|
+
const at = col.indexOf(n);
|
|
170
|
+
const showValue = [col[at - 1], col[at + 1]].filter((o) => !!o).reduce((min, o) => Math.min(min, (n.height + o.height) / 2 + pad), Number.POSITIVE_INFINITY) >= fontSize * (1 + require_layout.LINE_HEIGHT);
|
|
171
|
+
return {
|
|
172
|
+
side,
|
|
173
|
+
name: truncate(name, room, fontSize),
|
|
174
|
+
value: showValue ? truncate(value, room, fontSize) : ""
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
if (rtl) plot.x = width - plot.x - plot.width;
|
|
162
178
|
return {
|
|
163
179
|
nodes,
|
|
164
180
|
links,
|
|
165
181
|
plot,
|
|
166
182
|
nodeWidth,
|
|
167
|
-
labels
|
|
168
|
-
const [name, value] = texts[i];
|
|
169
|
-
const side = n.column === 0 && columns > 1 ? "left" : "right";
|
|
170
|
-
const room = side === "left" ? left : n.column === columns - 1 ? right : step - nodeWidth - 16;
|
|
171
|
-
const col = byColumn[n.column];
|
|
172
|
-
const at = col.indexOf(n);
|
|
173
|
-
const showValue = [col[at - 1], col[at + 1]].filter((o) => !!o).reduce((min, o) => Math.min(min, (n.height + o.height) / 2 + pad), Number.POSITIVE_INFINITY) >= fontSize * (1 + require_layout.LINE_HEIGHT);
|
|
174
|
-
return {
|
|
175
|
-
side,
|
|
176
|
-
name: truncate(name, room, fontSize),
|
|
177
|
-
value: showValue ? truncate(value, room, fontSize) : ""
|
|
178
|
-
};
|
|
179
|
-
})
|
|
183
|
+
labels
|
|
180
184
|
};
|
|
181
185
|
}
|
|
186
|
+
/** The x of a link's ends: the facing edges of its source and its target. */
|
|
187
|
+
const linkEnds = (link, nodeWidth) => link.source.x > link.target.x ? [link.source.x, link.target.x + nodeWidth] : [link.source.x + nodeWidth, link.target.x];
|
|
182
188
|
/** Path of a link: two cubic Béziers between the slices at its ends. */
|
|
183
189
|
function linkPath(link, nodeWidth) {
|
|
184
|
-
const x0 = link
|
|
185
|
-
const x1 = link.target.x;
|
|
190
|
+
const [x0, x1] = linkEnds(link, nodeWidth);
|
|
186
191
|
const xm = (x0 + x1) / 2;
|
|
187
192
|
const { sy, ty, width } = link;
|
|
188
193
|
const p = (...v) => v.map(require_layout.round).join(",");
|
|
@@ -195,8 +200,7 @@ const cubic = (a, b, c, d, t) => {
|
|
|
195
200
|
};
|
|
196
201
|
/** Whether `(px, py)` lies inside the ribbon of `link`. */
|
|
197
202
|
function inLink(link, nodeWidth, px, py) {
|
|
198
|
-
const x0 = link
|
|
199
|
-
const x1 = link.target.x;
|
|
203
|
+
const [x0, x1] = linkEnds(link, nodeWidth);
|
|
200
204
|
if (px < Math.min(x0, x1) || px > Math.max(x0, x1) || x0 === x1) return false;
|
|
201
205
|
const xm = (x0 + x1) / 2;
|
|
202
206
|
let lo = 0;
|
|
@@ -214,12 +218,19 @@ function renderSankey(options, ctx) {
|
|
|
214
218
|
const drawn = links.filter((link) => link.data.value > 0);
|
|
215
219
|
const formatValue = require_format.formatDetail(options.format, ctx.locale);
|
|
216
220
|
const nodeMark = (n) => ({
|
|
221
|
+
kind: "halo",
|
|
217
222
|
d: `M0,0h${require_layout.round(nodeWidth)}v${require_layout.round(n.height)}h${require_layout.round(-nodeWidth)}Z`,
|
|
218
223
|
x: n.x,
|
|
219
|
-
y: n.y
|
|
224
|
+
y: n.y,
|
|
225
|
+
under: true
|
|
226
|
+
});
|
|
227
|
+
const linkMark = (link) => ({
|
|
228
|
+
kind: "halo",
|
|
229
|
+
d: linkPath(link, nodeWidth),
|
|
230
|
+
under: true
|
|
220
231
|
});
|
|
221
232
|
const linkItem = (link) => ({
|
|
222
|
-
name: `${link.source.data.name} → ${link.target.data.name}`,
|
|
233
|
+
name: `${link.source.data.name} ${ctx.rtl ? "←" : "→"} ${link.target.data.name}`,
|
|
223
234
|
seriesIndex: link.index,
|
|
224
235
|
color: colorOf(link.source),
|
|
225
236
|
value: link.data.value,
|
|
@@ -248,11 +259,7 @@ function renderSankey(options, ctx) {
|
|
|
248
259
|
area: plot,
|
|
249
260
|
items: [own, ...flows],
|
|
250
261
|
seriesIndex: focused ? linkIndex : own.seriesIndex,
|
|
251
|
-
|
|
252
|
-
d: linkPath(link, nodeWidth),
|
|
253
|
-
x: 0,
|
|
254
|
-
y: 0
|
|
255
|
-
} : nodeMark(n)
|
|
262
|
+
highlight: link ? linkMark(link) : nodeMark(n)
|
|
256
263
|
};
|
|
257
264
|
};
|
|
258
265
|
const hitLink = (link) => {
|
|
@@ -265,11 +272,7 @@ function renderSankey(options, ctx) {
|
|
|
265
272
|
area: plot,
|
|
266
273
|
items: [item],
|
|
267
274
|
seriesIndex: link.index,
|
|
268
|
-
|
|
269
|
-
d: linkPath(link, nodeWidth),
|
|
270
|
-
x: 0,
|
|
271
|
-
y: 0
|
|
272
|
-
}
|
|
275
|
+
highlight: linkMark(link)
|
|
273
276
|
};
|
|
274
277
|
};
|
|
275
278
|
const interaction = {
|
|
@@ -285,64 +288,67 @@ function renderSankey(options, ctx) {
|
|
|
285
288
|
return n ? hitNode(n, seriesIndex) : null;
|
|
286
289
|
}
|
|
287
290
|
};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
key: n.data.name,
|
|
308
|
-
class: ["tc-series", `tc-series-${n.slot}`],
|
|
309
|
-
"data-series": n.data.name,
|
|
310
|
-
style: { "--tc-series-color": n.data.color }
|
|
311
|
-
}, require_vnode.h("rect", {
|
|
312
|
-
class: "tc-sankey-node",
|
|
313
|
-
x: require_layout.round(n.x),
|
|
314
|
-
y: require_layout.round(n.y),
|
|
315
|
-
width: require_layout.round(nodeWidth),
|
|
316
|
-
height: require_layout.round(n.height)
|
|
317
|
-
})))),
|
|
318
|
-
require_vnode.h("g", {
|
|
319
|
-
key: "labels",
|
|
320
|
-
class: "tc-sankey-labels",
|
|
321
|
-
"aria-hidden": "true"
|
|
322
|
-
}, nodes.map((n, i) => {
|
|
323
|
-
const label = labels[i];
|
|
324
|
-
if (!label.name && !label.value) return null;
|
|
325
|
-
const x = require_layout.round(label.side === "left" ? n.x - LABEL_GAP : n.x + nodeWidth + LABEL_GAP);
|
|
326
|
-
const y = require_layout.round(n.y + n.height / 2);
|
|
327
|
-
const anchor = label.side === "left" ? "end" : "start";
|
|
328
|
-
return require_vnode.h("g", {
|
|
291
|
+
return {
|
|
292
|
+
content: [
|
|
293
|
+
require_vnode.h("g", {
|
|
294
|
+
key: "links",
|
|
295
|
+
class: "tc-sankey-links"
|
|
296
|
+
}, drawn.map((link) => require_vnode.h("path", {
|
|
297
|
+
key: `${link.source.data.name}→${link.target.data.name}#${link.index}`,
|
|
298
|
+
class: [
|
|
299
|
+
"tc-series",
|
|
300
|
+
`tc-series-${link.source.slot}`,
|
|
301
|
+
"tc-sankey-link"
|
|
302
|
+
],
|
|
303
|
+
style: { "--tc-series-color": link.source.data.color },
|
|
304
|
+
d: linkPath(link, nodeWidth)
|
|
305
|
+
}))),
|
|
306
|
+
require_vnode.h("g", {
|
|
307
|
+
key: "nodes",
|
|
308
|
+
class: "tc-sankey-nodes"
|
|
309
|
+
}, nodes.map((n) => require_vnode.h("g", {
|
|
329
310
|
key: n.data.name,
|
|
330
|
-
class: "tc-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
"
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
311
|
+
class: ["tc-series", `tc-series-${n.slot}`],
|
|
312
|
+
"data-series": n.data.name,
|
|
313
|
+
style: { "--tc-series-color": n.data.color }
|
|
314
|
+
}, require_vnode.h("rect", {
|
|
315
|
+
class: "tc-sankey-node",
|
|
316
|
+
x: require_layout.round(n.x),
|
|
317
|
+
y: require_layout.round(n.y),
|
|
318
|
+
width: require_layout.round(nodeWidth),
|
|
319
|
+
height: require_layout.round(n.height)
|
|
320
|
+
})))),
|
|
321
|
+
require_vnode.h("g", {
|
|
322
|
+
key: "labels",
|
|
323
|
+
class: "tc-sankey-labels",
|
|
324
|
+
"aria-hidden": "true"
|
|
325
|
+
}, nodes.map((n, i) => {
|
|
326
|
+
const label = labels[i];
|
|
327
|
+
if (!label.name && !label.value) return null;
|
|
328
|
+
const before = label.side === "left" !== (ctx.rtl === true);
|
|
329
|
+
const x = require_layout.round(before ? n.x - LABEL_GAP : n.x + nodeWidth + LABEL_GAP);
|
|
330
|
+
const y = require_layout.round(n.y + n.height / 2);
|
|
331
|
+
const anchor = before ? "end" : "start";
|
|
332
|
+
return require_vnode.h("g", {
|
|
333
|
+
key: n.data.name,
|
|
334
|
+
class: "tc-sankey-label"
|
|
335
|
+
}, require_vnode.h("text", {
|
|
336
|
+
class: "tc-value-label tc-sankey-name",
|
|
337
|
+
x,
|
|
338
|
+
y,
|
|
339
|
+
dy: label.value ? "-0.25em" : "0.35em",
|
|
340
|
+
"text-anchor": anchor
|
|
341
|
+
}, label.name), label.value && require_vnode.h("text", {
|
|
342
|
+
class: "tc-tick-label tc-sankey-value",
|
|
343
|
+
x,
|
|
344
|
+
y,
|
|
345
|
+
dy: "0.95em",
|
|
346
|
+
"text-anchor": anchor
|
|
347
|
+
}, label.value));
|
|
348
|
+
}))
|
|
349
|
+
],
|
|
350
|
+
interaction
|
|
351
|
+
};
|
|
346
352
|
}
|
|
347
353
|
/** One legend entry per custom color, named after the first node wearing it. */
|
|
348
354
|
function sankeyLegend(options) {
|
|
@@ -414,7 +420,6 @@ const sankey = {
|
|
|
414
420
|
legend: sankeyLegend,
|
|
415
421
|
table: sankeyTable
|
|
416
422
|
};
|
|
417
|
-
//#endregion
|
|
418
423
|
Object.defineProperty(exports, "sankey", {
|
|
419
424
|
enumerable: true,
|
|
420
425
|
get: function() {
|
|
@@ -422,4 +427,4 @@ Object.defineProperty(exports, "sankey", {
|
|
|
422
427
|
}
|
|
423
428
|
});
|
|
424
429
|
|
|
425
|
-
//# sourceMappingURL=sankey-
|
|
430
|
+
//# sourceMappingURL=sankey-0CSp_Er9.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sankey-0CSp_Er9.cjs","names":["estimateTextWidth","innerRect","mirrorSides","insets","formatDetail","LINE_HEIGHT","round","h","isRecord","records","named","text","finite","cleanData"],"sources":["../src/charts/sankey.ts"],"sourcesContent":["import type { DataTable } from '../a11y.ts'\nimport type { ChartType, RenderContext, RenderResult } from '../chart.ts'\nimport { formatDetail, type NumberFormat } from '../format.ts'\nimport type { Highlight, Hit, HitItem, Interaction } from '../interaction.ts'\nimport {\n estimateTextWidth,\n type InsetsInput,\n innerRect,\n insets,\n LINE_HEIGHT,\n mirrorSides,\n type Rect,\n round,\n} from '../layout.ts'\nimport type { LegendItem } from '../legend.ts'\nimport { h } from '../vnode.ts'\nimport { cleanData, finite, isRecord, named, records, text } from './clean.ts'\n\n/** A node of the flow; nodes left out are made from the links. */\nexport interface SankeyNode {\n name: string\n /**\n * Custom color; overrides the palette slot via `--tc-series-color`. Nodes\n * sharing a color form one legend entry, named after the first of them.\n * Values that could inject CSS (`;`, quotes, `url()` …) are ignored, so colors from user data are safe.\n */\n color?: string\n /** Start hidden (toggle it back from the legend, with every node of its color). */\n hidden?: boolean\n}\n\n/** A flow between two nodes, by name. */\nexport interface SankeyLink {\n from: string\n to: string\n /** Non-negative value; negative values count as zero. */\n value: number\n}\n\nexport interface SankeyData {\n /** Optional: sets the stacking order within a column, and colors. */\n nodes?: readonly SankeyNode[]\n links: readonly SankeyLink[]\n}\n\nexport interface SankeyOptions {\n data: SankeyData\n /** Width of the node bars in pixels. Defaults to `12`. */\n nodeWidth?: number\n /** Vertical gap between the nodes of a column in pixels. Defaults to `16`. */\n nodePadding?: number\n /** Format of the values (labels, tooltips and the table). */\n format?: NumberFormat\n /**\n * `'justify'` (default) puts every node without outgoing flows in the last\n * column; `'left'` leaves it in the column after its sources.\n */\n align?: 'justify' | 'left'\n /** Extra space around the diagram, in pixels. */\n padding?: InsetsInput\n}\n\ninterface Node {\n data: SankeyNode\n index: number\n /** Palette slot, 1-based: the node's position in its column. */\n slot: number\n column: number\n value: number\n x: number\n y: number\n height: number\n ins: Link[]\n outs: Link[]\n}\n\ninterface Link {\n data: SankeyLink\n index: number\n source: Node\n target: Node\n /** Top of the slice at the source and at the target. */\n sy: number\n ty: number\n width: number\n}\n\ninterface Layout {\n nodes: Node[]\n links: Link[]\n /** The columns' extent, between the label margins. */\n plot: Rect\n nodeWidth: number\n labels: NodeLabel[]\n}\n\n/** A node's label: the name and the value under it, cut to fit (empty when hidden). */\ninterface NodeLabel {\n side: 'left' | 'right'\n name: string\n value: string\n}\n\n/** Space between a node and its label. */\nconst LABEL_GAP = 8\n/** Largest share of the width one side's labels may take. */\nconst MAX_LABEL_SHARE = 0.3\n/** Pixels around a node that still count as hovering it. */\nconst HOVER_SLOP = 2\n\n/** `text`, cut short with an ellipsis to fit `width` pixels. */\nfunction truncate(text: string, width: number, fontSize: number): string {\n if (estimateTextWidth(text, fontSize) <= width) return text\n let end = text.length\n while (end > 0 && estimateTextWidth(`${text.slice(0, end)}…`, fontSize) > width) end--\n return end > 0 ? `${text.slice(0, end).trimEnd()}…` : ''\n}\n\n/** The color of a node for hover and tooltip swatches. */\nconst colorOf = (node: Node): string => node.data.color ?? `var(--tc-color-${node.slot})`\n\n/** The visible nodes and links, in data order, with their columns. */\nfunction graph(data: SankeyData, hidden: ReadonlySet<string>, justify: boolean) {\n const byName = new Map<string, Node>()\n const nodes: Node[] = []\n const node = (name: string, data?: SankeyNode): Node => {\n let found = byName.get(name)\n if (!found) {\n found = {\n data: data ?? { name },\n index: nodes.length,\n slot: 1,\n column: 0,\n value: 0,\n x: 0,\n y: 0,\n height: 0,\n ins: [],\n outs: [],\n }\n byName.set(name, found)\n nodes.push(found)\n }\n return found\n }\n const declared = new Map((data.nodes ?? []).map((n) => [n.name, n]))\n /** A legend key hides every node of its color, see `sankeyLegend`. */\n const isHidden = (name: string) => {\n const n = declared.get(name)\n return hidden.has(name) || (n?.color !== undefined && hidden.has(legendKey(data, n.color)))\n }\n const links: Link[] = []\n data.links.forEach((link, index) => {\n if (link.from === link.to || isHidden(link.from) || isHidden(link.to)) return\n const source = node(link.from, declared.get(link.from))\n const target = node(link.to, declared.get(link.to))\n const out: Link = { data: link, index, source, target, sy: 0, ty: 0, width: 0 }\n links.push(out)\n if (link.value <= 0) return\n source.outs.push(out)\n target.ins.push(out)\n })\n for (const n of nodes) {\n n.value = Math.max(\n n.outs.reduce((sum, l) => sum + l.data.value, 0),\n n.ins.reduce((sum, l) => sum + l.data.value, 0),\n )\n }\n // Column: the longest path from a source, passes bounded so cycles end.\n for (let pass = 0; pass < nodes.length; pass++) {\n let changed = false\n for (const link of links) {\n if (link.data.value > 0 && link.target.column <= link.source.column) {\n link.target.column = link.source.column + 1\n changed = true\n }\n }\n if (!changed) break\n }\n const last = nodes.reduce((max, n) => Math.max(max, n.column), 0)\n if (justify) for (const n of nodes) if (n.outs.length === 0) n.column = last\n // Stack order within a column: declared nodes first, then first appearance.\n const order = [...declared.keys()]\n nodes.sort((a, b) => {\n if (a.column !== b.column) return a.column - b.column\n const ia = order.indexOf(a.data.name)\n const ib = order.indexOf(b.data.name)\n if (ia !== -1 && ib !== -1) return ia - ib\n if (ia !== ib) return ia === -1 ? 1 : -1\n return a.index - b.index\n })\n const slots = new Map<number, number>()\n nodes.forEach((n, index) => {\n n.index = index\n const slot = (slots.get(n.column) ?? 0) + 1\n slots.set(n.column, slot)\n n.slot = ((slot - 1) % 8) + 1\n })\n return { nodes, links, columns: last + 1 }\n}\n\n/** Key of the legend entry of `color`: the first node that wears it. */\nconst legendKey = (data: SankeyData, color: string): string =>\n (data.nodes ?? []).find((n) => n.color === color)?.name ?? color\n\nfunction layout(options: SankeyOptions, ctx: RenderContext): Layout {\n const { width, height, fontSize, locale } = ctx\n const nodeWidth = Math.max(1, options.nodeWidth ?? 12)\n const nodePadding = Math.max(0, options.nodePadding ?? 16)\n // Right to left, the layout is worked out as its mirror image, then flipped.\n const { rtl } = ctx\n const area = innerRect(width, height, mirrorSides(insets(options.padding), rtl))\n const { nodes, links, columns } = graph(options.data, ctx.hidden, options.align !== 'left')\n const format = formatDetail(options.format, locale)\n\n // Labels take their room from the sides: the first column's to its left,\n // the last column's to its right, the rest to the right of their node.\n const texts = nodes.map((n) => [n.data.name, format(n.value)] as const)\n const widest = (match: (n: Node) => boolean) =>\n nodes.reduce((max, n, i) => {\n if (!match(n)) return max\n const [name, value] = texts[i] as readonly [string, string]\n return Math.max(max, estimateTextWidth(name, fontSize), estimateTextWidth(value, fontSize))\n }, 0)\n const cap = area.width * MAX_LABEL_SHARE\n const left =\n columns > 1\n ? Math.min(\n cap,\n widest((n) => n.column === 0),\n )\n : 0\n const right = Math.min(\n cap,\n widest((n) => n.column === columns - 1),\n )\n const plot: Rect = {\n x: area.x + (left ? left + LABEL_GAP : 0),\n y: area.y,\n width: Math.max(\n 0,\n area.width - (left ? left + LABEL_GAP : 0) - (right ? right + LABEL_GAP : 0),\n ),\n height: area.height,\n }\n const step = columns > 1 ? (plot.width - nodeWidth) / (columns - 1) : 0\n\n // Heights: one scale for every column, so values compare across them.\n const byColumn: Node[][] = Array.from({ length: columns }, () => [])\n for (const n of nodes) byColumn[n.column]?.push(n)\n const pad = byColumn.reduce(\n (min, col) => (col.length > 1 ? Math.min(min, plot.height / 2 / (col.length - 1)) : min),\n nodePadding,\n )\n let k = Number.POSITIVE_INFINITY\n for (const col of byColumn) {\n const sum = col.reduce((s, n) => s + n.value, 0)\n if (sum > 0) k = Math.min(k, (plot.height - (col.length - 1) * pad) / sum)\n }\n if (!Number.isFinite(k) || k < 0) k = 0\n byColumn.forEach((col, c) => {\n const total = col.reduce((s, n) => s + n.value * k, 0) + (col.length - 1) * pad\n let y = plot.y + (plot.height - total) / 2\n for (const n of col) {\n const x = plot.x + (columns > 1 ? c * step : (plot.width - nodeWidth) / 2)\n n.x = rtl ? width - x - nodeWidth : x\n n.y = y\n n.height = n.value * k\n y += n.height + pad\n }\n })\n // Slices: flows leave and enter in the order of the node at the other end.\n for (const n of nodes) {\n let y = n.y\n for (const link of [...n.outs].sort((a, b) => a.target.y - b.target.y)) {\n link.sy = y\n link.width = link.data.value * k\n y += link.width\n }\n y = n.y\n for (const link of [...n.ins].sort((a, b) => a.source.y - b.source.y)) {\n link.ty = y\n y += link.data.value * k\n }\n }\n\n const labels = nodes.map((n, i): NodeLabel => {\n const [name, value] = texts[i] as readonly [string, string]\n const side: 'left' | 'right' = n.column === 0 && columns > 1 ? 'left' : 'right'\n const room =\n side === 'left' ? left : n.column === columns - 1 ? right : step - nodeWidth - LABEL_GAP * 2\n // Crowded columns keep only the names: the value line would run into the next label.\n const col = byColumn[n.column] as Node[]\n const at = col.indexOf(n)\n const neighbours = [col[at - 1], col[at + 1]].filter((o): o is Node => !!o)\n const spacing = neighbours.reduce(\n (min, o) => Math.min(min, (n.height + o.height) / 2 + pad),\n Number.POSITIVE_INFINITY,\n )\n const showValue = spacing >= fontSize * (1 + LINE_HEIGHT)\n return {\n side,\n name: truncate(name, room, fontSize),\n value: showValue ? truncate(value, room, fontSize) : '',\n }\n })\n if (rtl) plot.x = width - plot.x - plot.width\n return { nodes, links, plot, nodeWidth, labels }\n}\n\n/** The x of a link's ends: the facing edges of its source and its target. */\nconst linkEnds = (link: Link, nodeWidth: number): [number, number] =>\n link.source.x > link.target.x\n ? [link.source.x, link.target.x + nodeWidth]\n : [link.source.x + nodeWidth, link.target.x]\n\n/** Path of a link: two cubic Béziers between the slices at its ends. */\nfunction linkPath(link: Link, nodeWidth: number): string {\n const [x0, x1] = linkEnds(link, nodeWidth)\n const xm = (x0 + x1) / 2\n const { sy, ty, width } = link\n const p = (...v: number[]) => v.map(round).join(',')\n return `M${p(x0, sy)}C${p(xm, sy, xm, ty, x1, ty)}L${p(x1, ty + width)}C${p(xm, ty + width, xm, sy + width, x0, sy + width)}Z`\n}\n\n/** A point on a cubic Bézier with control points `a`, `b`, `c`, `d`. */\nconst cubic = (a: number, b: number, c: number, d: number, t: number): number => {\n const u = 1 - t\n return u * u * u * a + 3 * u * u * t * b + 3 * u * t * t * c + t * t * t * d\n}\n\n/** Whether `(px, py)` lies inside the ribbon of `link`. */\nfunction inLink(link: Link, nodeWidth: number, px: number, py: number): boolean {\n const [x0, x1] = linkEnds(link, nodeWidth)\n if (px < Math.min(x0, x1) || px > Math.max(x0, x1) || x0 === x1) return false\n const xm = (x0 + x1) / 2\n // x(t) is monotone, so bisection finds the t under the pointer.\n let lo = 0\n let hi = 1\n for (let i = 0; i < 20; i++) {\n const mid = (lo + hi) / 2\n if (cubic(x0, xm, xm, x1, mid) < px === x1 > x0) lo = mid\n else hi = mid\n }\n const top = cubic(link.sy, link.sy, link.ty, link.ty, (lo + hi) / 2)\n return py >= top && py <= top + link.width\n}\n\nfunction renderSankey(options: SankeyOptions, ctx: RenderContext): RenderResult {\n const { nodes, links, plot, nodeWidth, labels } = layout(options, ctx)\n const drawn = links.filter((link) => link.data.value > 0)\n const formatValue = formatDetail(options.format, ctx.locale)\n\n const nodeMark = (n: Node): Highlight => ({\n kind: 'halo',\n d: `M0,0h${round(nodeWidth)}v${round(n.height)}h${round(-nodeWidth)}Z`,\n x: n.x,\n y: n.y,\n under: true,\n })\n // Marks go under the chart: over it, a hovered flow would cover the labels on it.\n const linkMark = (link: Link): Highlight => ({\n kind: 'halo',\n d: linkPath(link, nodeWidth),\n under: true,\n })\n const linkItem = (link: Link): HitItem => ({\n name: `${link.source.data.name} ${ctx.rtl ? '←' : '→'} ${link.target.data.name}`,\n seriesIndex: link.index,\n color: colorOf(link.source),\n value: link.data.value,\n text: formatValue(link.data.value),\n x: (link.source.x + nodeWidth + link.target.x) / 2,\n y: cubic(link.sy, link.sy, link.ty, link.ty, 0.5) + link.width / 2,\n })\n const hitNode = (n: Node, linkIndex?: number): Hit => {\n const own: HitItem = {\n name: n.data.name,\n seriesIndex: links.length + n.index,\n color: colorOf(n),\n value: n.value,\n text: formatValue(n.value),\n x: n.x + nodeWidth / 2,\n y: n.y + n.height / 2,\n }\n const flows = [...n.ins, ...n.outs].map(linkItem)\n const focused = flows.find((item) => item.seriesIndex === linkIndex)\n const link = focused && drawn.find((l) => l.index === linkIndex)\n return {\n index: n.index,\n label: n.data.name,\n title: '',\n x: own.x,\n area: plot,\n items: [own, ...flows],\n seriesIndex: focused ? linkIndex : own.seriesIndex,\n highlight: link ? linkMark(link) : nodeMark(n),\n }\n }\n const hitLink = (link: Link): Hit => {\n const item = linkItem(link)\n return {\n index: link.source.index,\n label: link.source.data.name,\n title: '',\n x: item.x,\n area: plot,\n items: [item],\n seriesIndex: link.index,\n highlight: linkMark(link),\n }\n }\n\n const interaction: Interaction = {\n count: nodes.length,\n hitTest(px, py) {\n const n = nodes.find(\n (n) =>\n px >= n.x - HOVER_SLOP &&\n px <= n.x + nodeWidth + HOVER_SLOP &&\n py >= n.y - HOVER_SLOP &&\n py <= n.y + n.height + HOVER_SLOP,\n )\n if (n) return hitNode(n)\n const link = drawn.find((l) => inLink(l, nodeWidth, px, py))\n return link ? hitLink(link) : null\n },\n hitIndex(index, seriesIndex) {\n const n = nodes[index]\n return n ? hitNode(n, seriesIndex) : null\n },\n }\n\n const content = [\n h(\n 'g',\n { key: 'links', class: 'tc-sankey-links' },\n drawn.map((link) =>\n h('path', {\n key: `${link.source.data.name}→${link.target.data.name}#${link.index}`,\n class: ['tc-series', `tc-series-${link.source.slot}`, 'tc-sankey-link'],\n style: { '--tc-series-color': link.source.data.color },\n d: linkPath(link, nodeWidth),\n }),\n ),\n ),\n h(\n 'g',\n { key: 'nodes', class: 'tc-sankey-nodes' },\n nodes.map((n) =>\n h(\n 'g',\n {\n key: n.data.name,\n class: ['tc-series', `tc-series-${n.slot}`],\n 'data-series': n.data.name,\n style: { '--tc-series-color': n.data.color },\n },\n h('rect', {\n class: 'tc-sankey-node',\n x: round(n.x),\n y: round(n.y),\n width: round(nodeWidth),\n height: round(n.height),\n }),\n ),\n ),\n ),\n h(\n 'g',\n { key: 'labels', class: 'tc-sankey-labels', 'aria-hidden': 'true' },\n nodes.map((n, i) => {\n const label = labels[i] as NodeLabel\n if (!label.name && !label.value) return null\n // The label's side is the one of the left-to-right layout: mirrored with it.\n const before = (label.side === 'left') !== (ctx.rtl === true)\n const x = round(before ? n.x - LABEL_GAP : n.x + nodeWidth + LABEL_GAP)\n const y = round(n.y + n.height / 2)\n const anchor = before ? 'end' : 'start'\n return h(\n 'g',\n { key: n.data.name, class: 'tc-sankey-label' },\n h(\n 'text',\n {\n class: 'tc-value-label tc-sankey-name',\n x,\n y,\n dy: label.value ? '-0.25em' : '0.35em',\n 'text-anchor': anchor,\n },\n label.name,\n ),\n label.value &&\n h(\n 'text',\n {\n class: 'tc-tick-label tc-sankey-value',\n x,\n y,\n dy: '0.95em',\n 'text-anchor': anchor,\n },\n label.value,\n ),\n )\n }),\n ),\n ]\n return { content, interaction }\n}\n\n/** One legend entry per custom color, named after the first node wearing it. */\nfunction sankeyLegend(options: SankeyOptions): LegendItem[] {\n const seen = new Map<string, LegendItem>()\n for (const n of options.data.nodes ?? []) {\n if (n.color && !seen.has(n.color)) {\n const item: LegendItem = { key: n.name, name: n.name, index: seen.size, color: n.color }\n if (n.hidden) item.hidden = true\n seen.set(n.color, item)\n }\n }\n return [...seen.values()]\n}\n\nfunction sankeyTable(options: SankeyOptions, ctx: RenderContext): DataTable {\n const { links } = graph(options.data, ctx.hidden, true)\n const value = formatDetail(options.format, ctx.locale)\n return {\n columns: ['From', 'To', 'Value'],\n rows: links.map((link) => [link.data.from, link.data.to, value(link.data.value)]),\n }\n}\n\n/** Nodes and links from users, APIs and JSON, in the shape the layout expects. */\nconst cleanSankey = (data: unknown): unknown => {\n const d = isRecord(data) ? data : {}\n return {\n ...d,\n nodes: Array.isArray(d.nodes) ? records(d.nodes, (r) => named(r)) : undefined,\n links: records(d.links, (r) => ({\n from: text(r.from),\n to: text(r.to),\n value: Math.max(0, finite(r.value) ?? 0),\n })),\n }\n}\n\n/**\n * Sankey diagram: flows between nodes, as ribbons whose width is their\n * value. Nodes are made from the links (or declared, to set their order and\n * colors) and placed in columns by the longest path from a source.\n *\n * ```ts\n * new Chart('#el', {\n * type: sankey,\n * data: {\n * links: [\n * { from: 'Wages', to: 'Income', value: 60 },\n * { from: 'Dividends', to: 'Income', value: 15 },\n * { from: 'Income', to: 'Rent', value: 30 },\n * { from: 'Income', to: 'Savings', value: 45 },\n * ],\n * },\n * })\n * ```\n */\nexport const sankey: ChartType<SankeyOptions> = {\n name: 'sankey',\n clean: cleanData(cleanSankey),\n render: renderSankey,\n legend: sankeyLegend,\n table: sankeyTable,\n}\n"],"mappings":";;;;;;AAwGA,MAAM,YAAY;;AAElB,MAAM,kBAAkB;;AAExB,MAAM,aAAa;;AAGnB,SAAS,SAAS,MAAc,OAAe,UAA0B;CACvE,IAAIA,eAAAA,kBAAkB,MAAM,QAAQ,KAAK,OAAO,OAAO;CACvD,IAAI,MAAM,KAAK;CACf,OAAO,MAAM,KAAKA,eAAAA,kBAAkB,GAAG,KAAK,MAAM,GAAG,GAAG,EAAE,IAAI,QAAQ,IAAI,OAAO;CACjF,OAAO,MAAM,IAAI,GAAG,KAAK,MAAM,GAAG,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK;AACxD;;AAGA,MAAM,WAAW,SAAuB,KAAK,KAAK,SAAS,kBAAkB,KAAK,KAAK;;AAGvF,SAAS,MAAM,MAAkB,QAA6B,SAAkB;CAC9E,MAAM,yBAAS,IAAI,IAAkB;CACrC,MAA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;;;;;;AAqBA,MAAa,SAAmC;CAC9C,MAAM;CACN,OAAOC,cAAAA,UAAU,WAAW;CAC5B,QAAQ;CACR,QAAQ;CACR,OAAO;AACT"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
//#region src/charts/sankey.d.ts
|
|
1
|
+
import { o as ChartType } from "./chart-CYrrUCi3.js";
|
|
2
|
+
import { c as NumberFormat } from "./time-DRIDgv2a.js";
|
|
3
|
+
import { a as InsetsInput } from "./annotations-B02GR_KU.js";
|
|
5
4
|
/** A node of the flow; nodes left out are made from the links. */
|
|
6
5
|
interface SankeyNode {
|
|
7
6
|
name: string;
|
|
@@ -62,6 +61,4 @@ interface SankeyOptions {
|
|
|
62
61
|
* ```
|
|
63
62
|
*/
|
|
64
63
|
declare const sankey: ChartType<SankeyOptions>;
|
|
65
|
-
|
|
66
|
-
export { sankey as a, SankeyOptions as i, SankeyLink as n, SankeyNode as r, SankeyData as t };
|
|
67
|
-
//# sourceMappingURL=sankey-OV_WoPrl.d.ts.map
|
|
64
|
+
export { sankey as a, SankeyOptions as i, SankeyLink as n, SankeyNode as r, SankeyData as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import { a as isRecord,
|
|
5
|
-
|
|
1
|
+
import { n as formatDetail } from "./format-it1kepFG.js";
|
|
2
|
+
import { a as mirrorSides, i as insets, n as estimateTextWidth, r as innerRect, s as round, t as LINE_HEIGHT } from "./layout-DqAte3H8.js";
|
|
3
|
+
import { t as h } from "./vnode-_EMUqysL.js";
|
|
4
|
+
import { a as isRecord, c as named, d as text, i as finite, t as cleanData, u as records } from "./clean-CkoQobGv.js";
|
|
5
|
+
// src/charts/sankey.ts
|
|
6
6
|
/** Space between a node and its label. */
|
|
7
7
|
const LABEL_GAP = 8;
|
|
8
8
|
/** Largest share of the width one side's labels may take. */
|
|
@@ -108,7 +108,8 @@ function layout(options, ctx) {
|
|
|
108
108
|
const { width, height, fontSize, locale } = ctx;
|
|
109
109
|
const nodeWidth = Math.max(1, options.nodeWidth ?? 12);
|
|
110
110
|
const nodePadding = Math.max(0, options.nodePadding ?? 16);
|
|
111
|
-
const
|
|
111
|
+
const { rtl } = ctx;
|
|
112
|
+
const area = innerRect(width, height, mirrorSides(insets(options.padding), rtl));
|
|
112
113
|
const { nodes, links, columns } = graph(options.data, ctx.hidden, options.align !== "left");
|
|
113
114
|
const format = formatDetail(options.format, locale);
|
|
114
115
|
const texts = nodes.map((n) => [n.data.name, format(n.value)]);
|
|
@@ -140,7 +141,8 @@ function layout(options, ctx) {
|
|
|
140
141
|
const total = col.reduce((s, n) => s + n.value * k, 0) + (col.length - 1) * pad;
|
|
141
142
|
let y = plot.y + (plot.height - total) / 2;
|
|
142
143
|
for (const n of col) {
|
|
143
|
-
|
|
144
|
+
const x = plot.x + (columns > 1 ? c * step : (plot.width - nodeWidth) / 2);
|
|
145
|
+
n.x = rtl ? width - x - nodeWidth : x;
|
|
144
146
|
n.y = y;
|
|
145
147
|
n.height = n.value * k;
|
|
146
148
|
y += n.height + pad;
|
|
@@ -159,30 +161,33 @@ function layout(options, ctx) {
|
|
|
159
161
|
y += link.data.value * k;
|
|
160
162
|
}
|
|
161
163
|
}
|
|
164
|
+
const labels = nodes.map((n, i) => {
|
|
165
|
+
const [name, value] = texts[i];
|
|
166
|
+
const side = n.column === 0 && columns > 1 ? "left" : "right";
|
|
167
|
+
const room = side === "left" ? left : n.column === columns - 1 ? right : step - nodeWidth - 16;
|
|
168
|
+
const col = byColumn[n.column];
|
|
169
|
+
const at = col.indexOf(n);
|
|
170
|
+
const showValue = [col[at - 1], col[at + 1]].filter((o) => !!o).reduce((min, o) => Math.min(min, (n.height + o.height) / 2 + pad), Number.POSITIVE_INFINITY) >= fontSize * (1 + LINE_HEIGHT);
|
|
171
|
+
return {
|
|
172
|
+
side,
|
|
173
|
+
name: truncate(name, room, fontSize),
|
|
174
|
+
value: showValue ? truncate(value, room, fontSize) : ""
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
if (rtl) plot.x = width - plot.x - plot.width;
|
|
162
178
|
return {
|
|
163
179
|
nodes,
|
|
164
180
|
links,
|
|
165
181
|
plot,
|
|
166
182
|
nodeWidth,
|
|
167
|
-
labels
|
|
168
|
-
const [name, value] = texts[i];
|
|
169
|
-
const side = n.column === 0 && columns > 1 ? "left" : "right";
|
|
170
|
-
const room = side === "left" ? left : n.column === columns - 1 ? right : step - nodeWidth - 16;
|
|
171
|
-
const col = byColumn[n.column];
|
|
172
|
-
const at = col.indexOf(n);
|
|
173
|
-
const showValue = [col[at - 1], col[at + 1]].filter((o) => !!o).reduce((min, o) => Math.min(min, (n.height + o.height) / 2 + pad), Number.POSITIVE_INFINITY) >= fontSize * (1 + LINE_HEIGHT);
|
|
174
|
-
return {
|
|
175
|
-
side,
|
|
176
|
-
name: truncate(name, room, fontSize),
|
|
177
|
-
value: showValue ? truncate(value, room, fontSize) : ""
|
|
178
|
-
};
|
|
179
|
-
})
|
|
183
|
+
labels
|
|
180
184
|
};
|
|
181
185
|
}
|
|
186
|
+
/** The x of a link's ends: the facing edges of its source and its target. */
|
|
187
|
+
const linkEnds = (link, nodeWidth) => link.source.x > link.target.x ? [link.source.x, link.target.x + nodeWidth] : [link.source.x + nodeWidth, link.target.x];
|
|
182
188
|
/** Path of a link: two cubic Béziers between the slices at its ends. */
|
|
183
189
|
function linkPath(link, nodeWidth) {
|
|
184
|
-
const x0 = link
|
|
185
|
-
const x1 = link.target.x;
|
|
190
|
+
const [x0, x1] = linkEnds(link, nodeWidth);
|
|
186
191
|
const xm = (x0 + x1) / 2;
|
|
187
192
|
const { sy, ty, width } = link;
|
|
188
193
|
const p = (...v) => v.map(round).join(",");
|
|
@@ -195,8 +200,7 @@ const cubic = (a, b, c, d, t) => {
|
|
|
195
200
|
};
|
|
196
201
|
/** Whether `(px, py)` lies inside the ribbon of `link`. */
|
|
197
202
|
function inLink(link, nodeWidth, px, py) {
|
|
198
|
-
const x0 = link
|
|
199
|
-
const x1 = link.target.x;
|
|
203
|
+
const [x0, x1] = linkEnds(link, nodeWidth);
|
|
200
204
|
if (px < Math.min(x0, x1) || px > Math.max(x0, x1) || x0 === x1) return false;
|
|
201
205
|
const xm = (x0 + x1) / 2;
|
|
202
206
|
let lo = 0;
|
|
@@ -214,12 +218,19 @@ function renderSankey(options, ctx) {
|
|
|
214
218
|
const drawn = links.filter((link) => link.data.value > 0);
|
|
215
219
|
const formatValue = formatDetail(options.format, ctx.locale);
|
|
216
220
|
const nodeMark = (n) => ({
|
|
221
|
+
kind: "halo",
|
|
217
222
|
d: `M0,0h${round(nodeWidth)}v${round(n.height)}h${round(-nodeWidth)}Z`,
|
|
218
223
|
x: n.x,
|
|
219
|
-
y: n.y
|
|
224
|
+
y: n.y,
|
|
225
|
+
under: true
|
|
226
|
+
});
|
|
227
|
+
const linkMark = (link) => ({
|
|
228
|
+
kind: "halo",
|
|
229
|
+
d: linkPath(link, nodeWidth),
|
|
230
|
+
under: true
|
|
220
231
|
});
|
|
221
232
|
const linkItem = (link) => ({
|
|
222
|
-
name: `${link.source.data.name} → ${link.target.data.name}`,
|
|
233
|
+
name: `${link.source.data.name} ${ctx.rtl ? "←" : "→"} ${link.target.data.name}`,
|
|
223
234
|
seriesIndex: link.index,
|
|
224
235
|
color: colorOf(link.source),
|
|
225
236
|
value: link.data.value,
|
|
@@ -248,11 +259,7 @@ function renderSankey(options, ctx) {
|
|
|
248
259
|
area: plot,
|
|
249
260
|
items: [own, ...flows],
|
|
250
261
|
seriesIndex: focused ? linkIndex : own.seriesIndex,
|
|
251
|
-
|
|
252
|
-
d: linkPath(link, nodeWidth),
|
|
253
|
-
x: 0,
|
|
254
|
-
y: 0
|
|
255
|
-
} : nodeMark(n)
|
|
262
|
+
highlight: link ? linkMark(link) : nodeMark(n)
|
|
256
263
|
};
|
|
257
264
|
};
|
|
258
265
|
const hitLink = (link) => {
|
|
@@ -265,11 +272,7 @@ function renderSankey(options, ctx) {
|
|
|
265
272
|
area: plot,
|
|
266
273
|
items: [item],
|
|
267
274
|
seriesIndex: link.index,
|
|
268
|
-
|
|
269
|
-
d: linkPath(link, nodeWidth),
|
|
270
|
-
x: 0,
|
|
271
|
-
y: 0
|
|
272
|
-
}
|
|
275
|
+
highlight: linkMark(link)
|
|
273
276
|
};
|
|
274
277
|
};
|
|
275
278
|
const interaction = {
|
|
@@ -285,64 +288,67 @@ function renderSankey(options, ctx) {
|
|
|
285
288
|
return n ? hitNode(n, seriesIndex) : null;
|
|
286
289
|
}
|
|
287
290
|
};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
key: n.data.name,
|
|
308
|
-
class: ["tc-series", `tc-series-${n.slot}`],
|
|
309
|
-
"data-series": n.data.name,
|
|
310
|
-
style: { "--tc-series-color": n.data.color }
|
|
311
|
-
}, h("rect", {
|
|
312
|
-
class: "tc-sankey-node",
|
|
313
|
-
x: round(n.x),
|
|
314
|
-
y: round(n.y),
|
|
315
|
-
width: round(nodeWidth),
|
|
316
|
-
height: round(n.height)
|
|
317
|
-
})))),
|
|
318
|
-
h("g", {
|
|
319
|
-
key: "labels",
|
|
320
|
-
class: "tc-sankey-labels",
|
|
321
|
-
"aria-hidden": "true"
|
|
322
|
-
}, nodes.map((n, i) => {
|
|
323
|
-
const label = labels[i];
|
|
324
|
-
if (!label.name && !label.value) return null;
|
|
325
|
-
const x = round(label.side === "left" ? n.x - LABEL_GAP : n.x + nodeWidth + LABEL_GAP);
|
|
326
|
-
const y = round(n.y + n.height / 2);
|
|
327
|
-
const anchor = label.side === "left" ? "end" : "start";
|
|
328
|
-
return h("g", {
|
|
291
|
+
return {
|
|
292
|
+
content: [
|
|
293
|
+
h("g", {
|
|
294
|
+
key: "links",
|
|
295
|
+
class: "tc-sankey-links"
|
|
296
|
+
}, drawn.map((link) => h("path", {
|
|
297
|
+
key: `${link.source.data.name}→${link.target.data.name}#${link.index}`,
|
|
298
|
+
class: [
|
|
299
|
+
"tc-series",
|
|
300
|
+
`tc-series-${link.source.slot}`,
|
|
301
|
+
"tc-sankey-link"
|
|
302
|
+
],
|
|
303
|
+
style: { "--tc-series-color": link.source.data.color },
|
|
304
|
+
d: linkPath(link, nodeWidth)
|
|
305
|
+
}))),
|
|
306
|
+
h("g", {
|
|
307
|
+
key: "nodes",
|
|
308
|
+
class: "tc-sankey-nodes"
|
|
309
|
+
}, nodes.map((n) => h("g", {
|
|
329
310
|
key: n.data.name,
|
|
330
|
-
class: "tc-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
"
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
311
|
+
class: ["tc-series", `tc-series-${n.slot}`],
|
|
312
|
+
"data-series": n.data.name,
|
|
313
|
+
style: { "--tc-series-color": n.data.color }
|
|
314
|
+
}, h("rect", {
|
|
315
|
+
class: "tc-sankey-node",
|
|
316
|
+
x: round(n.x),
|
|
317
|
+
y: round(n.y),
|
|
318
|
+
width: round(nodeWidth),
|
|
319
|
+
height: round(n.height)
|
|
320
|
+
})))),
|
|
321
|
+
h("g", {
|
|
322
|
+
key: "labels",
|
|
323
|
+
class: "tc-sankey-labels",
|
|
324
|
+
"aria-hidden": "true"
|
|
325
|
+
}, nodes.map((n, i) => {
|
|
326
|
+
const label = labels[i];
|
|
327
|
+
if (!label.name && !label.value) return null;
|
|
328
|
+
const before = label.side === "left" !== (ctx.rtl === true);
|
|
329
|
+
const x = round(before ? n.x - LABEL_GAP : n.x + nodeWidth + LABEL_GAP);
|
|
330
|
+
const y = round(n.y + n.height / 2);
|
|
331
|
+
const anchor = before ? "end" : "start";
|
|
332
|
+
return h("g", {
|
|
333
|
+
key: n.data.name,
|
|
334
|
+
class: "tc-sankey-label"
|
|
335
|
+
}, h("text", {
|
|
336
|
+
class: "tc-value-label tc-sankey-name",
|
|
337
|
+
x,
|
|
338
|
+
y,
|
|
339
|
+
dy: label.value ? "-0.25em" : "0.35em",
|
|
340
|
+
"text-anchor": anchor
|
|
341
|
+
}, label.name), label.value && h("text", {
|
|
342
|
+
class: "tc-tick-label tc-sankey-value",
|
|
343
|
+
x,
|
|
344
|
+
y,
|
|
345
|
+
dy: "0.95em",
|
|
346
|
+
"text-anchor": anchor
|
|
347
|
+
}, label.value));
|
|
348
|
+
}))
|
|
349
|
+
],
|
|
350
|
+
interaction
|
|
351
|
+
};
|
|
346
352
|
}
|
|
347
353
|
/** One legend entry per custom color, named after the first node wearing it. */
|
|
348
354
|
function sankeyLegend(options) {
|
|
@@ -414,7 +420,6 @@ const sankey = {
|
|
|
414
420
|
legend: sankeyLegend,
|
|
415
421
|
table: sankeyTable
|
|
416
422
|
};
|
|
417
|
-
//#endregion
|
|
418
423
|
export { sankey as t };
|
|
419
424
|
|
|
420
|
-
//# sourceMappingURL=sankey-
|
|
425
|
+
//# sourceMappingURL=sankey-Dp4CuLVe.js.map
|