@chartts/core 0.1.2 → 0.1.3
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/LICENSE +21 -0
- package/dist/{area-type-B3CtuIIP.d.cts → area-type-BanqpQvK.d.cts} +1 -1
- package/dist/{area-type-DmB6fTVf.d.ts → area-type-Bzn6ur_t.d.ts} +1 -1
- package/dist/area.cjs +10 -10
- package/dist/area.d.cts +4 -4
- package/dist/area.d.ts +4 -4
- package/dist/area.js +5 -5
- package/dist/{bar-type-CkI-kkrC.d.cts → bar-type-BjYOtm2e.d.cts} +1 -1
- package/dist/{bar-type-Bne_khsO.d.ts → bar-type-D1gkUeQ2.d.ts} +1 -1
- package/dist/bar.cjs +9 -9
- package/dist/bar.d.cts +4 -4
- package/dist/bar.d.ts +4 -4
- package/dist/bar.js +4 -4
- package/dist/{baseline-type-B1O4XHT3.d.ts → baseline-type-DnAv8oax.d.ts} +1 -1
- package/dist/{baseline-type-BAPrZJ5W.d.cts → baseline-type-DskNy6iR.d.cts} +1 -1
- package/dist/baseline.cjs +9 -9
- package/dist/baseline.d.cts +4 -4
- package/dist/baseline.d.ts +4 -4
- package/dist/baseline.js +4 -4
- package/dist/{boxplot-type-CEWf7p5X.d.ts → boxplot-type-Bi46NGr5.d.ts} +1 -1
- package/dist/{boxplot-type-Da8_smoe.d.cts → boxplot-type-Df2L92GY.d.cts} +1 -1
- package/dist/boxplot.cjs +9 -9
- package/dist/boxplot.d.cts +4 -4
- package/dist/boxplot.d.ts +4 -4
- package/dist/boxplot.js +4 -4
- package/dist/{bubble-type-Dxb2JCKv.d.cts → bubble-type-D2_dA-tK.d.cts} +1 -1
- package/dist/{bubble-type-pru5MgB7.d.ts → bubble-type-XCkdPCxY.d.ts} +1 -1
- package/dist/bubble.cjs +9 -9
- package/dist/bubble.d.cts +4 -4
- package/dist/bubble.d.ts +4 -4
- package/dist/bubble.js +4 -4
- package/dist/{bullet-type-CPEYkEvt.d.ts → bullet-type-CluDVdqG.d.ts} +1 -1
- package/dist/{bullet-type-khCmwFqH.d.cts → bullet-type-yyHFEoBR.d.cts} +1 -1
- package/dist/bullet.cjs +10 -10
- package/dist/bullet.d.cts +4 -4
- package/dist/bullet.d.ts +4 -4
- package/dist/bullet.js +5 -5
- package/dist/{calendar-type-yJWPY6qT.d.ts → calendar-type-BXl4jP0I.d.ts} +1 -1
- package/dist/{calendar-type-Br5mpdea.d.cts → calendar-type-_hW3OLW-.d.cts} +1 -1
- package/dist/calendar.cjs +10 -10
- package/dist/calendar.d.cts +4 -4
- package/dist/calendar.d.ts +4 -4
- package/dist/calendar.js +5 -5
- package/dist/{candlestick-type-CtLZy_uC.d.ts → candlestick-type-CAfkfMPN.d.ts} +1 -1
- package/dist/{candlestick-type-CazXUb77.d.cts → candlestick-type-D-fhJzmV.d.cts} +1 -1
- package/dist/candlestick.cjs +9 -9
- package/dist/candlestick.d.cts +4 -4
- package/dist/candlestick.d.ts +4 -4
- package/dist/candlestick.js +4 -4
- package/dist/{chord-type-ruvHboZl.d.ts → chord-type-BLjyRxsx.d.ts} +1 -1
- package/dist/{chord-type-ChIZaOZd.d.cts → chord-type-Dvuvx5rp.d.cts} +1 -1
- package/dist/chord.cjs +10 -10
- package/dist/chord.d.cts +4 -4
- package/dist/chord.d.ts +4 -4
- package/dist/chord.js +5 -5
- package/dist/{chunk-FEQKBVCZ.cjs → chunk-2EZ2TVYT.cjs} +14 -14
- package/dist/chunk-2EZ2TVYT.cjs.map +1 -0
- package/dist/{chunk-GI7PBJSK.js → chunk-2ITF366P.js} +4 -4
- package/dist/chunk-2ITF366P.js.map +1 -0
- package/dist/{chunk-YMJQUKKX.js → chunk-2MWA7H6J.js} +68 -42
- package/dist/chunk-2MWA7H6J.js.map +1 -0
- package/dist/{chunk-CJEMSKW3.js → chunk-3SOKHPAO.js} +217 -57
- package/dist/chunk-3SOKHPAO.js.map +1 -0
- package/dist/{chunk-3N447NTJ.cjs → chunk-3V64BDKG.cjs} +14 -14
- package/dist/chunk-3V64BDKG.cjs.map +1 -0
- package/dist/{chunk-DZW35WR2.js → chunk-46ZZTP5B.js} +5 -5
- package/dist/chunk-46ZZTP5B.js.map +1 -0
- package/dist/{chunk-PCTMS2PX.cjs → chunk-47EP245Y.cjs} +19 -9
- package/dist/chunk-47EP245Y.cjs.map +1 -0
- package/dist/{chunk-DZHP4UUE.cjs → chunk-4H2LGLGI.cjs} +16 -12
- package/dist/chunk-4H2LGLGI.cjs.map +1 -0
- package/dist/{chunk-7HOU6XMW.js → chunk-4L62MAZA.js} +25 -28
- package/dist/chunk-4L62MAZA.js.map +1 -0
- package/dist/{chunk-GQR7IHER.js → chunk-4ORSJM2I.js} +6 -6
- package/dist/chunk-4ORSJM2I.js.map +1 -0
- package/dist/{chunk-FQG4DRJS.cjs → chunk-4WQUX2B4.cjs} +71 -45
- package/dist/chunk-4WQUX2B4.cjs.map +1 -0
- package/dist/{chunk-3QXN7JBV.js → chunk-4XVJYNOT.js} +7 -5
- package/dist/chunk-4XVJYNOT.js.map +1 -0
- package/dist/{chunk-6WJJ26J5.js → chunk-5J26EN5I.js} +6 -6
- package/dist/chunk-5J26EN5I.js.map +1 -0
- package/dist/{chunk-K2EZ4SS4.js → chunk-5YNIOIKK.js} +5 -5
- package/dist/chunk-5YNIOIKK.js.map +1 -0
- package/dist/{chunk-5LQ26P4J.cjs → chunk-66BHM3UN.cjs} +11 -11
- package/dist/chunk-66BHM3UN.cjs.map +1 -0
- package/dist/{chunk-DAH76GIX.cjs → chunk-6E6ZDWZD.cjs} +11 -11
- package/dist/chunk-6E6ZDWZD.cjs.map +1 -0
- package/dist/{chunk-COPERSVL.cjs → chunk-6EGHZDZI.cjs} +15 -15
- package/dist/{chunk-COPERSVL.cjs.map → chunk-6EGHZDZI.cjs.map} +1 -1
- package/dist/{chunk-KHQRHTTN.js → chunk-6JNW43SE.js} +40 -30
- package/dist/chunk-6JNW43SE.js.map +1 -0
- package/dist/{chunk-3YFDZGHO.cjs → chunk-6UWYKNFN.cjs} +13 -13
- package/dist/{chunk-3YFDZGHO.cjs.map → chunk-6UWYKNFN.cjs.map} +1 -1
- package/dist/{chunk-CHERQT4B.js → chunk-7PNCJ4OQ.js} +4 -4
- package/dist/chunk-7PNCJ4OQ.js.map +1 -0
- package/dist/{chunk-2KMMVJEE.cjs → chunk-7ZPHLIFP.cjs} +7 -7
- package/dist/chunk-7ZPHLIFP.cjs.map +1 -0
- package/dist/{chunk-FIAKZSRR.cjs → chunk-AG7VY6MJ.cjs} +19 -12
- package/dist/chunk-AG7VY6MJ.cjs.map +1 -0
- package/dist/{chunk-7MXBXWVD.js → chunk-ASNAQ35U.js} +5 -5
- package/dist/chunk-ASNAQ35U.js.map +1 -0
- package/dist/{chunk-DKVRRL3F.js → chunk-BT5H3WMI.js} +6 -6
- package/dist/chunk-BT5H3WMI.js.map +1 -0
- package/dist/{chunk-S64PTNT7.cjs → chunk-BYB3LQAT.cjs} +27 -30
- package/dist/chunk-BYB3LQAT.cjs.map +1 -0
- package/dist/{chunk-NZWFBAFQ.js → chunk-CCMLOCTH.js} +30 -4
- package/dist/chunk-CCMLOCTH.js.map +1 -0
- package/dist/{chunk-HOPFELRP.cjs → chunk-CDS2NXGT.cjs} +4 -4
- package/dist/{chunk-HOPFELRP.cjs.map → chunk-CDS2NXGT.cjs.map} +1 -1
- package/dist/{chunk-7JN6GXML.cjs → chunk-DKXW2FQC.cjs} +13 -11
- package/dist/chunk-DKXW2FQC.cjs.map +1 -0
- package/dist/{chunk-QCR6L55R.js → chunk-DR5MQC3W.js} +8 -5
- package/dist/chunk-DR5MQC3W.js.map +1 -0
- package/dist/{chunk-GUVPVNPD.cjs → chunk-DRIJNFWP.cjs} +11 -11
- package/dist/chunk-DRIJNFWP.cjs.map +1 -0
- package/dist/{chunk-BMTVFAX2.js → chunk-DX4FBN3I.js} +230 -99
- package/dist/chunk-DX4FBN3I.js.map +1 -0
- package/dist/{chunk-IKUA7O73.cjs → chunk-E43H3A3G.cjs} +7 -7
- package/dist/{chunk-IKUA7O73.cjs.map → chunk-E43H3A3G.cjs.map} +1 -1
- package/dist/{chunk-K7UR7GYC.cjs → chunk-ECB3UPTC.cjs} +13 -13
- package/dist/chunk-ECB3UPTC.cjs.map +1 -0
- package/dist/{chunk-TVPS2NJH.cjs → chunk-EHKHXQ46.cjs} +11 -11
- package/dist/chunk-EHKHXQ46.cjs.map +1 -0
- package/dist/{chunk-SLJNRP7O.cjs → chunk-EHNX3MG3.cjs} +14 -24
- package/dist/chunk-EHNX3MG3.cjs.map +1 -0
- package/dist/{chunk-MQBKLKYF.js → chunk-F5AOBHQY.js} +4 -4
- package/dist/{chunk-MQBKLKYF.js.map → chunk-F5AOBHQY.js.map} +1 -1
- package/dist/{chunk-KUFDELQM.cjs → chunk-FDNJNVKA.cjs} +10 -10
- package/dist/chunk-FDNJNVKA.cjs.map +1 -0
- package/dist/{chunk-NML7F34A.js → chunk-FSDI3NJV.js} +4 -4
- package/dist/chunk-FSDI3NJV.js.map +1 -0
- package/dist/{chunk-CCHMQZIB.js → chunk-FV7R2LLD.js} +5 -5
- package/dist/chunk-FV7R2LLD.js.map +1 -0
- package/dist/{chunk-ID7GYRYL.cjs → chunk-FZIBM3G5.cjs} +11 -11
- package/dist/chunk-FZIBM3G5.cjs.map +1 -0
- package/dist/{chunk-43WDYYVH.cjs → chunk-G6R6MSRF.cjs} +10 -10
- package/dist/chunk-G6R6MSRF.cjs.map +1 -0
- package/dist/{chunk-VK72MICB.cjs → chunk-GAWIUMAK.cjs} +8 -8
- package/dist/{chunk-VK72MICB.cjs.map → chunk-GAWIUMAK.cjs.map} +1 -1
- package/dist/{chunk-3NWZJCWL.js → chunk-GPSNBZPX.js} +5 -5
- package/dist/chunk-GPSNBZPX.js.map +1 -0
- package/dist/{chunk-MGYBMQAX.cjs → chunk-HFWO37RY.cjs} +9 -9
- package/dist/chunk-HFWO37RY.cjs.map +1 -0
- package/dist/{chunk-U7GBOQXX.js → chunk-HMB2RIEE.js} +5 -5
- package/dist/chunk-HMB2RIEE.js.map +1 -0
- package/dist/{chunk-RLH3PS3Y.js → chunk-ILCWDAKD.js} +3 -3
- package/dist/{chunk-RLH3PS3Y.js.map → chunk-ILCWDAKD.js.map} +1 -1
- package/dist/{chunk-L37ZPX6D.js → chunk-IRUIWMH6.js} +5 -5
- package/dist/chunk-IRUIWMH6.js.map +1 -0
- package/dist/{chunk-B7IV2PB3.cjs → chunk-JNQ4NL3R.cjs} +9 -9
- package/dist/chunk-JNQ4NL3R.cjs.map +1 -0
- package/dist/{chunk-FSKUEB7P.js → chunk-K5TPJVOK.js} +3 -3
- package/dist/{chunk-FSKUEB7P.js.map → chunk-K5TPJVOK.js.map} +1 -1
- package/dist/{chunk-5M624BRW.js → chunk-KTCP23W6.js} +4 -4
- package/dist/chunk-KTCP23W6.js.map +1 -0
- package/dist/{chunk-2L46SAT7.js → chunk-LIY7MYRG.js} +30 -5
- package/dist/chunk-LIY7MYRG.js.map +1 -0
- package/dist/{chunk-AA45U5KV.js → chunk-LK2A3HBT.js} +5 -5
- package/dist/chunk-LK2A3HBT.js.map +1 -0
- package/dist/{chunk-GMLJDDHZ.js → chunk-MPQECPE3.js} +3 -3
- package/dist/{chunk-GMLJDDHZ.js.map → chunk-MPQECPE3.js.map} +1 -1
- package/dist/{chunk-T6LXFMBR.cjs → chunk-MY4KMVJ5.cjs} +9 -9
- package/dist/{chunk-T6LXFMBR.cjs.map → chunk-MY4KMVJ5.cjs.map} +1 -1
- package/dist/chunk-MYXLKVJE.js +889 -0
- package/dist/chunk-MYXLKVJE.js.map +1 -0
- package/dist/{chunk-N7NZQVIV.cjs → chunk-NG7DRWWT.cjs} +7 -7
- package/dist/chunk-NG7DRWWT.cjs.map +1 -0
- package/dist/{chunk-MZQY2FTP.cjs → chunk-NGKUI7XE.cjs} +13 -13
- package/dist/chunk-NGKUI7XE.cjs.map +1 -0
- package/dist/{chunk-D2IP3MWJ.cjs → chunk-OAIMES5S.cjs} +219 -59
- package/dist/chunk-OAIMES5S.cjs.map +1 -0
- package/dist/{chunk-XKDBNAHH.cjs → chunk-OAL5RS2X.cjs} +11 -11
- package/dist/chunk-OAL5RS2X.cjs.map +1 -0
- package/dist/{chunk-FTKL3UAN.cjs → chunk-OFEROCC5.cjs} +6 -6
- package/dist/{chunk-FTKL3UAN.cjs.map → chunk-OFEROCC5.cjs.map} +1 -1
- package/dist/{chunk-IAE4VRB7.cjs → chunk-OUN3MWRQ.cjs} +35 -10
- package/dist/chunk-OUN3MWRQ.cjs.map +1 -0
- package/dist/{chunk-TIHVTKXS.cjs → chunk-PQCHNZHM.cjs} +11 -11
- package/dist/chunk-PQCHNZHM.cjs.map +1 -0
- package/dist/{chunk-BMEMMYVF.js → chunk-PVPTFMJJ.js} +5 -5
- package/dist/{chunk-BMEMMYVF.js.map → chunk-PVPTFMJJ.js.map} +1 -1
- package/dist/{chunk-LCEMO7NI.js → chunk-QERWC7U6.js} +3 -3
- package/dist/{chunk-LCEMO7NI.js.map → chunk-QERWC7U6.js.map} +1 -1
- package/dist/{chunk-2PRCN5OJ.cjs → chunk-QKJUAMRK.cjs} +6 -6
- package/dist/{chunk-2PRCN5OJ.cjs.map → chunk-QKJUAMRK.cjs.map} +1 -1
- package/dist/{chunk-WS2AL7GY.cjs → chunk-R6ZDSXN7.cjs} +34 -8
- package/dist/chunk-R6ZDSXN7.cjs.map +1 -0
- package/dist/{chunk-FKVYS4RB.js → chunk-RFEKSP62.js} +15 -8
- package/dist/chunk-RFEKSP62.js.map +1 -0
- package/dist/{chunk-FKAA5FNG.cjs → chunk-RHTVKBRC.cjs} +10 -10
- package/dist/chunk-RHTVKBRC.cjs.map +1 -0
- package/dist/{chunk-QRTYX5KO.js → chunk-RJIPFWW7.js} +5 -5
- package/dist/chunk-RJIPFWW7.js.map +1 -0
- package/dist/{chunk-GL3M7MAM.js → chunk-RN7NNB6I.js} +4 -4
- package/dist/chunk-RN7NNB6I.js.map +1 -0
- package/dist/{chunk-VGGKMTO6.js → chunk-RQJRVKAH.js} +4 -4
- package/dist/chunk-RQJRVKAH.js.map +1 -0
- package/dist/{chunk-AAKS22M3.cjs → chunk-RWQH5EO5.cjs} +12 -12
- package/dist/{chunk-AAKS22M3.cjs.map → chunk-RWQH5EO5.cjs.map} +1 -1
- package/dist/{chunk-SKREYNRK.cjs → chunk-SXVMEC6N.cjs} +45 -35
- package/dist/chunk-SXVMEC6N.cjs.map +1 -0
- package/dist/{chunk-4ABM7UYD.js → chunk-TVDQNLGJ.js} +4 -4
- package/dist/chunk-TVDQNLGJ.js.map +1 -0
- package/dist/{chunk-QXQSJ3FZ.js → chunk-TWSWD4PU.js} +5 -5
- package/dist/chunk-TWSWD4PU.js.map +1 -0
- package/dist/chunk-UFMPALRH.js +126 -0
- package/dist/chunk-UFMPALRH.js.map +1 -0
- package/dist/{chunk-3TLJCGGQ.cjs → chunk-UMIJYYF3.cjs} +230 -99
- package/dist/chunk-UMIJYYF3.cjs.map +1 -0
- package/dist/{chunk-DZKYVTV3.js → chunk-UZH6PVHD.js} +5 -5
- package/dist/{chunk-DZKYVTV3.js.map → chunk-UZH6PVHD.js.map} +1 -1
- package/dist/{chunk-ARQLGTTV.js → chunk-V45C74EB.js} +5 -5
- package/dist/{chunk-ARQLGTTV.js.map → chunk-V45C74EB.js.map} +1 -1
- package/dist/{chunk-EAKXLFOR.cjs → chunk-VBEZS3Q4.cjs} +11 -11
- package/dist/chunk-VBEZS3Q4.cjs.map +1 -0
- package/dist/{chunk-IXFSJBJS.js → chunk-WJP6CRML.js} +4 -14
- package/dist/chunk-WJP6CRML.js.map +1 -0
- package/dist/{chunk-KEMT7F5H.cjs → chunk-WVQVGQJO.cjs} +9 -9
- package/dist/chunk-WVQVGQJO.cjs.map +1 -0
- package/dist/chunk-WYIIWTIR.cjs +128 -0
- package/dist/chunk-WYIIWTIR.cjs.map +1 -0
- package/dist/{chunk-EYN74SQ5.js → chunk-XE5ZYFGM.js} +5 -5
- package/dist/chunk-XE5ZYFGM.js.map +1 -0
- package/dist/{chunk-S6NGWPXC.js → chunk-XKERO5K2.js} +4 -4
- package/dist/chunk-XKERO5K2.js.map +1 -0
- package/dist/chunk-XN6YS55F.cjs +891 -0
- package/dist/chunk-XN6YS55F.cjs.map +1 -0
- package/dist/{chunk-JT6H7G52.js → chunk-XWCY67K5.js} +5 -5
- package/dist/chunk-XWCY67K5.js.map +1 -0
- package/dist/{chunk-SC5BGA2N.cjs → chunk-XWN43PZF.cjs} +8 -8
- package/dist/chunk-XWN43PZF.cjs.map +1 -0
- package/dist/{chunk-Y4HJCMB4.cjs → chunk-YDQDZWZ7.cjs} +7 -7
- package/dist/chunk-YDQDZWZ7.cjs.map +1 -0
- package/dist/{chunk-VJQCHBS6.js → chunk-YJHB2GHQ.js} +15 -5
- package/dist/chunk-YJHB2GHQ.js.map +1 -0
- package/dist/{chunk-IUYPKYOU.js → chunk-YOLF5DYU.js} +9 -5
- package/dist/chunk-YOLF5DYU.js.map +1 -0
- package/dist/{chunk-ALRCYQQX.cjs → chunk-YX6RW6ZW.cjs} +10 -7
- package/dist/chunk-YX6RW6ZW.cjs.map +1 -0
- package/dist/{chunk-27E6G2GT.js → chunk-YZQROIJY.js} +4 -4
- package/dist/chunk-YZQROIJY.js.map +1 -0
- package/dist/{chunk-M6JYSINX.cjs → chunk-ZFSFOD5W.cjs} +8 -8
- package/dist/chunk-ZFSFOD5W.cjs.map +1 -0
- package/dist/{chunk-EFRBTSUO.cjs → chunk-ZTUKOCJN.cjs} +4 -4
- package/dist/{chunk-EFRBTSUO.cjs.map → chunk-ZTUKOCJN.cjs.map} +1 -1
- package/dist/{chunk-MVJKRPX7.js → chunk-ZY7ETQD6.js} +3 -3
- package/dist/{chunk-MVJKRPX7.js.map → chunk-ZY7ETQD6.js.map} +1 -1
- package/dist/{combo-type-wodyLq1f.d.cts → combo-type-CCrfKcTc.d.cts} +1 -1
- package/dist/{combo-type-BdSohVyy.d.ts → combo-type-Drb7xHSH.d.ts} +1 -1
- package/dist/combo.cjs +9 -9
- package/dist/combo.d.cts +4 -4
- package/dist/combo.d.ts +4 -4
- package/dist/combo.js +4 -4
- package/dist/{custom-type-B6w1n5Ua.d.cts → custom-type-CUdaJtsU.d.cts} +1 -1
- package/dist/{custom-type-XFjuPwCr.d.ts → custom-type-DeCdYBIK.d.ts} +1 -1
- package/dist/custom.cjs +10 -10
- package/dist/custom.d.cts +4 -4
- package/dist/custom.d.ts +4 -4
- package/dist/custom.js +5 -5
- package/dist/donut.cjs +11 -10
- package/dist/donut.cjs.map +1 -1
- package/dist/donut.d.cts +4 -4
- package/dist/donut.d.ts +4 -4
- package/dist/donut.js +6 -5
- package/dist/donut.js.map +1 -1
- package/dist/{dumbbell-type-w424KzI2.d.cts → dumbbell-type--8jqwUbP.d.cts} +1 -1
- package/dist/{dumbbell-type-DPSE0OTg.d.ts → dumbbell-type-FrAcyybz.d.ts} +1 -1
- package/dist/dumbbell.cjs +10 -10
- package/dist/dumbbell.d.cts +4 -4
- package/dist/dumbbell.d.ts +4 -4
- package/dist/dumbbell.js +5 -5
- package/dist/{engine-CNukbv7k.d.ts → engine-7vdmtmTm.d.cts} +20 -0
- package/dist/{engine-CNukbv7k.d.cts → engine-7vdmtmTm.d.ts} +20 -0
- package/dist/{factory-dbngWV4d.d.cts → factory-DVmPQ-5P.d.cts} +1 -1
- package/dist/{factory-jRzNNxwj.d.ts → factory-DXvw-FCZ.d.ts} +1 -1
- package/dist/{funnel-type-CMXGQq4T.d.ts → funnel-type-BhtkYPBR.d.ts} +1 -1
- package/dist/{funnel-type-BeVl3ohX.d.cts → funnel-type-BqLhbGkI.d.cts} +1 -1
- package/dist/funnel.cjs +10 -10
- package/dist/funnel.d.cts +4 -4
- package/dist/funnel.d.ts +4 -4
- package/dist/funnel.js +5 -5
- package/dist/{gauge-type-DmjDdfsY.d.cts → gauge-type-NeAO1otO.d.cts} +1 -1
- package/dist/{gauge-type-BpDBwCeD.d.ts → gauge-type-h6z_4lnL.d.ts} +1 -1
- package/dist/gauge.cjs +10 -10
- package/dist/gauge.d.cts +4 -4
- package/dist/gauge.d.ts +4 -4
- package/dist/gauge.js +5 -5
- package/dist/geo.cjs +12 -12
- package/dist/geo.d.cts +4 -4
- package/dist/geo.d.ts +4 -4
- package/dist/geo.js +5 -5
- package/dist/graph-type-Bg04GFeS.d.ts +15 -0
- package/dist/graph-type-DF-vww8T.d.cts +15 -0
- package/dist/graph.cjs +63 -10
- package/dist/graph.cjs.map +1 -1
- package/dist/graph.d.cts +65 -5
- package/dist/graph.d.ts +65 -5
- package/dist/graph.js +58 -6
- package/dist/graph.js.map +1 -1
- package/dist/{heatmap-type-q6nNhVTr.d.ts → heatmap-type-BAxcLZ1S.d.ts} +1 -1
- package/dist/{heatmap-type-D0shkxK7.d.cts → heatmap-type-CkmoO1Vi.d.cts} +1 -1
- package/dist/heatmap.cjs +10 -10
- package/dist/heatmap.d.cts +4 -4
- package/dist/heatmap.d.ts +4 -4
- package/dist/heatmap.js +5 -5
- package/dist/{histogram-type-BWil-Rb7.d.cts → histogram-type-BMxwKNZD.d.cts} +1 -1
- package/dist/{histogram-type-CF593WSp.d.ts → histogram-type-Bz1r_8dr.d.ts} +1 -1
- package/dist/histogram.cjs +9 -9
- package/dist/histogram.d.cts +4 -4
- package/dist/histogram.d.ts +4 -4
- package/dist/histogram.js +4 -4
- package/dist/{horizontal-bar-type-0mqnyMUR.d.cts → horizontal-bar-type-CPMqObyF.d.cts} +1 -1
- package/dist/{horizontal-bar-type-DAlrxY0h.d.ts → horizontal-bar-type-oNPstB_X.d.ts} +1 -1
- package/dist/horizontal-bar.cjs +9 -9
- package/dist/horizontal-bar.d.cts +4 -4
- package/dist/horizontal-bar.d.ts +4 -4
- package/dist/horizontal-bar.js +4 -4
- package/dist/index.cjs +180 -179
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -47
- package/dist/index.d.ts +47 -47
- package/dist/index.js +92 -91
- package/dist/index.js.map +1 -1
- package/dist/{kagi-type-Y5XUVm3h.d.ts → kagi-type-DLvdmNEs.d.ts} +1 -1
- package/dist/{kagi-type-aG-Q1bWk.d.cts → kagi-type-DolumABK.d.cts} +1 -1
- package/dist/kagi.cjs +10 -10
- package/dist/kagi.d.cts +4 -4
- package/dist/kagi.d.ts +4 -4
- package/dist/kagi.js +5 -5
- package/dist/{line-type-Diw0nXj7.d.ts → line-type-CQ_Sbwde.d.ts} +1 -1
- package/dist/{line-type-B8lgTFjb.d.cts → line-type-DU-iLYyU.d.cts} +1 -1
- package/dist/line.cjs +9 -9
- package/dist/line.d.cts +4 -4
- package/dist/line.d.ts +4 -4
- package/dist/line.js +4 -4
- package/dist/{lines-type-CGrg_mDi.d.cts → lines-type-BZF5YnFG.d.cts} +1 -1
- package/dist/{lines-type-V-seVNZ4.d.ts → lines-type-CkKW7kQN.d.ts} +1 -1
- package/dist/lines.cjs +10 -10
- package/dist/lines.d.cts +4 -4
- package/dist/lines.d.ts +4 -4
- package/dist/lines.js +5 -5
- package/dist/{lollipop-type-CoTzKLSu.d.cts → lollipop-type-BUeY0pGU.d.cts} +1 -1
- package/dist/{lollipop-type-Ygc4rRql.d.ts → lollipop-type-DY7z1meu.d.ts} +1 -1
- package/dist/lollipop.cjs +9 -9
- package/dist/lollipop.d.cts +4 -4
- package/dist/lollipop.d.ts +4 -4
- package/dist/lollipop.js +4 -4
- package/dist/{matrix-type-Crb_NwUJ.d.cts → matrix-type-DZBt3yku.d.cts} +1 -1
- package/dist/{matrix-type-Dag1VLCY.d.ts → matrix-type-DkaWmxKb.d.ts} +1 -1
- package/dist/matrix.cjs +10 -10
- package/dist/matrix.d.cts +4 -4
- package/dist/matrix.d.ts +4 -4
- package/dist/matrix.js +5 -5
- package/dist/{ohlc-type-BQBHvVJO.d.cts → ohlc-type-C6NE-Bb3.d.cts} +1 -1
- package/dist/{ohlc-type-CGR-vRGL.d.ts → ohlc-type-eQd0E8lm.d.ts} +1 -1
- package/dist/ohlc.cjs +9 -9
- package/dist/ohlc.d.cts +4 -4
- package/dist/ohlc.d.ts +4 -4
- package/dist/ohlc.js +4 -4
- package/dist/{parallel-type-D-S-EqeC.d.cts → parallel-type-Cn2B_2-r.d.cts} +1 -1
- package/dist/{parallel-type-6t6xyHMg.d.ts → parallel-type-D4B96-R-.d.ts} +1 -1
- package/dist/parallel.cjs +10 -10
- package/dist/parallel.d.cts +4 -4
- package/dist/parallel.d.ts +4 -4
- package/dist/parallel.js +5 -5
- package/dist/{pictorialbar-type-A-8mTX1N.d.ts → pictorialbar-type-CoClaroO.d.ts} +1 -1
- package/dist/{pictorialbar-type-CnJEH9GZ.d.cts → pictorialbar-type-jiWGSHOU.d.cts} +1 -1
- package/dist/pictorialbar.cjs +10 -10
- package/dist/pictorialbar.d.cts +4 -4
- package/dist/pictorialbar.d.ts +4 -4
- package/dist/pictorialbar.js +5 -5
- package/dist/{pie-type-S7kUKGRS.d.ts → pie-type-0inQl-lu.d.ts} +1 -1
- package/dist/{pie-type-duX5xkfQ.d.cts → pie-type-9iaid0XE.d.cts} +1 -1
- package/dist/pie.cjs +11 -10
- package/dist/pie.cjs.map +1 -1
- package/dist/pie.d.cts +4 -4
- package/dist/pie.d.ts +4 -4
- package/dist/pie.js +6 -5
- package/dist/pie.js.map +1 -1
- package/dist/{polar-type-CI6-I8Yg.d.cts → polar-type-BraqKI4A.d.ts} +2 -1
- package/dist/{polar-type-Dj21GIc9.d.ts → polar-type-DsB9FOAO.d.cts} +2 -1
- package/dist/polar.cjs +11 -10
- package/dist/polar.cjs.map +1 -1
- package/dist/polar.d.cts +4 -4
- package/dist/polar.d.ts +4 -4
- package/dist/polar.js +6 -5
- package/dist/polar.js.map +1 -1
- package/dist/{radar-type-CYjZHuKm.d.ts → radar-type-C0JiXn53.d.ts} +1 -1
- package/dist/{radar-type-Dgyr13Zd.d.cts → radar-type-DaLjHpgO.d.cts} +1 -1
- package/dist/radar.cjs +10 -10
- package/dist/radar.d.cts +4 -4
- package/dist/radar.d.ts +4 -4
- package/dist/radar.js +5 -5
- package/dist/{radialbar-type-CLZ8XgST.d.ts → radialbar-type-DMzib3wW.d.ts} +1 -1
- package/dist/{radialbar-type-C_SBXoaa.d.cts → radialbar-type-YtZDe2x4.d.cts} +1 -1
- package/dist/radialbar.cjs +10 -10
- package/dist/radialbar.d.cts +4 -4
- package/dist/radialbar.d.ts +4 -4
- package/dist/radialbar.js +5 -5
- package/dist/{range-type-_LbMV4tl.d.ts → range-type-RlwPvBxs.d.ts} +1 -1
- package/dist/{range-type-CkriEnLm.d.cts → range-type-imi4626F.d.cts} +1 -1
- package/dist/range.cjs +9 -9
- package/dist/range.d.cts +4 -4
- package/dist/range.d.ts +4 -4
- package/dist/range.js +4 -4
- package/dist/{renko-type-ejoXt2ro.d.ts → renko-type-Bv23hPuk.d.ts} +1 -1
- package/dist/{renko-type-43OXCtZ3.d.cts → renko-type-DEe4vBKT.d.cts} +1 -1
- package/dist/renko.cjs +10 -10
- package/dist/renko.d.cts +4 -4
- package/dist/renko.d.ts +4 -4
- package/dist/renko.js +5 -5
- package/dist/{sankey-type-DfkTUnXB.d.cts → sankey-type-B0LCLees.d.cts} +1 -1
- package/dist/{sankey-type-CN7PL5MQ.d.ts → sankey-type-Gr2owHtQ.d.ts} +1 -1
- package/dist/sankey.cjs +10 -10
- package/dist/sankey.d.cts +4 -4
- package/dist/sankey.d.ts +4 -4
- package/dist/sankey.js +5 -5
- package/dist/{scatter-type-CD7X1pZb.d.cts → scatter-type-C0vMtH11.d.cts} +1 -1
- package/dist/{scatter-type-D3HdPkZ6.d.ts → scatter-type-DPCIXt3X.d.ts} +1 -1
- package/dist/scatter.cjs +9 -9
- package/dist/scatter.d.cts +4 -4
- package/dist/scatter.d.ts +4 -4
- package/dist/scatter.js +4 -4
- package/dist/{sparkline-type-qt3yoLs7.d.cts → sparkline-type-BDDpw4DS.d.cts} +1 -1
- package/dist/{sparkline-type-COW3izgF.d.ts → sparkline-type-BtSsuoh4.d.ts} +1 -1
- package/dist/sparkline.cjs +9 -9
- package/dist/sparkline.d.cts +4 -4
- package/dist/sparkline.d.ts +4 -4
- package/dist/sparkline.js +4 -4
- package/dist/{stacked-bar-type-C-5pmb-D.d.ts → stacked-bar-type-5_GXIxLN.d.ts} +1 -1
- package/dist/{stacked-bar-type-Ct6HK2A0.d.cts → stacked-bar-type-BF4R1zEK.d.cts} +1 -1
- package/dist/stacked-bar.cjs +9 -9
- package/dist/stacked-bar.d.cts +4 -4
- package/dist/stacked-bar.d.ts +4 -4
- package/dist/stacked-bar.js +4 -4
- package/dist/{step-type-BSL-CUny.d.cts → step-type-CZJO5PE4.d.cts} +1 -1
- package/dist/{step-type-Cleoshov.d.ts → step-type-CoBGeRRR.d.ts} +1 -1
- package/dist/step.cjs +10 -10
- package/dist/step.d.cts +4 -4
- package/dist/step.d.ts +4 -4
- package/dist/step.js +5 -5
- package/dist/{sunburst-type-ZFw2w6m8.d.ts → sunburst-type-CAcFLV8s.d.ts} +1 -1
- package/dist/{sunburst-type-BOztb_Px.d.cts → sunburst-type-DgP1x1nn.d.cts} +1 -1
- package/dist/sunburst.cjs +11 -10
- package/dist/sunburst.cjs.map +1 -1
- package/dist/sunburst.d.cts +4 -4
- package/dist/sunburst.d.ts +4 -4
- package/dist/sunburst.js +6 -5
- package/dist/sunburst.js.map +1 -1
- package/dist/{themeriver-type-B5PYChcC.d.ts → themeriver-type-BxLJux1v.d.ts} +1 -1
- package/dist/{themeriver-type-BnRSsyal.d.cts → themeriver-type-CGn5zE2F.d.cts} +1 -1
- package/dist/themeriver.cjs +10 -10
- package/dist/themeriver.d.cts +4 -4
- package/dist/themeriver.d.ts +4 -4
- package/dist/themeriver.js +5 -5
- package/dist/{tree-type-B-bOSg0l.d.ts → tree-type-Dyw9F7oq.d.ts} +1 -1
- package/dist/{tree-type-Cz84wHnR.d.cts → tree-type-xf-pj4pG.d.cts} +1 -1
- package/dist/tree.cjs +10 -10
- package/dist/tree.d.cts +4 -4
- package/dist/tree.d.ts +4 -4
- package/dist/tree.js +5 -5
- package/dist/{treemap-type-DYDj-rWv.d.ts → treemap-type-B4ty-Vge.d.ts} +1 -1
- package/dist/{treemap-type-OBCGexiK.d.cts → treemap-type-CeLgbJFQ.d.cts} +1 -1
- package/dist/treemap.cjs +10 -10
- package/dist/treemap.d.cts +4 -4
- package/dist/treemap.d.ts +4 -4
- package/dist/treemap.js +5 -5
- package/dist/{volume-type-C9wRmKR6.d.ts → volume-type-2ZgLIkPV.d.ts} +1 -1
- package/dist/{volume-type-CfERBN5g.d.cts → volume-type-Dvnr4sC9.d.cts} +1 -1
- package/dist/volume.cjs +9 -9
- package/dist/volume.d.cts +4 -4
- package/dist/volume.d.ts +4 -4
- package/dist/volume.js +4 -4
- package/dist/{waterfall-type-hm5ylGgW.d.cts → waterfall-type-D_6Db7Zy.d.cts} +1 -1
- package/dist/{waterfall-type-CpdVtBi_.d.ts → waterfall-type-DsC5vlAP.d.ts} +1 -1
- package/dist/waterfall.cjs +9 -9
- package/dist/waterfall.d.cts +4 -4
- package/dist/waterfall.d.ts +4 -4
- package/dist/waterfall.js +4 -4
- package/dist/world-regions-C0JUJCGT.d.ts +25 -0
- package/dist/world-regions-gUFRPji8.d.cts +25 -0
- package/package.json +11 -7
- package/dist/chunk-27E6G2GT.js.map +0 -1
- package/dist/chunk-2KMMVJEE.cjs.map +0 -1
- package/dist/chunk-2L46SAT7.js.map +0 -1
- package/dist/chunk-3N447NTJ.cjs.map +0 -1
- package/dist/chunk-3NWZJCWL.js.map +0 -1
- package/dist/chunk-3QXN7JBV.js.map +0 -1
- package/dist/chunk-3TLJCGGQ.cjs.map +0 -1
- package/dist/chunk-43WDYYVH.cjs.map +0 -1
- package/dist/chunk-4ABM7UYD.js.map +0 -1
- package/dist/chunk-5LQ26P4J.cjs.map +0 -1
- package/dist/chunk-5M624BRW.js.map +0 -1
- package/dist/chunk-6WJJ26J5.js.map +0 -1
- package/dist/chunk-7HOU6XMW.js.map +0 -1
- package/dist/chunk-7JN6GXML.cjs.map +0 -1
- package/dist/chunk-7MXBXWVD.js.map +0 -1
- package/dist/chunk-AA45U5KV.js.map +0 -1
- package/dist/chunk-ALRCYQQX.cjs.map +0 -1
- package/dist/chunk-B7IV2PB3.cjs.map +0 -1
- package/dist/chunk-BMTVFAX2.js.map +0 -1
- package/dist/chunk-CCHMQZIB.js.map +0 -1
- package/dist/chunk-CHERQT4B.js.map +0 -1
- package/dist/chunk-CJEMSKW3.js.map +0 -1
- package/dist/chunk-D2IP3MWJ.cjs.map +0 -1
- package/dist/chunk-DAH76GIX.cjs.map +0 -1
- package/dist/chunk-DKVRRL3F.js.map +0 -1
- package/dist/chunk-DZHP4UUE.cjs.map +0 -1
- package/dist/chunk-DZW35WR2.js.map +0 -1
- package/dist/chunk-EAKXLFOR.cjs.map +0 -1
- package/dist/chunk-EYN74SQ5.js.map +0 -1
- package/dist/chunk-FEQKBVCZ.cjs.map +0 -1
- package/dist/chunk-FIAKZSRR.cjs.map +0 -1
- package/dist/chunk-FKAA5FNG.cjs.map +0 -1
- package/dist/chunk-FKVYS4RB.js.map +0 -1
- package/dist/chunk-FQG4DRJS.cjs.map +0 -1
- package/dist/chunk-GI7PBJSK.js.map +0 -1
- package/dist/chunk-GL3M7MAM.js.map +0 -1
- package/dist/chunk-GQR7IHER.js.map +0 -1
- package/dist/chunk-GUVPVNPD.cjs.map +0 -1
- package/dist/chunk-IAE4VRB7.cjs.map +0 -1
- package/dist/chunk-ID7GYRYL.cjs.map +0 -1
- package/dist/chunk-IUYPKYOU.js.map +0 -1
- package/dist/chunk-IXFSJBJS.js.map +0 -1
- package/dist/chunk-JT6H7G52.js.map +0 -1
- package/dist/chunk-K2EZ4SS4.js.map +0 -1
- package/dist/chunk-K7UR7GYC.cjs.map +0 -1
- package/dist/chunk-KEMT7F5H.cjs.map +0 -1
- package/dist/chunk-KHQRHTTN.js.map +0 -1
- package/dist/chunk-KUFDELQM.cjs.map +0 -1
- package/dist/chunk-L37ZPX6D.js.map +0 -1
- package/dist/chunk-M6JYSINX.cjs.map +0 -1
- package/dist/chunk-MGYBMQAX.cjs.map +0 -1
- package/dist/chunk-MZCKMTQE.cjs +0 -210
- package/dist/chunk-MZCKMTQE.cjs.map +0 -1
- package/dist/chunk-MZQY2FTP.cjs.map +0 -1
- package/dist/chunk-N7NZQVIV.cjs.map +0 -1
- package/dist/chunk-NML7F34A.js.map +0 -1
- package/dist/chunk-NQGZMWNT.js +0 -208
- package/dist/chunk-NQGZMWNT.js.map +0 -1
- package/dist/chunk-NZWFBAFQ.js.map +0 -1
- package/dist/chunk-PCTMS2PX.cjs.map +0 -1
- package/dist/chunk-QCR6L55R.js.map +0 -1
- package/dist/chunk-QRTYX5KO.js.map +0 -1
- package/dist/chunk-QXQSJ3FZ.js.map +0 -1
- package/dist/chunk-S64PTNT7.cjs.map +0 -1
- package/dist/chunk-S6NGWPXC.js.map +0 -1
- package/dist/chunk-SC5BGA2N.cjs.map +0 -1
- package/dist/chunk-SKREYNRK.cjs.map +0 -1
- package/dist/chunk-SLJNRP7O.cjs.map +0 -1
- package/dist/chunk-TIHVTKXS.cjs.map +0 -1
- package/dist/chunk-TVPS2NJH.cjs.map +0 -1
- package/dist/chunk-U7GBOQXX.js.map +0 -1
- package/dist/chunk-VGGKMTO6.js.map +0 -1
- package/dist/chunk-VJQCHBS6.js.map +0 -1
- package/dist/chunk-WS2AL7GY.cjs.map +0 -1
- package/dist/chunk-XKDBNAHH.cjs.map +0 -1
- package/dist/chunk-Y4HJCMB4.cjs.map +0 -1
- package/dist/chunk-YMJQUKKX.js.map +0 -1
- package/dist/graph-type-DkdAB6Vc.d.cts +0 -5
- package/dist/graph-type-ul9xwdf5.d.ts +0 -5
- package/dist/world-regions-D-TCHPZP.d.cts +0 -38
- package/dist/world-regions-DjMvYgFu.d.ts +0 -38
|
@@ -0,0 +1,889 @@
|
|
|
1
|
+
import { prepareNoAxes } from './chunk-MPQECPE3.js';
|
|
2
|
+
import { group, line, PathBuilder, path, rect, text, circle } from './chunk-DX4FBN3I.js';
|
|
3
|
+
|
|
4
|
+
// src/charts/graph/parse.ts
|
|
5
|
+
function parseGraphData(data, options) {
|
|
6
|
+
const opts = options;
|
|
7
|
+
const defaultShape = opts.nodeShape ?? "rect";
|
|
8
|
+
if (opts.nodes || opts.edges) {
|
|
9
|
+
return parseRichFormat(data, opts, defaultShape);
|
|
10
|
+
}
|
|
11
|
+
const hasArrow = data.series.some(
|
|
12
|
+
(s) => s.name.includes("\u2192") || s.name.includes("->")
|
|
13
|
+
);
|
|
14
|
+
if (hasArrow) {
|
|
15
|
+
return parseArrowNotation(data, defaultShape);
|
|
16
|
+
}
|
|
17
|
+
return parseAdjacencyMatrix(data, defaultShape);
|
|
18
|
+
}
|
|
19
|
+
function makeNode(id, label, index, value, shape, color, pin) {
|
|
20
|
+
return {
|
|
21
|
+
id,
|
|
22
|
+
label,
|
|
23
|
+
index,
|
|
24
|
+
value,
|
|
25
|
+
shape,
|
|
26
|
+
color,
|
|
27
|
+
pin,
|
|
28
|
+
x: 0,
|
|
29
|
+
y: 0,
|
|
30
|
+
vx: 0,
|
|
31
|
+
vy: 0,
|
|
32
|
+
width: 0,
|
|
33
|
+
height: 0
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function makeEdge(source, target, weight, label, style, color) {
|
|
37
|
+
return { source, target, weight, label, style, color };
|
|
38
|
+
}
|
|
39
|
+
function parseRichFormat(_data, opts, defaultShape) {
|
|
40
|
+
const graphNodes = [];
|
|
41
|
+
const idToIndex = /* @__PURE__ */ new Map();
|
|
42
|
+
if (opts.nodes) {
|
|
43
|
+
for (const nodeDef of opts.nodes) {
|
|
44
|
+
const idx = graphNodes.length;
|
|
45
|
+
idToIndex.set(nodeDef.id, idx);
|
|
46
|
+
graphNodes.push(
|
|
47
|
+
makeNode(
|
|
48
|
+
nodeDef.id,
|
|
49
|
+
nodeDef.label ?? nodeDef.id,
|
|
50
|
+
idx,
|
|
51
|
+
1,
|
|
52
|
+
nodeDef.shape ?? defaultShape,
|
|
53
|
+
nodeDef.color ?? null,
|
|
54
|
+
nodeDef.pin ?? null
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const graphEdges = [];
|
|
60
|
+
if (opts.edges) {
|
|
61
|
+
for (const edgeDef of opts.edges) {
|
|
62
|
+
if (!idToIndex.has(edgeDef.source)) {
|
|
63
|
+
const idx = graphNodes.length;
|
|
64
|
+
idToIndex.set(edgeDef.source, idx);
|
|
65
|
+
graphNodes.push(
|
|
66
|
+
makeNode(edgeDef.source, edgeDef.source, idx, 1, defaultShape, null, null)
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
if (!idToIndex.has(edgeDef.target)) {
|
|
70
|
+
const idx = graphNodes.length;
|
|
71
|
+
idToIndex.set(edgeDef.target, idx);
|
|
72
|
+
graphNodes.push(
|
|
73
|
+
makeNode(edgeDef.target, edgeDef.target, idx, 1, defaultShape, null, null)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
const srcIdx = idToIndex.get(edgeDef.source);
|
|
77
|
+
const tgtIdx = idToIndex.get(edgeDef.target);
|
|
78
|
+
graphEdges.push(
|
|
79
|
+
makeEdge(
|
|
80
|
+
srcIdx,
|
|
81
|
+
tgtIdx,
|
|
82
|
+
edgeDef.weight ?? 1,
|
|
83
|
+
edgeDef.label ?? null,
|
|
84
|
+
edgeDef.style ?? "solid",
|
|
85
|
+
edgeDef.color ?? null
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return { graphNodes, graphEdges };
|
|
91
|
+
}
|
|
92
|
+
var ARROW_RE = /\s*(?:→|->)\s*/;
|
|
93
|
+
function parseArrowNotation(data, defaultShape) {
|
|
94
|
+
const graphNodes = [];
|
|
95
|
+
const nameToIndex = /* @__PURE__ */ new Map();
|
|
96
|
+
const graphEdges = [];
|
|
97
|
+
function getOrCreateNode(name) {
|
|
98
|
+
let idx = nameToIndex.get(name);
|
|
99
|
+
if (idx !== void 0) return idx;
|
|
100
|
+
idx = graphNodes.length;
|
|
101
|
+
nameToIndex.set(name, idx);
|
|
102
|
+
graphNodes.push(makeNode(name, name, idx, 0, defaultShape, null, null));
|
|
103
|
+
return idx;
|
|
104
|
+
}
|
|
105
|
+
for (const series of data.series) {
|
|
106
|
+
const parts = series.name.split(ARROW_RE);
|
|
107
|
+
if (parts.length < 2) continue;
|
|
108
|
+
const srcName = parts[0];
|
|
109
|
+
const tgtName = parts[1];
|
|
110
|
+
const weight = series.values[0] ?? 1;
|
|
111
|
+
const srcIdx = getOrCreateNode(srcName);
|
|
112
|
+
const tgtIdx = getOrCreateNode(tgtName);
|
|
113
|
+
graphNodes[srcIdx].value += weight;
|
|
114
|
+
graphNodes[tgtIdx].value += weight;
|
|
115
|
+
graphEdges.push(makeEdge(srcIdx, tgtIdx, weight, null, "solid", null));
|
|
116
|
+
}
|
|
117
|
+
return { graphNodes, graphEdges };
|
|
118
|
+
}
|
|
119
|
+
function parseAdjacencyMatrix(data, defaultShape) {
|
|
120
|
+
const graphNodes = [];
|
|
121
|
+
for (let i = 0; i < data.labels.length; i++) {
|
|
122
|
+
const name = String(data.labels[i]);
|
|
123
|
+
const value = Math.abs(data.series[0]?.values[i] ?? 1);
|
|
124
|
+
graphNodes.push(makeNode(name, name, i, value, defaultShape, null, null));
|
|
125
|
+
}
|
|
126
|
+
const graphEdges = [];
|
|
127
|
+
if (data.series.length > 1 && data.series.length === data.labels.length) {
|
|
128
|
+
for (let i = 0; i < data.series.length; i++) {
|
|
129
|
+
const row = data.series[i];
|
|
130
|
+
for (let j = 0; j < row.values.length; j++) {
|
|
131
|
+
const weight = row.values[j] ?? 0;
|
|
132
|
+
if (weight > 0) {
|
|
133
|
+
graphEdges.push(makeEdge(i, j, weight, null, "solid", null));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return { graphNodes, graphEdges };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// src/charts/graph/text-measure.ts
|
|
142
|
+
var CHAR_WIDTH_RATIO = 0.6;
|
|
143
|
+
var PADDING_H = 16;
|
|
144
|
+
var PADDING_V = 10;
|
|
145
|
+
function measureNodeSize(label, fontSize, shape) {
|
|
146
|
+
const charWidth = fontSize * CHAR_WIDTH_RATIO;
|
|
147
|
+
const textWidth = label.length * charWidth;
|
|
148
|
+
const textHeight = fontSize * 1.2;
|
|
149
|
+
let w = textWidth + PADDING_H * 2;
|
|
150
|
+
let h = textHeight + PADDING_V * 2;
|
|
151
|
+
w = Math.max(w, 40);
|
|
152
|
+
h = Math.max(h, 28);
|
|
153
|
+
switch (shape) {
|
|
154
|
+
case "circle": {
|
|
155
|
+
const d = Math.sqrt(w * w + h * h);
|
|
156
|
+
return { width: d, height: d };
|
|
157
|
+
}
|
|
158
|
+
case "diamond": {
|
|
159
|
+
return { width: w * 1.45, height: h * 1.45 };
|
|
160
|
+
}
|
|
161
|
+
case "hexagon": {
|
|
162
|
+
return { width: w * 1.25, height: h * 1.15 };
|
|
163
|
+
}
|
|
164
|
+
case "stadium":
|
|
165
|
+
case "rect":
|
|
166
|
+
default:
|
|
167
|
+
return { width: w, height: h };
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// src/charts/graph/shapes.ts
|
|
172
|
+
function renderNodeShape(node, color, theme) {
|
|
173
|
+
const cx = node.x;
|
|
174
|
+
const cy = node.y;
|
|
175
|
+
const w = node.width;
|
|
176
|
+
const h = node.height;
|
|
177
|
+
const baseAttrs = {
|
|
178
|
+
class: "chartts-graph-node",
|
|
179
|
+
fill: color,
|
|
180
|
+
fillOpacity: 0.85,
|
|
181
|
+
stroke: color,
|
|
182
|
+
strokeWidth: 1.5,
|
|
183
|
+
"data-series": node.index,
|
|
184
|
+
"data-index": 0,
|
|
185
|
+
tabindex: 0,
|
|
186
|
+
role: "img",
|
|
187
|
+
ariaLabel: `${node.label}: ${node.value}`
|
|
188
|
+
};
|
|
189
|
+
let shapeNode;
|
|
190
|
+
switch (node.shape) {
|
|
191
|
+
case "circle": {
|
|
192
|
+
const r = Math.max(w, h) / 2;
|
|
193
|
+
shapeNode = circle(cx, cy, r, { ...baseAttrs });
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
case "diamond": {
|
|
197
|
+
const pb = new PathBuilder();
|
|
198
|
+
pb.moveTo(cx, cy - h / 2).lineTo(cx + w / 2, cy).lineTo(cx, cy + h / 2).lineTo(cx - w / 2, cy).close();
|
|
199
|
+
shapeNode = path(pb.build(), { ...baseAttrs });
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
case "hexagon": {
|
|
203
|
+
const rx = w / 2;
|
|
204
|
+
const ry = h / 2;
|
|
205
|
+
const pb = new PathBuilder();
|
|
206
|
+
for (let i = 0; i < 6; i++) {
|
|
207
|
+
const angle = Math.PI / 180 * (i * 60);
|
|
208
|
+
const px = cx + rx * Math.cos(angle);
|
|
209
|
+
const py = cy + ry * Math.sin(angle);
|
|
210
|
+
if (i === 0) pb.moveTo(px, py);
|
|
211
|
+
else pb.lineTo(px, py);
|
|
212
|
+
}
|
|
213
|
+
pb.close();
|
|
214
|
+
shapeNode = path(pb.build(), { ...baseAttrs });
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
case "stadium": {
|
|
218
|
+
shapeNode = rect(cx - w / 2, cy - h / 2, w, h, {
|
|
219
|
+
...baseAttrs,
|
|
220
|
+
rx: h / 2
|
|
221
|
+
});
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
// 'rect' is the default
|
|
225
|
+
default: {
|
|
226
|
+
shapeNode = rect(cx - w / 2, cy - h / 2, w, h, {
|
|
227
|
+
...baseAttrs,
|
|
228
|
+
rx: 8
|
|
229
|
+
});
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const labelNode = text(cx, cy, node.label, {
|
|
234
|
+
class: "chartts-graph-label",
|
|
235
|
+
fill: "#fff",
|
|
236
|
+
textAnchor: "middle",
|
|
237
|
+
dominantBaseline: "central",
|
|
238
|
+
fontSize: theme.fontSizeSmall,
|
|
239
|
+
fontFamily: theme.fontFamily,
|
|
240
|
+
fontWeight: 600
|
|
241
|
+
});
|
|
242
|
+
return [shapeNode, labelNode];
|
|
243
|
+
}
|
|
244
|
+
var PAD = 3;
|
|
245
|
+
function clipToNodeBoundary(node, angle) {
|
|
246
|
+
const cx = node.x;
|
|
247
|
+
const cy = node.y;
|
|
248
|
+
const w = node.width;
|
|
249
|
+
const h = node.height;
|
|
250
|
+
const cos = Math.cos(angle);
|
|
251
|
+
const sin = Math.sin(angle);
|
|
252
|
+
let bx;
|
|
253
|
+
let by;
|
|
254
|
+
switch (node.shape) {
|
|
255
|
+
case "circle": {
|
|
256
|
+
const r = Math.max(w, h) / 2;
|
|
257
|
+
bx = cx + r * cos;
|
|
258
|
+
by = cy + r * sin;
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
case "diamond": {
|
|
262
|
+
const hw = w / 2;
|
|
263
|
+
const hh = h / 2;
|
|
264
|
+
const t = 1 / (Math.abs(cos) / hw + Math.abs(sin) / hh);
|
|
265
|
+
bx = cx + t * cos;
|
|
266
|
+
by = cy + t * sin;
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
case "hexagon": {
|
|
270
|
+
const rx = w / 2;
|
|
271
|
+
const ry = h / 2;
|
|
272
|
+
const pt = hexBoundary(cx, cy, rx, ry, angle, cos, sin);
|
|
273
|
+
bx = pt.x;
|
|
274
|
+
by = pt.y;
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
// rect and stadium share the same rectangular bounding box logic
|
|
278
|
+
default: {
|
|
279
|
+
const hw = w / 2;
|
|
280
|
+
const hh = h / 2;
|
|
281
|
+
const cornerAngle = Math.atan2(hh, hw);
|
|
282
|
+
let a = (angle % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI);
|
|
283
|
+
if (a < cornerAngle || a >= 2 * Math.PI - cornerAngle) {
|
|
284
|
+
const t = hw / Math.abs(cos);
|
|
285
|
+
bx = cx + hw;
|
|
286
|
+
by = cy + t * sin;
|
|
287
|
+
} else if (a < Math.PI - cornerAngle) {
|
|
288
|
+
const t = hh / Math.abs(sin);
|
|
289
|
+
bx = cx + t * cos;
|
|
290
|
+
by = cy + hh;
|
|
291
|
+
} else if (a < Math.PI + cornerAngle) {
|
|
292
|
+
const t = hw / Math.abs(cos);
|
|
293
|
+
bx = cx - hw;
|
|
294
|
+
by = cy + t * sin;
|
|
295
|
+
} else {
|
|
296
|
+
const t = hh / Math.abs(sin);
|
|
297
|
+
bx = cx + t * cos;
|
|
298
|
+
by = cy - hh;
|
|
299
|
+
}
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
bx += PAD * cos;
|
|
304
|
+
by += PAD * sin;
|
|
305
|
+
return { x: bx, y: by };
|
|
306
|
+
}
|
|
307
|
+
function hexBoundary(cx, cy, rx, ry, _angle, cos, sin) {
|
|
308
|
+
const verts = [];
|
|
309
|
+
for (let i = 0; i < 6; i++) {
|
|
310
|
+
const a = Math.PI / 180 * (i * 60);
|
|
311
|
+
verts.push({ x: cx + rx * Math.cos(a), y: cy + ry * Math.sin(a) });
|
|
312
|
+
}
|
|
313
|
+
let bestT = Infinity;
|
|
314
|
+
let bestPt = { x: cx + rx * cos, y: cy + ry * sin };
|
|
315
|
+
for (let i = 0; i < 6; i++) {
|
|
316
|
+
const v0 = verts[i];
|
|
317
|
+
const v1 = verts[(i + 1) % 6];
|
|
318
|
+
const dx = v1.x - v0.x;
|
|
319
|
+
const dy = v1.y - v0.y;
|
|
320
|
+
const denom = cos * dy - sin * dx;
|
|
321
|
+
if (Math.abs(denom) < 1e-12) continue;
|
|
322
|
+
const t = ((v0.x - cx) * dy - (v0.y - cy) * dx) / denom;
|
|
323
|
+
const s = cos !== 0 ? (cx + t * cos - v0.x) / dx : (cy + t * sin - v0.y) / dy;
|
|
324
|
+
if (t > 1e-6 && s >= -1e-6 && s <= 1 + 1e-6 && t < bestT) {
|
|
325
|
+
bestT = t;
|
|
326
|
+
bestPt = { x: cx + t * cos, y: cy + t * sin };
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return bestPt;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// src/charts/graph/edges.ts
|
|
333
|
+
function renderArrowhead(tipX, tipY, angle, size, color) {
|
|
334
|
+
const cosA = Math.cos(angle);
|
|
335
|
+
const sinA = Math.sin(angle);
|
|
336
|
+
const baseX = tipX - cosA * size;
|
|
337
|
+
const baseY = tipY - sinA * size;
|
|
338
|
+
const perpX = -sinA * size * 0.4;
|
|
339
|
+
const perpY = cosA * size * 0.4;
|
|
340
|
+
const leftX = baseX + perpX;
|
|
341
|
+
const leftY = baseY + perpY;
|
|
342
|
+
const rightX = baseX - perpX;
|
|
343
|
+
const rightY = baseY - perpY;
|
|
344
|
+
const pb = new PathBuilder();
|
|
345
|
+
pb.moveTo(tipX, tipY).lineTo(leftX, leftY).lineTo(rightX, rightY).close();
|
|
346
|
+
return path(pb.build(), {
|
|
347
|
+
fill: color,
|
|
348
|
+
class: "chartts-graph-arrow"
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
function renderEdges(nodes, edges, options, theme) {
|
|
352
|
+
const result = [];
|
|
353
|
+
const pairIndex = /* @__PURE__ */ new Map();
|
|
354
|
+
for (const edge of edges) {
|
|
355
|
+
const src = nodes[edge.source];
|
|
356
|
+
const tgt = nodes[edge.target];
|
|
357
|
+
if (!src || !tgt) continue;
|
|
358
|
+
const angle = Math.atan2(tgt.y - src.y, tgt.x - src.x);
|
|
359
|
+
const start = clipToNodeBoundary(src, angle);
|
|
360
|
+
const end = clipToNodeBoundary(tgt, angle + Math.PI);
|
|
361
|
+
const edgeColor = edge.color ?? theme.gridColor;
|
|
362
|
+
const edgeAttrs = {
|
|
363
|
+
class: "chartts-graph-edge",
|
|
364
|
+
stroke: edgeColor,
|
|
365
|
+
strokeWidth: Math.max(1, Math.min(3, edge.weight * 0.5)),
|
|
366
|
+
strokeDasharray: edge.style === "dashed" ? "8,4" : edge.style === "dotted" ? "2,4" : void 0,
|
|
367
|
+
opacity: 0.6,
|
|
368
|
+
fill: "none"
|
|
369
|
+
};
|
|
370
|
+
let arrowAngle = angle;
|
|
371
|
+
let labelX = (start.x + end.x) / 2;
|
|
372
|
+
let labelY = (start.y + end.y) / 2;
|
|
373
|
+
if (options.edgeStyle === "straight" || options.edgeStyle === void 0) {
|
|
374
|
+
result.push(line(start.x, start.y, end.x, end.y, edgeAttrs));
|
|
375
|
+
} else {
|
|
376
|
+
const pairKey = Math.min(edge.source, edge.target) + ":" + Math.max(edge.source, edge.target);
|
|
377
|
+
const idx = pairIndex.get(pairKey) ?? 0;
|
|
378
|
+
pairIndex.set(pairKey, idx + 1);
|
|
379
|
+
const sign = idx % 2 === 0 ? 1 : -1;
|
|
380
|
+
const offset = Math.max(edge.weight * 8, 15);
|
|
381
|
+
const mx = (start.x + end.x) / 2;
|
|
382
|
+
const my = (start.y + end.y) / 2;
|
|
383
|
+
const perpAngle = angle + Math.PI / 2;
|
|
384
|
+
const cx = mx + Math.cos(perpAngle) * offset * sign;
|
|
385
|
+
const cy = my + Math.sin(perpAngle) * offset * sign;
|
|
386
|
+
const pb = new PathBuilder();
|
|
387
|
+
pb.moveTo(start.x, start.y).quadTo(cx, cy, end.x, end.y);
|
|
388
|
+
result.push(path(pb.build(), edgeAttrs));
|
|
389
|
+
arrowAngle = Math.atan2(end.y - cy, end.x - cx);
|
|
390
|
+
labelX = 0.25 * start.x + 0.5 * cx + 0.25 * end.x;
|
|
391
|
+
labelY = 0.25 * start.y + 0.5 * cy + 0.25 * end.y;
|
|
392
|
+
}
|
|
393
|
+
if (options.arrows !== false) {
|
|
394
|
+
const arrowSize = 8;
|
|
395
|
+
result.push(renderArrowhead(end.x, end.y, arrowAngle, arrowSize, edgeColor));
|
|
396
|
+
}
|
|
397
|
+
if (edge.label != null) {
|
|
398
|
+
const lx = labelX;
|
|
399
|
+
const ly = labelY;
|
|
400
|
+
const charWidth = (theme.fontSizeSmall - 1) * 0.6;
|
|
401
|
+
const pw = edge.label.length * charWidth + 8;
|
|
402
|
+
const ph = theme.fontSizeSmall - 1 + 6;
|
|
403
|
+
const bgFill = theme.background === "transparent" ? "#fff" : theme.background;
|
|
404
|
+
result.push(
|
|
405
|
+
rect(lx - pw / 2, ly - ph / 2, pw, ph, {
|
|
406
|
+
fill: bgFill,
|
|
407
|
+
rx: 3
|
|
408
|
+
})
|
|
409
|
+
);
|
|
410
|
+
result.push(
|
|
411
|
+
text(lx, ly, edge.label, {
|
|
412
|
+
fill: theme.textMuted,
|
|
413
|
+
textAnchor: "middle",
|
|
414
|
+
dominantBaseline: "central",
|
|
415
|
+
fontSize: theme.fontSizeSmall - 1,
|
|
416
|
+
fontFamily: theme.fontFamily
|
|
417
|
+
})
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
return result;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// src/charts/graph/layout-force.ts
|
|
425
|
+
var layoutCache = /* @__PURE__ */ new Map();
|
|
426
|
+
function cacheKey(nodes, edges) {
|
|
427
|
+
const nk = nodes.map((n) => n.id).join(",");
|
|
428
|
+
const ek = edges.map((e) => `${e.source}-${e.target}`).join(",");
|
|
429
|
+
return nk + "|" + ek;
|
|
430
|
+
}
|
|
431
|
+
function forceLayout(nodes, edges, opts) {
|
|
432
|
+
const { area, iterations } = opts;
|
|
433
|
+
const n = nodes.length;
|
|
434
|
+
if (n === 0) return;
|
|
435
|
+
const cx = area.x + area.width / 2;
|
|
436
|
+
const cy = area.y + area.height / 2;
|
|
437
|
+
const key = cacheKey(nodes, edges);
|
|
438
|
+
const cached = layoutCache.get(key);
|
|
439
|
+
if (cached && cached.length === n) {
|
|
440
|
+
for (let i = 0; i < n; i++) {
|
|
441
|
+
const node = nodes[i];
|
|
442
|
+
if (!node.pin) {
|
|
443
|
+
node.x = cached[i].x;
|
|
444
|
+
node.y = cached[i].y;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
} else {
|
|
448
|
+
for (let i = 0; i < n; i++) {
|
|
449
|
+
const node = nodes[i];
|
|
450
|
+
if (node.pin) {
|
|
451
|
+
node.x = area.x + node.pin.x * area.width;
|
|
452
|
+
node.y = area.y + node.pin.y * area.height;
|
|
453
|
+
} else {
|
|
454
|
+
const angle = 2 * Math.PI * i / n;
|
|
455
|
+
const r = Math.min(area.width, area.height) * 0.3;
|
|
456
|
+
node.x = cx + r * Math.cos(angle);
|
|
457
|
+
node.y = cy + r * Math.sin(angle);
|
|
458
|
+
}
|
|
459
|
+
node.vx = 0;
|
|
460
|
+
node.vy = 0;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
const k = Math.sqrt(area.width * area.height / Math.max(n, 1));
|
|
464
|
+
const repulsion = k * k;
|
|
465
|
+
for (let iter = 0; iter < iterations; iter++) {
|
|
466
|
+
const temp = 0.1 * (1 - iter / iterations) * Math.min(area.width, area.height) * 0.5;
|
|
467
|
+
for (const node of nodes) {
|
|
468
|
+
node.vx = 0;
|
|
469
|
+
node.vy = 0;
|
|
470
|
+
}
|
|
471
|
+
for (let i = 0; i < n; i++) {
|
|
472
|
+
for (let j = i + 1; j < n; j++) {
|
|
473
|
+
const ni = nodes[i];
|
|
474
|
+
const nj = nodes[j];
|
|
475
|
+
const dx = ni.x - nj.x;
|
|
476
|
+
const dy = ni.y - nj.y;
|
|
477
|
+
const dist = Math.max(Math.sqrt(dx * dx + dy * dy), 1);
|
|
478
|
+
const minDist = (Math.max(ni.width, ni.height) + Math.max(nj.width, nj.height)) / 2;
|
|
479
|
+
const effectiveDist = Math.max(dist - minDist * 0.6, 1);
|
|
480
|
+
const force = repulsion / (effectiveDist * effectiveDist);
|
|
481
|
+
const fx = dx / dist * force;
|
|
482
|
+
const fy = dy / dist * force;
|
|
483
|
+
ni.vx += fx;
|
|
484
|
+
ni.vy += fy;
|
|
485
|
+
nj.vx -= fx;
|
|
486
|
+
nj.vy -= fy;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
for (const edge of edges) {
|
|
490
|
+
const src = nodes[edge.source];
|
|
491
|
+
const tgt = nodes[edge.target];
|
|
492
|
+
const dx = tgt.x - src.x;
|
|
493
|
+
const dy = tgt.y - src.y;
|
|
494
|
+
const dist = Math.max(Math.sqrt(dx * dx + dy * dy), 1);
|
|
495
|
+
const force = dist * dist / k;
|
|
496
|
+
const fx = dx / dist * force * 0.1;
|
|
497
|
+
const fy = dy / dist * force * 0.1;
|
|
498
|
+
src.vx += fx;
|
|
499
|
+
src.vy += fy;
|
|
500
|
+
tgt.vx -= fx;
|
|
501
|
+
tgt.vy -= fy;
|
|
502
|
+
}
|
|
503
|
+
for (const node of nodes) {
|
|
504
|
+
const dx = cx - node.x;
|
|
505
|
+
const dy = cy - node.y;
|
|
506
|
+
node.vx += dx * 0.01;
|
|
507
|
+
node.vy += dy * 0.01;
|
|
508
|
+
}
|
|
509
|
+
for (const node of nodes) {
|
|
510
|
+
if (node.pin) continue;
|
|
511
|
+
node.vx *= 0.8;
|
|
512
|
+
node.vy *= 0.8;
|
|
513
|
+
const speed = Math.sqrt(node.vx * node.vx + node.vy * node.vy);
|
|
514
|
+
if (speed > 0) {
|
|
515
|
+
const capped = Math.min(speed, temp);
|
|
516
|
+
node.x += node.vx / speed * capped;
|
|
517
|
+
node.y += node.vy / speed * capped;
|
|
518
|
+
}
|
|
519
|
+
const mx = Math.max(20, node.width / 2 + 5);
|
|
520
|
+
const my = Math.max(20, node.height / 2 + 5);
|
|
521
|
+
node.x = Math.max(area.x + mx, Math.min(area.x + area.width - mx, node.x));
|
|
522
|
+
node.y = Math.max(area.y + my, Math.min(area.y + area.height - my, node.y));
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
layoutCache.set(key, nodes.map((nd) => ({ x: nd.x, y: nd.y })));
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// src/charts/graph/layout-hierarchy.ts
|
|
529
|
+
function hierarchyLayout(nodes, edges, opts) {
|
|
530
|
+
const n = nodes.length;
|
|
531
|
+
if (n === 0) return;
|
|
532
|
+
const { area, direction } = opts;
|
|
533
|
+
const outgoing = new Array(n);
|
|
534
|
+
const incoming = new Array(n);
|
|
535
|
+
for (let i = 0; i < n; i++) {
|
|
536
|
+
outgoing[i] = [];
|
|
537
|
+
incoming[i] = [];
|
|
538
|
+
}
|
|
539
|
+
const edgesCopy = edges.map((e) => ({ ...e }));
|
|
540
|
+
breakCycles(edgesCopy, n, outgoing, incoming);
|
|
541
|
+
const layers = assignLayers(n, outgoing, incoming);
|
|
542
|
+
const layerGroups = groupByLayer(layers, n);
|
|
543
|
+
orderLayers(layerGroups, outgoing, incoming, 3);
|
|
544
|
+
const isHorizontal = direction === "LR" || direction === "RL";
|
|
545
|
+
const maxLayer = Math.max(...layers, 0);
|
|
546
|
+
const availW = area.width;
|
|
547
|
+
const availH = area.height;
|
|
548
|
+
const layerCount = maxLayer + 1;
|
|
549
|
+
const layerGap = isHorizontal ? availW / (layerCount + 1) : availH / (layerCount + 1);
|
|
550
|
+
for (let layer = 0; layer <= maxLayer; layer++) {
|
|
551
|
+
const group2 = layerGroups[layer] ?? [];
|
|
552
|
+
if (group2.length === 0) continue;
|
|
553
|
+
const nodeGap = isHorizontal ? availH / (group2.length + 1) : availW / (group2.length + 1);
|
|
554
|
+
for (let pos = 0; pos < group2.length; pos++) {
|
|
555
|
+
const node = nodes[group2[pos]];
|
|
556
|
+
if (node.pin) {
|
|
557
|
+
node.x = area.x + node.pin.x * area.width;
|
|
558
|
+
node.y = area.y + node.pin.y * area.height;
|
|
559
|
+
continue;
|
|
560
|
+
}
|
|
561
|
+
let layerCoord = area.x + layerGap * (layer + 1);
|
|
562
|
+
let posCoord = area.y + nodeGap * (pos + 1);
|
|
563
|
+
if (isHorizontal) ; else {
|
|
564
|
+
const tmp = layerCoord;
|
|
565
|
+
layerCoord = posCoord;
|
|
566
|
+
posCoord = tmp;
|
|
567
|
+
}
|
|
568
|
+
switch (direction) {
|
|
569
|
+
case "TB":
|
|
570
|
+
node.x = layerCoord;
|
|
571
|
+
node.y = posCoord;
|
|
572
|
+
break;
|
|
573
|
+
case "BT":
|
|
574
|
+
node.x = layerCoord;
|
|
575
|
+
node.y = area.y + area.height - (posCoord - area.y);
|
|
576
|
+
break;
|
|
577
|
+
case "LR":
|
|
578
|
+
node.x = layerCoord;
|
|
579
|
+
node.y = posCoord;
|
|
580
|
+
break;
|
|
581
|
+
case "RL":
|
|
582
|
+
node.x = area.x + area.width - (layerCoord - area.x);
|
|
583
|
+
node.y = posCoord;
|
|
584
|
+
break;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
function breakCycles(edges, n, outgoing, incoming) {
|
|
590
|
+
for (const e of edges) {
|
|
591
|
+
outgoing[e.source].push(e.target);
|
|
592
|
+
incoming[e.target].push(e.source);
|
|
593
|
+
}
|
|
594
|
+
const WHITE = 0, GRAY = 1, BLACK = 2;
|
|
595
|
+
const color = new Array(n).fill(WHITE);
|
|
596
|
+
function dfs(u) {
|
|
597
|
+
color[u] = GRAY;
|
|
598
|
+
const out = outgoing[u];
|
|
599
|
+
for (let i = 0; i < out.length; i++) {
|
|
600
|
+
const v = out[i];
|
|
601
|
+
if (color[v] === GRAY) {
|
|
602
|
+
for (const e of edges) {
|
|
603
|
+
if (e.source === u && e.target === v) {
|
|
604
|
+
e.source = v;
|
|
605
|
+
e.target = u;
|
|
606
|
+
break;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
out.splice(i, 1);
|
|
610
|
+
i--;
|
|
611
|
+
outgoing[v].push(u);
|
|
612
|
+
incoming[u].push(v);
|
|
613
|
+
const idx = incoming[v].indexOf(u);
|
|
614
|
+
if (idx >= 0) incoming[v].splice(idx, 1);
|
|
615
|
+
} else if (color[v] === WHITE) {
|
|
616
|
+
dfs(v);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
color[u] = BLACK;
|
|
620
|
+
}
|
|
621
|
+
for (let i = 0; i < n; i++) {
|
|
622
|
+
if (color[i] === WHITE) dfs(i);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
function assignLayers(n, outgoing, incoming) {
|
|
626
|
+
const layers = new Array(n).fill(-1);
|
|
627
|
+
const roots = [];
|
|
628
|
+
for (let i = 0; i < n; i++) {
|
|
629
|
+
if (incoming[i].length === 0) roots.push(i);
|
|
630
|
+
}
|
|
631
|
+
if (roots.length === 0 && n > 0) roots.push(0);
|
|
632
|
+
const queue = [];
|
|
633
|
+
for (const r of roots) {
|
|
634
|
+
layers[r] = 0;
|
|
635
|
+
queue.push(r);
|
|
636
|
+
}
|
|
637
|
+
let qi = 0;
|
|
638
|
+
while (qi < queue.length) {
|
|
639
|
+
const u = queue[qi++];
|
|
640
|
+
for (const v of outgoing[u]) {
|
|
641
|
+
const newLayer = layers[u] + 1;
|
|
642
|
+
if (layers[v] < newLayer) {
|
|
643
|
+
layers[v] = newLayer;
|
|
644
|
+
queue.push(v);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
for (let i = 0; i < n; i++) {
|
|
649
|
+
if (layers[i] < 0) layers[i] = 0;
|
|
650
|
+
}
|
|
651
|
+
return layers;
|
|
652
|
+
}
|
|
653
|
+
function groupByLayer(layers, n) {
|
|
654
|
+
const maxLayer = Math.max(...layers, 0);
|
|
655
|
+
const groups = new Array(maxLayer + 1);
|
|
656
|
+
for (let i = 0; i <= maxLayer; i++) groups[i] = [];
|
|
657
|
+
for (let i = 0; i < n; i++) {
|
|
658
|
+
groups[layers[i]].push(i);
|
|
659
|
+
}
|
|
660
|
+
return groups;
|
|
661
|
+
}
|
|
662
|
+
function orderLayers(layerGroups, outgoing, incoming, passes) {
|
|
663
|
+
for (let pass = 0; pass < passes; pass++) {
|
|
664
|
+
for (let l = 1; l < layerGroups.length; l++) {
|
|
665
|
+
const layer = layerGroups[l];
|
|
666
|
+
const posMap = /* @__PURE__ */ new Map();
|
|
667
|
+
const prevLayer = layerGroups[l - 1];
|
|
668
|
+
for (let i = 0; i < prevLayer.length; i++) posMap.set(prevLayer[i], i);
|
|
669
|
+
layer.sort((a, b) => {
|
|
670
|
+
const ba = barycenter(a, incoming, posMap);
|
|
671
|
+
const bb = barycenter(b, incoming, posMap);
|
|
672
|
+
return ba - bb;
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
for (let l = layerGroups.length - 2; l >= 0; l--) {
|
|
676
|
+
const layer = layerGroups[l];
|
|
677
|
+
const posMap = /* @__PURE__ */ new Map();
|
|
678
|
+
const nextLayer = layerGroups[l + 1];
|
|
679
|
+
for (let i = 0; i < nextLayer.length; i++) posMap.set(nextLayer[i], i);
|
|
680
|
+
layer.sort((a, b) => {
|
|
681
|
+
const ba = barycenter(a, outgoing, posMap);
|
|
682
|
+
const bb = barycenter(b, outgoing, posMap);
|
|
683
|
+
return ba - bb;
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
function barycenter(nodeIdx, adj, posMap) {
|
|
689
|
+
const neighbors = adj[nodeIdx];
|
|
690
|
+
if (neighbors.length === 0) return 0;
|
|
691
|
+
let sum = 0;
|
|
692
|
+
let count = 0;
|
|
693
|
+
for (const nb of neighbors) {
|
|
694
|
+
const pos = posMap.get(nb);
|
|
695
|
+
if (pos !== void 0) {
|
|
696
|
+
sum += pos;
|
|
697
|
+
count++;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return count > 0 ? sum / count : 0;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
// src/charts/graph/layout-circular.ts
|
|
704
|
+
function circularLayout(nodes, edges, opts) {
|
|
705
|
+
const n = nodes.length;
|
|
706
|
+
if (n === 0) return;
|
|
707
|
+
const { area } = opts;
|
|
708
|
+
const cx = area.x + area.width / 2;
|
|
709
|
+
const cy = area.y + area.height / 2;
|
|
710
|
+
const maxNodeSize = Math.max(
|
|
711
|
+
...nodes.map((nd) => Math.max(nd.width, nd.height)),
|
|
712
|
+
40
|
|
713
|
+
);
|
|
714
|
+
const radius = Math.min(area.width, area.height) / 2 - maxNodeSize / 2 - 10;
|
|
715
|
+
const order = connectivityOrder(nodes, edges);
|
|
716
|
+
const unpinned = [];
|
|
717
|
+
for (const idx of order) {
|
|
718
|
+
if (!nodes[idx].pin) unpinned.push(idx);
|
|
719
|
+
}
|
|
720
|
+
const angleStep = 2 * Math.PI / Math.max(unpinned.length, 1);
|
|
721
|
+
const startAngle = -Math.PI / 2;
|
|
722
|
+
for (let i = 0; i < unpinned.length; i++) {
|
|
723
|
+
const node = nodes[unpinned[i]];
|
|
724
|
+
const angle = startAngle + angleStep * i;
|
|
725
|
+
node.x = cx + radius * Math.cos(angle);
|
|
726
|
+
node.y = cy + radius * Math.sin(angle);
|
|
727
|
+
}
|
|
728
|
+
for (const node of nodes) {
|
|
729
|
+
if (node.pin) {
|
|
730
|
+
node.x = area.x + node.pin.x * area.width;
|
|
731
|
+
node.y = area.y + node.pin.y * area.height;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
function connectivityOrder(nodes, edges) {
|
|
736
|
+
const n = nodes.length;
|
|
737
|
+
if (n === 0) return [];
|
|
738
|
+
const adj = new Array(n);
|
|
739
|
+
for (let i = 0; i < n; i++) adj[i] = [];
|
|
740
|
+
for (const e of edges) {
|
|
741
|
+
adj[e.source].push(e.target);
|
|
742
|
+
adj[e.target].push(e.source);
|
|
743
|
+
}
|
|
744
|
+
let startNode = 0;
|
|
745
|
+
let maxDeg = 0;
|
|
746
|
+
for (let i = 0; i < n; i++) {
|
|
747
|
+
if (adj[i].length > maxDeg) {
|
|
748
|
+
maxDeg = adj[i].length;
|
|
749
|
+
startNode = i;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
const visited = /* @__PURE__ */ new Set();
|
|
753
|
+
const order = [];
|
|
754
|
+
const queue = [startNode];
|
|
755
|
+
visited.add(startNode);
|
|
756
|
+
while (queue.length > 0) {
|
|
757
|
+
const u = queue.shift();
|
|
758
|
+
order.push(u);
|
|
759
|
+
const neighbors = adj[u].filter((v) => !visited.has(v));
|
|
760
|
+
neighbors.sort((a, b) => adj[b].length - adj[a].length);
|
|
761
|
+
for (const v of neighbors) {
|
|
762
|
+
if (!visited.has(v)) {
|
|
763
|
+
visited.add(v);
|
|
764
|
+
queue.push(v);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
for (let i = 0; i < n; i++) {
|
|
769
|
+
if (!visited.has(i)) order.push(i);
|
|
770
|
+
}
|
|
771
|
+
return order;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
// src/charts/graph/graph-type.ts
|
|
775
|
+
var graphChartType = {
|
|
776
|
+
type: "graph",
|
|
777
|
+
getScaleTypes() {
|
|
778
|
+
return { x: "categorical", y: "linear" };
|
|
779
|
+
},
|
|
780
|
+
prepareData(data, options) {
|
|
781
|
+
return prepareNoAxes(data, options);
|
|
782
|
+
},
|
|
783
|
+
render(ctx) {
|
|
784
|
+
const { data, area, theme, options } = ctx;
|
|
785
|
+
const graphOpts = options;
|
|
786
|
+
const result = [];
|
|
787
|
+
const { graphNodes, graphEdges } = parseGraphData(data, options);
|
|
788
|
+
if (graphNodes.length === 0) return result;
|
|
789
|
+
for (const node of graphNodes) {
|
|
790
|
+
const size = measureNodeSize(node.label, theme.fontSizeSmall, node.shape);
|
|
791
|
+
node.width = size.width;
|
|
792
|
+
node.height = size.height;
|
|
793
|
+
}
|
|
794
|
+
runLayout(graphNodes, graphEdges, graphOpts, area);
|
|
795
|
+
const edgeNodes = renderEdges(graphNodes, graphEdges, graphOpts, theme);
|
|
796
|
+
if (edgeNodes.length > 0) {
|
|
797
|
+
result.push(group(edgeNodes, { class: "chartts-graph-edges" }));
|
|
798
|
+
}
|
|
799
|
+
for (const node of graphNodes) {
|
|
800
|
+
const color = node.color ?? options.colors[node.index % options.colors.length];
|
|
801
|
+
const shapeNodes = renderNodeShape(node, color, theme);
|
|
802
|
+
result.push(group(shapeNodes, {
|
|
803
|
+
class: `chartts-series chartts-series-${node.index}`,
|
|
804
|
+
"data-series-name": node.label
|
|
805
|
+
}));
|
|
806
|
+
}
|
|
807
|
+
return result;
|
|
808
|
+
},
|
|
809
|
+
hitTest(ctx, mx, my) {
|
|
810
|
+
const { data, area, theme, options } = ctx;
|
|
811
|
+
const graphOpts = options;
|
|
812
|
+
const { graphNodes, graphEdges } = parseGraphData(data, options);
|
|
813
|
+
if (graphNodes.length === 0) return null;
|
|
814
|
+
for (const node of graphNodes) {
|
|
815
|
+
const size = measureNodeSize(node.label, theme.fontSizeSmall, node.shape);
|
|
816
|
+
node.width = size.width;
|
|
817
|
+
node.height = size.height;
|
|
818
|
+
}
|
|
819
|
+
runLayout(graphNodes, graphEdges, graphOpts, area);
|
|
820
|
+
let best = null;
|
|
821
|
+
let bestDist = Infinity;
|
|
822
|
+
for (const node of graphNodes) {
|
|
823
|
+
const dist = shapeDistance(node, mx, my);
|
|
824
|
+
if (dist < bestDist && dist < 8) {
|
|
825
|
+
bestDist = dist;
|
|
826
|
+
best = { seriesIndex: node.index, pointIndex: 0, distance: dist, x: node.x, y: node.y };
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
return best;
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
function runLayout(nodes, edges, opts, area) {
|
|
833
|
+
const layout = opts.layout ?? "force";
|
|
834
|
+
switch (layout) {
|
|
835
|
+
case "hierarchical":
|
|
836
|
+
hierarchyLayout(nodes, edges, {
|
|
837
|
+
area,
|
|
838
|
+
direction: opts.direction ?? "TB"
|
|
839
|
+
});
|
|
840
|
+
break;
|
|
841
|
+
case "circular":
|
|
842
|
+
circularLayout(nodes, edges, { area });
|
|
843
|
+
break;
|
|
844
|
+
case "force":
|
|
845
|
+
default:
|
|
846
|
+
forceLayout(nodes, edges, {
|
|
847
|
+
area,
|
|
848
|
+
iterations: opts.iterations ?? 120
|
|
849
|
+
});
|
|
850
|
+
break;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
function shapeDistance(node, mx, my) {
|
|
854
|
+
const dx = mx - node.x;
|
|
855
|
+
const dy = my - node.y;
|
|
856
|
+
const absDx = Math.abs(dx);
|
|
857
|
+
const absDy = Math.abs(dy);
|
|
858
|
+
switch (node.shape) {
|
|
859
|
+
case "circle": {
|
|
860
|
+
const r = Math.max(node.width, node.height) / 2;
|
|
861
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
862
|
+
return Math.max(0, dist - r);
|
|
863
|
+
}
|
|
864
|
+
case "diamond": {
|
|
865
|
+
const hw = node.width / 2;
|
|
866
|
+
const hh = node.height / 2;
|
|
867
|
+
const d = absDx / hw + absDy / hh;
|
|
868
|
+
return d <= 1 ? 0 : Math.sqrt(dx * dx + dy * dy) * (d - 1);
|
|
869
|
+
}
|
|
870
|
+
case "hexagon": {
|
|
871
|
+
const rx = node.width / 2;
|
|
872
|
+
const ry = node.height / 2;
|
|
873
|
+
const d = dx * dx / (rx * rx) + dy * dy / (ry * ry);
|
|
874
|
+
return d <= 1 ? 0 : Math.sqrt(dx * dx + dy * dy) * (Math.sqrt(d) - 1);
|
|
875
|
+
}
|
|
876
|
+
// rect, stadium
|
|
877
|
+
default: {
|
|
878
|
+
const hw = node.width / 2;
|
|
879
|
+
const hh = node.height / 2;
|
|
880
|
+
const ox = Math.max(0, absDx - hw);
|
|
881
|
+
const oy = Math.max(0, absDy - hh);
|
|
882
|
+
return Math.sqrt(ox * ox + oy * oy);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
export { graphChartType };
|
|
888
|
+
//# sourceMappingURL=chunk-MYXLKVJE.js.map
|
|
889
|
+
//# sourceMappingURL=chunk-MYXLKVJE.js.map
|