boardplot 0.0.0-stage → 0.53.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/CHANGELOG.md +49 -0
- package/LICENSE +201 -0
- package/NOTICE.md +180 -0
- package/README.md +208 -2
- package/THIRD_PARTY_NOTICES.md +1110 -0
- package/dist/DiagnosticDetails-UNYNYCAH.js +69 -0
- package/dist/ReaderBox-VOJSJ66R.js +137 -0
- package/dist/annotateEngine-DLMFJZ67.js +30 -0
- package/dist/build-identity.json +6 -0
- package/dist/chunk-24BHMKDD.js +83 -0
- package/dist/chunk-263SZKIL.js +8 -0
- package/dist/chunk-27QADBDV.js +211 -0
- package/dist/chunk-2CVH5E57.js +128 -0
- package/dist/chunk-2DOR5SS6.js +446 -0
- package/dist/chunk-2EQE4E3I.js +22 -0
- package/dist/chunk-2FNNAPCI.js +24 -0
- package/dist/chunk-2L2Q53EP.js +251 -0
- package/dist/chunk-2LMCD3ZR.js +6 -0
- package/dist/chunk-2ND7ZITT.js +3069 -0
- package/dist/chunk-2QT5ZUHO.js +2937 -0
- package/dist/chunk-2RSG7JYI.js +24 -0
- package/dist/chunk-2V6CLH33.js +1392 -0
- package/dist/chunk-2VWJ5BGO.js +566 -0
- package/dist/chunk-2WNYRWHG.js +51 -0
- package/dist/chunk-323YZWYJ.js +548 -0
- package/dist/chunk-33PB4V6K.js +382 -0
- package/dist/chunk-33PLBIMA.js +176 -0
- package/dist/chunk-3A2IEBCN.js +195 -0
- package/dist/chunk-3D3D3D23.js +25 -0
- package/dist/chunk-3EZRM4YM.js +92 -0
- package/dist/chunk-3H2W76TB.js +2353 -0
- package/dist/chunk-3JEQGGVD.js +19 -0
- package/dist/chunk-3QWZAEW5.js +26 -0
- package/dist/chunk-3SIRPKMP.js +12 -0
- package/dist/chunk-3SQCCESO.js +1592 -0
- package/dist/chunk-3XHJHQWU.js +42 -0
- package/dist/chunk-4G2O2ZPJ.js +83 -0
- package/dist/chunk-4JLBVIGW.js +24 -0
- package/dist/chunk-4RRNJLCM.js +746 -0
- package/dist/chunk-4UVW5WU6.js +76 -0
- package/dist/chunk-4X66BTP5.js +344 -0
- package/dist/chunk-53OYF4ZT.js +687 -0
- package/dist/chunk-57ZGVAU3.js +179 -0
- package/dist/chunk-5HECRVXJ.js +62 -0
- package/dist/chunk-5LGSRWFC.js +63 -0
- package/dist/chunk-5LYXD6ME.js +1112 -0
- package/dist/chunk-66RFKRGO.js +28 -0
- package/dist/chunk-6KWIQ5KF.js +18 -0
- package/dist/chunk-6OCR6ITN.js +72 -0
- package/dist/chunk-6RBTTCQD.js +802 -0
- package/dist/chunk-6Y7EXYLR.js +563 -0
- package/dist/chunk-7CTKTIPF.js +613 -0
- package/dist/chunk-7EVIIADO.js +185 -0
- package/dist/chunk-7X2ZYVAX.js +89 -0
- package/dist/chunk-7X65ZQN4.js +38 -0
- package/dist/chunk-A4QZXLXF.js +7 -0
- package/dist/chunk-A6CQPJWR.js +49 -0
- package/dist/chunk-A7IEVBYI.js +35 -0
- package/dist/chunk-ACXX2JNL.js +6 -0
- package/dist/chunk-ADKCLH3Z.js +98 -0
- package/dist/chunk-ADWSGPH5.js +23 -0
- package/dist/chunk-AG2CJ4JY.js +203 -0
- package/dist/chunk-AHQ4L3BE.js +30 -0
- package/dist/chunk-AOQ6VF5H.js +6 -0
- package/dist/chunk-AQROQDLR.js +3303 -0
- package/dist/chunk-AWTG3RFF.js +85 -0
- package/dist/chunk-B54RN2FD.js +692 -0
- package/dist/chunk-B67K6OWJ.js +48 -0
- package/dist/chunk-B6GFKYBZ.js +40 -0
- package/dist/chunk-BBL3R5YZ.js +186 -0
- package/dist/chunk-BBRBCMNR.js +28 -0
- package/dist/chunk-BIDIGDGH.js +6 -0
- package/dist/chunk-BLFWUMTD.js +12 -0
- package/dist/chunk-BM6SFFWF.js +6 -0
- package/dist/chunk-BMRD6MAH.js +24 -0
- package/dist/chunk-BPKXEMRE.js +197 -0
- package/dist/chunk-BUPLB3EX.js +129 -0
- package/dist/chunk-BW5VLBSZ.js +15 -0
- package/dist/chunk-BWGRWGVA.js +295 -0
- package/dist/chunk-BWLOXQDV.js +131 -0
- package/dist/chunk-BWTX7LUG.js +203 -0
- package/dist/chunk-C54QLNE4.js +69 -0
- package/dist/chunk-CAQ5P4VN.js +296 -0
- package/dist/chunk-CCCEBIUZ.js +296 -0
- package/dist/chunk-CDZHNLO6.js +42 -0
- package/dist/chunk-CJGSJKPO.js +25 -0
- package/dist/chunk-CN7JRHST.js +25 -0
- package/dist/chunk-CNX7EGSU.js +266 -0
- package/dist/chunk-COYOTQC2.js +75 -0
- package/dist/chunk-CRNMNZJD.js +1161 -0
- package/dist/chunk-CUVUDK4O.js +68 -0
- package/dist/chunk-CWDHCSL2.js +2919 -0
- package/dist/chunk-CYOJZ3GQ.js +631 -0
- package/dist/chunk-D4SOADBD.js +19 -0
- package/dist/chunk-D7SHZDA3.js +1808 -0
- package/dist/chunk-DAVHGK27.js +657 -0
- package/dist/chunk-DCCJRLAJ.js +422 -0
- package/dist/chunk-DCTCUZ5L.js +51 -0
- package/dist/chunk-DDCB7ZA5.js +2511 -0
- package/dist/chunk-DDI2W4TR.js +149 -0
- package/dist/chunk-DIHUGBZO.js +61 -0
- package/dist/chunk-DJHIQWSG.js +25 -0
- package/dist/chunk-DO5OZJAO.js +302 -0
- package/dist/chunk-DOFYKPTC.js +18 -0
- package/dist/chunk-DRTA6JG5.js +160 -0
- package/dist/chunk-DRW6KGBK.js +1062 -0
- package/dist/chunk-DU4A5AOY.js +1156 -0
- package/dist/chunk-DYS7EIXY.js +294 -0
- package/dist/chunk-E4IQ6M4S.js +24 -0
- package/dist/chunk-EFUWFB64.js +24 -0
- package/dist/chunk-EHBB2Z4D.js +290 -0
- package/dist/chunk-EHVESNLV.js +30 -0
- package/dist/chunk-EJPVVGD7.js +67 -0
- package/dist/chunk-EKQK5D6G.js +14 -0
- package/dist/chunk-EUADDXAV.js +30 -0
- package/dist/chunk-F6CNPC4L.js +47 -0
- package/dist/chunk-FBAYZSFC.js +2806 -0
- package/dist/chunk-FBB4BWKN.js +30 -0
- package/dist/chunk-FF23FYQD.js +1269 -0
- package/dist/chunk-FG6EDGMI.js +53 -0
- package/dist/chunk-FHA3KMFC.js +43 -0
- package/dist/chunk-FIANWJXX.js +19 -0
- package/dist/chunk-FIWNDOMO.js +6 -0
- package/dist/chunk-FV3VF36K.js +2721 -0
- package/dist/chunk-G5FMTRG5.js +37 -0
- package/dist/chunk-GCBOHVDZ.js +229 -0
- package/dist/chunk-GDOW2KNP.js +19 -0
- package/dist/chunk-GTG3IGLF.js +2674 -0
- package/dist/chunk-GZTNTHSW.js +21 -0
- package/dist/chunk-H4H4O62O.js +46 -0
- package/dist/chunk-H5G7T35P.js +24 -0
- package/dist/chunk-H63XQ3OO.js +942 -0
- package/dist/chunk-H67RTX46.js +43 -0
- package/dist/chunk-HA4IPWMM.js +841 -0
- package/dist/chunk-HKYTOJLV.js +33 -0
- package/dist/chunk-HOAH5XBR.js +542 -0
- package/dist/chunk-HTYFQHRC.js +24 -0
- package/dist/chunk-HYY5V2KL.js +19 -0
- package/dist/chunk-HZI56ASJ.js +79 -0
- package/dist/chunk-I6VAWNNU.js +24 -0
- package/dist/chunk-IBXXZVG7.js +80 -0
- package/dist/chunk-IDDA5INB.js +60 -0
- package/dist/chunk-IK4BHOPZ.js +33 -0
- package/dist/chunk-IL5T7I2A.js +27 -0
- package/dist/chunk-ILSXT6KT.js +24 -0
- package/dist/chunk-IV2UXZXX.js +16 -0
- package/dist/chunk-IYEFEBRN.js +41 -0
- package/dist/chunk-IYMI7YI4.js +829 -0
- package/dist/chunk-J6I2YFJH.js +58 -0
- package/dist/chunk-JFBEAUJ6.js +24 -0
- package/dist/chunk-JR7Y5ONB.js +27 -0
- package/dist/chunk-JSEYUJUQ.js +836 -0
- package/dist/chunk-JYBT2JNY.js +61 -0
- package/dist/chunk-K3HSQPSM.js +24 -0
- package/dist/chunk-KAXJFL7N.js +43 -0
- package/dist/chunk-KDMKHR5A.js +32 -0
- package/dist/chunk-KKWZWP67.js +24 -0
- package/dist/chunk-KOJ5QETJ.js +8 -0
- package/dist/chunk-KPKXJYQH.js +19 -0
- package/dist/chunk-KSJVENRU.js +113 -0
- package/dist/chunk-KZJOV4QW.js +33 -0
- package/dist/chunk-KZS46KDY.js +58 -0
- package/dist/chunk-L3JWM7FR.js +50 -0
- package/dist/chunk-L4S6UFTL.js +26 -0
- package/dist/chunk-L6DJ4ZY5.js +2008 -0
- package/dist/chunk-L7RHB734.js +23 -0
- package/dist/chunk-LCWJS34U.js +38 -0
- package/dist/chunk-LFTAMH7I.js +24 -0
- package/dist/chunk-LFX7W4B7.js +113 -0
- package/dist/chunk-LINZPU5D.js +8 -0
- package/dist/chunk-LIWLBLCT.js +83 -0
- package/dist/chunk-LNKY5Z2X.js +23 -0
- package/dist/chunk-LS7HVBI7.js +24 -0
- package/dist/chunk-M4EUXOLU.js +170 -0
- package/dist/chunk-M4SPKUZE.js +7 -0
- package/dist/chunk-M4YLED7M.js +17 -0
- package/dist/chunk-MBKZYJRC.js +1424 -0
- package/dist/chunk-MCYM3RNF.js +227 -0
- package/dist/chunk-MF6IVSBJ.js +48 -0
- package/dist/chunk-MIAPBQCA.js +24 -0
- package/dist/chunk-MJZHFH5R.js +1075 -0
- package/dist/chunk-MQFCG4KS.js +1467 -0
- package/dist/chunk-MVV6RQMG.js +128 -0
- package/dist/chunk-MYMT5KJL.js +1182 -0
- package/dist/chunk-MZL6LGKO.js +587 -0
- package/dist/chunk-N23YFPPI.js +47 -0
- package/dist/chunk-N3G2FYDL.js +300 -0
- package/dist/chunk-N3TPMXS3.js +161 -0
- package/dist/chunk-N73IBH55.js +58 -0
- package/dist/chunk-N7J7CZS6.js +43 -0
- package/dist/chunk-NCB3YLHF.js +28 -0
- package/dist/chunk-NHQGRKEA.js +63 -0
- package/dist/chunk-NKIYLFXZ.js +2774 -0
- package/dist/chunk-NOSDEJ3K.js +25934 -0
- package/dist/chunk-NQDVMUHX.js +433 -0
- package/dist/chunk-NSSNYY6Y.js +58 -0
- package/dist/chunk-NY5NUFDZ.js +117 -0
- package/dist/chunk-O3S2KNIW.js +25 -0
- package/dist/chunk-O3VN6BTL.js +24 -0
- package/dist/chunk-ONZLC47B.js +88 -0
- package/dist/chunk-OQEBOVUO.js +30 -0
- package/dist/chunk-OUEGGWH7.js +24 -0
- package/dist/chunk-OURX73UJ.js +728 -0
- package/dist/chunk-P25VEGGX.js +24 -0
- package/dist/chunk-P26Z62UV.js +24 -0
- package/dist/chunk-P5RNWMZC.js +2984 -0
- package/dist/chunk-P6KZIZDV.js +987 -0
- package/dist/chunk-PEUSKIFV.js +168 -0
- package/dist/chunk-PFVTYFSL.js +24 -0
- package/dist/chunk-PWROWDZS.js +137 -0
- package/dist/chunk-Q3CV2JJ2.js +3650 -0
- package/dist/chunk-QBR6IKIX.js +50 -0
- package/dist/chunk-QGCEHR6S.js +13 -0
- package/dist/chunk-QHRE2M6V.js +26 -0
- package/dist/chunk-QKL7IY42.js +38 -0
- package/dist/chunk-QO6HEXIZ.js +272 -0
- package/dist/chunk-QOIVXZUF.js +24 -0
- package/dist/chunk-QPWRHDLZ.js +17 -0
- package/dist/chunk-QSXK6PJL.js +19 -0
- package/dist/chunk-QTZVVZ2A.js +54 -0
- package/dist/chunk-QWXWVPNE.js +18 -0
- package/dist/chunk-QY5ZKUWY.js +383 -0
- package/dist/chunk-QZAT46PP.js +95 -0
- package/dist/chunk-RA66JA3D.js +24 -0
- package/dist/chunk-REOPXBUR.js +600 -0
- package/dist/chunk-RGZGLKFB.js +648 -0
- package/dist/chunk-RL3NUWMY.js +3378 -0
- package/dist/chunk-RNOJSEES.js +16 -0
- package/dist/chunk-ROXO4R3J.js +16 -0
- package/dist/chunk-RPIW5T55.js +40 -0
- package/dist/chunk-RQ5DNYLG.js +10 -0
- package/dist/chunk-RZNYW7UP.js +133 -0
- package/dist/chunk-S32YYDIB.js +420 -0
- package/dist/chunk-S4QSJAGY.js +44 -0
- package/dist/chunk-S6UX7KB6.js +335 -0
- package/dist/chunk-SDSONLMZ.js +2546 -0
- package/dist/chunk-SGD3ZHID.js +250 -0
- package/dist/chunk-SKRSCTT5.js +28 -0
- package/dist/chunk-SMCDXUIO.js +24 -0
- package/dist/chunk-SPTPFY4S.js +528 -0
- package/dist/chunk-SREWFAAJ.js +90 -0
- package/dist/chunk-SS42FJVN.js +3875 -0
- package/dist/chunk-SVZDXFPX.js +891 -0
- package/dist/chunk-SZPTTNW7.js +16 -0
- package/dist/chunk-T3IGJARD.js +22 -0
- package/dist/chunk-TA3TFKYZ.js +86 -0
- package/dist/chunk-TBGUEF3M.js +939 -0
- package/dist/chunk-TGK6KUGN.js +331 -0
- package/dist/chunk-TJSND556.js +1783 -0
- package/dist/chunk-TKOJZQAJ.js +24 -0
- package/dist/chunk-TM4OC53S.js +97 -0
- package/dist/chunk-TNEHPP3H.js +18 -0
- package/dist/chunk-TWOREVKJ.js +1760 -0
- package/dist/chunk-TXS3U77A.js +60 -0
- package/dist/chunk-UB6ODJHO.js +134 -0
- package/dist/chunk-UBZXQIDR.js +24 -0
- package/dist/chunk-ULTSSIOU.js +38 -0
- package/dist/chunk-UMDEWWXT.js +33 -0
- package/dist/chunk-V6O6KVOA.js +347 -0
- package/dist/chunk-VABRPZVC.js +43 -0
- package/dist/chunk-VDAKTZQP.js +18 -0
- package/dist/chunk-VDAZPGR2.js +79 -0
- package/dist/chunk-VERLFNWR.js +25 -0
- package/dist/chunk-VH2UUU7K.js +24 -0
- package/dist/chunk-VJ3FCGQF.js +12 -0
- package/dist/chunk-VK5ZDV67.js +47 -0
- package/dist/chunk-VKQNDOAI.js +40 -0
- package/dist/chunk-VTEV3WVF.js +690 -0
- package/dist/chunk-VXZFQKBJ.js +21 -0
- package/dist/chunk-WI5ITCOH.js +22 -0
- package/dist/chunk-WLZ54FWG.js +120 -0
- package/dist/chunk-WYJEOMNY.js +31 -0
- package/dist/chunk-WZGJSQKN.js +29 -0
- package/dist/chunk-WZL4EEBS.js +11 -0
- package/dist/chunk-X4YNDLVA.js +54 -0
- package/dist/chunk-X6SUFTD7.js +17 -0
- package/dist/chunk-XB4KZ6WO.js +81 -0
- package/dist/chunk-XJI6SWFS.js +569 -0
- package/dist/chunk-XJP5DKIL.js +29 -0
- package/dist/chunk-XN4ARQ2W.js +47 -0
- package/dist/chunk-XN7MQO45.js +359 -0
- package/dist/chunk-XQCQZBGX.js +100 -0
- package/dist/chunk-XXOHXA3A.js +69 -0
- package/dist/chunk-XZOHR765.js +127 -0
- package/dist/chunk-YCNLQYTC.js +133 -0
- package/dist/chunk-YCRGWQBS.js +526 -0
- package/dist/chunk-YF2PYLC4.js +210 -0
- package/dist/chunk-YG5GUELW.js +935 -0
- package/dist/chunk-YS6KMYM4.js +91 -0
- package/dist/chunk-YWP7XFKD.js +12 -0
- package/dist/chunk-Z2MGTKDR.js +20 -0
- package/dist/chunk-Z6CL7AR6.js +24 -0
- package/dist/chunk-Z7X3RGGA.js +22 -0
- package/dist/chunk-ZF43WRG3.js +29 -0
- package/dist/chunk-ZMF7WEGG.js +60 -0
- package/dist/chunk-ZNHFLJSY.js +375 -0
- package/dist/chunk-ZQ4VFQID.js +76 -0
- package/dist/chunk-ZQF34VPS.js +72 -0
- package/dist/chunk-ZU425HNM.js +24 -0
- package/dist/chunk-ZZU5R5UU.js +24 -0
- package/dist/cli/index.js +9 -0
- package/dist/core-3VCCUFVX.js +32 -0
- package/dist/core-4BZQQSHS.js +33 -0
- package/dist/core-4VT4MHNB.js +38 -0
- package/dist/core-5535KXRD.js +40 -0
- package/dist/core-5HQBPCHL.js +35 -0
- package/dist/core-6RYHWUJO.js +35 -0
- package/dist/core-7BZJCIXN.js +35 -0
- package/dist/core-AJTVU6X7.js +37 -0
- package/dist/core-C6YUSTZI.js +57 -0
- package/dist/core-EEB7HTCL.js +33 -0
- package/dist/core-EFMVDWNH.js +38 -0
- package/dist/core-ETAGQBZO.js +34 -0
- package/dist/core-FVR3WZEC.js +36 -0
- package/dist/core-GCTFVYMH.js +29 -0
- package/dist/core-GES44OTS.js +33 -0
- package/dist/core-GGQREDSI.js +47 -0
- package/dist/core-HRYOV6QD.js +38 -0
- package/dist/core-IKD3EE3S.js +38 -0
- package/dist/core-JM4R426L.js +32 -0
- package/dist/core-KKQS3WI2.js +40 -0
- package/dist/core-LA6XDYG7.js +40 -0
- package/dist/core-MJ7JWQT5.js +37 -0
- package/dist/core-MLROKJ2M.js +53 -0
- package/dist/core-MR52YBRX.js +31 -0
- package/dist/core-NP4VHWXL.js +29 -0
- package/dist/core-NQLNZDX5.js +41 -0
- package/dist/core-NSIJEKLI.js +44 -0
- package/dist/core-OJUQLIQ5.js +35 -0
- package/dist/core-PB3VUQSS.js +32 -0
- package/dist/core-Q6VLFFYC.js +56 -0
- package/dist/core-QY7AVIKZ.js +51 -0
- package/dist/core-SBQMHWTA.js +52 -0
- package/dist/core-UHECQHJ2.js +38 -0
- package/dist/core-V5FV4NWL.js +56 -0
- package/dist/core-WGM4XUN3.js +58 -0
- package/dist/core-WUQVFARS.js +34 -0
- package/dist/core-Z2F3IGSR.js +42 -0
- package/dist/dataTable-3CPPIHB3.js +58 -0
- package/dist/engine-FXFBCWHB.js +961 -0
- package/dist/fixtures.d.ts +1 -0
- package/dist/fixtures.js +41 -0
- package/dist/fontTables-WYCZNRE7.js +18 -0
- package/dist/fonts.d.ts +1 -0
- package/dist/fonts.js +19 -0
- package/dist/geo/dach.d.ts +1 -0
- package/dist/geo/dach.js +14 -0
- package/dist/geo/de-states.d.ts +1 -0
- package/dist/geo/de-states.js +14 -0
- package/dist/geo/eu27.d.ts +1 -0
- package/dist/geo/eu27.js +14 -0
- package/dist/geo/europe.d.ts +1 -0
- package/dist/geo/europe.js +14 -0
- package/dist/geo/index.d.ts +1 -0
- package/dist/geo/index.js +41 -0
- package/dist/geo/us-states.d.ts +1 -0
- package/dist/geo/us-states.js +14 -0
- package/dist/geo/world.d.ts +1 -0
- package/dist/geo/world.js +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +364 -0
- package/dist/main-YLKBTHJP.js +569 -0
- package/dist/mcp/server.js +1025 -0
- package/dist/module-SVEW5ZUE.js +137233 -0
- package/dist/react/bar.d.ts +1 -0
- package/dist/react/bar.js +81 -0
- package/dist/react/bartable.d.ts +1 -0
- package/dist/react/bartable.js +70 -0
- package/dist/react/box.d.ts +1 -0
- package/dist/react/box.js +65 -0
- package/dist/react/bullet.d.ts +1 -0
- package/dist/react/bullet.js +72 -0
- package/dist/react/butterfly.d.ts +1 -0
- package/dist/react/butterfly.js +66 -0
- package/dist/react/choropleth.d.ts +1 -0
- package/dist/react/choropleth.js +67 -0
- package/dist/react/cohort.d.ts +1 -0
- package/dist/react/cohort.js +70 -0
- package/dist/react/column.d.ts +1 -0
- package/dist/react/column.js +86 -0
- package/dist/react/combo.d.ts +1 -0
- package/dist/react/combo.js +86 -0
- package/dist/react/creative.d.ts +1 -0
- package/dist/react/creative.js +61 -0
- package/dist/react/diagram.d.ts +1 -0
- package/dist/react/diagram.js +60 -0
- package/dist/react/dimswitch.d.ts +1 -0
- package/dist/react/dimswitch.js +72 -0
- package/dist/react/dot.d.ts +1 -0
- package/dist/react/dot.js +70 -0
- package/dist/react/export.d.ts +1 -0
- package/dist/react/export.js +658 -0
- package/dist/react/funnel.d.ts +1 -0
- package/dist/react/funnel.js +63 -0
- package/dist/react/gantt.d.ts +1 -0
- package/dist/react/gantt.js +62 -0
- package/dist/react/grid.d.ts +1 -0
- package/dist/react/grid.js +67 -0
- package/dist/react/heatmap.d.ts +1 -0
- package/dist/react/heatmap.js +68 -0
- package/dist/react/histogram.d.ts +1 -0
- package/dist/react/histogram.js +86 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +504 -0
- package/dist/react/kpi.d.ts +1 -0
- package/dist/react/kpi.js +67 -0
- package/dist/react/likert.d.ts +1 -0
- package/dist/react/likert.js +83 -0
- package/dist/react/line.d.ts +1 -0
- package/dist/react/line.js +81 -0
- package/dist/react/mekko.d.ts +1 -0
- package/dist/react/mekko.js +71 -0
- package/dist/react/pareto.d.ts +1 -0
- package/dist/react/pareto.js +90 -0
- package/dist/react/pie.d.ts +1 -0
- package/dist/react/pie.js +64 -0
- package/dist/react/prepare.d.ts +1 -0
- package/dist/react/prepare.js +278 -0
- package/dist/react/pvm.d.ts +1 -0
- package/dist/react/pvm.js +68 -0
- package/dist/react/pyramid.d.ts +1 -0
- package/dist/react/pyramid.js +67 -0
- package/dist/react/sankey.d.ts +1 -0
- package/dist/react/sankey.js +59 -0
- package/dist/react/scatter.d.ts +1 -0
- package/dist/react/scatter.js +63 -0
- package/dist/react/slope.d.ts +1 -0
- package/dist/react/slope.js +64 -0
- package/dist/react/sparkline.d.ts +1 -0
- package/dist/react/sparkline.js +59 -0
- package/dist/react/spec.d.ts +1 -0
- package/dist/react/spec.js +379 -0
- package/dist/react/status.d.ts +1 -0
- package/dist/react/status.js +64 -0
- package/dist/react/story.d.ts +1 -0
- package/dist/react/story.js +140 -0
- package/dist/react/table.d.ts +1 -0
- package/dist/react/table.js +69 -0
- package/dist/react/theme.d.ts +1 -0
- package/dist/react/theme.js +53 -0
- package/dist/react/tilemap.d.ts +1 -0
- package/dist/react/tilemap.js +66 -0
- package/dist/react/treemap.d.ts +1 -0
- package/dist/react/treemap.js +61 -0
- package/dist/react/variance.d.ts +1 -0
- package/dist/react/variance.js +65 -0
- package/dist/react/waffle.d.ts +1 -0
- package/dist/react/waffle.js +62 -0
- package/dist/react/waterfall.d.ts +1 -0
- package/dist/react/waterfall.js +68 -0
- package/dist/resvg-ZOVDIZTV.js +23 -0
- package/dist/rows.d.ts +1 -0
- package/dist/rows.js +23 -0
- package/dist/rowsModule-YVLAROIP.js +27 -0
- package/dist/schema-2K6C3U24.js +23 -0
- package/dist/schema-2KIHLTYI.js +23 -0
- package/dist/schema-4HY2MWZC.js +30 -0
- package/dist/schema-4S5CXHAO.js +24 -0
- package/dist/schema-5BKQV56C.js +27 -0
- package/dist/schema-5HA5DSYN.js +24 -0
- package/dist/schema-5NKJPSBD.js +23 -0
- package/dist/schema-65FOKNHK.js +43 -0
- package/dist/schema-6OHZWHUI.js +23 -0
- package/dist/schema-6RYJS2GM.js +24 -0
- package/dist/schema-6W4M3WJ4.js +23 -0
- package/dist/schema-7TLSFG6M.js +24 -0
- package/dist/schema-AMFRKUFS.js +27 -0
- package/dist/schema-B7CZPPB4.js +28 -0
- package/dist/schema-BNRNHGHQ.js +26 -0
- package/dist/schema-E4MRCGPZ.js +24 -0
- package/dist/schema-F3WYTR65.js +26 -0
- package/dist/schema-FA6XIHTW.js +23 -0
- package/dist/schema-GZNOW4LX.js +23 -0
- package/dist/schema-HEIDGCSL.js +23 -0
- package/dist/schema-JB2H6KPA.js +23 -0
- package/dist/schema-MPXZNWV3.js +23 -0
- package/dist/schema-NHNQK6XO.js +23 -0
- package/dist/schema-NN6UPDPW.js +23 -0
- package/dist/schema-O4YNAGIY.js +23 -0
- package/dist/schema-O7AKK232.js +29 -0
- package/dist/schema-OJCML6LV.js +24 -0
- package/dist/schema-ORTRMYI6.js +24 -0
- package/dist/schema-PJ6P52BC.js +23 -0
- package/dist/schema-RTWES6NR.js +24 -0
- package/dist/schema-S36SRYGO.js +24 -0
- package/dist/schema-S3TCLTYD.js +23 -0
- package/dist/schema-SWWMOLOR.js +54 -0
- package/dist/schema-WOSEZNKG.js +26 -0
- package/dist/schema-Y6KBWUUR.js +23 -0
- package/dist/schema-YQYTLKSW.js +23 -0
- package/dist/schema-ZUUUY3QS.js +33 -0
- package/dist/specValidation-VNWIKLHH.js +49 -0
- package/dist/theme.d.ts +1 -0
- package/dist/theme.js +24 -0
- package/dist/themeShapeRules-2D3KWSPQ.js +11 -0
- package/dist/types/core/a11y/accessibility.d.ts +43 -0
- package/dist/types/core/a11y/recordsShared.d.ts +44 -0
- package/dist/types/core/a11y/structuralRecords.d.ts +6 -0
- package/dist/types/core/a11y/types.d.ts +116 -0
- package/dist/types/core/annotate.d.ts +300 -0
- package/dist/types/core/annotateArms.d.ts +37 -0
- package/dist/types/core/annotateFields.d.ts +30 -0
- package/dist/types/core/annotateGapBracket.d.ts +66 -0
- package/dist/types/core/annotateLinks.d.ts +47 -0
- package/dist/types/core/annotateTargets.d.ts +90 -0
- package/dist/types/core/axis.d.ts +179 -0
- package/dist/types/core/bandSelect.d.ts +10 -0
- package/dist/types/core/bands.d.ts +14 -0
- package/dist/types/core/calendarLabels.d.ts +101 -0
- package/dist/types/core/charts/band/stacks.d.ts +155 -0
- package/dist/types/core/charts/bar/fixtures.d.ts +9 -0
- package/dist/types/core/charts/bar/layout.d.ts +95 -0
- package/dist/types/core/charts/bartable/fixtures.d.ts +4 -0
- package/dist/types/core/charts/bartable/types.d.ts +192 -0
- package/dist/types/core/charts/box/fixtures.d.ts +12 -0
- package/dist/types/core/charts/box/types.d.ts +110 -0
- package/dist/types/core/charts/bullet/fixtures.d.ts +11 -0
- package/dist/types/core/charts/butterfly/fixtures.d.ts +9 -0
- package/dist/types/core/charts/choropleth/fixtures.d.ts +3 -0
- package/dist/types/core/charts/choropleth/overlayTypes.d.ts +68 -0
- package/dist/types/core/charts/choropleth/types.d.ts +117 -0
- package/dist/types/core/charts/cohort/fixtures.d.ts +12 -0
- package/dist/types/core/charts/cohort/types.d.ts +165 -0
- package/dist/types/core/charts/column/anomaly.d.ts +204 -0
- package/dist/types/core/charts/column/fixtures.d.ts +12 -0
- package/dist/types/core/charts/column/layout.d.ts +116 -0
- package/dist/types/core/charts/column/model.d.ts +295 -0
- package/dist/types/core/charts/column/types.d.ts +56 -0
- package/dist/types/core/charts/combo/endpoints.d.ts +165 -0
- package/dist/types/core/charts/combo/fixtures.d.ts +12 -0
- package/dist/types/core/charts/combo/layout.d.ts +48 -0
- package/dist/types/core/charts/creative/fixtures.d.ts +4 -0
- package/dist/types/core/charts/creative/types.d.ts +73 -0
- package/dist/types/core/charts/diagram/fixtures.d.ts +3 -0
- package/dist/types/core/charts/dimswitch/compile.d.ts +20 -0
- package/dist/types/core/charts/dimswitch/fixtures.d.ts +3 -0
- package/dist/types/core/charts/dimswitch/types.d.ts +152 -0
- package/dist/types/core/charts/dot/fixtures.d.ts +11 -0
- package/dist/types/core/charts/funnel/fixtures.d.ts +11 -0
- package/dist/types/core/charts/gantt/fixtures.d.ts +9 -0
- package/dist/types/core/charts/gantt/layout.d.ts +63 -0
- package/dist/types/core/charts/grid/fixtures.d.ts +3 -0
- package/dist/types/core/charts/grid/metricStack.d.ts +108 -0
- package/dist/types/core/charts/grid/metricStackSchema.d.ts +74 -0
- package/dist/types/core/charts/grid/normalize.d.ts +99 -0
- package/dist/types/core/charts/grid/schema.d.ts +168 -0
- package/dist/types/core/charts/heatmap/fixtures.d.ts +11 -0
- package/dist/types/core/charts/histogram/fixtures.d.ts +15 -0
- package/dist/types/core/charts/histogram/types.d.ts +98 -0
- package/dist/types/core/charts/kpi/fixtures.d.ts +9 -0
- package/dist/types/core/charts/likert/fixtures.d.ts +11 -0
- package/dist/types/core/charts/likert/layout.d.ts +111 -0
- package/dist/types/core/charts/line/fixtures.d.ts +16 -0
- package/dist/types/core/charts/line/types.d.ts +6 -0
- package/dist/types/core/charts/mekko/fixtures.d.ts +13 -0
- package/dist/types/core/charts/pareto/fixtures.d.ts +5 -0
- package/dist/types/core/charts/pareto/layout.d.ts +68 -0
- package/dist/types/core/charts/pie/fixtures.d.ts +14 -0
- package/dist/types/core/charts/pvm/fixtures.d.ts +13 -0
- package/dist/types/core/charts/pvm/types.d.ts +118 -0
- package/dist/types/core/charts/pyramid/fixtures.d.ts +4 -0
- package/dist/types/core/charts/pyramid/types.d.ts +92 -0
- package/dist/types/core/charts/sankey/fixtures.d.ts +4 -0
- package/dist/types/core/charts/sankey/types.d.ts +116 -0
- package/dist/types/core/charts/scatter/fixtures.d.ts +12 -0
- package/dist/types/core/charts/scatter/types.d.ts +58 -0
- package/dist/types/core/charts/slope/fixtures.d.ts +13 -0
- package/dist/types/core/charts/sparkline/fixtures.d.ts +9 -0
- package/dist/types/core/charts/status/fixtures.d.ts +8 -0
- package/dist/types/core/charts/status/layout.d.ts +71 -0
- package/dist/types/core/charts/table/fitFormats.d.ts +67 -0
- package/dist/types/core/charts/table/fixtures.d.ts +7 -0
- package/dist/types/core/charts/table/resolve.d.ts +72 -0
- package/dist/types/core/charts/table/view.d.ts +156 -0
- package/dist/types/core/charts/tilemap/fixtures.d.ts +3 -0
- package/dist/types/core/charts/tilemap/types.d.ts +94 -0
- package/dist/types/core/charts/treemap/fixtures.d.ts +4 -0
- package/dist/types/core/charts/treemap/types.d.ts +78 -0
- package/dist/types/core/charts/variance/fixtures.d.ts +12 -0
- package/dist/types/core/charts/waffle/fixtures.d.ts +5 -0
- package/dist/types/core/charts/waffle/types.d.ts +117 -0
- package/dist/types/core/charts/waterfall/fixtures.d.ts +9 -0
- package/dist/types/core/claims/browser.d.ts +49 -0
- package/dist/types/core/claims/manifest.d.ts +22 -0
- package/dist/types/core/dateFormat.d.ts +39 -0
- package/dist/types/core/deferred.d.ts +121 -0
- package/dist/types/core/diagnostics/describe.d.ts +149 -0
- package/dist/types/core/diagnostics/jsonPatch.d.ts +36 -0
- package/dist/types/core/doc/bareChart.d.ts +2 -0
- package/dist/types/core/doc/diagnostics.d.ts +124 -0
- package/dist/types/core/doc/docExpand.d.ts +39 -0
- package/dist/types/core/doc/document.d.ts +43 -0
- package/dist/types/core/doc/ownedDocumentCopy.d.ts +5 -0
- package/dist/types/core/doc/specError.d.ts +6 -0
- package/dist/types/core/emptyData.d.ts +27 -0
- package/dist/types/core/eventLane.d.ts +208 -0
- package/dist/types/core/fontMetrics/index.d.ts +47 -0
- package/dist/types/core/fontMetrics/injected.d.ts +40 -0
- package/dist/types/core/fontMetrics/tableDocument.d.ts +73 -0
- package/dist/types/core/fontMetrics/tables.generated.d.ts +17 -0
- package/dist/types/core/footer.d.ts +59 -0
- package/dist/types/core/format.d.ts +149 -0
- package/dist/types/core/formatPrecision.d.ts +136 -0
- package/dist/types/core/formatSpec.d.ts +304 -0
- package/dist/types/core/frame.d.ts +583 -0
- package/dist/types/core/geo/packs/all.d.ts +7 -0
- package/dist/types/core/geo/packs/dach.d.ts +16 -0
- package/dist/types/core/geo/packs/de-states.d.ts +16 -0
- package/dist/types/core/geo/packs/eu27.d.ts +16 -0
- package/dist/types/core/geo/packs/europe.d.ts +16 -0
- package/dist/types/core/geo/packs/index.d.ts +22 -0
- package/dist/types/core/geo/packs/registry.d.ts +37 -0
- package/dist/types/core/geo/packs/us-states.d.ts +16 -0
- package/dist/types/core/geo/packs/world.d.ts +16 -0
- package/dist/types/core/geo/tiles/eu27.generated.d.ts +412 -0
- package/dist/types/core/geo/tiles/europe.generated.d.ts +842 -0
- package/dist/types/core/geo/tiles/index.d.ts +8 -0
- package/dist/types/core/geo/tiles/types.d.ts +36 -0
- package/dist/types/core/geo/tiles/us-states.generated.d.ts +952 -0
- package/dist/types/core/geo/tiles/world.generated.d.ts +968 -0
- package/dist/types/core/geo/types.d.ts +146 -0
- package/dist/types/core/geometry.d.ts +102 -0
- package/dist/types/core/grid/sharedScale.d.ts +82 -0
- package/dist/types/core/icons.d.ts +227 -0
- package/dist/types/core/inputError.d.ts +14 -0
- package/dist/types/core/isoDate.d.ts +2 -0
- package/dist/types/core/isoTime.d.ts +7 -0
- package/dist/types/core/label/categoryRow.d.ts +332 -0
- package/dist/types/core/label/occupied.d.ts +41 -0
- package/dist/types/core/label/ownership.d.ts +83 -0
- package/dist/types/core/label/solver.d.ts +384 -0
- package/dist/types/core/label/tickRow.d.ts +78 -0
- package/dist/types/core/live/types.d.ts +50 -0
- package/dist/types/core/normalize/shared.d.ts +56 -0
- package/dist/types/core/notes.d.ts +174 -0
- package/dist/types/core/othersShade.d.ts +9 -0
- package/dist/types/core/periodYears.d.ts +9 -0
- package/dist/types/core/polyline.d.ts +11 -0
- package/dist/types/core/rangeRules.d.ts +19 -0
- package/dist/types/core/ratioTier.d.ts +120 -0
- package/dist/types/core/readerStrings.d.ts +13 -0
- package/dist/types/core/reading.d.ts +120 -0
- package/dist/types/core/registry.d.ts +178 -0
- package/dist/types/core/repaintGeometry.d.ts +19 -0
- package/dist/types/core/request.d.ts +124 -0
- package/dist/types/core/rows.d.ts +47 -0
- package/dist/types/core/scale.d.ts +106 -0
- package/dist/types/core/schema/capability.d.ts +229 -0
- package/dist/types/core/schema/namedColumns.d.ts +45 -0
- package/dist/types/core/schema/reference.d.ts +31 -0
- package/dist/types/core/schema/refusals.d.ts +45 -0
- package/dist/types/core/schema/unknownKeys.d.ts +45 -0
- package/dist/types/core/seriesIdentity.d.ts +120 -0
- package/dist/types/core/shareRounding.d.ts +49 -0
- package/dist/types/core/sizing.d.ts +330 -0
- package/dist/types/core/staticFooter.d.ts +6 -0
- package/dist/types/core/story.d.ts +41 -0
- package/dist/types/core/structureCounts.d.ts +10 -0
- package/dist/types/core/svg/renderSvg.d.ts +51 -0
- package/dist/types/core/target.d.ts +89 -0
- package/dist/types/core/text.d.ts +113 -0
- package/dist/types/core/theme.d.ts +478 -0
- package/dist/types/core/themeFields.d.ts +11 -0
- package/dist/types/core/themeRules.d.ts +111 -0
- package/dist/types/core/themeShape.d.ts +87 -0
- package/dist/types/core/themeValidate.d.ts +15 -0
- package/dist/types/core/timeAxis.d.ts +106 -0
- package/dist/types/core/types/annotations.d.ts +227 -0
- package/dist/types/core/types/cell.d.ts +82 -0
- package/dist/types/core/types/data.d.ts +314 -0
- package/dist/types/core/types/diagram.d.ts +234 -0
- package/dist/types/core/types/index.d.ts +8 -0
- package/dist/types/core/types/options.d.ts +1583 -0
- package/dist/types/core/types/scene.d.ts +990 -0
- package/dist/types/core/types/sizing.d.ts +51 -0
- package/dist/types/core/types/table.d.ts +873 -0
- package/dist/types/core/types/theme.d.ts +806 -0
- package/dist/types/core/zoom.d.ts +106 -0
- package/dist/types/fixtures/index.d.ts +40 -0
- package/dist/types/fixtures/registry.d.ts +15 -0
- package/dist/types/fonts.d.ts +10 -0
- package/dist/types/index.d.ts +70 -0
- package/dist/types/react/BoardplotTheme.d.ts +9 -0
- package/dist/types/react/DimSwitchChart.d.ts +36 -0
- package/dist/types/react/ScaleGroup.d.ts +31 -0
- package/dist/types/react/SceneRenderer.d.ts +23 -0
- package/dist/types/react/SizePlaceholder.d.ts +51 -0
- package/dist/types/react/StoryFrame.d.ts +42 -0
- package/dist/types/react/TableChart.d.ts +220 -0
- package/dist/types/react/a11ySurface.d.ts +20 -0
- package/dist/types/react/barrelCharts.d.ts +1023 -0
- package/dist/types/react/charts/bar.d.ts +28 -0
- package/dist/types/react/charts/bartable.d.ts +27 -0
- package/dist/types/react/charts/box.d.ts +27 -0
- package/dist/types/react/charts/bullet.d.ts +28 -0
- package/dist/types/react/charts/butterfly.d.ts +28 -0
- package/dist/types/react/charts/choropleth.d.ts +27 -0
- package/dist/types/react/charts/cohort.d.ts +52 -0
- package/dist/types/react/charts/column.d.ts +27 -0
- package/dist/types/react/charts/combo.d.ts +7 -0
- package/dist/types/react/charts/creative.d.ts +27 -0
- package/dist/types/react/charts/diagram.d.ts +162 -0
- package/dist/types/react/charts/dimswitch.d.ts +6 -0
- package/dist/types/react/charts/dot.d.ts +28 -0
- package/dist/types/react/charts/funnel.d.ts +28 -0
- package/dist/types/react/charts/gantt.d.ts +28 -0
- package/dist/types/react/charts/grid.d.ts +29 -0
- package/dist/types/react/charts/heatmap.d.ts +28 -0
- package/dist/types/react/charts/histogram.d.ts +27 -0
- package/dist/types/react/charts/kpi.d.ts +28 -0
- package/dist/types/react/charts/likert.d.ts +27 -0
- package/dist/types/react/charts/line.d.ts +28 -0
- package/dist/types/react/charts/mekko.d.ts +28 -0
- package/dist/types/react/charts/pareto.d.ts +28 -0
- package/dist/types/react/charts/pie.d.ts +28 -0
- package/dist/types/react/charts/pvm.d.ts +27 -0
- package/dist/types/react/charts/pyramid.d.ts +27 -0
- package/dist/types/react/charts/sankey.d.ts +27 -0
- package/dist/types/react/charts/scatter.d.ts +28 -0
- package/dist/types/react/charts/slope.d.ts +28 -0
- package/dist/types/react/charts/sparkline.d.ts +28 -0
- package/dist/types/react/charts/status.d.ts +27 -0
- package/dist/types/react/charts/table.d.ts +6 -0
- package/dist/types/react/charts/tilemap.d.ts +27 -0
- package/dist/types/react/charts/treemap.d.ts +27 -0
- package/dist/types/react/charts/variance.d.ts +28 -0
- package/dist/types/react/charts/waffle.d.ts +28 -0
- package/dist/types/react/charts/waterfall.d.ts +28 -0
- package/dist/types/react/createChartComponent.d.ts +135 -0
- package/dist/types/react/export/clipboard.d.ts +8 -0
- package/dist/types/react/export/csv.d.ts +2 -0
- package/dist/types/react/export/frame.d.ts +35 -0
- package/dist/types/react/export/index.d.ts +7 -0
- package/dist/types/react/export/png.d.ts +14 -0
- package/dist/types/react/export/svg.d.ts +5 -0
- package/dist/types/react/export/types.d.ts +69 -0
- package/dist/types/react/export/useExport.d.ts +17 -0
- package/dist/types/react/exportLink.d.ts +49 -0
- package/dist/types/react/footerFrame.d.ts +25 -0
- package/dist/types/react/hover/dataTable.d.ts +13 -0
- package/dist/types/react/hover/engine.d.ts +210 -0
- package/dist/types/react/hover/keyboard.d.ts +44 -0
- package/dist/types/react/hover/labelCard.d.ts +170 -0
- package/dist/types/react/hover/placement.d.ts +49 -0
- package/dist/types/react/index.d.ts +16 -0
- package/dist/types/react/parseChartSpec.d.ts +16 -0
- package/dist/types/react/prepare.d.ts +32 -0
- package/dist/types/react/prepared.d.ts +53 -0
- package/dist/types/react/preparedTable.d.ts +15 -0
- package/dist/types/react/rowsInput.d.ts +55 -0
- package/dist/types/react/rowsModule.d.ts +18 -0
- package/dist/types/react/rowsStore.d.ts +50 -0
- package/dist/types/react/scale-group.d.ts +2 -0
- package/dist/types/react/scaleGroupContext.d.ts +22 -0
- package/dist/types/react/scenePaint.d.ts +10 -0
- package/dist/types/react/scrollState.d.ts +26 -0
- package/dist/types/react/spec.d.ts +82 -0
- package/dist/types/react/specValidation.d.ts +45 -0
- package/dist/types/react/story.d.ts +15 -0
- package/dist/types/react/theme.d.ts +9 -0
- package/dist/types/react/themeContext.d.ts +44 -0
- package/dist/types/react/useChartLayout.d.ts +22 -0
- package/dist/types/react/useContainerSize.d.ts +57 -0
- package/dist/types/react/useHover.d.ts +100 -0
- package/dist/types/react/useZoom.d.ts +50 -0
- package/dist/types/rows.d.ts +63 -0
- package/dist/types/tableLooks.d.ts +6 -0
- package/dist/types/theme.d.ts +3 -0
- package/dist/types/validate.d.ts +3 -0
- package/dist/validate.d.ts +1 -0
- package/dist/validate.js +223 -0
- package/docs/FONTS.md +68 -0
- package/docs/TELEMETRY.md +94 -0
- package/docs/manual.md +850 -0
- package/docs/reference/bar.md +222 -0
- package/docs/reference/bartable.md +143 -0
- package/docs/reference/box.md +93 -0
- package/docs/reference/bullet.md +118 -0
- package/docs/reference/butterfly.md +117 -0
- package/docs/reference/choropleth.md +148 -0
- package/docs/reference/cohort.md +149 -0
- package/docs/reference/column.md +275 -0
- package/docs/reference/combo.md +219 -0
- package/docs/reference/creative.md +147 -0
- package/docs/reference/diagram.md +191 -0
- package/docs/reference/dimswitch.md +1395 -0
- package/docs/reference/dot.md +117 -0
- package/docs/reference/fixtures.md +1089 -0
- package/docs/reference/funnel.md +121 -0
- package/docs/reference/gantt.md +138 -0
- package/docs/reference/grid.md +302 -0
- package/docs/reference/heatmap.md +127 -0
- package/docs/reference/histogram.md +77 -0
- package/docs/reference/kpi.md +115 -0
- package/docs/reference/likert.md +113 -0
- package/docs/reference/line.md +436 -0
- package/docs/reference/mekko.md +114 -0
- package/docs/reference/options.md +313 -0
- package/docs/reference/pareto.md +102 -0
- package/docs/reference/pie.md +114 -0
- package/docs/reference/pvm.md +114 -0
- package/docs/reference/pyramid.md +99 -0
- package/docs/reference/react.md +706 -0
- package/docs/reference/reading.md +28 -0
- package/docs/reference/sankey.md +110 -0
- package/docs/reference/scatter.md +211 -0
- package/docs/reference/slope.md +126 -0
- package/docs/reference/sparkline.md +74 -0
- package/docs/reference/status.md +107 -0
- package/docs/reference/table.md +673 -0
- package/docs/reference/theme.md +361 -0
- package/docs/reference/tilemap.md +121 -0
- package/docs/reference/treemap.md +86 -0
- package/docs/reference/variance.md +126 -0
- package/docs/reference/waffle.md +106 -0
- package/docs/reference/waterfall.md +164 -0
- package/llms.txt +57 -0
- package/package.json +437 -4
|
@@ -0,0 +1,1424 @@
|
|
|
1
|
+
import {
|
|
2
|
+
INSIDE_MIN_H,
|
|
3
|
+
INSIDE_MIN_W
|
|
4
|
+
} from "./chunk-27QADBDV.js";
|
|
5
|
+
import {
|
|
6
|
+
warnMissingValue
|
|
7
|
+
} from "./chunk-5LGSRWFC.js";
|
|
8
|
+
import {
|
|
9
|
+
labelOn
|
|
10
|
+
} from "./chunk-VJ3FCGQF.js";
|
|
11
|
+
import {
|
|
12
|
+
annotateEngine,
|
|
13
|
+
runAnnotatePass
|
|
14
|
+
} from "./chunk-KZS46KDY.js";
|
|
15
|
+
import {
|
|
16
|
+
chartPalette,
|
|
17
|
+
chartTheme
|
|
18
|
+
} from "./chunk-3QWZAEW5.js";
|
|
19
|
+
import {
|
|
20
|
+
structureCount
|
|
21
|
+
} from "./chunk-LFX7W4B7.js";
|
|
22
|
+
import {
|
|
23
|
+
emptyIdRecord
|
|
24
|
+
} from "./chunk-LINZPU5D.js";
|
|
25
|
+
import {
|
|
26
|
+
calendarCategories,
|
|
27
|
+
chartSizing,
|
|
28
|
+
linearScale,
|
|
29
|
+
rowSizing,
|
|
30
|
+
warnSpreadOverflow
|
|
31
|
+
} from "./chunk-RL3NUWMY.js";
|
|
32
|
+
import {
|
|
33
|
+
prepareFractionData
|
|
34
|
+
} from "./chunk-3EZRM4YM.js";
|
|
35
|
+
import {
|
|
36
|
+
PRIORITY,
|
|
37
|
+
SWATCH_RESERVE,
|
|
38
|
+
adjacentSeriesWarnings,
|
|
39
|
+
authoredFootnoteCount,
|
|
40
|
+
authoredNotes,
|
|
41
|
+
clamp,
|
|
42
|
+
composedTextRole,
|
|
43
|
+
createOccupiedIndex,
|
|
44
|
+
fitText,
|
|
45
|
+
footnoteSuffix,
|
|
46
|
+
frameTextOptions,
|
|
47
|
+
labelCtx,
|
|
48
|
+
labelsToNodes,
|
|
49
|
+
normalizeLegendOption,
|
|
50
|
+
rectContains,
|
|
51
|
+
rectSeriesAdjacentWarnings,
|
|
52
|
+
rectsOverlap,
|
|
53
|
+
retainAdjacentWarningRule,
|
|
54
|
+
solveFrame,
|
|
55
|
+
solveLabels
|
|
56
|
+
} from "./chunk-SS42FJVN.js";
|
|
57
|
+
import {
|
|
58
|
+
disclosureNote
|
|
59
|
+
} from "./chunk-BPKXEMRE.js";
|
|
60
|
+
import {
|
|
61
|
+
formatterFromExample,
|
|
62
|
+
seriesRasterFormatter
|
|
63
|
+
} from "./chunk-RGZGLKFB.js";
|
|
64
|
+
import {
|
|
65
|
+
MINUS,
|
|
66
|
+
chartStrings,
|
|
67
|
+
formatAutomaticNumber,
|
|
68
|
+
formatAutomaticPercent,
|
|
69
|
+
notApplicableGlyph,
|
|
70
|
+
smallRateDecimals
|
|
71
|
+
} from "./chunk-53OYF4ZT.js";
|
|
72
|
+
import {
|
|
73
|
+
cellMeta,
|
|
74
|
+
cellValue,
|
|
75
|
+
isPctCell
|
|
76
|
+
} from "./chunk-O3VN6BTL.js";
|
|
77
|
+
import {
|
|
78
|
+
PLAN_MUTED_PAINT,
|
|
79
|
+
STAGE_SHADE_MAX,
|
|
80
|
+
canvasMargin,
|
|
81
|
+
effectiveFill,
|
|
82
|
+
emphasisWeight,
|
|
83
|
+
isOthersFill,
|
|
84
|
+
markRolePaint,
|
|
85
|
+
mixedPaint,
|
|
86
|
+
othersSeparation,
|
|
87
|
+
paintColor,
|
|
88
|
+
seriesPaint,
|
|
89
|
+
solidMutedPlan,
|
|
90
|
+
strokeToken,
|
|
91
|
+
withSegmentSeams
|
|
92
|
+
} from "./chunk-CWDHCSL2.js";
|
|
93
|
+
import {
|
|
94
|
+
NormalizeError,
|
|
95
|
+
accessibleTitle,
|
|
96
|
+
normalizeCategory,
|
|
97
|
+
normalizeScenario,
|
|
98
|
+
normalizeSeriesValues,
|
|
99
|
+
resolveHighlight,
|
|
100
|
+
resolveSize
|
|
101
|
+
} from "./chunk-SGD3ZHID.js";
|
|
102
|
+
import {
|
|
103
|
+
maxOf,
|
|
104
|
+
pushAll
|
|
105
|
+
} from "./chunk-WYJEOMNY.js";
|
|
106
|
+
import {
|
|
107
|
+
defaultMeasurer
|
|
108
|
+
} from "./chunk-AG2CJ4JY.js";
|
|
109
|
+
|
|
110
|
+
// src/core/strings/funnel.ts
|
|
111
|
+
var EN = {
|
|
112
|
+
// reader-facing wording linked only by its consumers.
|
|
113
|
+
funnelTitle: "Funnel: {v1} to {v2}",
|
|
114
|
+
stagesCount: "{v1} stage{v2}",
|
|
115
|
+
funnelDesc: "Funnel chart with {v1} stage{v2}. {v3}.",
|
|
116
|
+
funnelUndefined: "{v1}: not defined, the previous stage is zero.",
|
|
117
|
+
totalCvr: "Total CVR",
|
|
118
|
+
stepCvr: "Step CVR",
|
|
119
|
+
// A spanning head over the two short column heads.
|
|
120
|
+
cvrSpanHeader: "Conversion rate",
|
|
121
|
+
stepCvrShort: "Step",
|
|
122
|
+
totalCvrShort: "Total",
|
|
123
|
+
centeredFunnelDesc: "Centered funnel chart with {v1} equal-height stage bands; width at each boundary is proportional to the stage total. {v2}.",
|
|
124
|
+
stageIncreased: "\u2191 increased",
|
|
125
|
+
stageAdvance: "{v1} advance",
|
|
126
|
+
previousStageZero: "not defined: previous stage is zero",
|
|
127
|
+
advanceProbe: "44% advance",
|
|
128
|
+
missing: "missing",
|
|
129
|
+
funnelIncreaseDesc: " ({v1} \u2192 {v2}: stage total increased; conversion percentage not shown)",
|
|
130
|
+
funnelConversionDesc: " ({v1} \u2192 {v2}: {v3} conversion)",
|
|
131
|
+
stageCvrDesc: "{v1} {v2}; stage CVR {v3}; total CVR {v4}",
|
|
132
|
+
clampedFunnelNote: "{v1} {v2} below zero shown as 0.",
|
|
133
|
+
biggestDrop: "Biggest drop: {v1}",
|
|
134
|
+
dropValue: "Drop {v1}",
|
|
135
|
+
stagePair: "{v1} to {v2}"
|
|
136
|
+
}, DE = {
|
|
137
|
+
// reader-facing wording linked only by its consumers.
|
|
138
|
+
funnelTitle: "Trichter: {v1} bis {v2}",
|
|
139
|
+
stagesCount: "{v1} {v1|Stufe|Stufen}",
|
|
140
|
+
funnelDesc: "Trichterdiagramm mit {v1} {v1|Stufe|Stufen}. {v3}.",
|
|
141
|
+
funnelUndefined: "{v1}: nicht definiert, vorherige Stufe ist null.",
|
|
142
|
+
totalCvr: "Gesamt-CVR",
|
|
143
|
+
stepCvr: "Stufen-CVR",
|
|
144
|
+
// A spanning head over the two short column heads.
|
|
145
|
+
cvrSpanHeader: "Konversionsrate",
|
|
146
|
+
stepCvrShort: "Stufe",
|
|
147
|
+
totalCvrShort: "Gesamt",
|
|
148
|
+
centeredFunnelDesc: "Zentriertes Trichterdiagramm mit {v1} {v1|gleich hoher Stufe|gleich hohen Stufen}. Die Breite jeder Grenze ist proportional zur Summe der Stufe. {v2}.",
|
|
149
|
+
stageIncreased: "\u2191 gestiegen",
|
|
150
|
+
stageAdvance: "{v1} weiter",
|
|
151
|
+
previousStageZero: "nicht definiert: vorherige Stufe ist null",
|
|
152
|
+
advanceProbe: "44% weiter",
|
|
153
|
+
missing: "fehlend",
|
|
154
|
+
funnelIncreaseDesc: " ({v1} \u2192 {v2}: Stufensumme gestiegen; Umwandlungsprozentsatz nicht gezeigt)",
|
|
155
|
+
funnelConversionDesc: " ({v1} \u2192 {v2}: {v3} Umwandlung)",
|
|
156
|
+
stageCvrDesc: "{v1} {v2}; Stufen-CVR {v3}; Gesamt-CVR {v4}",
|
|
157
|
+
clampedFunnelNote: "{v1} {v1|Wert|Werte} unter null als 0 gezeigt.",
|
|
158
|
+
biggestDrop: "Gr\xF6\xDFter Abfall: {v1}",
|
|
159
|
+
dropValue: "Abfall {v1}",
|
|
160
|
+
stagePair: "{v1} bis {v2}"
|
|
161
|
+
}, { chartString } = chartStrings(EN, DE);
|
|
162
|
+
|
|
163
|
+
// src/core/charts/funnel/derive.ts
|
|
164
|
+
function funnelValueFormats(plotted, cells, formats, totalRaster) {
|
|
165
|
+
let percentOnly = cells.every((row, si) => !plotted[si].format && row.every((cell) => cell === null || isPctCell(cell) && !cell.format)) && cells.some((row) => row.some((cell) => cell !== null));
|
|
166
|
+
return {
|
|
167
|
+
valueText: (si, ci, value) => {
|
|
168
|
+
let cell = cells[si][ci];
|
|
169
|
+
return (isPctCell(cell) && !cell.format && !plotted[si].format ? formats[ci].fmtPercent : formats[ci].forSeries(plotted[si], cellMeta(cell)?.format))(value);
|
|
170
|
+
},
|
|
171
|
+
totalFmt: percentOnly ? totalRaster.fmtPercent : totalRaster.fmt
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function clampedNote(clamped, options) {
|
|
175
|
+
return clamped === 0 ? [] : [disclosureNote(chartString(options, "clampedFunnelNote", { v1: clamped, v2: clamped === 1 ? "value" : "values" }))];
|
|
176
|
+
}
|
|
177
|
+
function deriveFunnel(plotted, stages, fmt, warnings) {
|
|
178
|
+
let clamped = 0, raw = plotted.map(() => []), values = plotted.map(
|
|
179
|
+
(s, si) => normalizeSeriesValues(s, stages, si).map((cell, ci) => {
|
|
180
|
+
let v = cellValue(cell);
|
|
181
|
+
raw[si][ci] = v;
|
|
182
|
+
let owner = { seriesId: s.id, categoryId: stages[ci].id };
|
|
183
|
+
return v === null ? (warnMissingValue(
|
|
184
|
+
warnings,
|
|
185
|
+
`series '${s.id}' at stage '${stages[ci].id}'`,
|
|
186
|
+
owner,
|
|
187
|
+
"no segment, no stage total and no conversion to or from that stage"
|
|
188
|
+
), null) : v < 0 ? (warnings.push({
|
|
189
|
+
code: "negative-value",
|
|
190
|
+
severity: "warn",
|
|
191
|
+
message: `series '${s.id}' at stage '${stages[ci].id}': negative value ${v} clamped to 0`,
|
|
192
|
+
owner
|
|
193
|
+
}), clamped++, 0) : v;
|
|
194
|
+
})
|
|
195
|
+
), stageTotals = emptyIdRecord(), shownTotals = emptyIdRecord(), clampedStage = stages.map((_c, ci) => raw.some((row) => (row[ci] ?? 0) < 0)), known = stages.map((c, ci) => {
|
|
196
|
+
let cells = values.map((row) => row[ci] ?? null), sum = cells.reduce((a, v) => a + (v ?? 0), 0);
|
|
197
|
+
return stageTotals[c.id] = cells.includes(null) ? null : sum, shownTotals[c.id] = cells.includes(null) ? null : raw.reduce((a, row) => a + row[ci], 0), sum;
|
|
198
|
+
}), conversions = [], undefinedSteps = [];
|
|
199
|
+
for (let ci = 0; ci < stages.length - 1; ci++) {
|
|
200
|
+
let from = stages[ci], to = stages[ci + 1], fromTotal = stageTotals[from.id] ?? null, toTotal = stageTotals[to.id] ?? null;
|
|
201
|
+
if (!(fromTotal === null || toTotal === null || clampedStage[ci] || clampedStage[ci + 1])) {
|
|
202
|
+
if (toTotal > fromTotal && warnings.push({
|
|
203
|
+
code: "funnel-stage-increased",
|
|
204
|
+
severity: "warn",
|
|
205
|
+
message: `stage total increased from '${from.id}' (${fmt(fromTotal)}) to '${to.id}' (${fmt(toTotal)}) \u2014 conversion is not shown as a percentage`,
|
|
206
|
+
owner: { categoryId: from.id }
|
|
207
|
+
}), fromTotal <= 0) {
|
|
208
|
+
warnings.push({
|
|
209
|
+
code: "conversion-undefined",
|
|
210
|
+
severity: "warn",
|
|
211
|
+
message: `stage '${from.id}' has zero total \u2014 conversion to '${to.id}' is undefined`,
|
|
212
|
+
owner: { categoryId: from.id }
|
|
213
|
+
}), undefinedSteps.push({ fromId: from.id, toId: to.id });
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
conversions.push({ fromId: from.id, toId: to.id, rate: toTotal / fromTotal });
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
let worstDrop;
|
|
220
|
+
for (let c of conversions)
|
|
221
|
+
c.rate <= 1 && (!worstDrop || c.rate < worstDrop.rate) && (worstDrop = c);
|
|
222
|
+
return { values, known, stageTotals, shownTotals, clampedStages: clampedStage, conversions, undefinedSteps, clamped, ...worstDrop ? { worstDrop } : {} };
|
|
223
|
+
}
|
|
224
|
+
function missingGlyph(theme) {
|
|
225
|
+
return theme.table?.glyphs?.missing ?? "\u2013";
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// src/core/charts/funnel/centered.ts
|
|
229
|
+
var CVR_SPAN_HEADER = "cvr:span-header";
|
|
230
|
+
function stageLabelInfo(name, value, font, measure) {
|
|
231
|
+
let lines = value ? [name, value] : [name];
|
|
232
|
+
return {
|
|
233
|
+
text: lines.join(" \xB7 "),
|
|
234
|
+
lines,
|
|
235
|
+
w: Math.max(...lines.map((line) => measure(line, font).width)),
|
|
236
|
+
h: font.size * (font.lineHeight ?? 1.2) * lines.length
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function centeredLabelNodes(theme, labels, strong, header, labelFont, marks) {
|
|
240
|
+
let emitted = labelsToNodes(theme, labels, (label) => label.id.startsWith("stage:") ? strong : label.id === "total-cvr:header" || label.id === "step-cvr:header" || label.id === CVR_SPAN_HEADER ? header : labelFont, marks), byNode = new Map(labels.map((label) => [label.nodeId, label]));
|
|
241
|
+
for (let node of emitted) {
|
|
242
|
+
if (node.t !== "text" || !node.id.endsWith(":body")) continue;
|
|
243
|
+
let label = byNode.get(node.id.slice(0, -5));
|
|
244
|
+
if (!label?.align) continue;
|
|
245
|
+
node.x = label.align === "middle" ? label.rect.x + label.rect.w / 2 : label.rect.x + label.rect.w, node.align = label.align, node.role = composedTextRole(node.lines.join(" "));
|
|
246
|
+
let head = emitted.find((item) => item.id === label.nodeId);
|
|
247
|
+
if (head?.t === "text") {
|
|
248
|
+
let round = (v) => Math.round(v * 100) / 100;
|
|
249
|
+
head.y = round(head.y), node.y = round(head.y + node.font.size * (node.font.lineHeight ?? 1.2));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return emitted;
|
|
253
|
+
}
|
|
254
|
+
var LABEL_COLUMN_GAP = 8;
|
|
255
|
+
function rampFunnelPaint(theme, plotted, series, stageIndex, palette, stageCount) {
|
|
256
|
+
if (theme.marks?.funnelFill !== "ramp" || series.fill) return;
|
|
257
|
+
let ramp = theme.color.palettes?.[palette ?? ""] ?? theme.color.series;
|
|
258
|
+
if (plotted.length === 1 && stageCount > ramp.length) return;
|
|
259
|
+
let lost = (candidate) => candidate.colorRole === "status-lost" || candidate.colorRole === "bad";
|
|
260
|
+
if (lost(series)) return { token: "badFill", tint: 0.55 };
|
|
261
|
+
let rank = plotted.length === 1 ? stageIndex : plotted.filter((candidate) => !lost(candidate)).indexOf(series);
|
|
262
|
+
return seriesPaint(Math.max(0, rank), palette);
|
|
263
|
+
}
|
|
264
|
+
function shadeStage(paint, index, count, direction) {
|
|
265
|
+
let progress = index / (count - 1);
|
|
266
|
+
return shadeBy(paint, STAGE_SHADE_MAX * (direction === "lighten" ? progress : 1 - progress));
|
|
267
|
+
}
|
|
268
|
+
function shadeBy(paint, amount) {
|
|
269
|
+
return amount <= 0 ? paint : mixedPaint(paint, { token: "background", theme: { kind: "brighter-pole" } }, 1 - amount, "token" in paint ? paint.token : "series-1");
|
|
270
|
+
}
|
|
271
|
+
function insideStagePaint(paint, pattern, theme) {
|
|
272
|
+
return {
|
|
273
|
+
insidePaint: paint,
|
|
274
|
+
insidePattern: pattern,
|
|
275
|
+
insideFill: effectiveFill(paintColor(theme, paint), pattern, theme)
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
var MIN_FUNNEL_W = 96, MIN_FUNNEL_W_COMPACT = 64;
|
|
279
|
+
function layoutCenteredFunnel(data, options) {
|
|
280
|
+
let warnings = [];
|
|
281
|
+
options.bandFraction !== void 0 && warnings.push({
|
|
282
|
+
code: "funnel-centered-band-fraction-ignored",
|
|
283
|
+
severity: "info",
|
|
284
|
+
message: "variant:'centered' uses equal, contiguous stage heights \u2014 bandFraction is ignored"
|
|
285
|
+
}), options.worstDropCallout && warnings.push({ code: "funnel-worst-drop-callout-rows-only", severity: "warn", message: "funnel worstDropCallout requires variant:'rows' \u2014 ignored" });
|
|
286
|
+
let theme = chartTheme(options), na = notApplicableGlyph(options.strings), paletteRamp = chartPalette(theme, options.palette, warnings), size = resolveSize(options.size), measure = options.measure ?? defaultMeasurer, autoDecimals = (value) => Number.isInteger(value) || Math.abs(value) >= 100 ? 0 : 1, fmt = options.format ? formatterFromExample(options.format, options.locale?.language) : (value) => formatAutomaticNumber(value, { locale: options.locale?.language, decimals: autoDecimals(value) }), fmtPct = (rate) => {
|
|
287
|
+
let pct = rate * 100;
|
|
288
|
+
return formatAutomaticPercent(pct, smallRateDecimals(pct), !1, options.locale?.language);
|
|
289
|
+
}, highlights = new Set(resolveHighlight(options.highlight)), labelsOpt = options.labels, labelOn2 = (kind) => labelOn(options, kind);
|
|
290
|
+
if (!data || !Array.isArray(data.categories) || data.categories.length === 0)
|
|
291
|
+
throw new NormalizeError("empty-data", "categories", "funnel requires at least one stage");
|
|
292
|
+
if (!Array.isArray(data.series) || data.series.length === 0)
|
|
293
|
+
throw new NormalizeError("empty-data", "series", "funnel requires at least one series");
|
|
294
|
+
let stages = data.categories.map(
|
|
295
|
+
(category, index) => normalizeCategory(category, index)
|
|
296
|
+
), plotted = data.series.filter((series) => series.role !== "reference");
|
|
297
|
+
if (plotted.length === 0)
|
|
298
|
+
throw new NormalizeError("empty-data", "series", "funnel requires at least one data-role series");
|
|
299
|
+
let numbers = deriveFunnel(plotted, stages, fmt, warnings), { stageTotals, conversions, worstDrop } = numbers, values = numbers.values.map((row) => row.map((value) => value ?? 0)), glyph = missingGlyph(theme), cells = plotted.map((series, si) => normalizeSeriesValues(series, stages, si));
|
|
300
|
+
plotted.length > 1 && cells.some((row) => row.some((cell) => cellMeta(cell)?.label !== void 0)) && warnings.push({
|
|
301
|
+
code: "funnel-cell-label-ignored",
|
|
302
|
+
severity: "warn",
|
|
303
|
+
message: "values[].label has no effect on a centered funnel with several series because each stage prints its total, not segment values.",
|
|
304
|
+
suggest: "Set variant: 'rows' to show the cell labels, or remove values[].label."
|
|
305
|
+
});
|
|
306
|
+
let formats = stages.map((_, ci) => seriesRasterFormatter(options.format, plotted.length === 1 ? numbers.values[0] : plotted.map((_2, si) => numbers.values[si][ci]), options.locale?.language, options.unit, options.target, void 0, !0)), totalRaster = seriesRasterFormatter(options.format, Object.values(stageTotals), options.locale?.language, options.unit, options.target);
|
|
307
|
+
if (!options.format) for (let format of [...formats, totalRaster]) format.spec.wholeCounts = !0;
|
|
308
|
+
let { valueText, totalFmt } = funnelValueFormats(plotted, cells, formats, totalRaster), firstTotal = stageTotals[stages[0].id] ?? null, cumulativeCvrs = stages.map((stage, ci) => {
|
|
309
|
+
let total = stageTotals[stage.id] ?? null, measurable = !numbers.clampedStages[0] && !numbers.clampedStages[ci];
|
|
310
|
+
return { stageId: stage.id, rate: measurable && firstTotal !== null && firstTotal > 0 && total !== null ? total / firstTotal : null };
|
|
311
|
+
}), totalText = (stage) => {
|
|
312
|
+
let total = numbers.shownTotals[stage.id] ?? null;
|
|
313
|
+
if (total === null) return glyph;
|
|
314
|
+
if (plotted.length !== 1) return totalFmt(total);
|
|
315
|
+
let ci = stages.findIndex((item) => item.id === stage.id), label = cellMeta(cells[0][ci])?.label, text = valueText(0, ci, total);
|
|
316
|
+
return label === !1 ? "" : typeof label == "string" ? label.replace(/\$\{value\}/g, text) : text;
|
|
317
|
+
}, stageCvrText = (categoryIndex) => {
|
|
318
|
+
if (categoryIndex === 0) return "\u2013";
|
|
319
|
+
let previous = stages[categoryIndex - 1], stage = stages[categoryIndex], conversion = conversions.find(
|
|
320
|
+
(candidate) => candidate.fromId === previous.id && candidate.toId === stage.id
|
|
321
|
+
);
|
|
322
|
+
return conversion ? conversion.rate > 1 ? "increased" : fmtPct(conversion.rate) : na;
|
|
323
|
+
}, cumulativeCvrText = (rate) => rate === null ? na : rate > 1 ? "increased" : fmtPct(rate), occupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), sides = canvasMargin(theme, size.width), margin = { top: 20, right: sides.right, bottom: 16, left: sides.left, ...options.margin }, legendOpts = normalizeLegendOption(options.legend, plotted.length > 1 ? { position: "top" } : void 0), legendItems = plotted.map((series, seriesIndex) => ({
|
|
324
|
+
id: series.id,
|
|
325
|
+
label: series.label ?? series.id,
|
|
326
|
+
paint: seriesPaint2(series, seriesIndex),
|
|
327
|
+
pattern: centeredPattern(series)
|
|
328
|
+
}));
|
|
329
|
+
if (legendOpts?.order) {
|
|
330
|
+
let rank = new Map(legendOpts.order.map((id, index) => [id, index]));
|
|
331
|
+
legendItems.sort((a, b) => (rank.get(a.id) ?? 999) - (rank.get(b.id) ?? 999));
|
|
332
|
+
}
|
|
333
|
+
let frameResult = solveFrame(
|
|
334
|
+
{
|
|
335
|
+
size,
|
|
336
|
+
margin,
|
|
337
|
+
...frameTextOptions(options),
|
|
338
|
+
footnotes: [
|
|
339
|
+
...authoredNotes(options),
|
|
340
|
+
...clampedNote(numbers.clamped, options),
|
|
341
|
+
...numbers.undefinedSteps.length ? [disclosureNote(chartString(options, "funnelUndefined", { v1: na }))] : []
|
|
342
|
+
],
|
|
343
|
+
legend: legendOpts ? { options: legendOpts, items: legendItems } : void 0,
|
|
344
|
+
theme,
|
|
345
|
+
measure
|
|
346
|
+
},
|
|
347
|
+
occupied
|
|
348
|
+
), inner = frameResult.plot, labelFont = { family: theme.type.family, ...theme.type.label }, strongFont = { family: theme.type.family, ...theme.type.label, weight: emphasisWeight(theme) }, headerFont = { family: theme.type.family, ...theme.type.axis }, stageLabelInfos = stages.map((stage) => stageLabelInfo(
|
|
349
|
+
stage.label ?? stage.id,
|
|
350
|
+
totalText(stage),
|
|
351
|
+
strongFont,
|
|
352
|
+
measure
|
|
353
|
+
)), showTotalCvr = options.totalCvr === "column" && labelsOpt !== !1, cvrFont = strongFont, compactForm = options.mode === "compact", colPad = compactForm ? 10 : 16, splitHeads = compactForm, headLines = (text) => splitHeads ? text.split(" ") : [text], headSize = (text) => {
|
|
354
|
+
let lines = headLines(text);
|
|
355
|
+
return { width: Math.max(...lines.map((line) => measure(line, headerFont).width)), height: lines.length * measure(lines[0], headerFont).height };
|
|
356
|
+
}, spanForm = showTotalCvr && labelOn2("annotation") && labelOn2("point") && stages.length > 1, spanText = chartString(options, "cvrSpanHeader"), spanSize = measure(spanText, headerFont), cvrHeaderText = chartString(options, spanForm ? "totalCvrShort" : "totalCvr"), cvrHeaderSize = headSize(cvrHeaderText), cvrTexts = cumulativeCvrs.map((item) => cumulativeCvrText(item.rate)), cvrSizes = cvrTexts.map((text) => measure(text, cvrFont)), cvrBlockWidth = showTotalCvr ? Math.max(cvrHeaderSize.width, maxOf(cvrSizes.map((item) => item.width))) + colPad : 0, showStepCvr = labelsOpt !== !1 && labelOn2("point") && stages.length > 1, stepHeaderText = chartString(options, spanForm ? "stepCvrShort" : "stepCvr"), stepHeaderSize = headSize(stepHeaderText), stepTexts = stages.map((_, index) => stageCvrText(index)), stepSizes = stepTexts.map((text) => measure(text, labelFont)), stepBlockWidth = showStepCvr ? Math.max(stepHeaderSize.width, maxOf(stepSizes.map((item) => item.width))) + colPad : 0, headBlockH = () => 2 * measure(stepHeaderText.split(" ")[0] ?? "", headerFont).height, headerReserve = showTotalCvr || showStepCvr ? headBlockH() + 8 : 0, rowsTop = inner.y + headerReserve, rowsBottom = inner.y + inner.h, rowsHeight = Math.max(stages.length, rowsBottom - rowsTop), bandHeight = rowsHeight / stages.length, setTableForm = (split) => {
|
|
357
|
+
splitHeads = split, cvrHeaderSize = headSize(cvrHeaderText), cvrBlockWidth = showTotalCvr ? Math.max(cvrHeaderSize.width, maxOf(cvrSizes.map((item) => item.width))) + colPad : 0, stepHeaderSize = headSize(stepHeaderText), stepBlockWidth = showStepCvr ? Math.max(stepHeaderSize.width, maxOf(stepSizes.map((item) => item.width))) + colPad : 0, headerReserve = showTotalCvr || showStepCvr ? headBlockH() + 8 : 0, rowsTop = inner.y + headerReserve, rowsHeight = Math.max(stages.length, rowsBottom - rowsTop), bandHeight = rowsHeight / stages.length;
|
|
358
|
+
}, maxTotal = Math.max(0, maxOf(numbers.known)), boundaryWidthFor = (categoryIndex, funnelWidth2) => maxTotal > 0 ? numbers.known[categoryIndex] / maxTotal * funnelWidth2 : 0, fitsInside = (categoryIndex, funnelWidth2, label) => {
|
|
359
|
+
if (label.h + 6 > bandHeight) return !1;
|
|
360
|
+
let topWidth = boundaryWidthFor(categoryIndex, funnelWidth2), bottomWidth = boundaryWidthFor(
|
|
361
|
+
Math.min(categoryIndex + 1, stages.length - 1),
|
|
362
|
+
funnelWidth2
|
|
363
|
+
), topT = clamp((bandHeight - label.h) / 2 / bandHeight, 0, 1), bottomT = clamp((bandHeight + label.h) / 2 / bandHeight, 0, 1), widthAt = (t) => topWidth + (bottomWidth - topWidth) * t;
|
|
364
|
+
return Math.min(widthAt(topT), widthAt(bottomT)) >= label.w + 12;
|
|
365
|
+
}, minFunnelW = compactForm ? MIN_FUNNEL_W_COMPACT : MIN_FUNNEL_W, cagrReserve = (options.annotations ?? []).some((ann) => ann.kind === "cagr") ? measure("\u2212100.0% p.a.", strongFont).width + (compactForm ? 24 : 48) : 0, fitAllInside = () => stageLabelInfos.every((label, categoryIndex) => fitsInside(categoryIndex, Math.max(10, inner.w - stepBlockWidth - cvrBlockWidth - cagrReserve), label)), allInside = fitAllInside();
|
|
366
|
+
!allInside && !splitHeads && labelOn2("total") && (setTableForm(!0), allInside = fitAllInside());
|
|
367
|
+
let labelColumnW = labelOn2("total") && !allInside ? maxOf(stageLabelInfos.map((label) => label.w)) + LABEL_COLUMN_GAP : 0, funnelWidth = Math.max(10, inner.w - stepBlockWidth - cvrBlockWidth - cagrReserve - labelColumnW), funnelLeft = inner.x + labelColumnW, narrowestFunnel = 1 / 0, columnW = labelOn2("total") ? maxOf(stageLabelInfos.map((label) => label.w)) + LABEL_COLUMN_GAP : 0;
|
|
368
|
+
for (let w = minFunnelW; w <= Math.max(minFunnelW, 640); w += 4) {
|
|
369
|
+
let outside = stageLabelInfos.every((label, ci) => fitsInside(ci, w, label)) ? 0 : columnW;
|
|
370
|
+
if (narrowestFunnel = Math.min(narrowestFunnel, w + outside), outside === 0) break;
|
|
371
|
+
}
|
|
372
|
+
narrowestFunnel = Math.min(narrowestFunnel, minFunnelW + columnW);
|
|
373
|
+
let axisX = funnelLeft + funnelWidth / 2, stepX = funnelLeft + funnelWidth + cagrReserve + 8, cvrX = stepX + stepBlockWidth, headY = (h) => inner.y + Math.max(0, headerReserve - 8 - h), flushRight = (x, block, w) => x + Math.max(0, block - colPad) - w, boundaryWidths = emptyIdRecord();
|
|
374
|
+
stages.forEach((stage, categoryIndex) => {
|
|
375
|
+
boundaryWidths[stage.id] = boundaryWidthFor(categoryIndex, funnelWidth);
|
|
376
|
+
});
|
|
377
|
+
let plot = { x: funnelLeft, y: rowsTop, w: funnelWidth, h: rowsHeight }, nodes = [...frameResult.nodes], marks = { rows: [] }, labelRequests = [], rowLanes = [];
|
|
378
|
+
stages.forEach((stage, categoryIndex) => {
|
|
379
|
+
let yTop = rowsTop + categoryIndex * bandHeight, yBottom = yTop + bandHeight, nextIndex = Math.min(categoryIndex + 1, stages.length - 1), topWidth = boundaryWidths[stage.id], bottomWidth = boundaryWidths[stages[nextIndex].id], fullRect = {
|
|
380
|
+
x: axisX - Math.max(topWidth, bottomWidth) / 2,
|
|
381
|
+
y: yTop,
|
|
382
|
+
w: Math.max(topWidth, bottomWidth),
|
|
383
|
+
h: bandHeight
|
|
384
|
+
}, lane = { x: inner.x, y: yTop, w: inner.w, h: bandHeight };
|
|
385
|
+
rowLanes.push(lane);
|
|
386
|
+
let segmentRecords = [], topCumulative = 0, bottomCumulative = 0;
|
|
387
|
+
if (plotted.forEach((series, seriesIndex) => {
|
|
388
|
+
let topValue = values[seriesIndex][categoryIndex], bottomValue = values[seriesIndex][nextIndex], topLeft = axisX - topWidth / 2 + scaleValue(topCumulative), topRight = topLeft + scaleValue(topValue), bottomLeft = axisX - bottomWidth / 2 + scaleValue(bottomCumulative), bottomRight = bottomLeft + scaleValue(bottomValue);
|
|
389
|
+
if (topCumulative += topValue, bottomCumulative += bottomValue, topValue <= 0 && bottomValue <= 0 || numbers.values[seriesIndex][categoryIndex] === null) return;
|
|
390
|
+
let rect = {
|
|
391
|
+
x: Math.min(topLeft, bottomLeft),
|
|
392
|
+
y: yTop,
|
|
393
|
+
w: Math.max(topRight, bottomRight) - Math.min(topLeft, bottomLeft),
|
|
394
|
+
h: bandHeight
|
|
395
|
+
}, nodeId = `mark:${stage.id}:${series.id}`, pattern = centeredPattern(series), paint = stagePaint(series, seriesIndex, categoryIndex), outlined = pattern === "outline" && !solidMutedPlan(theme), sep = pattern === void 0 ? othersSeparation(paint, theme) : void 0, pathNode = {
|
|
396
|
+
t: "path",
|
|
397
|
+
id: nodeId,
|
|
398
|
+
d: quadrilateralPath(topLeft, topRight, bottomRight, bottomLeft, yTop, yBottom),
|
|
399
|
+
fill: outlined ? { token: "background" } : pattern === "outline" ? PLAN_MUTED_PAINT : paint,
|
|
400
|
+
stroke: outlined ? paint : sep?.stroke ?? { token: "background" },
|
|
401
|
+
width: outlined ? theme.pattern.outlineStrokeWidth : sep?.strokeWidth ?? strokeToken(theme, "hair"),
|
|
402
|
+
...pattern === void 0 && isOthersFill(paint) ? { separation: { fill: paint, backing: { token: "background" }, fallback: { stroke: { token: "background" }, strokeWidth: strokeToken(theme, "hair") } } } : {},
|
|
403
|
+
owner: { categoryId: stage.id, seriesId: series.id },
|
|
404
|
+
part: "segment"
|
|
405
|
+
};
|
|
406
|
+
nodes.push(pathNode), occupied.claim(rect, "mark", pathNode.owner, pathNode.part), segmentRecords.push({ id: series.id, rect, nodeId });
|
|
407
|
+
}), marks.rows.push({
|
|
408
|
+
categoryId: stage.id,
|
|
409
|
+
rect: fullRect,
|
|
410
|
+
lane,
|
|
411
|
+
segments: segmentRecords
|
|
412
|
+
}), labelOn2("total")) {
|
|
413
|
+
let info = stageLabelInfos[categoryIndex], rowCenterY = yTop + bandHeight / 2, inside = allInside, candidates = inside ? [{
|
|
414
|
+
slot: "insideCenter",
|
|
415
|
+
rect: {
|
|
416
|
+
x: axisX - info.w / 2,
|
|
417
|
+
y: rowCenterY - info.h / 2,
|
|
418
|
+
w: info.w,
|
|
419
|
+
h: info.h
|
|
420
|
+
},
|
|
421
|
+
penalty: 0,
|
|
422
|
+
...plotted.length === 1 ? insideStagePaint(stagePaint(plotted[0], 0, categoryIndex), centeredPattern(plotted[0]), theme) : { needsBacking: !0 }
|
|
423
|
+
}] : [{
|
|
424
|
+
slot: "outsideLeft",
|
|
425
|
+
rect: { x: funnelLeft - LABEL_COLUMN_GAP - info.w, y: rowCenterY - info.h / 2, w: info.w, h: info.h },
|
|
426
|
+
penalty: 0
|
|
427
|
+
}];
|
|
428
|
+
labelRequests.push({
|
|
429
|
+
id: `stage:${stage.id}`,
|
|
430
|
+
kind: "total",
|
|
431
|
+
role: composedTextRole(info.text),
|
|
432
|
+
owner: { categoryId: stage.id },
|
|
433
|
+
text: info.text,
|
|
434
|
+
lines: info.lines,
|
|
435
|
+
font: strongFont,
|
|
436
|
+
align: inside ? "middle" : "end",
|
|
437
|
+
priority: PRIORITY.total + (highlights.has(stage.id) ? PRIORITY.highlightBonus : 0),
|
|
438
|
+
candidates
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
if (showStepCvr) {
|
|
442
|
+
let stepText = stepTexts[categoryIndex], stepSize = stepSizes[categoryIndex];
|
|
443
|
+
labelRequests.push({
|
|
444
|
+
id: `step-cvr:${stage.id}`,
|
|
445
|
+
...categoryIndex > 0 && conversions.some((c) => c.toId === stage.id) ? { claimId: `funnel:conv:${stages[categoryIndex - 1].id}:${stage.id}` } : {},
|
|
446
|
+
kind: "point",
|
|
447
|
+
role: composedTextRole(stepText),
|
|
448
|
+
owner: { categoryId: stage.id },
|
|
449
|
+
text: stepText,
|
|
450
|
+
lines: [stepText],
|
|
451
|
+
font: labelFont,
|
|
452
|
+
priority: PRIORITY.extreme,
|
|
453
|
+
// A named column's values are its content: the density gate keeps them with the head.
|
|
454
|
+
keepWhenDense: !0,
|
|
455
|
+
candidates: [{
|
|
456
|
+
slot: "stepCvrColumn",
|
|
457
|
+
rect: { x: flushRight(stepX, stepBlockWidth, stepSize.width), y: yTop + bandHeight / 2 - stepSize.height / 2, w: stepSize.width, h: stepSize.height },
|
|
458
|
+
penalty: 0
|
|
459
|
+
}]
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
if (showTotalCvr && labelOn2("point")) {
|
|
463
|
+
let cvrText = cvrTexts[categoryIndex], cvrSize = cvrSizes[categoryIndex];
|
|
464
|
+
labelRequests.push({
|
|
465
|
+
id: `total-cvr:${stage.id}`,
|
|
466
|
+
...cumulativeCvrs[categoryIndex].rate !== null ? { claimId: `funnel:total-cvr:${stage.id}` } : {},
|
|
467
|
+
kind: "point",
|
|
468
|
+
role: composedTextRole(cvrText),
|
|
469
|
+
owner: { categoryId: stage.id },
|
|
470
|
+
text: cvrText,
|
|
471
|
+
lines: [cvrText],
|
|
472
|
+
font: cvrFont,
|
|
473
|
+
priority: PRIORITY.extreme,
|
|
474
|
+
keepWhenDense: !0,
|
|
475
|
+
candidates: [{
|
|
476
|
+
slot: "cvrColumn",
|
|
477
|
+
rect: {
|
|
478
|
+
x: flushRight(cvrX, cvrBlockWidth, cvrSize.width),
|
|
479
|
+
y: yTop + bandHeight / 2 - cvrSize.height / 2,
|
|
480
|
+
w: cvrSize.width,
|
|
481
|
+
h: cvrSize.height
|
|
482
|
+
},
|
|
483
|
+
penalty: 0
|
|
484
|
+
}]
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
}), showStepCvr && labelOn2("annotation") && labelRequests.push({
|
|
488
|
+
id: "step-cvr:header",
|
|
489
|
+
kind: "annotation",
|
|
490
|
+
role: "caption",
|
|
491
|
+
...spanForm ? { pad: 0 } : {},
|
|
492
|
+
owner: { annotationId: "step-cvr-header" },
|
|
493
|
+
text: stepHeaderText,
|
|
494
|
+
lines: headLines(stepHeaderText),
|
|
495
|
+
font: headerFont,
|
|
496
|
+
priority: PRIORITY.total,
|
|
497
|
+
align: "end",
|
|
498
|
+
candidates: [{ slot: "cvrHeader", rect: { x: flushRight(stepX, stepBlockWidth, stepHeaderSize.width), y: headY(stepHeaderSize.height), w: stepHeaderSize.width, h: stepHeaderSize.height }, penalty: 0 }]
|
|
499
|
+
}), spanForm && labelRequests.push({
|
|
500
|
+
id: CVR_SPAN_HEADER,
|
|
501
|
+
kind: "annotation",
|
|
502
|
+
role: "caption",
|
|
503
|
+
owner: { annotationId: "cvr-span-header" },
|
|
504
|
+
text: spanText,
|
|
505
|
+
lines: [spanText],
|
|
506
|
+
font: headerFont,
|
|
507
|
+
priority: PRIORITY.total,
|
|
508
|
+
align: "end",
|
|
509
|
+
// The two head rows touch; their line height keeps the air between them.
|
|
510
|
+
pad: 0,
|
|
511
|
+
// Flush right over the total column; a longer head reaches left over the
|
|
512
|
+
// empty head row above the funnel and never widens the columns.
|
|
513
|
+
candidates: [{ slot: "cvrHeader", rect: { x: Math.max(inner.x, cvrX + cvrBlockWidth - colPad - spanSize.width), y: inner.y, w: spanSize.width, h: spanSize.height }, penalty: 0 }]
|
|
514
|
+
}), showTotalCvr && labelOn2("annotation") && labelRequests.push({
|
|
515
|
+
id: "total-cvr:header",
|
|
516
|
+
kind: "annotation",
|
|
517
|
+
role: "caption",
|
|
518
|
+
...spanForm ? { pad: 0 } : {},
|
|
519
|
+
owner: { annotationId: "total-cvr-header" },
|
|
520
|
+
text: cvrHeaderText,
|
|
521
|
+
lines: headLines(cvrHeaderText),
|
|
522
|
+
font: headerFont,
|
|
523
|
+
priority: PRIORITY.total,
|
|
524
|
+
align: "end",
|
|
525
|
+
candidates: [{
|
|
526
|
+
slot: "cvrHeader",
|
|
527
|
+
rect: {
|
|
528
|
+
x: flushRight(cvrX, cvrBlockWidth, cvrHeaderSize.width),
|
|
529
|
+
y: headY(cvrHeaderSize.height),
|
|
530
|
+
w: cvrHeaderSize.width,
|
|
531
|
+
h: cvrHeaderSize.height
|
|
532
|
+
},
|
|
533
|
+
penalty: 0
|
|
534
|
+
}]
|
|
535
|
+
});
|
|
536
|
+
for (let request of labelRequests) {
|
|
537
|
+
let categoryId = request.owner.categoryId;
|
|
538
|
+
if (categoryId === void 0) continue;
|
|
539
|
+
let categoryIndex = stages.findIndex((stage) => stage.id === categoryId);
|
|
540
|
+
request.candidates = request.candidates.filter(
|
|
541
|
+
(candidate) => rectContains(rowLanes[categoryIndex], candidate.rect)
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
stages.forEach((stage, categoryIndex) => {
|
|
545
|
+
occupied.claim(
|
|
546
|
+
rowLanes[categoryIndex],
|
|
547
|
+
"mark",
|
|
548
|
+
{ categoryId: stage.id },
|
|
549
|
+
"funnel-row-lane"
|
|
550
|
+
);
|
|
551
|
+
});
|
|
552
|
+
let solveCtx = labelCtx(theme, size, options, {
|
|
553
|
+
measure,
|
|
554
|
+
plot,
|
|
555
|
+
labelPad: 2
|
|
556
|
+
}), solved = solveLabels(labelRequests, occupied, solveCtx);
|
|
557
|
+
pushAll(warnings, solved.warnings);
|
|
558
|
+
for (let label of solved.placed)
|
|
559
|
+
label.id.startsWith("stage:") && label.lines.length > 1 && (label.font = labelFont, label.headLines = 1, label.headWeight = emphasisWeight(theme)), label.id.startsWith("total-cvr:") && label.id !== "total-cvr:header" && (label.font = cvrFont), (label.id === "step-cvr:header" || label.id === "total-cvr:header" || label.id === CVR_SPAN_HEADER) && (label.ink = { token: "inkMuted" });
|
|
560
|
+
for (let column of ["step-cvr", "total-cvr"]) {
|
|
561
|
+
let values2 = solved.placed.filter((label) => label.id.startsWith(`${column}:`) && label.id !== `${column}:header`), head = solved.placed.find((label) => label.id === `${column}:header`);
|
|
562
|
+
head && !head.hidden && values2.length > 0 && values2.every((label) => label.hidden) && (head.hidden = values2[0].hidden);
|
|
563
|
+
}
|
|
564
|
+
let span = solved.placed.find((label) => label.id === CVR_SPAN_HEADER), columnHeads = solved.placed.filter((label) => label.id === "step-cvr:header" || label.id === "total-cvr:header");
|
|
565
|
+
span && !span.hidden && columnHeads.length > 0 && columnHeads.every((label) => label.hidden) && (span.hidden = columnHeads[0].hidden);
|
|
566
|
+
for (let label of solved.placed)
|
|
567
|
+
label.hidden !== "collision" || label.owner.categoryId === void 0 || warnings.push({
|
|
568
|
+
code: "funnel-label-hidden",
|
|
569
|
+
severity: "warn",
|
|
570
|
+
message: `label '${label.id}' could not stay in stage '${label.owner.categoryId}' without a collision \u2014 hidden`,
|
|
571
|
+
owner: label.owner
|
|
572
|
+
});
|
|
573
|
+
let resolve = (ref) => {
|
|
574
|
+
let normalized = typeof ref == "string" ? { categoryId: ref, edge: "total" } : ref;
|
|
575
|
+
if (!("categoryId" in normalized) || !normalized.categoryId) return null;
|
|
576
|
+
let categoryIndex = stages.findIndex((stage2) => stage2.id === normalized.categoryId);
|
|
577
|
+
if (categoryIndex < 0) return null;
|
|
578
|
+
let stage = stages[categoryIndex], nextIndex = Math.min(categoryIndex + 1, stages.length - 1), y = rowsTop + (categoryIndex + 0.5) * bandHeight, value = stageTotals[stage.id] ?? null, boundaryX = axisX + (normalized.edge === "start" ? -1 : 1) * boundaryWidths[stage.id] / 2, left = axisX - (boundaryWidths[stage.id] + boundaryWidths[stages[nextIndex].id]) / 4, right = axisX + (boundaryWidths[stage.id] + boundaryWidths[stages[nextIndex].id]) / 4;
|
|
579
|
+
if ("seriesId" in normalized && normalized.seriesId) {
|
|
580
|
+
let seriesIndex = plotted.findIndex((series) => series.id === normalized.seriesId);
|
|
581
|
+
if (seriesIndex < 0) return null;
|
|
582
|
+
value = numbers.values[seriesIndex][categoryIndex] ?? null;
|
|
583
|
+
let topBefore = values.slice(0, seriesIndex).reduce((sum, seriesValues) => sum + seriesValues[categoryIndex], 0), bottomBefore = values.slice(0, seriesIndex).reduce((sum, seriesValues) => sum + seriesValues[nextIndex], 0), topLeft = axisX - boundaryWidths[stage.id] / 2 + scaleValue(topBefore);
|
|
584
|
+
boundaryX = topLeft + (normalized.edge === "start" ? 0 : scaleValue(value ?? 0));
|
|
585
|
+
let bottomLeft = axisX - boundaryWidths[stages[nextIndex].id] / 2 + scaleValue(bottomBefore);
|
|
586
|
+
left = (topLeft + bottomLeft) / 2, right = left + (scaleValue(values[seriesIndex][categoryIndex]) + scaleValue(values[seriesIndex][nextIndex])) / 2;
|
|
587
|
+
}
|
|
588
|
+
return value === null ? null : {
|
|
589
|
+
x: normalized.edge === "start" ? left : right,
|
|
590
|
+
y,
|
|
591
|
+
comparisonPoint: { x: boundaryX, y: rowsTop + categoryIndex * bandHeight },
|
|
592
|
+
row: { y: rowsTop + categoryIndex * bandHeight, h: bandHeight },
|
|
593
|
+
value,
|
|
594
|
+
date: stage.date,
|
|
595
|
+
label: stage.label,
|
|
596
|
+
owner: { categoryId: stage.id, ...normalized.seriesId ? { seriesId: normalized.seriesId } : {} }
|
|
597
|
+
};
|
|
598
|
+
}, annotationOccupied = createOccupiedIndex({
|
|
599
|
+
x: 0,
|
|
600
|
+
y: 0,
|
|
601
|
+
w: size.width,
|
|
602
|
+
h: size.height
|
|
603
|
+
}), columnRects = new Set(solved.placed.filter((label) => cagrReserve > 0 && /^(step|total)-cvr:/.test(label.id)).map((label) => JSON.stringify(label.rect))), annotationSeed = occupied.snapshot().filter((claim) => claim.part !== "funnel-row-lane" && !(claim.kind === "label" && columnRects.has(JSON.stringify(claim.rect))));
|
|
604
|
+
for (let claim of annotationSeed)
|
|
605
|
+
annotationOccupied.claim(claim.rect, claim.kind, claim.owner, claim.part);
|
|
606
|
+
let annotationResult = runAnnotatePass({
|
|
607
|
+
annotations: options.annotations ?? [],
|
|
608
|
+
valueAxis: "horizontal",
|
|
609
|
+
defaultSpan: stages.length > 1 ? { from: stages[0].id, to: stages.at(-1).id } : void 0,
|
|
610
|
+
resolve,
|
|
611
|
+
occupied: annotationOccupied,
|
|
612
|
+
plot,
|
|
613
|
+
theme,
|
|
614
|
+
measure,
|
|
615
|
+
format: options.format,
|
|
616
|
+
locale: options.locale?.language,
|
|
617
|
+
strings: options.strings,
|
|
618
|
+
solveCtx
|
|
619
|
+
});
|
|
620
|
+
pushAll(warnings, annotationResult.warnings);
|
|
621
|
+
for (let claim of annotationOccupied.snapshot().slice(annotationSeed.length))
|
|
622
|
+
occupied.claim(claim.rect, claim.kind, claim.owner, claim.part);
|
|
623
|
+
let allLabels = [...solved.placed, ...annotationResult.labels];
|
|
624
|
+
pushAll(nodes, annotationResult.nodes), pushAll(nodes, centeredLabelNodes(theme, allLabels, strongFont, headerFont, labelFont, nodes));
|
|
625
|
+
let heads = allLabels.filter((label) => !label.hidden && (label.id === "step-cvr:header" || label.id === "total-cvr:header"));
|
|
626
|
+
if (heads.length > 0) {
|
|
627
|
+
let ruleY = Math.round(Math.max(...heads.map((label) => label.rect.y + label.rect.h)) + 3) + 0.5, left = showStepCvr ? stepX : cvrX, right = Math.max(...heads.map((label) => label.rect.x + label.rect.w));
|
|
628
|
+
ruleY < rowsTop && nodes.push({ t: "line", id: "cvr:header-rule", x1: left, y1: ruleY, x2: right, y2: ruleY, stroke: { token: "grid" }, width: strokeToken(theme, "hair"), owner: {}, part: "gridline" });
|
|
629
|
+
}
|
|
630
|
+
let a11yParts = stages.map((stage, categoryIndex) => {
|
|
631
|
+
let stageCvr = stageCvrText(categoryIndex), totalCvr = cumulativeCvrText(cumulativeCvrs[categoryIndex].rate);
|
|
632
|
+
return chartString(options, "stageCvrDesc", { v1: stage.label, v2: numbers.shownTotals[stage.id] == null ? chartString(options, "missing") : totalFmt(numbers.shownTotals[stage.id]), v3: stageCvr, v4: totalCvr });
|
|
633
|
+
}), first = stages[0], last = stages[stages.length - 1], tallestStageLabelH = Math.max(0, maxOf(stageLabelInfos.map((label) => label.h))), paintWarningRules = [];
|
|
634
|
+
return pushAll(warnings, centeredAdjacentWarnings(marks, nodes, values, plotted, theme, { rules: paintWarningRules, before: warnings.filter((warning) => !["pie-ramp-crowded", "likert-ramp-invisible", "band-lightness-insufficient", "series-adjacent-similar", "highlight-reads-as-loss"].includes(warning.code)).length })), {
|
|
635
|
+
type: "funnel",
|
|
636
|
+
size,
|
|
637
|
+
// Rows share one pitch, so the tallest stage label sizes them: a hidden value makes only its own label one line.
|
|
638
|
+
sizing: rowSizing("funnel", size, {
|
|
639
|
+
chromeH: size.height - rowsHeight,
|
|
640
|
+
minimumRowsH: stages.length * Math.max(28, labelOn2("total") ? tallestStageLabelH + 6 : 0),
|
|
641
|
+
// A wide card gets air around each stage (pitch 56 at 960, 52 at 720, 40 at 480, 36 at 400): 0.05 px of air
|
|
642
|
+
// per px of canvas over 400, up to 19 px.
|
|
643
|
+
naturalRowsH: stages.length * (Math.max(28, labelOn2("total") ? tallestStageLabelH + 6 : 0) + clamp((size.width - 400) * 0.05, 0, 19)),
|
|
644
|
+
// The frame, the funnel at its narrowest readable width, the stage
|
|
645
|
+
// labels it sends outside, and the CVR columns.
|
|
646
|
+
// The funnel width plus the labels it sends outside, at the narrowest sum.
|
|
647
|
+
minWidth: size.width - inner.w + cagrReserve + stepBlockWidth + cvrBlockWidth + narrowestFunnel
|
|
648
|
+
}),
|
|
649
|
+
plot,
|
|
650
|
+
scene: nodes,
|
|
651
|
+
labels: allLabels,
|
|
652
|
+
axes: [{
|
|
653
|
+
axis: "y",
|
|
654
|
+
ticks: stages.map((stage, categoryIndex) => ({
|
|
655
|
+
at: stage.id,
|
|
656
|
+
pos: rowsTop + (categoryIndex + 0.5) * bandHeight,
|
|
657
|
+
labelId: labelOn2("total") ? `stage:${stage.id}` : void 0
|
|
658
|
+
}))
|
|
659
|
+
}],
|
|
660
|
+
annotations: annotationResult.placed,
|
|
661
|
+
legend: frameResult.legend,
|
|
662
|
+
frame: frameResult.frame,
|
|
663
|
+
marks,
|
|
664
|
+
derived: {
|
|
665
|
+
stageTotals,
|
|
666
|
+
conversions,
|
|
667
|
+
...worstDrop ? { worstDrop } : {},
|
|
668
|
+
cumulativeCvrs,
|
|
669
|
+
boundaryWidths
|
|
670
|
+
},
|
|
671
|
+
a11y: {
|
|
672
|
+
title: accessibleTitle(options.title, chartString(options, "funnelTitle", { v1: first.label, v2: last.label })),
|
|
673
|
+
desc: chartString(options, "centeredFunnelDesc", { v1: stages.length, v2: a11yParts.join("; ") })
|
|
674
|
+
},
|
|
675
|
+
warnings,
|
|
676
|
+
paintWarningRules,
|
|
677
|
+
debug: {
|
|
678
|
+
occupied: occupied.snapshot(),
|
|
679
|
+
decisions: [...solved.decisions, ...annotationResult.decisions]
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
function scaleValue(value) {
|
|
683
|
+
return maxTotal > 0 ? value / maxTotal * funnelWidth : 0;
|
|
684
|
+
}
|
|
685
|
+
function seriesPaint2(series, seriesIndex, stageIndex = 0) {
|
|
686
|
+
let ramp = rampFunnelPaint(theme, plotted, series, stageIndex, paletteRamp ? options.palette : void 0, stages.length);
|
|
687
|
+
return ramp || (series.fill ? { css: series.fill } : series.colorRole ? markRolePaint(series.colorRole, !0) : seriesPaint(seriesIndex, paletteRamp ? options.palette : void 0));
|
|
688
|
+
}
|
|
689
|
+
function stagePaint(series, seriesIndex, categoryIndex) {
|
|
690
|
+
let paint = seriesPaint2(series, seriesIndex, categoryIndex);
|
|
691
|
+
return plotted.length !== 1 || stages.length === 1 || series.fill || series.colorRole || paletteRamp || rampFunnelPaint(theme, plotted, series, categoryIndex, void 0, stages.length) ? paint : shadeStage(paint, categoryIndex, stages.length, options.stageShade);
|
|
692
|
+
}
|
|
693
|
+
function centeredPattern(series) {
|
|
694
|
+
let scenario = normalizeScenario(series.scenario, `series[${series.id}].scenario`);
|
|
695
|
+
if (scenario === "FC") {
|
|
696
|
+
warnings.some((warning) => warning.code === "funnel-centered-pattern-fallback") || warnings.push({
|
|
697
|
+
code: "funnel-centered-pattern-fallback",
|
|
698
|
+
severity: "warn",
|
|
699
|
+
message: "variant:'centered' renders FC stage faces with their existing solid paint because path hatching is unavailable"
|
|
700
|
+
});
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
return scenario === "PL" ? "outline" : void 0;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
function centeredAdjacentWarnings(marks, nodes, values, series, theme, capture) {
|
|
707
|
+
let byId = new Map(nodes.map((node) => [node.id, node])), samples = [];
|
|
708
|
+
return marks.rows.forEach((row, categoryIndex) => {
|
|
709
|
+
let nextIndex = Math.min(categoryIndex + 1, marks.rows.length - 1), end = 0;
|
|
710
|
+
series.forEach((series2, seriesIndex) => {
|
|
711
|
+
let from = end;
|
|
712
|
+
end += (values[seriesIndex][categoryIndex] + values[seriesIndex][nextIndex]) / 2;
|
|
713
|
+
let segment = row.segments.find((segment2) => segment2.id === series2.id), node = segment ? byId.get(segment.nodeId) : void 0;
|
|
714
|
+
if (node?.t !== "path" || !node.fill) return;
|
|
715
|
+
let paint = "token" in node.fill && node.fill.token === "background" && node.stroke ? node.stroke : node.fill;
|
|
716
|
+
samples.push({ seriesId: series2.id, categoryId: row.categoryId, from, to: end, paint, css: paintColor(theme, paint), highlighted: !1 });
|
|
717
|
+
});
|
|
718
|
+
}), retainAdjacentWarningRule(samples, !0, capture), adjacentSeriesWarnings(samples, !0, theme);
|
|
719
|
+
}
|
|
720
|
+
function quadrilateralPath(topLeft, topRight, bottomRight, bottomLeft, yTop, yBottom) {
|
|
721
|
+
return `M ${topLeft} ${yTop} L ${topRight} ${yTop} L ${bottomRight} ${yBottom} L ${bottomLeft} ${yBottom} Z`;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
// src/core/charts/funnel/comparisons.ts
|
|
725
|
+
function isText(claim) {
|
|
726
|
+
return claim.kind === "label" || claim.part === "caption";
|
|
727
|
+
}
|
|
728
|
+
function arrowRects(a, b, y) {
|
|
729
|
+
return [
|
|
730
|
+
{ x: a.x - 1, y: Math.min(a.y, y), w: 2, h: Math.abs(y - a.y) },
|
|
731
|
+
{ x: b.x - 1, y: Math.min(b.y, y), w: 2, h: Math.abs(y - b.y) },
|
|
732
|
+
{ x: Math.min(a.x, b.x), y: y - 3, w: Math.max(Math.abs(a.x - b.x), 1), h: 6 }
|
|
733
|
+
];
|
|
734
|
+
}
|
|
735
|
+
function clearOfText(occupied, a, b, y) {
|
|
736
|
+
return arrowRects(a, b, y).every((rect) => !occupied.hitsWhich(rect, 1).some(isText));
|
|
737
|
+
}
|
|
738
|
+
function shaftStrip(a, b, y) {
|
|
739
|
+
return { x: Math.min(a.x, b.x), y: y - 3, w: Math.max(Math.abs(a.x - b.x), 1), h: 6 };
|
|
740
|
+
}
|
|
741
|
+
function funnelComparisonLayout(bandY) {
|
|
742
|
+
let takenLanes = [];
|
|
743
|
+
return {
|
|
744
|
+
draw(pass, a, b, text, id, kind, computed, derivation) {
|
|
745
|
+
let shared = { ...pass, input: { ...pass.input, comparisonLayout: void 0 } };
|
|
746
|
+
if (kind === "cagr") {
|
|
747
|
+
annotateEngine().drawCagrArm(shared, a, b, text, id, computed, derivation);
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
let lane = [...bandY === void 0 ? [] : [bandY], (a.y + b.y) / 2].find(
|
|
751
|
+
(y) => !takenLanes.some((taken) => Math.abs(taken - y) < 0.5) && clearOfText(pass.input.occupied, a, b, y) && !pass.input.occupied.hits(shaftStrip(a, b, y), 2)
|
|
752
|
+
);
|
|
753
|
+
if (lane === void 0) {
|
|
754
|
+
pass.warn?.(
|
|
755
|
+
"label-hidden",
|
|
756
|
+
`diff '${id}': every lane between the two stages and under the last row is taken by another arrow or crosses a step caption, so the arrow was not drawn`
|
|
757
|
+
);
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
takenLanes.push(lane);
|
|
761
|
+
let before = pass.nodes.length;
|
|
762
|
+
annotateEngine().drawHorizontalLevelDiff({ ...shared, diffHeights: [lane] }, a, b, text, id, computed, derivation);
|
|
763
|
+
for (let node of pass.nodes.slice(before))
|
|
764
|
+
node.t !== "line" || node.part !== "leader" || pass.input.occupied.claim(
|
|
765
|
+
{ x: node.x1 - 1, y: Math.min(node.y1, node.y2), w: 2, h: Math.abs(node.y2 - node.y1) },
|
|
766
|
+
"annotation",
|
|
767
|
+
{ annotationId: id },
|
|
768
|
+
"leader"
|
|
769
|
+
);
|
|
770
|
+
},
|
|
771
|
+
emit: () => []
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
// src/core/charts/funnel/outsideValues.ts
|
|
776
|
+
var OUTSIDE_GAP = 8, BAR_GAP = 8, TOTAL_GAP = 10;
|
|
777
|
+
function outsideStart(rowEndX, totalW) {
|
|
778
|
+
return rowEndX + BAR_GAP + (totalW > 0 ? totalW + TOTAL_GAP : 0);
|
|
779
|
+
}
|
|
780
|
+
function outsideWidth(textW, totalW) {
|
|
781
|
+
return textW + (totalW > 0 ? SWATCH_RESERVE : 0);
|
|
782
|
+
}
|
|
783
|
+
function outsideSegments(row, pxPerUnit, fits) {
|
|
784
|
+
let drawn = row.segments.filter((segment) => segment.value * pxPerUnit > 0.01);
|
|
785
|
+
return drawn.every((segment, index) => fits(segment.textW, segment.value * pxPerUnit, index === 0)) ? [] : drawn.map((segment) => outsideWidth(segment.textW, row.totalW));
|
|
786
|
+
}
|
|
787
|
+
function barWidthForOutsideValues(input) {
|
|
788
|
+
let { x0, limit, maxTotal, rows, fits } = input;
|
|
789
|
+
if (maxTotal <= 0) return input.barW;
|
|
790
|
+
let floor = Math.max(10, input.barW / 2), barW = input.barW;
|
|
791
|
+
for (let pass = 0; pass < 8; pass++) {
|
|
792
|
+
let next = barW;
|
|
793
|
+
for (let row of rows) {
|
|
794
|
+
let widths = outsideSegments(row, barW / maxTotal, fits);
|
|
795
|
+
if (widths.length === 0 || row.total <= 0) continue;
|
|
796
|
+
let cluster = widths.reduce((sum, w) => sum + w, 0) + OUTSIDE_GAP * (widths.length - 1), room = limit - (outsideStart(x0, row.totalW) - x0) - cluster - x0;
|
|
797
|
+
next = Math.min(next, room * maxTotal / row.total);
|
|
798
|
+
}
|
|
799
|
+
if (next = Math.max(floor, next), next >= barW - 0.01) break;
|
|
800
|
+
barW = next;
|
|
801
|
+
}
|
|
802
|
+
return barW;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// src/core/charts/funnel/rowsText.ts
|
|
806
|
+
function lineHeight(font) {
|
|
807
|
+
return font.size * (font.lineHeight ?? 1.2);
|
|
808
|
+
}
|
|
809
|
+
function fitText2(text, font, maxWidth, maxLines, measure, options) {
|
|
810
|
+
let fitted = fitText(text, font, maxWidth, maxLines, measure, options), lines = fitted.lines.length > 0 ? fitted.lines : [""];
|
|
811
|
+
return {
|
|
812
|
+
lines,
|
|
813
|
+
w: Math.max(1, ...lines.map((line) => measure(line, font).width)),
|
|
814
|
+
h: lines.length * lineHeight(font),
|
|
815
|
+
...fitted.title !== void 0 ? { title: fitted.title } : {}
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
var CALLOUT_GUTTER = 12, CALLOUT_MAX_LINES = 3;
|
|
819
|
+
function calloutForm(cap, dropText, pair, font, measure, options) {
|
|
820
|
+
let wide = chartString(options, "biggestDrop", { v1: dropText }), head = measure(wide, font).width <= cap ? wide : chartString(options, "dropValue", { v1: dropText }), body = fitText2(pair, font, cap, CALLOUT_MAX_LINES - 1, measure), lines = [head, ...body.lines], w = Math.max(...lines.map((line) => measure(line, font).width)), cut = body.title !== void 0 || measure(head, font).width > cap;
|
|
821
|
+
return { lines, w, h: lines.length * lineHeight(font), ...cut ? { title: `${wide} \xB7 ${pair}` } : {} };
|
|
822
|
+
}
|
|
823
|
+
function dropCallout(dropPercent, fromLabel, toLabel, font, measure, space, options) {
|
|
824
|
+
let dropText = `${MINUS}${dropPercent}%`, pair = chartString(options, "stagePair", { v1: fromLabel, v2: toLabel }), below = space.besideCaption ? fitText2(chartString(options, "biggestDrop", { v1: dropText }), font, space.captionW, 2, measure) : fitText2(`Biggest drop: ${dropText} \xB7 ${pair}`, font, space.captionW, 2, measure), natural = calloutForm(Number.POSITIVE_INFINITY, dropText, pair, font, measure, options), caps = [natural.w, space.innerW * 0.3, space.innerW * 0.24, space.innerW * 0.18].filter((cap, index) => index === 0 || cap < natural.w).map((cap) => Math.max(40, cap));
|
|
825
|
+
for (let cap of caps) {
|
|
826
|
+
let form = cap === natural.w ? natural : calloutForm(cap, dropText, pair, font, measure, options), reserve = form.w + CALLOUT_GUTTER;
|
|
827
|
+
if (form.title === void 0 && space.avail - reserve >= space.avail * 0.6)
|
|
828
|
+
return { column: form, reserve, below };
|
|
829
|
+
}
|
|
830
|
+
return { column: null, reserve: 0, below };
|
|
831
|
+
}
|
|
832
|
+
var CALLOUT_BESIDE_GAP = 10;
|
|
833
|
+
function belowCalloutCandidates(below, caption, lane, captionLineH) {
|
|
834
|
+
let size = { w: below.w, h: below.h }, laneSlot = { slot: "sourceOutbound", rect: { ...lane, ...size }, penalty: 2 };
|
|
835
|
+
if (!caption) return [laneSlot];
|
|
836
|
+
let lastLineCy = caption.y + caption.h - captionLineH / 2;
|
|
837
|
+
return [
|
|
838
|
+
{ slot: "captionBeside", rect: { x: caption.x + caption.w + CALLOUT_BESIDE_GAP, y: lastLineCy - below.h / 2, ...size }, penalty: 0 },
|
|
839
|
+
{ slot: "captionUnder", rect: { x: caption.x, y: caption.y + caption.h + LABEL_PAD, ...size }, penalty: 1 },
|
|
840
|
+
// Under a caption in the right-aligned conversion column, aligned to its right edge.
|
|
841
|
+
{ slot: "captionUnderRight", rect: { x: caption.x + caption.w - below.w, y: caption.y + caption.h + LABEL_PAD, ...size }, penalty: 1 },
|
|
842
|
+
laneSlot
|
|
843
|
+
];
|
|
844
|
+
}
|
|
845
|
+
var LANE_PAD = 3;
|
|
846
|
+
function laneY(lane, desiredCy, h, padding = LANE_PAD) {
|
|
847
|
+
let centred = desiredCy - h / 2;
|
|
848
|
+
if (centred >= lane.y && centred + h <= lane.y + lane.h) return centred;
|
|
849
|
+
let pad = Math.min(padding, Math.max(0, (lane.h - h) / 2)), top = lane.y + pad, bottom = lane.y + lane.h - h - pad;
|
|
850
|
+
return Math.min(Math.max(desiredCy - h / 2, top), Math.max(top, bottom));
|
|
851
|
+
}
|
|
852
|
+
var LABEL_PAD = 2, MAX_GAP_FRACTION = 0.55;
|
|
853
|
+
function rowGapFraction(stageCount, step, captionBandH, piBase) {
|
|
854
|
+
return stageCount <= 1 ? piBase : clamp((captionBandH + 8) / Math.max(step, 1), piBase, MAX_GAP_FRACTION);
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// src/core/charts/funnel/layout.ts
|
|
858
|
+
var CAT_LABEL_LINES = 2, MIN_LONGEST_BAR = 96, INSIDE_SIDE_PAD = 4, CONVERSION_GAP = 12, CALLOUT_INSET = 10, CALLOUT_GUTTER2 = 12, CHIP_GAP = 14, CHIP_BAR_GAP = 6, CHIP_BLOCK_GAP = 16, CHIP_RIGHT_SHARE = 0.6, CHIP_BAR = 26, CHIP_BAR_CARD = 24, CARD_PLOT_W = 440, CHIP_CAPTION_PAD = 12, CHIP_TINT_PAD = 8, CHIP_TINT_OUTSET = 6;
|
|
859
|
+
function rowOptionWarnings(options) {
|
|
860
|
+
let warnings = [];
|
|
861
|
+
return options.totalCvr === "column" && warnings.push({
|
|
862
|
+
code: "funnel-total-cvr-centered-only",
|
|
863
|
+
severity: "warn",
|
|
864
|
+
message: "funnel totalCvr:'column' requires variant:'centered' \u2014 ignored"
|
|
865
|
+
}), options.stageShade !== void 0 && warnings.push({
|
|
866
|
+
code: "funnel-stage-shade-centered-only",
|
|
867
|
+
severity: "warn",
|
|
868
|
+
message: "funnel stageShade requires variant:'centered'; row paints remain unchanged"
|
|
869
|
+
}), warnings;
|
|
870
|
+
}
|
|
871
|
+
function segmentLabelPriority(value, maxAbs, highlighted) {
|
|
872
|
+
return PRIORITY.interior + (maxAbs > 0 ? Math.round(99 * Math.abs(value) / maxAbs) : 0) + (highlighted ? PRIORITY.highlightBonus : 0);
|
|
873
|
+
}
|
|
874
|
+
function layoutFunnel(data, options = {}) {
|
|
875
|
+
if (options.variant === "centered") return layoutCenteredFunnel(data, options);
|
|
876
|
+
let warnings = rowOptionWarnings(options), theme = chartTheme(options), paletteRamp = chartPalette(theme, options.palette, warnings), size = resolveSize(options.size), measure = options.measure ?? defaultMeasurer, autoDecimals = (v) => Number.isInteger(v) || Math.abs(v) >= 100 ? 0 : 1, fmt = options.format ? formatterFromExample(options.format, options.locale?.language) : (v) => formatAutomaticNumber(v, { locale: options.locale?.language, decimals: autoDecimals(v) }), fmtPct = (rate) => {
|
|
877
|
+
let pct = rate * 100;
|
|
878
|
+
return formatAutomaticPercent(pct, smallRateDecimals(pct), !1, options.locale?.language);
|
|
879
|
+
}, highlights = new Set(resolveHighlight(options.highlight)), labelsOpt = options.labels, labelOn2 = (kind) => labelOn(options, kind);
|
|
880
|
+
if (!data || !Array.isArray(data.categories) || data.categories.length === 0)
|
|
881
|
+
throw new NormalizeError("empty-data", "categories", "funnel requires at least one stage");
|
|
882
|
+
if (!Array.isArray(data.series) || data.series.length === 0)
|
|
883
|
+
throw new NormalizeError("empty-data", "series", "funnel requires at least one series");
|
|
884
|
+
let stages = data.categories.map((c, i) => normalizeCategory(c, i)), plotted = data.series.filter((s) => s.role !== "reference");
|
|
885
|
+
if (plotted.length === 0)
|
|
886
|
+
throw new NormalizeError("empty-data", "series", "funnel requires at least one data-role series");
|
|
887
|
+
let { values, known, stageTotals, shownTotals, conversions, worstDrop, undefinedSteps, clamped } = deriveFunnel(plotted, stages, fmt, warnings), glyph = missingGlyph(theme), cells = plotted.map((series, si) => normalizeSeriesValues(series, stages, si)), formats = stages.map((_, ci) => seriesRasterFormatter(options.format, plotted.length === 1 ? values[0] : plotted.map((_2, si) => values[si][ci]), options.locale?.language, options.unit, options.target, void 0, !0)), totalRaster = seriesRasterFormatter(options.format, Object.values(stageTotals), options.locale?.language, options.unit, options.target);
|
|
888
|
+
if (!options.format) for (let format of [...formats, totalRaster]) format.spec.wholeCounts = !0;
|
|
889
|
+
let { valueText, totalFmt } = funnelValueFormats(plotted, cells, formats, totalRaster), cellText = (si, ci, value) => {
|
|
890
|
+
let label = cellMeta(cells[si][ci])?.label;
|
|
891
|
+
return label === !1 ? null : typeof label == "string" ? label.replace(/\$\{value\}/g, valueText(si, ci, value)) : valueText(si, ci, value);
|
|
892
|
+
}, occupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), margin = { ...canvasMargin(theme, size.width), ...options.margin }, legendOpts = normalizeLegendOption(options.legend, plotted.length > 1 ? { position: "top" } : void 0), legendItems = plotted.map((s, si) => ({
|
|
893
|
+
id: s.id,
|
|
894
|
+
label: s.label ?? s.id,
|
|
895
|
+
paint: seriesPaint2(s, si),
|
|
896
|
+
pattern: seriesPattern(s)
|
|
897
|
+
}));
|
|
898
|
+
if (legendOpts?.order) {
|
|
899
|
+
let rank = new Map(legendOpts.order.map((id, i) => [id, i]));
|
|
900
|
+
legendItems.sort((a, b) => (rank.get(a.id) ?? 999) - (rank.get(b.id) ?? 999));
|
|
901
|
+
}
|
|
902
|
+
let keyed = legendOpts ? { options: legendOpts, items: legendItems } : void 0, frameResult = solveFrame(
|
|
903
|
+
{
|
|
904
|
+
size,
|
|
905
|
+
margin,
|
|
906
|
+
...frameTextOptions(options),
|
|
907
|
+
footnotes: [...authoredNotes(options), ...clampedNote(clamped, options)],
|
|
908
|
+
legend: keyed,
|
|
909
|
+
theme,
|
|
910
|
+
measure
|
|
911
|
+
},
|
|
912
|
+
occupied
|
|
913
|
+
), inner = frameResult.plot, innerRight = inner.x + inner.w, tickFont = { family: theme.type.family, ...theme.type.axis }, labelFont = { family: theme.type.family, ...theme.type.label }, strongFont = { family: theme.type.family, ...theme.type.label, weight: emphasisWeight(theme) }, captionFont = { family: theme.type.family, ...theme.type.footnote }, captionStrong = { ...captionFont, weight: emphasisWeight(theme) }, tickStrong = { ...tickFont, weight: emphasisWeight(theme) }, highlightedStep = (fromId) => highlights.has(fromId), catCap = options.mode === "compact" ? Math.max(40, inner.w * 0.18) : Math.max(50, inner.w * 0.24), catMarkOf = (c) => footnoteSuffix(c.footnote, c.id, { count: authoredFootnoteCount(options), warnings }), catNameOf = (c) => c.label ?? c.id, catLabelOf = (c) => `${catNameOf(c)}${catMarkOf(c)}`, catFont = (c) => highlights.has(c.id) ? tickStrong : tickFont, withCatMark = (fitted, c) => {
|
|
914
|
+
let mark = catMarkOf(c);
|
|
915
|
+
if (!mark) return fitted;
|
|
916
|
+
let lines = [...fitted.lines];
|
|
917
|
+
return lines[lines.length - 1] = `${lines[lines.length - 1] ?? ""}${mark}`, { ...fitted, lines, w: fitted.w + measure(mark, catFont(c)).width };
|
|
918
|
+
}, fitCatName = (c, maxWidth, maxLines) => withCatMark(fitText2(catNameOf(c), catFont(c), Math.max(1, maxWidth - (catMarkOf(c) ? measure(catMarkOf(c), catFont(c)).width : 0)), maxLines, measure, { target: options.target, typeRole: "axis" }), c), catInfo = stages.map((c) => fitCatName(c, catCap, CAT_LABEL_LINES)), bandW = labelOn2("category") ? maxOf(catInfo.map((c) => c.w)) + 14 : 0, totalTexts = stages.map((c, ci) => {
|
|
919
|
+
let total = shownTotals[c.id] ?? null;
|
|
920
|
+
return total === null ? glyph : plotted.length === 1 ? cellText(0, ci, total) ?? "" : totalFmt(total);
|
|
921
|
+
}), totalSizes = totalTexts.map((t) => measure(t, strongFont)), totalReserve = labelOn2("total") ? maxOf(totalSizes.map((t) => t.width)) + 14 : 8, callout = null;
|
|
922
|
+
worstDrop && options.worstDropCallout === !0 && labelsOpt !== !1 && !(options.annotations ?? []).some((a) => a.kind === "note") && (callout = dropCallout(
|
|
923
|
+
formatAutomaticNumber((1 - worstDrop.rate) * 100, { locale: options.locale?.language, decimals: 0 }),
|
|
924
|
+
stages.find((c) => c.id === worstDrop.fromId)?.label ?? worstDrop.fromId,
|
|
925
|
+
stages.find((c) => c.id === worstDrop.toId)?.label ?? worstDrop.toId,
|
|
926
|
+
labelFont,
|
|
927
|
+
measure,
|
|
928
|
+
// Captions live right of the baseline: their width is the row right of the label band.
|
|
929
|
+
{ innerW: inner.w, avail: inner.w - bandW - totalReserve, captionW: inner.w - bandW - 8, besideCaption: labelOn2("point") },
|
|
930
|
+
options
|
|
931
|
+
));
|
|
932
|
+
let noteReserve = callout?.reserve ?? 0, steps = [
|
|
933
|
+
...conversions.map((conv) => ({ ...conv, text: conv.rate > 1 ? chartString(options, "stageIncreased") : chartString(options, "stageAdvance", { v1: fmtPct(conv.rate) }) })),
|
|
934
|
+
...undefinedSteps.map((step) => ({ ...step, text: chartString(options, "previousStageZero") }))
|
|
935
|
+
], captions = new Map(labelOn2("point") ? steps.map(({ fromId, text }) => {
|
|
936
|
+
let font = highlightedStep(fromId) ? captionStrong : captionFont, caption = { lines: [text], w: measure(text, font).width, h: lineHeight(font) };
|
|
937
|
+
return [fromId, caption];
|
|
938
|
+
}) : []), convColW = Math.max(0, maxOf([...captions.values()].map((c) => c.w))), convRight = innerRight - noteReserve - 2, x0 = inner.x + bandW, rowsTop = inner.y + 4, authoredKinds = new Set((options.annotations ?? []).map((a) => a.kind)), arrowBandH = authoredKinds.has("diff") ? Math.ceil(lineHeight(labelFont) + 14) : 0, annotationBandH = arrowBandH + (authoredKinds.has("delta") || authoredKinds.has("abs") ? Math.ceil(lineHeight(labelFont) + 10) : 0), rowsSpace = inner.y + Math.max(14, inner.h) - 4 - annotationBandH - rowsTop, rowsH = Math.max(10, rowsSpace), rowsBottom = rowsTop + rowsH, convProbe = measure(chartString(options, "advanceProbe"), captionFont), bf = options.bandFraction ?? 0.68, piBase = 1 - bf, stepApprox = rowsH / stages.length, maxTotal = Math.max(0, maxOf(known)), maxAbsValue = Math.max(0, maxOf(values.flat().map((v) => Math.abs(v ?? 0)))), worstCaption = callout && !callout.column && labelOn2("point") ? captions.get(worstDrop.fromId) : void 0, calloutStackH = worstCaption ? callout.below.h + LABEL_PAD : 0, shownCaptions = [...captions.values()].map((c) => ({ ...c, h: c.h + (c === worstCaption ? calloutStackH : 0) })), multi = plotted.length > 1, captionOnlyBandH = Math.max(convProbe.height, maxOf(shownCaptions.map((c) => c.h))), totalAnnotationGap = (options.annotations ?? []).some((ann) => (ann.kind === "delta" || ann.kind === "abs") && totalAnchorStage(ann.at) >= 0) ? 2 * (measure("0", labelFont).height + 6) : 0, captionBandH = captions.size > 0 || totalAnnotationGap > 0 ? Math.max(captionOnlyBandH, totalAnnotationGap) : 0, pi = captionBandH > 0 ? rowGapFraction(stages.length, stepApprox, captionBandH, piBase) : piBase;
|
|
939
|
+
options.bandFraction !== void 0 && pi > piBase + 1e-6 && warnings.push({
|
|
940
|
+
code: "funnel-band-fraction-overridden",
|
|
941
|
+
severity: "warn",
|
|
942
|
+
message: `bandFraction ${bf} leaves the step captions no room at this height; the bars take ${Math.round((1 - pi) * 100)}% of each row. Give the chart more height, or drop bandFraction`
|
|
943
|
+
});
|
|
944
|
+
let chipMode = multi && labelOn2("segment"), chips = chipMode ? chipColumns() : void 0, barRoom = Math.max(10, inner.w - bandW - totalReserve - noteReserve), chipsRight = chips !== void 0 && barRoom - chips.blockW - CHIP_BLOCK_GAP >= CHIP_RIGHT_SHARE * barRoom, chipPerLine = 1, chipLines = 0, chipUnderH = 0, setChipLines = (reserve) => {
|
|
945
|
+
chipPerLine = chips === void 0 ? 1 : chipsRight ? plotted.length : Math.max(1, Math.floor((innerRight - noteReserve - reserve - 2 - x0 + CHIP_GAP) / chips.pitch)), chipLines = chips === void 0 || chipsRight ? 0 : Math.ceil(plotted.length / chipPerLine), chipUnderH = chipLines > 0 ? CHIP_BAR_GAP + chipLines * chips.lineH : 0;
|
|
946
|
+
};
|
|
947
|
+
setChipLines(0);
|
|
948
|
+
let chipIsRedundant = (ci, drawn, text) => drawn === 1 && labelOn2("total") && stageTotals[stages[ci].id] != null && text === totalTexts[ci], chipsOnRow = (ci) => {
|
|
949
|
+
if (chipLines === 0) return !1;
|
|
950
|
+
let drawn = plotted.filter((_s, si) => (values[si][ci] ?? 0) > 0).length;
|
|
951
|
+
return drawn !== 1 ? drawn > 1 : plotted.some((_s, si) => {
|
|
952
|
+
let value = values[si][ci];
|
|
953
|
+
if (value == null || value <= 0) return !1;
|
|
954
|
+
let text = cellText(si, ci, value);
|
|
955
|
+
return !!text && !chipIsRedundant(ci, drawn, text);
|
|
956
|
+
});
|
|
957
|
+
}, band = chipRowBand(), underH = (ci) => chipsOnRow(ci) ? chipUnderH : 0, inGap = band.step - band.bandwidth - chipUnderH >= captionBandH + 2 * LABEL_PAD, convReserve = !inGap && convColW > 0 ? convColW + CONVERSION_GAP : 0;
|
|
958
|
+
chipMode && chipLines > 0 && convReserve > 0 && (setChipLines(convReserve), band = chipRowBand());
|
|
959
|
+
let barW0 = Math.max(10, inner.w - bandW - totalReserve - noteReserve - convReserve), chipLimit = innerRight - noteReserve - convReserve - 2, chipX0 = chips === void 0 ? x0 : chipsRight ? chipLimit - chips.blockW : x0, fitsInside = (textW, segmentW, first2) => textW + 2 * INSIDE_SIDE_PAD + (first2 ? 2 : 0) <= segmentW && labelFont.size <= band.bandwidth && segmentW >= INSIDE_MIN_W && band.bandwidth >= INSIDE_MIN_H, barW = chipMode ? Math.max(10, chipsRight ? barW0 - chips.blockW - CHIP_BLOCK_GAP : barW0) : barWidthForOutsideValues({
|
|
960
|
+
barW: barW0,
|
|
961
|
+
x0,
|
|
962
|
+
limit: innerRight - noteReserve - convReserve - 2,
|
|
963
|
+
maxTotal,
|
|
964
|
+
fits: fitsInside,
|
|
965
|
+
rows: stages.map((_c, ci) => ({
|
|
966
|
+
total: known[ci],
|
|
967
|
+
totalW: labelOn2("total") ? totalSizes[ci].width : 0,
|
|
968
|
+
segments: multi && labelOn2("segment") ? plotted.flatMap((_s, si) => {
|
|
969
|
+
let value = values[si][ci] ?? null, text = value === null ? null : cellText(si, ci, value);
|
|
970
|
+
return text === null ? [] : [{ value, textW: measure(text, labelFont).width }];
|
|
971
|
+
}) : []
|
|
972
|
+
}))
|
|
973
|
+
}), xScale = linearScale([0, maxTotal || 1], [x0, x0 + barW]), plot = { x: x0, y: rowsTop, w: barW, h: rowsH }, rowLanes = stages.map((_stage, ci) => {
|
|
974
|
+
let y = ci === 0 ? rowsTop : band.position(ci), bottom = ci + 1 < stages.length ? band.position(ci + 1) : rowsBottom;
|
|
975
|
+
return { x: inner.x, y, w: inner.w, h: Math.max(bottom - y, band.bandwidth) };
|
|
976
|
+
}), nodes = [...frameResult.nodes], marks = { rows: [] }, labelRequests = [];
|
|
977
|
+
stages.forEach((cat, ci) => {
|
|
978
|
+
if (!highlights.has(cat.id)) return;
|
|
979
|
+
let chipPad = Math.max(0, Math.min(CHIP_TINT_PAD, (band.step - band.bandwidth - chipUnderH - captionOnlyBandH) / 2 - LABEL_PAD)), tintTop = band.position(ci) - chipPad, tintBottom = ci + 1 < stages.length ? band.position(ci + 1) - chipPad - LABEL_PAD : band.position(ci) + band.bandwidth + underH(ci) + chipPad, outset = Math.min(CHIP_TINT_OUTSET, inner.x / 2);
|
|
980
|
+
nodes.push({
|
|
981
|
+
t: "rect",
|
|
982
|
+
id: `rowTint:${cat.id}`,
|
|
983
|
+
rect: { x: inner.x - outset, y: tintTop, w: inner.w + 2 * outset, h: tintBottom - tintTop },
|
|
984
|
+
fill: { token: "others" },
|
|
985
|
+
owner: { categoryId: cat.id },
|
|
986
|
+
part: "rowTint"
|
|
987
|
+
});
|
|
988
|
+
});
|
|
989
|
+
let rowEnds = [], rowValueEnd = /* @__PURE__ */ new Map(), cumEnd = stages.map(() => plotted.map(() => x0));
|
|
990
|
+
function pushSegmentValues(row) {
|
|
991
|
+
let { cat, segLabs, rowCy, rowEndX, lane } = row;
|
|
992
|
+
if (segLabs.length === 0) return;
|
|
993
|
+
if (segLabs.some((l) => !l.fits)) for (let l of segLabs) l.fits = !1;
|
|
994
|
+
let outs = segLabs.filter((l) => !l.fits), outXs = /* @__PURE__ */ new Map(), totalW = labelOn2("total") ? row.totalWidth : 0, cursor = outsideStart(rowEndX, totalW), queue = (l) => {
|
|
995
|
+
outXs.set(l, cursor), cursor += outsideWidth(l.w, totalW) + OUTSIDE_GAP;
|
|
996
|
+
};
|
|
997
|
+
outs.forEach(queue), outs.length > 0 && rowValueEnd.set(cat.id, cursor - OUTSIDE_GAP), warnSpreadOverflow(warnings, cursor - OUTSIDE_GAP <= innerRight - 2, "displaced segment labels exceed their row band even after spreading \u2014 labels stay bounded but overlap; fewer segments or a larger canvas fixes it"), segLabs.filter((l) => l.fits).forEach(queue), segLabs.forEach((l) => {
|
|
998
|
+
let candidates = [{
|
|
999
|
+
slot: "outsideRight",
|
|
1000
|
+
rect: { x: outXs.get(l), y: laneY(lane, rowCy, l.h), w: outsideWidth(l.w, totalW), h: l.h },
|
|
1001
|
+
penalty: 2,
|
|
1002
|
+
...totalW > 0 ? { swatch: l.insidePaint } : {}
|
|
1003
|
+
}];
|
|
1004
|
+
l.fits && candidates.unshift({
|
|
1005
|
+
slot: "insideCenter",
|
|
1006
|
+
// Pad 0: an inside value belongs on its segment, so it is pushed
|
|
1007
|
+
// into the lane only far enough to stay out of the next row.
|
|
1008
|
+
rect: { x: l.cx - l.w / 2, y: laneY(lane, rowCy, l.h, 0), w: l.w, h: l.h },
|
|
1009
|
+
penalty: 0,
|
|
1010
|
+
insideFill: l.fillCss,
|
|
1011
|
+
insidePaint: l.insidePaint,
|
|
1012
|
+
insidePattern: l.insidePattern
|
|
1013
|
+
}), labelRequests.push({
|
|
1014
|
+
id: `segment:${cat.id}:${l.sid}`,
|
|
1015
|
+
kind: "segment",
|
|
1016
|
+
owner: { categoryId: cat.id, seriesId: l.sid },
|
|
1017
|
+
text: l.text,
|
|
1018
|
+
lines: [l.text],
|
|
1019
|
+
font: labelFont,
|
|
1020
|
+
priority: l.priority,
|
|
1021
|
+
// One drawn segment means the segment value IS the stage total, and
|
|
1022
|
+
// the bold total at the bar end already prints it, unless a missing
|
|
1023
|
+
// value left that total unknown.
|
|
1024
|
+
...row.drawn === 1 && labelOn2("total") && stageTotals[cat.id] != null && l.text === totalTexts[stages.findIndex((stage) => stage.id === cat.id)] ? { redundant: !0, suppressedAs: "redundant" } : {},
|
|
1025
|
+
candidates
|
|
1026
|
+
});
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
function pushChips(cat, ci, rowChips, drawn) {
|
|
1030
|
+
if (!chips || rowChips.length === 0) return;
|
|
1031
|
+
let lane = rowLanes[ci], top = band.position(ci), font = highlights.has(cat.id) ? strongFont : labelFont, hasPrintedChip = !1;
|
|
1032
|
+
for (let chip of rowChips) {
|
|
1033
|
+
let redundant = chipIsRedundant(ci, drawn, chip.text);
|
|
1034
|
+
hasPrintedChip ||= !redundant;
|
|
1035
|
+
let t = measure(chip.text, font), line = chipsRight ? 0 : Math.floor(chip.si / chipPerLine), col = chipsRight ? chip.si : chip.si % chipPerLine, cy = chipsRight ? top + band.bandwidth / 2 : top + band.bandwidth + CHIP_BAR_GAP + (line + 0.5) * chips.lineH, y = laneY(lane, cy, t.height, 0), fits = chipsRight || y >= top + band.bandwidth;
|
|
1036
|
+
labelRequests.push({
|
|
1037
|
+
id: `segment:${cat.id}:${chip.sid}`,
|
|
1038
|
+
kind: "segment",
|
|
1039
|
+
owner: { categoryId: cat.id, seriesId: chip.sid },
|
|
1040
|
+
text: chip.text,
|
|
1041
|
+
lines: [chip.text],
|
|
1042
|
+
font,
|
|
1043
|
+
priority: segmentLabelPriority(chip.value, maxAbsValue, highlights.has(chip.sid) || highlights.has(cat.id)),
|
|
1044
|
+
...redundant ? { redundant: !0, suppressedAs: "redundant" } : {},
|
|
1045
|
+
candidates: fits ? [{
|
|
1046
|
+
slot: chipsRight ? "chipColumn" : "chipLine",
|
|
1047
|
+
rect: { x: chipX0 + col * chips.pitch, y, w: t.width + SWATCH_RESERVE, h: t.height },
|
|
1048
|
+
penalty: 0,
|
|
1049
|
+
swatch: chip.paint
|
|
1050
|
+
}] : []
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
if (hasPrintedChip) {
|
|
1054
|
+
let end = chipX0 + Math.min(plotted.length, chipPerLine) * chips.pitch - CHIP_GAP;
|
|
1055
|
+
rowValueEnd.set(cat.id, Math.max(rowValueEnd.get(cat.id) ?? end, end));
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
stages.forEach((cat, ci) => {
|
|
1059
|
+
let ry = band.position(ci), bw = band.bandwidth, rowCy = ry + bw / 2, cum = 0, segRecs = [], segLabs = [], rowChips = [];
|
|
1060
|
+
plotted.forEach((s, si) => {
|
|
1061
|
+
let v = values[si][ci] ?? null;
|
|
1062
|
+
if (v === null) {
|
|
1063
|
+
cumEnd[ci][si] = xScale(cum);
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
let sx = xScale(cum), ex = xScale(cum + v);
|
|
1067
|
+
cum += v, cumEnd[ci][si] = ex;
|
|
1068
|
+
let w = ex - sx;
|
|
1069
|
+
if (v === 0) return;
|
|
1070
|
+
let rect = { x: sx, y: ry, w, h: bw }, nodeId = `mark:${cat.id}:${s.id}`, segmentPaint = seriesPaint2(s, si, ci), sep = othersSeparation(segmentPaint, theme);
|
|
1071
|
+
nodes.push({
|
|
1072
|
+
t: "rect",
|
|
1073
|
+
id: nodeId,
|
|
1074
|
+
rect,
|
|
1075
|
+
fill: segmentPaint,
|
|
1076
|
+
pattern: seriesPattern(s),
|
|
1077
|
+
...sep ? { stroke: sep.stroke, strokeWidth: sep.strokeWidth } : {},
|
|
1078
|
+
...isOthersFill(segmentPaint) ? { separation: { fill: segmentPaint, backing: { token: "background" } } } : {},
|
|
1079
|
+
owner: { categoryId: cat.id, seriesId: s.id },
|
|
1080
|
+
part: "segment",
|
|
1081
|
+
display: { value: valueText(si, ci, v) }
|
|
1082
|
+
}), occupied.claim(rect, "mark", { categoryId: cat.id, seriesId: s.id }), segRecs.push({ id: s.id, rect, nodeId });
|
|
1083
|
+
let text = cellText(si, ci, v);
|
|
1084
|
+
if (chipMode && text)
|
|
1085
|
+
rowChips.push({ si, sid: s.id, text, paint: segmentPaint, value: v });
|
|
1086
|
+
else if (multi && labelOn2("segment") && text) {
|
|
1087
|
+
let t = measure(text, labelFont);
|
|
1088
|
+
segLabs.push({
|
|
1089
|
+
sid: s.id,
|
|
1090
|
+
text,
|
|
1091
|
+
w: t.width,
|
|
1092
|
+
h: t.height,
|
|
1093
|
+
rect,
|
|
1094
|
+
cx: sx + w / 2,
|
|
1095
|
+
fits: fitsInside(t.width, w, segLabs.length === 0),
|
|
1096
|
+
fillCss: effectiveFill(seriesCss(s, si, ci), seriesPattern(s), theme),
|
|
1097
|
+
insidePaint: seriesPaint2(s, si, ci),
|
|
1098
|
+
insidePattern: seriesPattern(s),
|
|
1099
|
+
priority: segmentLabelPriority(v, maxAbsValue, highlights.has(s.id) || highlights.has(cat.id))
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
1103
|
+
let rowEndX = xScale(known[ci]);
|
|
1104
|
+
rowEnds.push(rowEndX), rowValueEnd.set(cat.id, labelOn2("total") ? rowEndX + 6 + totalSizes[ci].width : rowEndX), marks.rows.push({
|
|
1105
|
+
categoryId: cat.id,
|
|
1106
|
+
rect: { x: x0, y: ry, w: Math.max(rowEndX - x0, 0), h: bw },
|
|
1107
|
+
lane: rowLanes[ci],
|
|
1108
|
+
segments: segRecs
|
|
1109
|
+
});
|
|
1110
|
+
let totText = totalTexts[ci], totSize = totalSizes[ci], lane = rowLanes[ci];
|
|
1111
|
+
if (labelOn2("total") && totText) {
|
|
1112
|
+
let slotAt = (desiredCy, slot, penalty) => ({
|
|
1113
|
+
slot,
|
|
1114
|
+
rect: {
|
|
1115
|
+
x: rowEndX + 6,
|
|
1116
|
+
y: laneY(lane, desiredCy, totSize.height),
|
|
1117
|
+
w: totSize.width,
|
|
1118
|
+
h: totSize.height
|
|
1119
|
+
},
|
|
1120
|
+
penalty
|
|
1121
|
+
});
|
|
1122
|
+
labelRequests.push({
|
|
1123
|
+
id: `total:${cat.id}`,
|
|
1124
|
+
kind: "total",
|
|
1125
|
+
owner: { categoryId: cat.id },
|
|
1126
|
+
text: totText,
|
|
1127
|
+
lines: [totText],
|
|
1128
|
+
font: strongFont,
|
|
1129
|
+
priority: PRIORITY.total + (highlights.has(cat.id) ? PRIORITY.highlightBonus : 0),
|
|
1130
|
+
candidates: [
|
|
1131
|
+
slotAt(rowCy, "outsideEnd", 0),
|
|
1132
|
+
slotAt(rowCy - totSize.height - 2, "outsideEndUp", 1),
|
|
1133
|
+
slotAt(rowCy + totSize.height + 2, "outsideEndDown", 2)
|
|
1134
|
+
]
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
if (labelOn2("category")) {
|
|
1138
|
+
let lanes = Math.max(1, Math.floor(lane.h / lineHeight(catFont(cat)))), info = lanes >= catInfo[ci].lines.length ? catInfo[ci] : fitCatName(cat, bandW - 14, lanes);
|
|
1139
|
+
labelRequests.push({
|
|
1140
|
+
id: `category:${cat.id}`,
|
|
1141
|
+
kind: "category",
|
|
1142
|
+
owner: { categoryId: cat.id },
|
|
1143
|
+
text: catLabelOf(cat),
|
|
1144
|
+
lines: info.lines,
|
|
1145
|
+
...info.title ? { title: info.title } : {},
|
|
1146
|
+
font: catFont(cat),
|
|
1147
|
+
priority: PRIORITY.grandTotal,
|
|
1148
|
+
candidates: [
|
|
1149
|
+
{
|
|
1150
|
+
slot: "left",
|
|
1151
|
+
// names stand left-aligned at the plot edge.
|
|
1152
|
+
rect: { x: inner.x, y: laneY(lane, rowCy, info.h), w: info.w, h: info.h },
|
|
1153
|
+
penalty: 0
|
|
1154
|
+
}
|
|
1155
|
+
]
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
chipMode ? pushChips(cat, ci, rowChips, segRecs.length) : pushSegmentValues({
|
|
1159
|
+
cat,
|
|
1160
|
+
segLabs,
|
|
1161
|
+
drawn: segRecs.length,
|
|
1162
|
+
ry,
|
|
1163
|
+
bw,
|
|
1164
|
+
rowCy,
|
|
1165
|
+
rowEndX,
|
|
1166
|
+
lane,
|
|
1167
|
+
totalWidth: totSize.width
|
|
1168
|
+
});
|
|
1169
|
+
});
|
|
1170
|
+
let worstCaptionRect, captionRects = [];
|
|
1171
|
+
if (labelOn2("point") && steps.forEach((conv) => {
|
|
1172
|
+
let ci = stages.findIndex((c) => c.id === conv.fromId);
|
|
1173
|
+
if (ci < 0 || ci + 1 >= stages.length) return;
|
|
1174
|
+
let gapTop = band.position(ci) + band.bandwidth + (inGap ? underH(ci) : 0), gapBot = band.position(ci + 1), gapCy = (gapTop + gapBot) / 2, caption = captions.get(conv.fromId), text = caption.lines.join(" "), t = { width: caption.w, height: caption.h }, centred = { x: inGap ? x0 : convRight - t.width, y: gapCy - t.height / 2, w: t.width, h: t.height }, stacked = caption === worstCaption && calloutStackH > 0 ? { ...centred, y: gapCy - (t.height + calloutStackH) / 2 } : void 0;
|
|
1175
|
+
caption === worstCaption && (worstCaptionRect = stacked ?? centred), captionRects.push(stacked ?? centred), labelRequests.push({
|
|
1176
|
+
id: `conv:${conv.fromId}:${conv.toId}`,
|
|
1177
|
+
claimId: `funnel:conv:${conv.fromId}:${conv.toId}`,
|
|
1178
|
+
kind: "point",
|
|
1179
|
+
role: composedTextRole(text),
|
|
1180
|
+
owner: { categoryId: conv.fromId },
|
|
1181
|
+
text,
|
|
1182
|
+
lines: caption.lines,
|
|
1183
|
+
...caption.title ? { title: caption.title } : {},
|
|
1184
|
+
font: highlightedStep(conv.fromId) ? captionStrong : captionFont,
|
|
1185
|
+
typeRole: "footnote",
|
|
1186
|
+
priority: PRIORITY.extreme + (highlights.has(conv.fromId) ? PRIORITY.highlightBonus : 0),
|
|
1187
|
+
candidates: [
|
|
1188
|
+
...stacked ? [{ slot: "conversionColumnStacked", rect: stacked, penalty: 0 }] : [],
|
|
1189
|
+
{ slot: "conversionColumn", rect: centred, penalty: 0 }
|
|
1190
|
+
]
|
|
1191
|
+
});
|
|
1192
|
+
}), callout && worstDrop) {
|
|
1193
|
+
let ci = stages.findIndex((c) => c.id === worstDrop.fromId), lane = rowLanes[ci], rowCy = band.position(ci) + band.bandwidth / 2, shown = callout.column ?? callout.below, candidates = [];
|
|
1194
|
+
if (callout.column) {
|
|
1195
|
+
let column = callout.column, far = Math.max(inner.x + 2, innerRight - column.w - 2), near = clamp(rowValueEnd.get(worstDrop.fromId) + CALLOUT_GUTTER2, inner.x + 2, far), rect = (x) => ({ x, y: laneY(lane, rowCy, column.h), w: column.w, h: column.h }), nearClear = far - near > 1 && !captionRects.some((r) => rectsOverlap(r, rect(near), 2));
|
|
1196
|
+
nearClear && candidates.push({ slot: "sourceOuter", rect: rect(near), penalty: 0 }), candidates.push({ slot: nearClear ? "sourceOuterFar" : "sourceOuter", rect: rect(far), penalty: nearClear ? 1 : 0 });
|
|
1197
|
+
} else
|
|
1198
|
+
candidates.push(...belowCalloutCandidates(callout.below, worstCaptionRect, {
|
|
1199
|
+
x: clamp(rowEnds[ci] + 8, x0 + 4, Math.max(x0 + 4, innerRight - callout.below.w - 2)),
|
|
1200
|
+
y: Math.max(lane.y, lane.y + lane.h - callout.below.h - 3)
|
|
1201
|
+
}, lineHeight(captionFont)));
|
|
1202
|
+
labelRequests.push({
|
|
1203
|
+
id: "annotation:note-worst-drop",
|
|
1204
|
+
kind: "annotation",
|
|
1205
|
+
owner: { categoryId: worstDrop.fromId, annotationId: "note-worst-drop" },
|
|
1206
|
+
text: shown.lines.join(" "),
|
|
1207
|
+
lines: shown.lines,
|
|
1208
|
+
...shown.title ? { title: shown.title } : {},
|
|
1209
|
+
font: labelFont,
|
|
1210
|
+
priority: PRIORITY.extreme,
|
|
1211
|
+
candidates
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
for (let request of labelRequests) {
|
|
1215
|
+
let categoryId = request.owner.categoryId;
|
|
1216
|
+
if (categoryId === void 0) continue;
|
|
1217
|
+
let ci = stages.findIndex((stage) => stage.id === categoryId);
|
|
1218
|
+
ci < 0 || (request.candidates = request.candidates.filter(
|
|
1219
|
+
(candidate) => rectContains(rowLanes[ci], candidate.rect)
|
|
1220
|
+
));
|
|
1221
|
+
}
|
|
1222
|
+
stages.forEach((stage, ci) => {
|
|
1223
|
+
let lane = rowLanes[ci];
|
|
1224
|
+
occupied.claim(
|
|
1225
|
+
{ x: lane.x, y: lane.y + LANE_PAD, w: lane.w, h: Math.max(1, lane.h - 2 * LANE_PAD) },
|
|
1226
|
+
"mark",
|
|
1227
|
+
{ categoryId: stage.id },
|
|
1228
|
+
"funnel-row-lane"
|
|
1229
|
+
);
|
|
1230
|
+
});
|
|
1231
|
+
let solveCtx = labelCtx(theme, size, options, {
|
|
1232
|
+
measure,
|
|
1233
|
+
plot,
|
|
1234
|
+
labelPad: LABEL_PAD
|
|
1235
|
+
}), solved = solveLabels(labelRequests, occupied, solveCtx);
|
|
1236
|
+
pushAll(warnings, solved.warnings);
|
|
1237
|
+
for (let label of solved.placed)
|
|
1238
|
+
label.hidden !== "collision" || label.owner.categoryId === void 0 || warnings.push({
|
|
1239
|
+
code: "funnel-label-hidden",
|
|
1240
|
+
severity: "warn",
|
|
1241
|
+
message: `label '${label.id}' could not stay in row '${label.owner.categoryId}' without a collision \u2014 hidden`,
|
|
1242
|
+
owner: label.owner
|
|
1243
|
+
});
|
|
1244
|
+
let resolve = (ref) => {
|
|
1245
|
+
let norm = typeof ref == "string" ? { categoryId: ref, edge: "total" } : ref;
|
|
1246
|
+
if (!("categoryId" in norm) || !norm.categoryId) return null;
|
|
1247
|
+
let ci = stages.findIndex((c) => c.id === norm.categoryId);
|
|
1248
|
+
if (ci < 0) return null;
|
|
1249
|
+
let cat = stages[ci], rowCy = band.position(ci) + band.bandwidth / 2, value = stageTotals[cat.id] ?? null, xEnd = xScale(known[ci]);
|
|
1250
|
+
if ("seriesId" in norm && norm.seriesId) {
|
|
1251
|
+
let si = plotted.findIndex((s) => s.id === norm.seriesId);
|
|
1252
|
+
if (si < 0) return null;
|
|
1253
|
+
value = values[si][ci] ?? null, xEnd = cumEnd[ci][si];
|
|
1254
|
+
}
|
|
1255
|
+
if (value === null) return null;
|
|
1256
|
+
let edge = norm.edge ?? "total", underBar = totalAnchorStage(ref) === ci;
|
|
1257
|
+
return {
|
|
1258
|
+
x: edge === "start" ? x0 : xEnd,
|
|
1259
|
+
y: underBar ? band.position(ci) + band.bandwidth : rowCy,
|
|
1260
|
+
...underBar ? { comparisonPoint: { x: xEnd, y: rowCy } } : {},
|
|
1261
|
+
// A callout leads onto its own bar, inside the bar end, so it cannot
|
|
1262
|
+
// read as pointing at the row above.
|
|
1263
|
+
calloutPoint: {
|
|
1264
|
+
x: edge === "start" ? x0 : Math.max(x0 + 1, xEnd - Math.min(CALLOUT_INSET, (xEnd - x0) / 2)),
|
|
1265
|
+
y: band.position(ci) + Math.min(CALLOUT_INSET, band.bandwidth / 4)
|
|
1266
|
+
},
|
|
1267
|
+
value,
|
|
1268
|
+
date: cat.date,
|
|
1269
|
+
label: cat.label,
|
|
1270
|
+
owner: { categoryId: cat.id, ...norm.seriesId ? { seriesId: norm.seriesId } : {} }
|
|
1271
|
+
};
|
|
1272
|
+
}, userAnnotations = options.annotations ?? [], annotationOccupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), annotationSeed = occupied.snapshot().filter((claim) => claim.part !== "funnel-row-lane");
|
|
1273
|
+
for (let claim of annotationSeed)
|
|
1274
|
+
annotationOccupied.claim(claim.rect, claim.kind, claim.owner, claim.part);
|
|
1275
|
+
for (let ann of userAnnotations) {
|
|
1276
|
+
let ci = ann.kind === "delta" || ann.kind === "abs" ? totalAnchorStage(ann.at) : -1;
|
|
1277
|
+
if (ci < 0) continue;
|
|
1278
|
+
let endX = xScale(known[ci]);
|
|
1279
|
+
annotationOccupied.claim(
|
|
1280
|
+
{ x: endX, y: band.position(ci), w: innerRight - endX, h: band.bandwidth },
|
|
1281
|
+
"mark",
|
|
1282
|
+
{ categoryId: stages[ci].id },
|
|
1283
|
+
"funnel-value-column"
|
|
1284
|
+
);
|
|
1285
|
+
}
|
|
1286
|
+
let annResult = runAnnotatePass({
|
|
1287
|
+
annotations: userAnnotations,
|
|
1288
|
+
valueAxis: "horizontal",
|
|
1289
|
+
defaultSpan: stages.length > 1 ? { from: stages[0].id, to: stages.at(-1).id } : void 0,
|
|
1290
|
+
calloutLeaderWidths: 3,
|
|
1291
|
+
comparisonLayout: funnelComparisonLayout(arrowBandH > 0 ? rowsBottom + annotationBandH - 5 : void 0),
|
|
1292
|
+
resolve,
|
|
1293
|
+
occupied: annotationOccupied,
|
|
1294
|
+
plot: { ...plot, h: plot.h + annotationBandH },
|
|
1295
|
+
theme,
|
|
1296
|
+
measure,
|
|
1297
|
+
format: options.format,
|
|
1298
|
+
locale: options.locale?.language,
|
|
1299
|
+
strings: options.strings,
|
|
1300
|
+
solveCtx
|
|
1301
|
+
});
|
|
1302
|
+
pushAll(warnings, annResult.warnings);
|
|
1303
|
+
let annotationClaims = annotationOccupied.snapshot().slice(annotationSeed.length).filter((claim) => claim.part !== "funnel-value-column");
|
|
1304
|
+
for (let claim of annotationClaims)
|
|
1305
|
+
occupied.claim(claim.rect, claim.kind, claim.owner, claim.part);
|
|
1306
|
+
let autoNoteAnnotations = callout && worstDrop ? [{
|
|
1307
|
+
id: "note-worst-drop",
|
|
1308
|
+
kind: "note",
|
|
1309
|
+
computedText: (callout.column ?? callout.below).lines.join(" "),
|
|
1310
|
+
nodeIds: [],
|
|
1311
|
+
labelId: "annotation:note-worst-drop"
|
|
1312
|
+
}] : [], allLabels = [...solved.placed, ...annResult.labels];
|
|
1313
|
+
for (let label of allLabels)
|
|
1314
|
+
label.id.startsWith("conv:") && !highlightedStep(label.owner.categoryId ?? "") && (label.ink = { token: "inkMuted" });
|
|
1315
|
+
pushAll(nodes, annResult.nodes), pushAll(nodes, labelsToNodes(
|
|
1316
|
+
theme,
|
|
1317
|
+
allLabels,
|
|
1318
|
+
(l) => l.kind === "total" ? strongFont : l.id.startsWith("conv:") ? highlightedStep(l.owner.categoryId ?? "") ? captionStrong : captionFont : l.kind === "category" ? highlights.has(l.owner.categoryId ?? "") ? tickStrong : tickFont : chipMode && l.kind === "segment" && highlights.has(l.owner.categoryId ?? "") ? strongFont : labelFont,
|
|
1319
|
+
nodes
|
|
1320
|
+
));
|
|
1321
|
+
let first = stages[0], last = stages[stages.length - 1], a11yParts = stages.map((c, ci) => {
|
|
1322
|
+
let total = shownTotals[c.id] ?? null, p = `${c.label} ${total === null ? chartString(options, "missing") : totalFmt(total)}`, conv = conversions.find((cv) => cv.fromId === c.id);
|
|
1323
|
+
if (conv) {
|
|
1324
|
+
let to = stages[ci + 1];
|
|
1325
|
+
p += conv.rate > 1 ? chartString(options, "funnelIncreaseDesc", { v1: c.label, v2: to.label }) : chartString(options, "funnelConversionDesc", { v1: c.label, v2: to.label, v3: fmtPct(conv.rate) });
|
|
1326
|
+
}
|
|
1327
|
+
return p;
|
|
1328
|
+
}), labelH = Math.max(maxOf(catInfo.map((label) => label.h)), maxOf(totalSizes.map((label) => label.height))), chipLastH = (barH) => Math.max(barH + (totalAnnotationGap > 0 ? totalAnnotationGap / 2 + 2 * LANE_PAD : 0), labelH + 2 * LANE_PAD) + (chipsOnRow(stages.length - 1) ? chipUnderH : 0), chipCap = inner.w < CARD_PLOT_W ? CHIP_BAR_CARD : CHIP_BAR, chipCaptionGap = (pad) => captions.size > 0 ? maxOf(shownCaptions.map((c) => c.h)) + 2 * pad : 2 * pad, naturalRowsH = (stages.length - 1) * Math.max(chipCap + chipUnderH + chipCaptionGap(CHIP_CAPTION_PAD), labelH + 2 * LABEL_PAD) + chipLastH(chipCap), chipMinBar = Math.min(chipCap, Math.max(10, labelH)), chipMinimumRowsH = (stages.length - 1) * Math.max(chipMinBar + chipUnderH + LABEL_PAD, labelH + 2 * LABEL_PAD) + chipLastH(chipMinBar), paintWarningRules = [];
|
|
1329
|
+
return pushAll(warnings, rectSeriesAdjacentWarnings(nodes, (paint) => paintColor(theme, paint), "horizontal", highlights, theme, { rules: paintWarningRules, before: warnings.filter((warning) => !["pie-ramp-crowded", "likert-ramp-invisible", "band-lightness-insufficient", "series-adjacent-similar", "highlight-reads-as-loss"].includes(warning.code)).length })), {
|
|
1330
|
+
type: "funnel",
|
|
1331
|
+
size,
|
|
1332
|
+
sizing: rowSizing("funnel", size, {
|
|
1333
|
+
chromeH: size.height - rowsSpace,
|
|
1334
|
+
minimumRowsH: chipMinimumRowsH,
|
|
1335
|
+
naturalRowsH,
|
|
1336
|
+
// The frame around the rows, the stage-name column, the longest bar
|
|
1337
|
+
// at its shortest readable length, and the stage totals after it.
|
|
1338
|
+
minWidth: size.width - inner.w + bandW + MIN_LONGEST_BAR + totalReserve
|
|
1339
|
+
}),
|
|
1340
|
+
plot,
|
|
1341
|
+
scene: withSegmentSeams(nodes, theme),
|
|
1342
|
+
labels: allLabels,
|
|
1343
|
+
axes: [
|
|
1344
|
+
{
|
|
1345
|
+
axis: "y",
|
|
1346
|
+
ticks: stages.map((c, ci) => ({
|
|
1347
|
+
at: c.id,
|
|
1348
|
+
pos: band.position(ci) + band.bandwidth / 2,
|
|
1349
|
+
labelId: labelOn2("category") ? `category:${c.id}` : void 0
|
|
1350
|
+
}))
|
|
1351
|
+
}
|
|
1352
|
+
],
|
|
1353
|
+
annotations: [...annResult.placed, ...autoNoteAnnotations],
|
|
1354
|
+
legend: frameResult.legend,
|
|
1355
|
+
frame: frameResult.frame,
|
|
1356
|
+
marks,
|
|
1357
|
+
derived: { stageTotals, conversions, ...worstDrop ? { worstDrop } : {} },
|
|
1358
|
+
a11y: {
|
|
1359
|
+
title: accessibleTitle(options.title, chartString(options, "funnelTitle", { v1: first.label, v2: last.label })),
|
|
1360
|
+
counts: [structureCount("stages", stages.length, chartString(options, "stagesCount", { v1: stages.length, v2: stages.length === 1 ? "" : "s" }))],
|
|
1361
|
+
desc: chartString(options, "funnelDesc", { v1: stages.length, v2: stages.length === 1 ? "" : "s", v3: a11yParts.join("; ") })
|
|
1362
|
+
},
|
|
1363
|
+
warnings,
|
|
1364
|
+
paintWarningRules,
|
|
1365
|
+
debug: {
|
|
1366
|
+
occupied: occupied.snapshot(),
|
|
1367
|
+
decisions: [...solved.decisions, ...annResult.decisions]
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
function chipColumns() {
|
|
1371
|
+
let textW = 0;
|
|
1372
|
+
stages.forEach((c, ci) => plotted.forEach((_s, si) => {
|
|
1373
|
+
let v = values[si][ci];
|
|
1374
|
+
if (v == null || v <= 0) return;
|
|
1375
|
+
let text = cellText(si, ci, v);
|
|
1376
|
+
text && (textW = Math.max(textW, measure(text, highlights.has(c.id) ? strongFont : labelFont).width));
|
|
1377
|
+
}));
|
|
1378
|
+
let colW = textW + SWATCH_RESERVE, pitch = colW + CHIP_GAP;
|
|
1379
|
+
return { colW, pitch, blockW: plotted.length * pitch - CHIP_GAP, lineH: lineHeight(labelFont) };
|
|
1380
|
+
}
|
|
1381
|
+
function chipRowBand() {
|
|
1382
|
+
let n = stages.length, cap = inner.w < CARD_PLOT_W ? CHIP_BAR_CARD : CHIP_BAR, rowLabelH = Math.max(maxOf(catInfo.map((c) => c.h)), maxOf(totalSizes.map((t) => t.height))), lastExtra = chipsOnRow(n - 1) ? chipUnderH : 0, minGap = captions.size > 0 ? captionOnlyBandH + 2 * LABEL_PAD : 4, lastFloor = Math.max(
|
|
1383
|
+
rowLabelH + 2 * LANE_PAD,
|
|
1384
|
+
totalAnnotationGap > 0 ? Math.min(cap, rowsH / n) + totalAnnotationGap / 2 + 2 * LANE_PAD : 0
|
|
1385
|
+
), fitBw = n > 1 ? (rowsH - lastExtra - lastFloor - (n - 1) * (chipUnderH + minGap)) / (n - 1) : rowsH - lastExtra, want = options.bandFraction !== void 0 ? options.bandFraction * (rowsH / n) : cap, floor = Math.min(want, Math.max(10, rowLabelH)), bandwidth = Math.max(floor, Math.min(want, fitBw)), lastH = Math.max(bandwidth, lastFloor) + lastExtra, step = n > 1 ? Math.max(bandwidth, (rowsH - lastH) / (n - 1)) : rowsH;
|
|
1386
|
+
return { position: (i) => rowsTop + i * step, bandwidth, step };
|
|
1387
|
+
}
|
|
1388
|
+
function totalAnchorStage(ref) {
|
|
1389
|
+
let norm = typeof ref == "string" ? { categoryId: ref } : ref;
|
|
1390
|
+
return !("categoryId" in norm) || norm.seriesId || (norm.edge ?? "total") !== "total" ? -1 : stages.findIndex((stage) => stage.id === norm.categoryId);
|
|
1391
|
+
}
|
|
1392
|
+
function seriesPaint2(s, si, ci) {
|
|
1393
|
+
let ramp = rampFunnelPaint(theme, plotted, s, ci ?? 0, paletteRamp ? options.palette : void 0, stages.length);
|
|
1394
|
+
if (ramp) return ramp;
|
|
1395
|
+
if (s.fill) return { css: s.fill };
|
|
1396
|
+
if (s.colorRole) return markRolePaint(s.colorRole, !0);
|
|
1397
|
+
let paint = seriesPaint(si, paletteRamp ? options.palette : void 0);
|
|
1398
|
+
return ci !== void 0 && theme.marks?.funnelFill === "ramp" && plotted.length === 1 && stages.length > 1 ? shadeStage(paint, ci, stages.length, void 0) : paint;
|
|
1399
|
+
}
|
|
1400
|
+
function seriesCss(s, si, ci) {
|
|
1401
|
+
return paintColor(theme, seriesPaint2(s, si, ci));
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
function seriesPattern(s) {
|
|
1405
|
+
let sc = normalizeScenario(s.scenario, `series[${s.id}].scenario`);
|
|
1406
|
+
return sc === "FC" ? "hatch45" : sc === "PL" ? "outline" : void 0;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
// src/core/charts/funnel/core.ts
|
|
1410
|
+
var funnelCore = {
|
|
1411
|
+
type: "funnel",
|
|
1412
|
+
sizing: chartSizing("funnel"),
|
|
1413
|
+
title: "Funnel / pipeline",
|
|
1414
|
+
summary: "Stage-flow funnel: stacked rows or an honest-width centered silhouette with derived conversion rates",
|
|
1415
|
+
layout: (data, options) => layoutFunnel(prepareFractionData(data), options),
|
|
1416
|
+
categoryLabels: calendarCategories,
|
|
1417
|
+
prepare: prepareFractionData,
|
|
1418
|
+
defaults: { worstDropCallout: !1 },
|
|
1419
|
+
annotationKinds: ["note", "callout", "delta", "abs", "diff", "cagr"]
|
|
1420
|
+
};
|
|
1421
|
+
|
|
1422
|
+
export {
|
|
1423
|
+
funnelCore
|
|
1424
|
+
};
|