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,1161 @@
|
|
|
1
|
+
import {
|
|
2
|
+
layoutHeatmap
|
|
3
|
+
} from "./chunk-MYMT5KJL.js";
|
|
4
|
+
import {
|
|
5
|
+
liftOrFallback,
|
|
6
|
+
missesSize,
|
|
7
|
+
tightSpacingWarning
|
|
8
|
+
} from "./chunk-XN4ARQ2W.js";
|
|
9
|
+
import {
|
|
10
|
+
fieldHeadFont,
|
|
11
|
+
fieldHeadText,
|
|
12
|
+
headInk,
|
|
13
|
+
headRule,
|
|
14
|
+
totalGround,
|
|
15
|
+
totalRule
|
|
16
|
+
} from "./chunk-QTZVVZ2A.js";
|
|
17
|
+
import {
|
|
18
|
+
fitColumn,
|
|
19
|
+
fittedLabel,
|
|
20
|
+
gutterBudget,
|
|
21
|
+
stepDownFont
|
|
22
|
+
} from "./chunk-ZQF34VPS.js";
|
|
23
|
+
import {
|
|
24
|
+
chartTheme
|
|
25
|
+
} from "./chunk-3QWZAEW5.js";
|
|
26
|
+
import {
|
|
27
|
+
AVERAGE_ROW_ID,
|
|
28
|
+
deriveRetention,
|
|
29
|
+
missingCohortRate
|
|
30
|
+
} from "./chunk-BBL3R5YZ.js";
|
|
31
|
+
import {
|
|
32
|
+
rowDrivenHeight
|
|
33
|
+
} from "./chunk-GZTNTHSW.js";
|
|
34
|
+
import {
|
|
35
|
+
structureCount
|
|
36
|
+
} from "./chunk-LFX7W4B7.js";
|
|
37
|
+
import {
|
|
38
|
+
tableRuleInk
|
|
39
|
+
} from "./chunk-Z2MGTKDR.js";
|
|
40
|
+
import {
|
|
41
|
+
SIZE_TOLERANCE,
|
|
42
|
+
VERIFY_ADVICE,
|
|
43
|
+
chartSizing,
|
|
44
|
+
heightOmitted,
|
|
45
|
+
rowSizing
|
|
46
|
+
} from "./chunk-RL3NUWMY.js";
|
|
47
|
+
import {
|
|
48
|
+
PRIORITY,
|
|
49
|
+
UNIT_LINE,
|
|
50
|
+
authoredNotes,
|
|
51
|
+
clamp,
|
|
52
|
+
createOccupiedIndex,
|
|
53
|
+
frameRendersUnit,
|
|
54
|
+
frameTextOptions,
|
|
55
|
+
labelCtx,
|
|
56
|
+
labelsToNodes,
|
|
57
|
+
legendOff,
|
|
58
|
+
solveFrame,
|
|
59
|
+
solveLabels,
|
|
60
|
+
subtitleUnitClause,
|
|
61
|
+
textCarriesCohortUnit,
|
|
62
|
+
withAuthoredFootnotes
|
|
63
|
+
} from "./chunk-SS42FJVN.js";
|
|
64
|
+
import {
|
|
65
|
+
disclosureNote,
|
|
66
|
+
keepShownNotes,
|
|
67
|
+
staticFrame
|
|
68
|
+
} from "./chunk-BPKXEMRE.js";
|
|
69
|
+
import {
|
|
70
|
+
AUTOMATIC_FORMAT,
|
|
71
|
+
formatterFromExample
|
|
72
|
+
} from "./chunk-RGZGLKFB.js";
|
|
73
|
+
import {
|
|
74
|
+
autoDecimals,
|
|
75
|
+
chartStrings,
|
|
76
|
+
formatAutomaticNumber,
|
|
77
|
+
formatAutomaticPercent,
|
|
78
|
+
formatExactNumber,
|
|
79
|
+
numberFormat,
|
|
80
|
+
numberRange,
|
|
81
|
+
roundHalfUp,
|
|
82
|
+
smallRateDecimals,
|
|
83
|
+
typicalDecimals
|
|
84
|
+
} from "./chunk-53OYF4ZT.js";
|
|
85
|
+
import {
|
|
86
|
+
canvasMargin,
|
|
87
|
+
emphasisInk,
|
|
88
|
+
emphasisWeight,
|
|
89
|
+
paintColor,
|
|
90
|
+
resolveSemanticPaletteTheme,
|
|
91
|
+
secondaryFont,
|
|
92
|
+
semanticPalettePaint,
|
|
93
|
+
spaceTokens,
|
|
94
|
+
strokeToken,
|
|
95
|
+
tableEmphasis,
|
|
96
|
+
textScaleOf
|
|
97
|
+
} from "./chunk-CWDHCSL2.js";
|
|
98
|
+
import {
|
|
99
|
+
NormalizeError,
|
|
100
|
+
TARGET_SIZE,
|
|
101
|
+
accessibleTitle,
|
|
102
|
+
resolveSize,
|
|
103
|
+
resolveSubtitle
|
|
104
|
+
} from "./chunk-SGD3ZHID.js";
|
|
105
|
+
import {
|
|
106
|
+
maxOf,
|
|
107
|
+
minOf,
|
|
108
|
+
pushAll
|
|
109
|
+
} from "./chunk-WYJEOMNY.js";
|
|
110
|
+
import {
|
|
111
|
+
defaultMeasurer
|
|
112
|
+
} from "./chunk-AG2CJ4JY.js";
|
|
113
|
+
|
|
114
|
+
// src/core/strings/cohort.ts
|
|
115
|
+
var EN = {
|
|
116
|
+
measure: "Retention",
|
|
117
|
+
title: "Cohort {measure}: {cohorts} cohorts over {periods} periods",
|
|
118
|
+
cells: "{count} cell{count||s}",
|
|
119
|
+
baseValue: "base {value}",
|
|
120
|
+
cohort: "Cohort",
|
|
121
|
+
period: "Period {period}",
|
|
122
|
+
cohortSize: "Cohort size",
|
|
123
|
+
weightedAverage: "Weighted average",
|
|
124
|
+
averageGrey: "Weighted average, same scale in grey",
|
|
125
|
+
periodBase: "{period} base",
|
|
126
|
+
support: "{count} cohort{count||s}",
|
|
127
|
+
supportRange: "{first} to {last} cohorts",
|
|
128
|
+
noObservation: "No observation for this period",
|
|
129
|
+
notReached: "Not yet reached",
|
|
130
|
+
noContributor: "No contributing cohort",
|
|
131
|
+
formula: "{measure} = active / {basis}",
|
|
132
|
+
baseFormula: "cohort base (period 0)",
|
|
133
|
+
previousFormula: "the previous period's active",
|
|
134
|
+
formulaCount: "{formula}; n per cohort in the row label.",
|
|
135
|
+
anchorNote: "{period} is 100% by definition \u2014 the grey anchor column, not a result; blank = not reached yet.",
|
|
136
|
+
hatchMissing: "Hatched cells = missing count, or a rate or average that needs it.",
|
|
137
|
+
hatchNm: "Hatched cells = not meaningful: {periods}, no survivors in the previous period.",
|
|
138
|
+
averageBase: "Weighted average = total active / total base of the cohorts with a readable cell, never the mean of the percentages.",
|
|
139
|
+
averagePrevious: "Weighted average = total active / total previous-period active, never the mean of the percentages.",
|
|
140
|
+
everySupport: "Every average rests on {count} cohort{count||s}.",
|
|
141
|
+
averageSupports: "Cohorts behind each average: {first} at {firstPeriod}, {last} at {lastPeriod}.",
|
|
142
|
+
unsupportedAverage: "No cohort has a readable rate at {periods}: the average is hatched there, not 0%.",
|
|
143
|
+
allSuppressed: "No cell prints its rate at this size: all {count} rates read from colour alone.",
|
|
144
|
+
someSuppressed: "{count} of {total} rates are too narrow to print and read from colour alone.",
|
|
145
|
+
uncountedSuppressed: "Some cells are too narrow to print their rate and read from colour alone.",
|
|
146
|
+
missing: "missing",
|
|
147
|
+
notMeaningful: "not meaningful",
|
|
148
|
+
atPeriod: "{value} at {period}",
|
|
149
|
+
missingAt: "missing at {period}, a count it needs is missing",
|
|
150
|
+
blankAverage: "blank, with no contributing cohort",
|
|
151
|
+
valueSupport: "{value} on {count} cohort{count||s}",
|
|
152
|
+
descStart: "Cohort {measure} triangle, {cohorts} cohorts by {periods} periods since start. {formula} ",
|
|
153
|
+
descReach: "Period 0 is 100% by construction. The oldest cohort reaches {first}; the newest reaches {last}. ",
|
|
154
|
+
descBlank: "{count} cell{count||s} are blank because those cohorts have not reached that period. ",
|
|
155
|
+
descAverage: "Weighted averages run from {first} to {last}. ",
|
|
156
|
+
descBases: "Bases: {first} for the oldest cohort, {last} for the newest.",
|
|
157
|
+
missingExhibit: "\u2014 = missing count, or a rate or total that needs it; blank = not reached yet.",
|
|
158
|
+
previousBasis: "previous active count",
|
|
159
|
+
cohortBasis: "cohort size",
|
|
160
|
+
anchorClause: "{period} is 100% by definition; ",
|
|
161
|
+
anchorHidden: "{period} not shown: 100% of every cohort by definition.",
|
|
162
|
+
periodsHidden: "Not shown for space: {periods}.",
|
|
163
|
+
emptyUnobserved: "{anchor}empty cells are unobserved.",
|
|
164
|
+
bold: "Bold: {measure} above {threshold}%{after}.",
|
|
165
|
+
afterPeriod: " after {period}",
|
|
166
|
+
weightedTotal: "Total is weighted by {basis}, never the mean of cohort percentages.",
|
|
167
|
+
weightedObserved: "Weighted average uses {basis} across observed cohorts.",
|
|
168
|
+
positiveAnchor: "{period} = 100% for positive bases; ",
|
|
169
|
+
steppedBlank: "{anchor}blanks = unobserved or zero denominator.{weighting}",
|
|
170
|
+
withinColumn: "Within each column",
|
|
171
|
+
withinColumnUnit: "{unit}, within each column",
|
|
172
|
+
low: "Low",
|
|
173
|
+
high: "High",
|
|
174
|
+
exhibitTitle: "Cohort {measure} table: {count} cohorts",
|
|
175
|
+
exhibitDesc: "{measure} table with a separate cohort-size column and periods {periods}. {formula} Empty cells are unobserved{anchor}.{missing}{total}",
|
|
176
|
+
exhibitDescAnchor: "; period 0 is 100% by definition",
|
|
177
|
+
exhibitDescMissing: " A dash marks a missing count, or a rate or total that needs it.",
|
|
178
|
+
exhibitDescTotal: " The total row is weighted by {basis}."
|
|
179
|
+
}, DE = {
|
|
180
|
+
measure: "Bindung",
|
|
181
|
+
title: "Kohorten f\xFCr {measure}: {cohorts} Kohorten \xFCber {periods} Perioden",
|
|
182
|
+
cells: "{count} {count|Zelle|Zellen}",
|
|
183
|
+
baseValue: "Basis {value}",
|
|
184
|
+
cohort: "Kohorte",
|
|
185
|
+
period: "Periode {period}",
|
|
186
|
+
cohortSize: "Kohortengr\xF6\xDFe",
|
|
187
|
+
weightedAverage: "Gewichteter Mittelwert",
|
|
188
|
+
averageGrey: "Gewichteter Mittelwert, gleiche Skala in Grau",
|
|
189
|
+
periodBase: "Basis {period}",
|
|
190
|
+
support: "{count} {count|Kohorte|Kohorten}",
|
|
191
|
+
supportRange: "{first} bis {last} Kohorten",
|
|
192
|
+
noObservation: "Keine Beobachtung f\xFCr diese Periode",
|
|
193
|
+
notReached: "Noch nicht erreicht",
|
|
194
|
+
noContributor: "Keine beitragende Kohorte",
|
|
195
|
+
formula: "{measure} = aktiv / {basis}",
|
|
196
|
+
baseFormula: "Kohortenbasis (Periode 0)",
|
|
197
|
+
previousFormula: "aktive Mitglieder der Vorperiode",
|
|
198
|
+
formulaCount: "{formula}; n je Kohorte in der Zeilenbeschriftung.",
|
|
199
|
+
anchorNote: "{period} ist per Definition 100% \u2014 die graue Basisspalte, kein Ergebnis; leer = noch nicht erreicht.",
|
|
200
|
+
hatchMissing: "Schraffierte Zellen = fehlende Anzahl oder eine Quote oder ein Mittelwert, die diese Anzahl ben\xF6tigen.",
|
|
201
|
+
hatchNm: "Schraffierte Zellen = nicht sinnvoll: {periods}, keine verbleibenden Mitglieder in der Vorperiode.",
|
|
202
|
+
averageBase: "Gewichteter Mittelwert = aktive Mitglieder / Gesamtbasis der Kohorten mit lesbarer Zelle, kein Mittelwert der Prozentwerte.",
|
|
203
|
+
averagePrevious: "Gewichteter Mittelwert = aktive Mitglieder / aktive Mitglieder der Vorperiode, kein Mittelwert der Prozentwerte.",
|
|
204
|
+
everySupport: "Jeder Mittelwert beruht auf {count} {count|Kohorte|Kohorten}.",
|
|
205
|
+
averageSupports: "Kohorten je Mittelwert: {first} bei {firstPeriod}, {last} bei {lastPeriod}.",
|
|
206
|
+
unsupportedAverage: "Keine Kohorte hat bei {periods} eine lesbare Quote: Der Mittelwert ist dort schraffiert, nicht 0%.",
|
|
207
|
+
allSuppressed: "Bei dieser Gr\xF6\xDFe zeigt keine Zelle ihre Quote als Zahl: Alle {count} Quoten sind nur durch Farbe lesbar.",
|
|
208
|
+
someSuppressed: "F\xFCr {count} von {total} Quoten fehlt Platz f\xFCr die Zahl. Sie sind nur durch Farbe lesbar.",
|
|
209
|
+
uncountedSuppressed: "Einige Zellen sind zu schmal f\xFCr ihre Quote als Zahl. Sie sind nur durch Farbe lesbar.",
|
|
210
|
+
missing: "fehlend",
|
|
211
|
+
notMeaningful: "nicht sinnvoll",
|
|
212
|
+
atPeriod: "{value} bei {period}",
|
|
213
|
+
missingAt: "fehlend bei {period}, eine ben\xF6tigte Anzahl fehlt",
|
|
214
|
+
blankAverage: "leer, ohne beitragende Kohorte",
|
|
215
|
+
valueSupport: "{value} aus {count} {count|Kohorte|Kohorten}",
|
|
216
|
+
descStart: "Kohorten-Dreieck f\xFCr {measure}, {cohorts} Kohorten nach {periods} Perioden seit Beginn. {formula} ",
|
|
217
|
+
descReach: "Periode 0 ist definitionsgem\xE4\xDF 100%. Die \xE4lteste Kohorte erreicht {first}; die j\xFCngste erreicht {last}. ",
|
|
218
|
+
descBlank: "{count} {count|Zelle ist|Zellen sind} leer, da diese Kohorten die Periode noch nicht erreicht haben. ",
|
|
219
|
+
descAverage: "Gewichtete Mittelwerte reichen von {first} bis {last}. ",
|
|
220
|
+
descBases: "Basis: {first} f\xFCr die \xE4lteste Kohorte, {last} f\xFCr die j\xFCngste.",
|
|
221
|
+
missingExhibit: "\u2014 = fehlende Anzahl oder eine Quote oder Summe, die diese Anzahl ben\xF6tigt; leer = noch nicht erreicht.",
|
|
222
|
+
previousBasis: "aktive Anzahl der Vorperiode",
|
|
223
|
+
cohortBasis: "Kohortengr\xF6\xDFe",
|
|
224
|
+
anchorClause: "{period} ist per Definition 100%; ",
|
|
225
|
+
anchorHidden: "{period} nicht gezeigt: per Definition 100% jeder Kohorte.",
|
|
226
|
+
periodsHidden: "Aus Platzgr\xFCnden nicht gezeigt: {periods}.",
|
|
227
|
+
emptyUnobserved: "{anchor}leere Zellen sind unbeobachtet.",
|
|
228
|
+
bold: "Fett: {measure} \xFCber {threshold}%{after}.",
|
|
229
|
+
afterPeriod: " nach {period}",
|
|
230
|
+
weightedTotal: "Die Summe ist nach {basis} gewichtet, kein Mittelwert der Kohorten-Prozentwerte.",
|
|
231
|
+
weightedObserved: "Der gewichtete Mittelwert nutzt {basis} \xFCber beobachtete Kohorten.",
|
|
232
|
+
positiveAnchor: "{period} = 100% bei positiver Basis; ",
|
|
233
|
+
steppedBlank: "{anchor}leer = unbeobachtet oder Nenner null.{weighting}",
|
|
234
|
+
withinColumn: "Innerhalb jeder Spalte",
|
|
235
|
+
withinColumnUnit: "{unit}, innerhalb jeder Spalte",
|
|
236
|
+
low: "Niedrig",
|
|
237
|
+
high: "Hoch",
|
|
238
|
+
exhibitTitle: "Kohortentabelle f\xFCr {measure}: {count} Kohorten",
|
|
239
|
+
exhibitDesc: "Tabelle f\xFCr {measure} mit eigener Spalte f\xFCr die Kohortengr\xF6\xDFe und den Perioden {periods}. {formula} Leere Zellen sind unbeobachtet{anchor}.{missing}{total}",
|
|
240
|
+
exhibitDescAnchor: "; Periode 0 ist per Definition 100%",
|
|
241
|
+
exhibitDescMissing: " Ein Strich zeigt eine fehlende Anzahl oder eine Quote oder Summe, die diese Anzahl ben\xF6tigt.",
|
|
242
|
+
exhibitDescTotal: " Die Summenzeile ist nach {basis} gewichtet."
|
|
243
|
+
}, { chartString } = chartStrings(EN, DE);
|
|
244
|
+
|
|
245
|
+
// src/core/charts/cohort/wording.ts
|
|
246
|
+
function cohortMeasure(options) {
|
|
247
|
+
return options.strings?.cohortMeasure?.trim() || chartString(options, "measure");
|
|
248
|
+
}
|
|
249
|
+
function cohortFormula(options, basis) {
|
|
250
|
+
let formula = options.strings?.cohortFormula?.trim() || chartString(options, "formula", { measure: cohortMeasure(options), basis: chartString(options, basis === "cohort" ? "baseFormula" : "previousFormula") });
|
|
251
|
+
return /[.!?]$/.test(formula) ? formula : `${formula}.`;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// src/core/charts/cohort/exhibit.ts
|
|
255
|
+
var LABEL_TRACK = 118, SIZE_TRACK = 96, ROW_H = 28, BASE_LINE_H = 16, HEADER_H = 28, LEGEND_H = 18, BIN_TINTS = [0.94, 0.8, 0.58, 0.3, 0], TIGHT_SPACING = /* @__PURE__ */ Symbol("cohortTightSpacing"), COHORT_LIFT = /* @__PURE__ */ Symbol("cohortZeroLift"), REGULAR_WIDTH = /* @__PURE__ */ Symbol("cohortRegularWidth"), STACKED_TEXT = /* @__PURE__ */ Symbol("cohortStackedText"), HIDDEN_PERIODS = /* @__PURE__ */ Symbol("cohortHiddenPeriods"), PROBE_HEIGHT = 4e3;
|
|
256
|
+
function layoutCohortExhibit(sourceData, options) {
|
|
257
|
+
return options.format || options[COHORT_LIFT] !== void 0 ? layoutCohortExhibitOnce(sourceData, options) : liftOrFallback(
|
|
258
|
+
(mode) => layoutCohortExhibitOnce(sourceData, mode === "full" ? options : { ...options, [COHORT_LIFT]: mode }),
|
|
259
|
+
(lifted, plain) => costsWidth(lifted, plain, options)
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
function costsWidth(lifted, plain, options) {
|
|
263
|
+
let open = options[TARGET_SIZE]?.fixed, fixedWidth = open?.width !== !1 && options.size !== void 0, misses = (geometry) => geometry.sizing !== void 0 && (open?.width !== !1 && geometry.size.width + 0.5 < geometry.sizing.minWidth || open?.height !== !1 && !heightOmitted(options.size) && geometry.size.height + 0.5 < geometry.sizing.minHeight), squeezed = (geometry) => fixedWidth && geometry.size.width + 0.5 < (geometry.sizing?.naturalWidth ?? 0);
|
|
264
|
+
if (misses(plain)) return !1;
|
|
265
|
+
if (misses(lifted) || squeezed(lifted) && !squeezed(plain)) return !0;
|
|
266
|
+
let before = new Set(plain.warnings.map((warning) => warning.code));
|
|
267
|
+
return lifted.warnings.some((warning) => !before.has(warning.code));
|
|
268
|
+
}
|
|
269
|
+
function layoutCohortExhibitOnce(sourceData, options) {
|
|
270
|
+
let warnings = [], data = options.excludeCurrentPeriod ? withoutCurrentPeriod(sourceData) : sourceData, basis = options.basis ?? "cohort", totals = options.total ?? "weighted", result = deriveRetention(data, { basis, averages: !1 });
|
|
271
|
+
pushAll(warnings, result.warnings);
|
|
272
|
+
let derived = result.derived, available = Array.from({ length: derived.periodCount }, (_, index) => index), visible = normalizeVisiblePeriods(options.visiblePeriods, available, warnings);
|
|
273
|
+
options.designatedPeriod !== void 0 && options.variant === "pure" && !visible.includes(options.designatedPeriod) && warnings.push({
|
|
274
|
+
code: "designated-period-out-of-range",
|
|
275
|
+
severity: "warn",
|
|
276
|
+
message: `designatedPeriod ${options.designatedPeriod} is not one of the ${visible.length} periods the exhibit shows; no column is emphasised`,
|
|
277
|
+
suggest: "pick a zero-based period index the exhibit shows"
|
|
278
|
+
});
|
|
279
|
+
let total = totals === "weighted" ? deriveExhibitTotal(derived) : void 0, outputDerived = {
|
|
280
|
+
...derived,
|
|
281
|
+
visiblePeriods: visible,
|
|
282
|
+
...total ? { total } : {},
|
|
283
|
+
...options.excludeCurrentPeriod ? { excludedCurrentPeriod: !0 } : {}
|
|
284
|
+
}, removed = sourceData.cohorts[sourceData.cohorts.length - 1], exclusion = options.excludeCurrentPeriod ? disclosureNote(/^de(?:-|$)/i.test(options.locale?.language ?? "") ? `Ausgeschlossen: laufende Periode. Kohorte ${removed.label ?? removed.id}; letzte Beobachtung jeder fr\xFCheren Kohorte.` : `Excluded: running period. Cohort ${removed.label ?? removed.id}; last observation of each earlier cohort.`) : void 0, full = buildExhibit(data, outputDerived, visible, options, [...warnings], exclusion), misses = missesSize(full, options), { width: missesWidth, height: missesHeight } = misses;
|
|
285
|
+
if (options.belowMinimum === "refuse" || !full.sizing || !(missesWidth || missesHeight)) return full;
|
|
286
|
+
let tightWith = (names) => buildExhibit(data, outputDerived, visible, { ...options, [TIGHT_SPACING]: { columns: missesWidth, rows: missesHeight, names } }, [...warnings], exclusion), tight = tightWith(!1);
|
|
287
|
+
if (missesWidth && tight.sizing && tight.size.width + 0.5 < tight.sizing.minWidth && tight.sizing.minWidth - tight.size.width <= 8) {
|
|
288
|
+
let tighter = tightWith(!0);
|
|
289
|
+
tighter.labels.some((label) => label.hidden === "collision") || (tight = tighter);
|
|
290
|
+
}
|
|
291
|
+
let hides = (geometry) => geometry.labels.some((label) => label.hidden === "collision"), compactForm = missesWidth && options.mode === "compact" && (hides(tight) || missesSize(tight, options).width);
|
|
292
|
+
if (compactForm) {
|
|
293
|
+
let at = (periods, widthOnly = !1) => {
|
|
294
|
+
let hidden = visible.filter((period) => !periods.includes(period)), leftOut = hidden.filter((period) => period !== 0);
|
|
295
|
+
return buildExhibit(data, { ...outputDerived, visiblePeriods: periods, ...leftOut.length > 0 ? { periodsLeftOut: leftOut } : {} }, periods, {
|
|
296
|
+
...options,
|
|
297
|
+
[TIGHT_SPACING]: { columns: !0, rows: missesHeight, names: !0 },
|
|
298
|
+
[STACKED_TEXT]: !0,
|
|
299
|
+
...widthOnly ? { size: { width: full.size.width, height: Math.max(full.size.height, PROBE_HEIGHT) } } : {},
|
|
300
|
+
...hidden.length > 0 ? { [HIDDEN_PERIODS]: hidden } : {}
|
|
301
|
+
}, [...warnings], exclusion);
|
|
302
|
+
}, draws = (geometry) => !hides(geometry) && !missesSize(geometry, options).width, columns = visible, anchorFull = visible[0] === 0 && visible.length > 1 && derived.cohorts.every((row) => row.observedPeriods === 0 || row.retention[0] === 1), fits = draws(at(visible, !0));
|
|
303
|
+
if (!fits && anchorFull && (columns = visible.slice(1), fits = draws(at(columns, !0))), !fits && options.visiblePeriods === void 0) {
|
|
304
|
+
let candidates = columns, kept = (count) => {
|
|
305
|
+
let first = candidates.slice(0, count), designated = options.variant === "pure" ? options.designatedPeriod : void 0;
|
|
306
|
+
return designated === void 0 || first.includes(designated) || !candidates.includes(designated) ? first : [...first.slice(0, count - 1), designated];
|
|
307
|
+
}, low = 0, high = candidates.length;
|
|
308
|
+
for (; high - low > 1; ) {
|
|
309
|
+
let count = Math.floor((low + high) / 2);
|
|
310
|
+
draws(at(kept(count), !0)) ? low = count : high = count;
|
|
311
|
+
}
|
|
312
|
+
columns = kept(Math.max(1, low));
|
|
313
|
+
}
|
|
314
|
+
if (tight = at(columns), hides(tight) && (missesSize(tight, options).height || (tight.sizing?.naturalHeight ?? 0) > tight.size.height + SIZE_TOLERANCE)) return tight;
|
|
315
|
+
}
|
|
316
|
+
if (hides(tight)) return full;
|
|
317
|
+
if (compactForm) {
|
|
318
|
+
let hidden = visible.filter((period) => !(tight.derived.visiblePeriods ?? visible).includes(period));
|
|
319
|
+
return tight.warnings.push({
|
|
320
|
+
code: "table-tight-spacing",
|
|
321
|
+
severity: "warn",
|
|
322
|
+
message: `Cell air and column gaps were reduced${hidden.length > 0 ? `, and ${hidden.length} period column${hidden.length === 1 ? " was" : "s were"} left out,` : ""} to fit the cohort table.`,
|
|
323
|
+
suggest: "Measure the spec with mode 'full' for the size that draws the whole table at regular spacing.",
|
|
324
|
+
field: ["options", "size"]
|
|
325
|
+
}), tight;
|
|
326
|
+
}
|
|
327
|
+
let verify = options[VERIFY_ADVICE] === !0, repair = full;
|
|
328
|
+
for (let pass = 0; verify && pass < 6 && repair.sizing; pass++) {
|
|
329
|
+
let size = {
|
|
330
|
+
width: Math.ceil(Math.max(repair.size.width, repair.sizing.minWidth)),
|
|
331
|
+
height: Math.ceil(Math.max(repair.size.height, repair.sizing.minHeight))
|
|
332
|
+
};
|
|
333
|
+
if (size.width === repair.size.width && size.height === repair.size.height) break;
|
|
334
|
+
repair = buildExhibit(data, outputDerived, visible, { ...options, size }, [], exclusion);
|
|
335
|
+
}
|
|
336
|
+
let warning = tightSpacingWarning(
|
|
337
|
+
misses,
|
|
338
|
+
{ width: "cell air and column gaps", height: "row air" },
|
|
339
|
+
"the cohort table",
|
|
340
|
+
"regular",
|
|
341
|
+
verify ? { ...repair, sizing: repair.sizing } : estimatedRegularSize(full, options),
|
|
342
|
+
options
|
|
343
|
+
);
|
|
344
|
+
return verify || (warning.message = warning.message.replace("regular spacing needs", "the estimated size for regular spacing is") + " Use measure for the verified size."), tight.warnings.push(warning), tight;
|
|
345
|
+
}
|
|
346
|
+
function estimatedRegularSize(full, options) {
|
|
347
|
+
let theme = chartTheme(options), chrome = full.size.width - full.plot.w, content = full[REGULAR_WIDTH], width = Math.ceil(Math.max(full.size.width, full.sizing.minWidth, content + chrome)), scale = 1;
|
|
348
|
+
for (let pass = 0; pass < 4; pass++) {
|
|
349
|
+
let wider = chartTheme({ ...options, size: { width } });
|
|
350
|
+
scale = Math.max(scale, ...["label", "axis", "title", "subtitle", "footnote"].map((role) => wider.type[role].size / theme.type[role].size));
|
|
351
|
+
let margin = options.margin?.left === void 0 ? canvasMargin(wider, width).left - canvasMargin(theme, full.size.width).left : 0, next = Math.ceil(Math.max(width, content * scale + chrome + margin));
|
|
352
|
+
if (next === width) break;
|
|
353
|
+
width = next;
|
|
354
|
+
}
|
|
355
|
+
let height = Math.ceil(Math.max(full.size.height, full.sizing.minHeight) * scale);
|
|
356
|
+
return { size: { width, height }, sizing: { minWidth: width, minHeight: height } };
|
|
357
|
+
}
|
|
358
|
+
function deriveExhibitTotal(derived) {
|
|
359
|
+
let base = derived.cohorts.reduce((sum, row) => sum + row.base, 0), retention = Array.from({ length: derived.periodCount }, (_, period) => {
|
|
360
|
+
if (derived.cohorts.some((row) => missingCohortRate(row, period, derived.basis))) return null;
|
|
361
|
+
let numerator = 0, denominator = 0;
|
|
362
|
+
for (let row of derived.cohorts) {
|
|
363
|
+
if (period >= row.observedPeriods || row.retention[period] === null) continue;
|
|
364
|
+
let rowDenominator = derived.basis === "cohort" || period === 0 ? row.base : row.active[period - 1];
|
|
365
|
+
if (rowDenominator === 0) continue;
|
|
366
|
+
let rowNumerator = row.active[period];
|
|
367
|
+
numerator += rowNumerator, denominator += rowDenominator;
|
|
368
|
+
}
|
|
369
|
+
return denominator === 0 ? null : numerator / denominator;
|
|
370
|
+
});
|
|
371
|
+
return { base, retention };
|
|
372
|
+
}
|
|
373
|
+
function withoutCurrentPeriod(data) {
|
|
374
|
+
if (!Array.isArray(data.cohorts) || data.cohorts.length <= 2)
|
|
375
|
+
throw new NormalizeError(
|
|
376
|
+
"cohort-current-period-exclusion-empty",
|
|
377
|
+
"options.excludeCurrentPeriod",
|
|
378
|
+
"excluding the running month would leave fewer than two completed cohorts",
|
|
379
|
+
"keep the current month or supply at least three cohorts"
|
|
380
|
+
);
|
|
381
|
+
return {
|
|
382
|
+
...data,
|
|
383
|
+
cohorts: data.cohorts.slice(0, -1).map((cohort) => ({
|
|
384
|
+
...cohort,
|
|
385
|
+
active: cohort.active.slice(0, -1)
|
|
386
|
+
}))
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
function normalizeVisiblePeriods(requested, available, warnings) {
|
|
390
|
+
if (requested === void 0) return available;
|
|
391
|
+
let allowed = new Set(available), seen = /* @__PURE__ */ new Set(), visible = [], ignored = [];
|
|
392
|
+
for (let index of requested) {
|
|
393
|
+
if (!allowed.has(index) || seen.has(index)) {
|
|
394
|
+
ignored.push(index);
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
seen.add(index), visible.push(index);
|
|
398
|
+
}
|
|
399
|
+
if (visible.sort((a, b) => a - b), ignored.length > 0 && warnings.push({
|
|
400
|
+
code: "cohort-period-filter-ignored",
|
|
401
|
+
severity: "warn",
|
|
402
|
+
message: `visiblePeriods ignored duplicate or unavailable indices: ${ignored.join(", ")}`,
|
|
403
|
+
suggest: `choose unique indices between 0 and ${available.length - 1}`
|
|
404
|
+
}), visible.length === 0)
|
|
405
|
+
throw new NormalizeError(
|
|
406
|
+
"cohort-period-filter-empty",
|
|
407
|
+
"options.visiblePeriods",
|
|
408
|
+
"visiblePeriods hides every available period",
|
|
409
|
+
`choose at least one index between 0 and ${available.length - 1}`
|
|
410
|
+
);
|
|
411
|
+
return visible;
|
|
412
|
+
}
|
|
413
|
+
function exhibitRows(data, derived, options) {
|
|
414
|
+
let rows = derived.cohorts.map((row, index) => ({
|
|
415
|
+
id: row.id,
|
|
416
|
+
label: data.cohorts[index].label ?? data.cohorts[index].id,
|
|
417
|
+
base: row.base,
|
|
418
|
+
retention: row.retention,
|
|
419
|
+
observedPeriods: row.observedPeriods,
|
|
420
|
+
kind: "cohort"
|
|
421
|
+
}));
|
|
422
|
+
if (derived.total) {
|
|
423
|
+
let usedIds = new Set(rows.map((row) => row.id)), totalId = "cohort-total";
|
|
424
|
+
for (; usedIds.has(totalId); ) totalId = `_${totalId}`;
|
|
425
|
+
rows.push({
|
|
426
|
+
id: totalId,
|
|
427
|
+
label: chartString(options, "total"),
|
|
428
|
+
base: derived.total.base,
|
|
429
|
+
retention: derived.total.retention,
|
|
430
|
+
observedPeriods: derived.periodCount,
|
|
431
|
+
kind: "total"
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
return rows;
|
|
435
|
+
}
|
|
436
|
+
function retentionFormatter(options, rows, compact) {
|
|
437
|
+
let suffix = options.showPercentSign ? "%" : "";
|
|
438
|
+
if (options.format) {
|
|
439
|
+
let format = formatterFromExample(options.format, options.locale?.language);
|
|
440
|
+
return (retention) => `${format(retention * 100)}${suffix}`;
|
|
441
|
+
}
|
|
442
|
+
let whole = (value) => Number((value * 100).toFixed(1)) % 1 === 0, decimals = rows.some((row) => row.retention.some((value, period) => period > 0 && period < row.observedPeriods && value !== null && value !== void 0 && (!whole(value) || smallRateDecimals(value * 100) > 0))) ? 1 : 0, own = /* @__PURE__ */ new Map(), decimalsAt = (period) => own.get(period) ?? own.set(period, Math.max(decimals, typicalDecimals(rows.flatMap((row) => {
|
|
443
|
+
let value = row.retention[period];
|
|
444
|
+
return period < row.observedPeriods && value !== null && value !== void 0 ? [value * 100] : [];
|
|
445
|
+
})))).get(period), lift = options[COHORT_LIFT];
|
|
446
|
+
return (retention, period) => {
|
|
447
|
+
let percent = retention * 100, decimals2 = decimalsAt(period), text = formatAutomaticNumber(percent, { locale: options.locale?.language, decimals: decimals2, automatic: lift !== "none" });
|
|
448
|
+
return `${lift !== "none" && percent !== 0 && Number(roundHalfUp(Math.abs(percent), decimals2)) === 0 && (lift === "compact" || compact?.(text + suffix)) ? numberFormat(options.locale?.language ?? "en-US", { notation: "scientific", maximumSignificantDigits: 1 }).format(percent) : text}${suffix}`;
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
function exhibitTracks(rows, visible, data, options, font, measure, format = retentionFormatter(options, rows), stackFont = font, head) {
|
|
452
|
+
let tight = options[TIGHT_SPACING]?.columns === !0, air = options[STACKED_TEXT] ? 6 : 4, width = (text, wrapFont = stackFont) => options[STACKED_TEXT] ? maxOf(twoLines(text, wrapFont, measure).map((line) => measure(line, wrapFont).width)) : measure(text, font).width, label = Math.max(tight ? 0 : LABEL_TRACK, maxOf(rows.map((row) => measure(row.label, font).width + (tight ? 4 : 12)))), sizeHead = Math.max(
|
|
453
|
+
width(options.cohortSizeLabel ?? chartString(options, "cohortSize"), font),
|
|
454
|
+
head ? options[STACKED_TEXT] ? width(head.text, head.font) : measure(head.text, head.font).width : 0
|
|
455
|
+
), size = Math.max(
|
|
456
|
+
tight ? 0 : SIZE_TRACK,
|
|
457
|
+
sizeHead + (tight ? air : 18),
|
|
458
|
+
maxOf(rows.map((row) => measure(formatAutomaticNumber(row.base, { locale: options.locale?.language, decimals: 0 }), font).width + (tight ? air : 18)))
|
|
459
|
+
), values = rows.flatMap((row) => visible.flatMap((period) => {
|
|
460
|
+
let value = row.retention[period];
|
|
461
|
+
return period >= row.observedPeriods || value === null || value === void 0 ? [] : [format(value, period)];
|
|
462
|
+
})), support = visible.flatMap((period) => {
|
|
463
|
+
let observed = rows.filter((row) => row.kind !== "total" && period < row.observedPeriods), rates = observed.flatMap((row) => row.retention[period] == null ? [] : [row.retention[period]]);
|
|
464
|
+
return [
|
|
465
|
+
...rows.some((row) => row.kind === "total") && options.basis !== "previous" ? [chartString(options, "baseValue", { value: formatAutomaticNumber(observed.reduce((sum, row) => sum + row.base, 0), { locale: options.locale?.language, decimals: 0 }) })] : [],
|
|
466
|
+
...options.variant === "stepped" && (options.formatScope ?? "column") === "column" ? rates.length ? [numberRange(format(minOf(rates), period), format(maxOf(rates), period))] : [] : []
|
|
467
|
+
];
|
|
468
|
+
}), month = Math.max(tight ? 0 : 56, maxOf([...visible.map((period) => periodName(data.periodLabel, period, options.locale?.language)), ...values].map((text) => measure(text, font).width + (tight ? air : 16))), maxOf(support.map((text) => width(text) + (tight ? air : 16))));
|
|
469
|
+
return { label, size, month };
|
|
470
|
+
}
|
|
471
|
+
function pureEmphasis(options, period, value) {
|
|
472
|
+
return options.threshold !== !1 && period !== 0 && value * 100 > (options.threshold ?? 60);
|
|
473
|
+
}
|
|
474
|
+
function exhibitNotes(data, derived, options, visible) {
|
|
475
|
+
let methodNote = options.methodNote === !0, first = periodName(data.periodLabel, 0, options.locale?.language), hidden = options[HIDDEN_PERIODS] ?? [], later = hidden.filter((period) => period !== 0), formula = [
|
|
476
|
+
...hidden.includes(0) ? [disclosureNote(chartString(options, "anchorHidden", { period: first }))] : [],
|
|
477
|
+
...later.length > 0 ? [disclosureNote(chartString(options, "periodsHidden", { periods: periodRuns(data.periodLabel, later, options.locale?.language) }))] : [],
|
|
478
|
+
...methodNote || derived.basis === "previous" ? [cohortFormula(options, derived.basis)] : [],
|
|
479
|
+
...derived.cohorts.some((row) => visible.some((period) => missingCohortRate(row, period, derived.basis))) ? [disclosureNote(chartString(options, "missingExhibit"))] : []
|
|
480
|
+
], anchor = visible.includes(0), basis = chartString(options, derived.basis === "previous" ? "previousBasis" : "cohortBasis");
|
|
481
|
+
if (options.variant !== "stepped") return [
|
|
482
|
+
...formula,
|
|
483
|
+
...methodNote ? [disclosureNote(chartString(options, "emptyUnobserved", { anchor: anchor ? chartString(options, "anchorClause", { period: first }) : "" }))] : [],
|
|
484
|
+
// The bold rates are an encoding; the note names it.
|
|
485
|
+
...exhibitRows(data, derived, options).some((row) => row.kind !== "total" && visible.some((period) => {
|
|
486
|
+
let value = row.retention[period];
|
|
487
|
+
return period < row.observedPeriods && value != null && pureEmphasis(options, period, value);
|
|
488
|
+
})) ? [disclosureNote(chartString(options, "bold", { measure: cohortMeasure(options).toLocaleLowerCase(options.locale?.language ?? "en"), threshold: formatExactNumber(typeof options.threshold == "number" ? options.threshold : 60, options.locale?.language), after: anchor ? chartString(options, "afterPeriod", { period: first }) : "" }))] : [],
|
|
489
|
+
...derived.total ? [chartString(options, "weightedTotal", { basis })] : []
|
|
490
|
+
];
|
|
491
|
+
let weighting = derived.total ? chartString(options, "weightedObserved", { basis }) : "";
|
|
492
|
+
return methodNote ? [...formula, disclosureNote(chartString(options, "steppedBlank", { anchor: anchor ? chartString(options, "positiveAnchor", { period: first }) : "", weighting: weighting ? ` ${weighting}` : "" }))] : [...formula, ...weighting ? [weighting] : []];
|
|
493
|
+
}
|
|
494
|
+
function buildExhibit(data, derived, visible, options, warnings, exclusion) {
|
|
495
|
+
let style = options.variant, scope = style === "pure" ? "classic" : options.formatScope ?? "column";
|
|
496
|
+
style === "pure" && options.formatScope === "column" && warnings.push({
|
|
497
|
+
code: "cohort-format-scope-ignored",
|
|
498
|
+
severity: "warn",
|
|
499
|
+
message: "formatScope 'column' was ignored \u2014 Pure Exhibit uses the absolute threshold by design",
|
|
500
|
+
suggest: "remove formatScope, or use variant 'stepped'"
|
|
501
|
+
});
|
|
502
|
+
let theme = resolveSemanticPaletteTheme(
|
|
503
|
+
chartTheme(options),
|
|
504
|
+
options.palette,
|
|
505
|
+
warnings
|
|
506
|
+
), size = resolveSize(options.size), tightRows = options[TIGHT_SPACING]?.rows === !0, rowAir = tightRows ? 6 : 8, rowH = Math.max(tightRows ? 0 : ROW_H, theme.type.label.size * (theme.type.label.lineHeight ?? 1.2) + rowAir), headerRowH = Math.max(tightRows ? 0 : HEADER_H, theme.type.axis.size * (theme.type.axis.lineHeight ?? 1.2) + rowAir), baseRowH = Math.max(BASE_LINE_H, theme.type.label.size * (theme.type.label.lineHeight ?? 1.2) + 4), measure = options.measure ?? defaultMeasurer, occupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), margin = { top: options.exhibitLabel ? 38 : 20, right: 16, bottom: 14, left: canvasMargin(theme, size.width).left, ...options.margin }, methodFootnotes = exhibitNotes(data, derived, options, visible), authored = authoredNotes(options), ownFootnotes = authored.filter((note) => note !== exclusion), frameOptions = ownFootnotes.length === authored.length ? options : withAuthoredFootnotes(options, authored, ownFootnotes), rowData = exhibitRows(data, derived, options).map((row) => style === "stepped" && row.kind === "total" ? { ...row, label: chartString(options, "weightedAverage") } : row), totalId = rowData.find((row) => row.kind === "total")?.id, formatValue = retentionFormatter(options, rowData), measureName = cohortMeasure(options), unit = options.unit?.trim() || "%", carriesUnit = (text) => textCarriesCohortUnit(text, unit), subtitle = resolveSubtitle(options.subtitle), measureHasUnit = subtitle !== void 0 && carriesUnit(subtitle.measure), authoredUnit = options.unit?.trim(), subtitleUnit = measureHasUnit || options[UNIT_LINE] !== void 0 || subtitle !== void 0 && !!authoredUnit && frameRendersUnit({ subtitle, unit: authoredUnit }), footnotes = [...ownFootnotes, ...exclusion ? [exclusion] : [], ...methodFootnotes], ruleOverNotes = staticFrame.pinned && options.source !== void 0 && footnotes.length > 0, frame = solveFrame(
|
|
507
|
+
{
|
|
508
|
+
size,
|
|
509
|
+
margin,
|
|
510
|
+
// A measure that already names the unit keeps it once ("Retention percent", not "… in %").
|
|
511
|
+
...frameTextOptions(measureHasUnit && options.unit !== void 0 ? { ...frameOptions, unit: void 0 } : frameOptions),
|
|
512
|
+
footnotes,
|
|
513
|
+
theme,
|
|
514
|
+
measure
|
|
515
|
+
},
|
|
516
|
+
occupied
|
|
517
|
+
), nodes = [...frame.nodes], requests = [], fontById = /* @__PURE__ */ new Map(), labelInk = /* @__PURE__ */ new Map(), cellPaints = /* @__PURE__ */ new Map(), marks = { cells: [], sizeCells: [] }, drawnSubtitle = frame.nodes.flatMap((node) => node.t === "text" && node.id.startsWith("frame:subtitle") ? node.lines : []).join(" "), needsUnit = options.unitShown !== !0 && !carriesUnit(formatValue(1, 0)) && !(subtitleUnit && carriesUnit(drawnSubtitle)), unitCaption = carriesUnit(measureName) ? measureName : `${measureName}${subtitleUnitClause(unit, measureName)}`, totalGap = style === "stepped" && derived.total ? 6 : 0, trackFont = { family: theme.type.family, ...theme.type.label, weight: tableEmphasis(theme) }, headFont = fieldHeadFont(theme), sizeHead = { font: headFont, text: fieldHeadText(options.cohortSizeLabel ?? chartString(options, "cohortSize"), theme) }, stackFont = secondaryFont(theme), tracks = exhibitTracks(rowData, visible, data, options, trackFont, measure, formatValue, stackFont, sizeHead), regularWidth = tracks.label + tracks.size + visible.length * tracks.month, nameFont = { family: theme.type.family, ...theme.type.label }, rowNames = fitColumn(rowData.map((row) => {
|
|
518
|
+
let font = row.kind === "total" ? { ...nameFont, weight: tableEmphasis(theme) } : nameFont, cap = Math.max(24, frame.plot.w * 0.3 - 12);
|
|
519
|
+
return {
|
|
520
|
+
text: row.label,
|
|
521
|
+
font,
|
|
522
|
+
maxWidth: cap,
|
|
523
|
+
maxLines: 2,
|
|
524
|
+
wider: gutterBudget(cap, frame.plot.w, tracks.size + visible.length * tracks.month) - 12,
|
|
525
|
+
shrink: stepDownFont(theme, font, "label", options.target, textScaleOf(options)),
|
|
526
|
+
target: options.target,
|
|
527
|
+
textScale: textScaleOf(options),
|
|
528
|
+
typeRole: "label"
|
|
529
|
+
};
|
|
530
|
+
}), measure), gap = options[TIGHT_SPACING]?.names === !0 ? 4 : 12;
|
|
531
|
+
tracks.label = Math.max(measure(chartString(options, "cohort"), nameFont).width + gap, measure(fieldHeadText(chartString(options, "cohort"), theme), headFont).width + gap, maxOf(rowNames.map((name) => name.w + gap))), rowH = Math.max(rowH, maxOf(rowNames.map((name) => name.h + rowAir)));
|
|
532
|
+
let fullWidth = tracks.label + tracks.size + visible.length * tracks.month;
|
|
533
|
+
if (style === "pure" && !options.format && frame.plot.w < fullWidth) {
|
|
534
|
+
let rateWidth = tracks.month * Math.min(1, frame.plot.w / fullWidth) - 2;
|
|
535
|
+
formatValue = retentionFormatter(options, rowData, (text) => measure(text, trackFont).width > rateWidth), tracks = { ...exhibitTracks(rowData, visible, data, options, trackFont, measure, formatValue, stackFont, sizeHead), label: tracks.label };
|
|
536
|
+
}
|
|
537
|
+
let showSteppedLegend = style === "stepped" && options.legend !== "none", steps = options.steps ?? DEFAULT_STEPS, caption = options.strings?.cohortMeasure ? `${measureName}${options.unit && !carriesUnit(measureName) ? ` (${options.unit})` : ""}` : options.unit ?? measureName, keyFont = { family: theme.type.family, ...theme.type.axis }, keyFits = (text) => measure(text, keyFont).width + 10 + steppedKeyText(scope, caption, steps, options.locale?.language).labels.reduce((width, label) => width + 16 + (label ? 4 + measure(label, keyFont).width : 0), 0) <= frame.plot.w, keyUnit = !needsUnit || !showSteppedLegend ? void 0 : scope === "column" ? chartString(options, "withinColumnUnit", { unit: unitCaption }) : carriesUnit(caption) ? void 0 : unitCaption, keyCaption = keyUnit !== void 0 && keyFits(keyUnit) ? keyUnit : void 0, keyFlow = showSteppedLegend ? steppedKeyFlow(steppedKeyText(scope, caption, steps, options.locale?.language, keyCaption), keyFont, measure, size.width - frame.plot.x) : void 0, legendOffset = keyFlow ? LEGEND_H + keyFlow.pitch * (keyFlow.rows - 1) + 10 : 0, tableTop = frame.plot.y + legendOffset, desiredWidth = tracks.label + tracks.size + visible.length * tracks.month, scale = Math.min(1, frame.plot.w / desiredWidth), labelW = tracks.label * scale, sizeW = tracks.size * scale, monthW = style === "stepped" ? tracks.month * scale : (frame.plot.w - labelW - sizeW) / visible.length, tableLeft = frame.plot.x, sizeLeft = tableLeft + labelW, monthLeft = sizeLeft + sizeW, tableRight = monthLeft + visible.length * monthW, averageBases = derived.total && derived.basis !== "previous" ? visible.map((period) => derived.cohorts.reduce((sum, row) => sum + (period < row.observedPeriods ? row.base : 0), 0)) : void 0, columnRanges = scope === "column" ? visible.map((period) => {
|
|
538
|
+
let values = derived.cohorts.flatMap((row) => {
|
|
539
|
+
let value = period < row.observedPeriods ? row.retention[period] : null;
|
|
540
|
+
return value == null ? [] : [value];
|
|
541
|
+
});
|
|
542
|
+
return period === 0 || values.length === 0 ? void 0 : { min: minOf(values), max: maxOf(values) };
|
|
543
|
+
}) : void 0, axisFont = options[STACKED_TEXT] ? stackFont : { family: theme.type.family, ...theme.type.axis }, baseFont = options[STACKED_TEXT] ? stackFont : { family: theme.type.family, ...theme.type.label }, lineH = (font) => font.size * (font.lineHeight ?? 1.2), wrapped = (text, font, room) => options[STACKED_TEXT] && measure(text, font).width > room ? twoLines(text, font, measure) : [text], sizeHeader = sizeHead.text, sizeHeaderFont = headFont, sizeHeaderLines = wrapped(sizeHeader, sizeHeaderFont, sizeW - 4), rangeLines = columnRanges?.map((range, column) => {
|
|
544
|
+
if (!range) return [];
|
|
545
|
+
let [low, high] = [formatValue(range.min, visible[column]), formatValue(range.max, visible[column])];
|
|
546
|
+
return wrapped(low === high ? low : numberRange(low, high), axisFont, monthW - 4);
|
|
547
|
+
}), baseLines = averageBases?.map((base) => wrapped(chartString(options, "baseValue", { value: formatAutomaticNumber(base, { locale: options.locale?.language, decimals: 0 }) }), baseFont, monthW - 4)), extraLines = (blocks) => Math.max(0, maxOf((blocks ?? []).map((lines) => lines.length - 1)));
|
|
548
|
+
headerRowH = Math.max(headerRowH, sizeHeaderLines.length * lineH(sizeHeaderFont) + rowAir);
|
|
549
|
+
let baseLineH = averageBases ? baseRowH + extraLines(baseLines) * lineH(baseFont) : 0, headerH = headerRowH + (columnRanges ? baseRowH + extraLines(rangeLines) * lineH(axisFont) : 0), tableBottom = tableTop + headerH + rowData.length * rowH + totalGap + baseLineH;
|
|
550
|
+
{
|
|
551
|
+
let grow = rowDrivenHeight({
|
|
552
|
+
options,
|
|
553
|
+
width: size.width,
|
|
554
|
+
height: size.height,
|
|
555
|
+
chromeH: size.height - frame.plot.h + legendOffset,
|
|
556
|
+
rowsH: tableBottom - tableTop + 6
|
|
557
|
+
});
|
|
558
|
+
if (grow !== void 0) return buildExhibit(data, derived, visible, { ...options, size: { width: size.width, height: grow } }, warnings, exclusion);
|
|
559
|
+
}
|
|
560
|
+
let headerFont = { family: theme.type.family, ...theme.type.axis }, cellFont = { family: theme.type.family, ...theme.type.label }, strongFont = { ...cellFont, weight: emphasisWeight(theme) }, totalFont = { ...cellFont, weight: tableEmphasis(theme) }, totalPaint = totalGround(theme, options.palette), mutedInk = { token: "inkMuted" }, background = { token: "background" }, designated = options.designatedPeriod ?? 3, binByPeriod = columnBins(derived, visible, scope, steps, totalId), rules = [], addLine = (id, x1, y1, x2, y2, width, stroke, part) => {
|
|
561
|
+
rules.push({ t: "line", id, x1, y1, x2, y2, stroke, width, owner: {}, part }), occupied.claim({ x: Math.min(x1, x2), y: Math.min(y1, y2), w: Math.max(1, Math.abs(x2 - x1)), h: Math.max(1, Math.abs(y2 - y1)) }, "axis", {}, part);
|
|
562
|
+
}, head = headRule(theme);
|
|
563
|
+
addLine("cohort-header-bottom", tableLeft, tableTop + headerH, tableRight, tableTop + headerH, head.width, head.stroke, "tableRule");
|
|
564
|
+
let addLabel = (id, text, rect, font, ink, owner = {}, kind = "point", insidePaint, fitted, align) => {
|
|
565
|
+
requests.push({
|
|
566
|
+
id,
|
|
567
|
+
kind,
|
|
568
|
+
typeRole: kind === "axisTitle" || id.startsWith("cohort-header-range:") ? "axis" : "label",
|
|
569
|
+
owner,
|
|
570
|
+
text,
|
|
571
|
+
...owner.categoryId?.startsWith("t") && owner.seriesId ? {
|
|
572
|
+
noteText: `${rowData.find((row) => row.id === owner.seriesId)?.label ?? ""} ${text} (${periodName(data.periodLabel, Number(owner.categoryId.slice(1)), options.locale?.language)})`
|
|
573
|
+
} : {},
|
|
574
|
+
...fitted ? fittedLabel(fitted, font) : { lines: [text] },
|
|
575
|
+
...align ? { align } : {},
|
|
576
|
+
font,
|
|
577
|
+
priority: kind === "axisTitle" ? PRIORITY.endpoint : PRIORITY.interior,
|
|
578
|
+
candidates: [{ slot: `${id}:fixed`, rect, penalty: 0, ...insidePaint ? { insideFill: paintColor(theme, insidePaint), insidePaint } : {} }]
|
|
579
|
+
}), fontById.set(id, font), labelInk.set(id, ink);
|
|
580
|
+
}, measuredRect = (text, font, x, y, align) => {
|
|
581
|
+
let measured = measure(text, font);
|
|
582
|
+
return {
|
|
583
|
+
x: align === "start" ? x : align === "middle" ? x - measured.width / 2 : x - measured.width,
|
|
584
|
+
y: y + (rowH - measured.height) / 2,
|
|
585
|
+
w: measured.width,
|
|
586
|
+
h: measured.height
|
|
587
|
+
};
|
|
588
|
+
}, addBlock = (id, lines, font, x, y, h, align, ink, owner, kind) => {
|
|
589
|
+
let w = maxOf(lines.map((line) => measure(line, font).width)), blockH = lines.length === 1 ? measure(lines[0], font).height : lines.length * lineH(font), rect = { x: align === "middle" ? x - w / 2 : x - w, y: y + (h - blockH) / 2, w, h: blockH };
|
|
590
|
+
addLabel(
|
|
591
|
+
id,
|
|
592
|
+
lines.join(" "),
|
|
593
|
+
rect,
|
|
594
|
+
font,
|
|
595
|
+
ink,
|
|
596
|
+
owner,
|
|
597
|
+
kind,
|
|
598
|
+
void 0,
|
|
599
|
+
{ lines, w, h: blockH, font, ...font === stackFont ? { typeRole: "secondary" } : {} },
|
|
600
|
+
lines.length === 1 ? void 0 : align
|
|
601
|
+
);
|
|
602
|
+
}, keyShowsUnit = showSteppedLegend && (keyCaption !== void 0 || scope === "classic" && carriesUnit(caption)), sizeEnd = sizeLeft + sizeW - (options[STACKED_TEXT] ? 4 : 18) * scale, cornerRoom = sizeEnd - maxOf(sizeHeaderLines.map((line) => measure(line, headFont).width)) - 8 - tableLeft, cornerTexts = [unitCaption, subtitleUnitClause(unit, "").trim(), unit], unitCorner = needsUnit && !keyShowsUnit ? cornerTexts.find((text) => text !== "" && measure(text, headerFont).width <= cornerRoom) : void 0, corner = unitCorner ?? fieldHeadText(chartString(options, "cohort"), theme), cornerFont = unitCorner === void 0 ? headFont : headerFont, headPaint = headInk();
|
|
603
|
+
if (addLabel("cohort-header-label", corner, measuredRect(corner, cornerFont, tableLeft, tableTop, "start"), cornerFont, headPaint, {}, "axisTitle"), sizeHeaderLines.length > 1 ? addBlock("cohort-header-size", sizeHeaderLines, headFont, sizeEnd, tableTop, headerRowH, "end", headPaint, {}, "axisTitle") : addLabel("cohort-header-size", sizeHeader, measuredRect(sizeHeader, headFont, sizeEnd, tableTop, "end"), headFont, headPaint, {}, "axisTitle"), visible.forEach((period, column) => {
|
|
604
|
+
let text = periodName(data.periodLabel, period, options.locale?.language), ink = style === "pure" && period === designated ? emphasisInk(theme) : headPaint;
|
|
605
|
+
addLabel(
|
|
606
|
+
`cohort-header-period:${period}`,
|
|
607
|
+
text,
|
|
608
|
+
measuredRect(text, headerFont, monthLeft + (column + 0.5) * monthW, tableTop, "middle"),
|
|
609
|
+
headerFont,
|
|
610
|
+
ink,
|
|
611
|
+
{},
|
|
612
|
+
"axisTitle"
|
|
613
|
+
);
|
|
614
|
+
let range = columnRanges?.[column];
|
|
615
|
+
if (range && options[STACKED_TEXT])
|
|
616
|
+
addBlock(`cohort-header-range:${period}`, rangeLines[column], axisFont, monthLeft + (column + 0.5) * monthW, tableTop + headerRowH - 4, headerH - headerRowH, "middle", mutedInk, { categoryId: `t${period}` }, "point");
|
|
617
|
+
else if (range) {
|
|
618
|
+
let rangeFont = { family: theme.type.family, ...theme.type.axis }, [low, high] = [formatValue(range.min, period), formatValue(range.max, period)], rangeText = low === high ? low : numberRange(low, high), measured = measure(rangeText, rangeFont);
|
|
619
|
+
addLabel(
|
|
620
|
+
`cohort-header-range:${period}`,
|
|
621
|
+
rangeText,
|
|
622
|
+
{ x: monthLeft + (column + 0.5) * monthW - measured.width / 2, y: tableTop + headerRowH - 4 + (baseRowH - measured.height) / 2, w: measured.width, h: measured.height },
|
|
623
|
+
rangeFont,
|
|
624
|
+
mutedInk,
|
|
625
|
+
{ categoryId: `t${period}` },
|
|
626
|
+
"point"
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
}), rowData.forEach((row, rowIndex) => {
|
|
630
|
+
let y = tableTop + headerH + rowIndex * rowH + (row.kind === "total" ? totalGap : 0), rowFont = row.kind === "total" ? totalFont : cellFont;
|
|
631
|
+
if (style === "pure" && rowIndex > 0 && row.kind !== "total" && addLine(`cohort-row-rule:${row.id}`, tableLeft, y, tableRight, y, theme.table?.ruleWidths?.row ?? strokeToken(theme, "hair"), tableRuleInk(), "rowRule"), row.kind === "total") {
|
|
632
|
+
let rule = totalRule(theme);
|
|
633
|
+
nodes.push({ t: "rect", id: `cohort-total-ground:${row.id}`, rect: { x: tableLeft, y, w: tableRight - tableLeft, h: rowH }, fill: totalPaint, owner: {}, part: "cohortTotalGround" }), addLine(`cohort-total-rule:${row.id}`, tableLeft, y - totalGap / 2, tableRight, y - totalGap / 2, rule.width, rule.stroke, "totalRule"), rules.push({ t: "line", id: `cohort-total-rule-below:${row.id}`, x1: tableLeft, y1: y + rowH, x2: tableRight, y2: y + rowH, stroke: rule.stroke, width: rule.width, owner: {}, part: "totalRule" });
|
|
634
|
+
}
|
|
635
|
+
let rowGround = row.kind === "total" ? totalPaint : background;
|
|
636
|
+
addLabel(
|
|
637
|
+
`cohort-row:${row.id}`,
|
|
638
|
+
row.label,
|
|
639
|
+
{ x: tableLeft, y: y + (rowH - rowNames[rowIndex].h) / 2, w: rowNames[rowIndex].w, h: rowNames[rowIndex].h },
|
|
640
|
+
rowFont,
|
|
641
|
+
{ token: "ink" },
|
|
642
|
+
{ seriesId: row.id },
|
|
643
|
+
"series",
|
|
644
|
+
void 0,
|
|
645
|
+
rowNames[rowIndex]
|
|
646
|
+
);
|
|
647
|
+
let sizeRect = { x: sizeLeft, y, w: sizeW, h: rowH }, sizeNodeId = `cohort-size:${row.id}`;
|
|
648
|
+
nodes.push({ t: "rect", id: sizeNodeId, rect: sizeRect, fill: rowGround, owner: { seriesId: row.id, categoryId: "cohort-size" }, part: "cohortSize", display: { value: formatAutomaticNumber(row.base, { locale: options.locale?.language, decimals: 0 }) } }), occupied.claim(sizeRect, "mark", { seriesId: row.id, categoryId: "cohort-size" }, "cohortSize"), marks.sizeCells.push({ rowId: row.id, rowLabel: row.label, value: row.base, rect: sizeRect, nodeId: sizeNodeId, kind: row.kind });
|
|
649
|
+
let sizeText = formatAutomaticNumber(row.base, { locale: options.locale?.language, decimals: 0 });
|
|
650
|
+
addLabel(
|
|
651
|
+
`cohort-size-label:${row.id}`,
|
|
652
|
+
sizeText,
|
|
653
|
+
measuredRect(sizeText, rowFont, sizeEnd, y, "end"),
|
|
654
|
+
rowFont,
|
|
655
|
+
{ token: "ink" },
|
|
656
|
+
{ seriesId: row.id, categoryId: "cohort-size" },
|
|
657
|
+
"point",
|
|
658
|
+
rowGround
|
|
659
|
+
), visible.forEach((period, column) => {
|
|
660
|
+
let retention = period < row.observedPeriods ? row.retention[period] ?? null : null, missing = row.kind === "total" ? derived.cohorts.some((cohort) => missingCohortRate(cohort, period, derived.basis)) : missingCohortRate(derived.cohorts.find((cohort) => cohort.id === row.id), period, derived.basis), rect = {
|
|
661
|
+
x: monthLeft + column * monthW,
|
|
662
|
+
y,
|
|
663
|
+
w: style === "stepped" ? Math.max(0, monthW - 1) : monthW,
|
|
664
|
+
h: style === "stepped" ? rowH - 1 : rowH
|
|
665
|
+
}, nodeId = `cohort-cell:${row.id}:t${period}`, bin = retention === null || period === 0 ? null : binByPeriod.get(`${row.id}:${period}`) ?? classicBin(retention * 100, steps), paint = retention === null || period === 0 ? rowGround : style === "pure" ? period === designated ? { token: "focus", tint: 0.94 } : rowGround : semanticPalettePaint(theme, options.palette, "sequential", BIN_TINTS[bin]);
|
|
666
|
+
if (cellPaints.set(nodeId, paint), nodes.push({
|
|
667
|
+
t: "rect",
|
|
668
|
+
id: nodeId,
|
|
669
|
+
rect,
|
|
670
|
+
fill: paint,
|
|
671
|
+
owner: { seriesId: row.id, categoryId: `t${period}` },
|
|
672
|
+
part: row.kind === "total" ? "cohortTotalCell" : "cohortCell",
|
|
673
|
+
display: retention === null ? { state: chartString(options, missing ? "noObservation" : "notReached") } : { value: formatValue(retention, period) }
|
|
674
|
+
}), occupied.claim(rect, "mark", { seriesId: row.id, categoryId: `t${period}` }, row.kind === "total" ? "cohortTotalCell" : "cohortCell"), marks.cells.push({
|
|
675
|
+
rowId: row.id,
|
|
676
|
+
periodId: `t${period}`,
|
|
677
|
+
periodIndex: period,
|
|
678
|
+
rowLabel: row.label,
|
|
679
|
+
periodLabel: periodName(data.periodLabel, period, options.locale?.language),
|
|
680
|
+
kind: row.kind === "total" ? "total" : "cohort",
|
|
681
|
+
rect,
|
|
682
|
+
nodeId,
|
|
683
|
+
retention
|
|
684
|
+
}), retention === null && !missing) return;
|
|
685
|
+
let text = missing ? "\u2014" : formatValue(retention, period), highlighted = style === "pure" && retention !== null && pureEmphasis(options, period, retention), font = row.kind === "total" && style !== "pure" ? totalFont : highlighted ? strongFont : cellFont, ink = period === 0 ? mutedInk : highlighted ? emphasisInk(theme, paint) : style === "stepped" && (bin ?? 0) >= 3 ? { token: "inkInverse" } : { token: "ink" };
|
|
686
|
+
addLabel(
|
|
687
|
+
`cohort-cell:${row.id}:t${period}`,
|
|
688
|
+
text,
|
|
689
|
+
measuredRect(text, font, rect.x + rect.w / 2, y, "middle"),
|
|
690
|
+
font,
|
|
691
|
+
ink,
|
|
692
|
+
{ seriesId: row.id, categoryId: `t${period}` },
|
|
693
|
+
row.kind === "total" ? "total" : "point",
|
|
694
|
+
paint
|
|
695
|
+
);
|
|
696
|
+
});
|
|
697
|
+
}), averageBases) {
|
|
698
|
+
let y = tableBottom - baseLineH;
|
|
699
|
+
visible.forEach((period, column) => {
|
|
700
|
+
if (options[STACKED_TEXT]) {
|
|
701
|
+
addBlock(`cohort-average-base:t${period}`, baseLines[column], baseFont, monthLeft + (column + 0.5) * monthW, y, baseLineH, "middle", mutedInk, { seriesId: totalId, categoryId: `t${period}` }, "annotation");
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
let text = chartString(options, "baseValue", { value: formatAutomaticNumber(averageBases[column], { locale: options.locale?.language, decimals: 0 }) }), measured = measure(text, baseFont);
|
|
705
|
+
addLabel(
|
|
706
|
+
`cohort-average-base:t${period}`,
|
|
707
|
+
text,
|
|
708
|
+
{ x: monthLeft + (column + 0.5) * monthW - measured.width / 2, y: y + (baseLineH - measured.height) / 2, w: measured.width, h: measured.height },
|
|
709
|
+
baseFont,
|
|
710
|
+
mutedInk,
|
|
711
|
+
{ seriesId: totalId, categoryId: `t${period}` },
|
|
712
|
+
"annotation"
|
|
713
|
+
);
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
let legend;
|
|
717
|
+
if (style === "stepped" && !showSteppedLegend) {
|
|
718
|
+
let key = steppedKeyText(scope, caption, steps, options.locale?.language);
|
|
719
|
+
legendOff(warnings, "cohort", [key.caption, ...key.labels.filter(Boolean)]);
|
|
720
|
+
}
|
|
721
|
+
if (showSteppedLegend && (legend = addSteppedLegend(nodes, requests, fontById, labelInk, occupied, { ...frame.plot, w: tableRight - tableLeft }, scope, caption, theme, options.palette, measure, steps, keyFlow, options.locale?.language, keyCaption)), options.exhibitLabel) {
|
|
722
|
+
let font = { family: theme.type.family, ...theme.type.label, letterSpacing: 2.2 };
|
|
723
|
+
addLabel("cohort-exhibit-label", options.exhibitLabel, measuredRect(options.exhibitLabel, font, frame.plot.x, 12, "start"), font, mutedInk, {}, "axisTitle");
|
|
724
|
+
}
|
|
725
|
+
if (frame.frame.sourceNodeId) {
|
|
726
|
+
let sourceNode = nodes.find((node) => node.id === frame.frame.sourceNodeId), firstNote = ruleOverNotes ? nodes.find((node) => node.id === frame.frame.footnoteNodeIds?.[0]) : void 0, footGap = spaceTokens(theme, size.width).gapAxisFootnote, contentBottom = tableBottom, y = firstNote?.t === "text" ? Math.max(firstNote.y - footGap - 1, Math.min(firstNote.y - 5, contentBottom + footGap - 5)) : sourceNode?.t === "text" ? sourceNode.y - 5 : void 0;
|
|
727
|
+
sourceNode?.t === "text" && y !== void 0 && addLine("cohort-source-rule", frame.plot.x, y, tableRight, y, strokeToken(theme, "hair"), { token: "grid" }, "sourceRule");
|
|
728
|
+
}
|
|
729
|
+
let solved = solveLabels(requests, occupied, labelCtx(theme, size, options, {
|
|
730
|
+
focus: void 0,
|
|
731
|
+
measure,
|
|
732
|
+
plot: frame.plot,
|
|
733
|
+
labelPad: 1
|
|
734
|
+
}));
|
|
735
|
+
for (let label of solved.placed) {
|
|
736
|
+
if (style === "stepped" && label.id.startsWith("cohort-cell:")) continue;
|
|
737
|
+
let ink = labelInk.get(label.id);
|
|
738
|
+
ink && (label.ink = ink);
|
|
739
|
+
}
|
|
740
|
+
pushAll(nodes, rules), pushAll(nodes, labelsToNodes(theme, solved.placed, (label) => fontById.get(label.id) ?? cellFont, nodes)), pushAll(warnings, solved.warnings);
|
|
741
|
+
for (let label of solved.placed)
|
|
742
|
+
if (label.id.startsWith("cohort-row:") && label.hidden === "collision") {
|
|
743
|
+
let warning = warnings.find((w) => w.code === "label-hidden" && w.owner?.seriesId === label.owner.seriesId);
|
|
744
|
+
warning && (warning.severity = "error");
|
|
745
|
+
}
|
|
746
|
+
return {
|
|
747
|
+
type: "cohort",
|
|
748
|
+
[REGULAR_WIDTH]: regularWidth,
|
|
749
|
+
size,
|
|
750
|
+
sizing: rowSizing("cohort", size, {
|
|
751
|
+
chromeH: size.height - frame.plot.h + legendOffset,
|
|
752
|
+
minimumRowsH: headerH + rowData.length * Math.max(rowH, measure("0", cellFont).height) + totalGap + baseLineH + 6,
|
|
753
|
+
naturalRowsH: tableBottom - tableTop + 6,
|
|
754
|
+
minWidth: size.width - frame.plot.w + desiredWidth,
|
|
755
|
+
naturalWidth: size.width - frame.plot.w + desiredWidth
|
|
756
|
+
}),
|
|
757
|
+
plot: { x: tableLeft, y: tableTop, w: tableRight - tableLeft, h: Math.max(0, tableBottom - tableTop) },
|
|
758
|
+
scene: nodes,
|
|
759
|
+
labels: solved.placed,
|
|
760
|
+
axes: [],
|
|
761
|
+
annotations: [],
|
|
762
|
+
...legend ? { legend } : {},
|
|
763
|
+
frame: frame.frame,
|
|
764
|
+
marks,
|
|
765
|
+
derived,
|
|
766
|
+
a11y: {
|
|
767
|
+
title: accessibleTitle(options.title, chartString(options, "exhibitTitle", { measure: measureName.toLocaleLowerCase(options.locale?.language ?? "en"), count: String(derived.cohorts.length) })),
|
|
768
|
+
desc: chartString(options, "exhibitDesc", { measure: measureName, periods: visible.map((period) => periodName(data.periodLabel, period, options.locale?.language)).join(", "), formula: cohortFormula(options, derived.basis), anchor: visible.includes(0) ? chartString(options, "exhibitDescAnchor") : "", missing: derived.cohorts.some((row) => visible.some((period) => missingCohortRate(row, period, derived.basis))) ? chartString(options, "exhibitDescMissing") : "", total: derived.total ? chartString(options, "exhibitDescTotal", { basis: chartString(options, derived.basis === "previous" ? "previousBasis" : "cohortBasis") }) : "" })
|
|
769
|
+
},
|
|
770
|
+
warnings,
|
|
771
|
+
debug: { occupied: occupied.snapshot(), decisions: solved.decisions }
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
function columnBins(derived, visible, scope, steps, totalId) {
|
|
775
|
+
let result = /* @__PURE__ */ new Map();
|
|
776
|
+
for (let period of visible) {
|
|
777
|
+
let values = derived.cohorts.flatMap((row) => {
|
|
778
|
+
let value = period < row.observedPeriods ? row.retention[period] : null;
|
|
779
|
+
return value == null ? [] : [{ rowId: row.id, value }];
|
|
780
|
+
});
|
|
781
|
+
if (period === 0) continue;
|
|
782
|
+
if (scope === "classic") {
|
|
783
|
+
values.forEach(({ rowId, value }) => result.set(`${rowId}:${period}`, classicBin(value * 100, steps)));
|
|
784
|
+
let total2 = derived.total?.retention[period];
|
|
785
|
+
total2 != null && result.set(`${totalId}:${period}`, classicBin(total2 * 100, steps));
|
|
786
|
+
continue;
|
|
787
|
+
}
|
|
788
|
+
let min = minOf(values.map(({ value }) => value)), max = maxOf(values.map(({ value }) => value));
|
|
789
|
+
values.forEach(({ rowId, value }) => {
|
|
790
|
+
let bin = values.length === 1 || max === min ? 2 : Math.min(4, Math.floor((value - min) / (max - min) * 5));
|
|
791
|
+
result.set(`${rowId}:${period}`, bin);
|
|
792
|
+
});
|
|
793
|
+
let total = derived.total?.retention[period];
|
|
794
|
+
if (total != null) {
|
|
795
|
+
let bin = values.length === 1 || max === min ? 2 : Math.max(0, Math.min(4, Math.floor((total - min) / (max - min) * 5)));
|
|
796
|
+
result.set(`${totalId}:${period}`, bin);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
return result;
|
|
800
|
+
}
|
|
801
|
+
var DEFAULT_STEPS = [30, 40, 50, 60];
|
|
802
|
+
function classicBin(percent, steps) {
|
|
803
|
+
let index = steps.findIndex((step) => percent < step);
|
|
804
|
+
return index === -1 ? steps.length : index;
|
|
805
|
+
}
|
|
806
|
+
function stepLabels(steps, locale) {
|
|
807
|
+
let fmt = (value) => {
|
|
808
|
+
let [mantissa, exponent = "0"] = String(value).split("e"), decimals = Math.min(20, Math.max(0, (mantissa.split(".")[1]?.length ?? 0) - Number(exponent)));
|
|
809
|
+
return formatAutomaticNumber(value, { decimals, locale });
|
|
810
|
+
};
|
|
811
|
+
return [`<${fmt(steps[0])}`, ...steps.slice(0, -1).map((step, index) => `${fmt(step)} to <${fmt(steps[index + 1])}`), `${fmt(steps.at(-1))}+`];
|
|
812
|
+
}
|
|
813
|
+
function periodName(label, index, locale) {
|
|
814
|
+
let initial = (label ?? "").trim().charAt(0).toUpperCase();
|
|
815
|
+
return initial === "" ? chartString({ locale }, "period", { period: String(index) }) : `${initial}${index}`;
|
|
816
|
+
}
|
|
817
|
+
function periodRuns(label, periods, locale) {
|
|
818
|
+
let runs = [];
|
|
819
|
+
for (let period of [...periods].sort((a, b) => a - b)) {
|
|
820
|
+
let last = runs.at(-1);
|
|
821
|
+
last && period === last[1] + 1 ? last[1] = period : runs.push([period, period]);
|
|
822
|
+
}
|
|
823
|
+
return runs.map(([start, end]) => start === end ? periodName(label, start, locale) : numberRange(periodName(label, start, locale), periodName(label, end, locale))).join(", ");
|
|
824
|
+
}
|
|
825
|
+
function twoLines(text, font, measure) {
|
|
826
|
+
let best = [text], bestWidth = measure(text, font).width;
|
|
827
|
+
for (let index = 1; index < text.length - 1; index++) {
|
|
828
|
+
let char = text[index];
|
|
829
|
+
if (char !== " " && char !== "\u2013") continue;
|
|
830
|
+
let lines = char === " " ? [text.slice(0, index), text.slice(index + 1)] : [text.slice(0, index + 1), text.slice(index + 1)], lead = lines[0].trimEnd(), tail = lines[1].trimStart();
|
|
831
|
+
if (lead === "" || tail === "") continue;
|
|
832
|
+
let width = Math.max(measure(lead, font).width, measure(tail, font).width);
|
|
833
|
+
width < bestWidth && (best = [lead, tail], bestWidth = width);
|
|
834
|
+
}
|
|
835
|
+
return best;
|
|
836
|
+
}
|
|
837
|
+
function steppedKeyText(scope, unit, steps, locale, override) {
|
|
838
|
+
return {
|
|
839
|
+
labels: scope === "column" ? [chartString({ locale }, "low"), "", "", "", chartString({ locale }, "high")] : stepLabels(steps, locale),
|
|
840
|
+
// Column scope ranks each month against itself, so M3 "51" can shade
|
|
841
|
+
// darker than M1 "64": the caption says so instead of the unit.
|
|
842
|
+
caption: override ?? (scope === "column" ? chartString({ locale }, "withinColumn") : unit ?? chartString({ locale }, "measure"))
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
function addSteppedLegend(nodes, requests, fontById, labelInk, occupied, plot, scope, unit, theme, palette, measure, steps, flow, locale, override) {
|
|
846
|
+
let { labels, caption } = steppedKeyText(scope, unit, steps, locale, override), font = { family: theme.type.family, ...theme.type.axis }, captionW = measure(caption, font).width, x = plot.x, y = plot.y, items = [], add = (id, text, rect) => {
|
|
847
|
+
requests.push({ id, kind: "scale", typeRole: "axis", owner: {}, text, lines: [text], font, priority: PRIORITY.endpoint, candidates: [{ slot: `${id}:fixed`, rect, penalty: 0 }] }), fontById.set(id, font), labelInk.set(id, { token: "inkMuted" });
|
|
848
|
+
}, captionH = measure(caption, font).height;
|
|
849
|
+
return add("cohort-legend-caption", caption, { x, y: y + (12 - captionH) / 2, w: captionW, h: captionH }), x += captionW + 10, labels.forEach((label, index) => {
|
|
850
|
+
flow.breaks.has(index) && ([x, y] = [plot.x, y + flow.pitch]);
|
|
851
|
+
let swatchId = `cohort-legend-swatch:${index}`, labelId = `cohort-legend-label:${index}`, fill = semanticPalettePaint(theme, palette, "sequential", BIN_TINTS[index]);
|
|
852
|
+
if (nodes.push({ t: "rect", id: swatchId, rect: { x, y, w: 12, h: 12 }, fill, owner: { categoryId: `bin${index}` }, part: "swatch" }), occupied.claim({ x, y, w: 12, h: 12 }, "legend", { categoryId: `bin${index}` }, "swatch"), x += 12, label) {
|
|
853
|
+
let width = measure(label, font).width, height = measure(label, font).height;
|
|
854
|
+
add(labelId, label, { x: x + 4, y: y + (12 - height) / 2, w: width, h: height }), x += 4 + width, items.push({ id: `bin${index}`, swatchNodeId: swatchId, labelId: `label:${labelId}` });
|
|
855
|
+
}
|
|
856
|
+
x += 4;
|
|
857
|
+
}), { rect: { x: plot.x, y: plot.y, w: plot.w, h: LEGEND_H + flow.pitch * (flow.rows - 1) }, items };
|
|
858
|
+
}
|
|
859
|
+
function steppedKeyFlow(text, font, measure, width) {
|
|
860
|
+
let bins = text.labels.map((label) => 12 + (label ? 4 + measure(label, font).width : 0)), breaks = /* @__PURE__ */ new Set(), pitch = Math.max(LEGEND_H, measure(text.caption, font).height + 4);
|
|
861
|
+
if (measure(text.caption, font).width + 10 + bins.reduce((sum, bin) => sum + bin + 4, 0) - 4 <= width) return { rows: 1, breaks, pitch };
|
|
862
|
+
let x = 0;
|
|
863
|
+
return bins.forEach((bin, index) => {
|
|
864
|
+
(index === 0 || x + bin > width) && (breaks.add(index), x = 0), x += bin + 4;
|
|
865
|
+
}), { rows: 1 + breaks.size, breaks, pitch };
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// src/core/charts/cohort/layout.ts
|
|
869
|
+
var ANSWERED_HERE = ["palette", "sort", "valueAxis", "annotations"];
|
|
870
|
+
function layoutCohort(data, options = {}) {
|
|
871
|
+
if (options.variant !== void 0 && options.variant !== "heatmap") {
|
|
872
|
+
let geometry = layoutCohortExhibit(data, options);
|
|
873
|
+
return options.labels !== void 0 && geometry.warnings.push({
|
|
874
|
+
code: "labels-exhibit-unsupported",
|
|
875
|
+
severity: "warn",
|
|
876
|
+
message: "cohort exhibit variants do not consult 'labels' \u2014 pure and stepped draw a fixed label set, so the option changed nothing",
|
|
877
|
+
suggest: "drop 'labels', or set variant 'heatmap', which honours it"
|
|
878
|
+
}), geometry;
|
|
879
|
+
}
|
|
880
|
+
let warnings = [], basis = options.basis ?? "cohort", averagesMode = options.averages ?? !1, methodNote = options.methodNote === !0;
|
|
881
|
+
options.sort?.categories !== void 0 && options.sort.categories !== "sheet" && warnings.push({
|
|
882
|
+
code: "cohort-sort-ignored",
|
|
883
|
+
severity: "warn",
|
|
884
|
+
message: `sort.categories '${options.sort.categories}' was ignored \u2014 periods are ordinal time since cohort start and cannot be reordered by value`,
|
|
885
|
+
suggest: "remove options.sort.categories"
|
|
886
|
+
});
|
|
887
|
+
let segmentSort = options.sort?.segments;
|
|
888
|
+
(segmentSort === "asc" || segmentSort === "desc") && warnings.push({
|
|
889
|
+
code: "cohort-sort-ignored",
|
|
890
|
+
severity: "warn",
|
|
891
|
+
message: `sort.segments '${segmentSort}' was ignored \u2014 ranking cohorts by mean retention destroys the chronological staircase the triangle depends on`,
|
|
892
|
+
suggest: "use sort.segments 'reverse' to put the newest cohort at the top"
|
|
893
|
+
}), options.valueAxis !== void 0 && warnings.push({
|
|
894
|
+
code: "cohort-option-ignored",
|
|
895
|
+
severity: "warn",
|
|
896
|
+
message: "options.valueAxis was ignored \u2014 a retention triangle has no value axis; colour and the in-cell percentages carry the scale",
|
|
897
|
+
suggest: "remove options.valueAxis"
|
|
898
|
+
});
|
|
899
|
+
let {
|
|
900
|
+
derived,
|
|
901
|
+
warnings: derivedWarnings,
|
|
902
|
+
notMeaningful,
|
|
903
|
+
unsupportedAveragePeriods
|
|
904
|
+
} = deriveRetention(data, {
|
|
905
|
+
basis,
|
|
906
|
+
averages: averagesMode
|
|
907
|
+
});
|
|
908
|
+
pushAll(warnings, derivedWarnings);
|
|
909
|
+
let periodCount = derived.periodCount, periodIds = Array.from({ length: periodCount }, (_, t) => `t${t}`), periodNames = periodLabels(data.periodLabel, periodCount, options), baseSuffix = /* @__PURE__ */ new Map();
|
|
910
|
+
for (let row of derived.cohorts)
|
|
911
|
+
baseSuffix.set(row.id, `(n = ${formatAutomaticNumber(row.base, { locale: options.locale?.language, decimals: 0 })})`);
|
|
912
|
+
let cohortLabel = (index) => `${data.cohorts[index].label ?? data.cohorts[index].id} ${baseSuffix.get(derived.cohorts[index].id)}`, theme = resolveSemanticPaletteTheme(
|
|
913
|
+
chartTheme(options),
|
|
914
|
+
options.palette,
|
|
915
|
+
warnings
|
|
916
|
+
), rampTint = (r) => clamp(1 - Math.min(r, 1), 0, 1), cohortPaint = (r) => (
|
|
917
|
+
// The ramp is tints of series 1.
|
|
918
|
+
semanticPalettePaint(theme, options.palette, "sequential", rampTint(r))
|
|
919
|
+
), ANCHOR_PAINT = semanticPalettePaint(theme, options.palette, "neutral", 0.86), averagePaint = (r) => semanticPalettePaint(theme, options.palette, "neutralMark", rampTint(r)), cssOf = (paint) => paintColor(theme, paint), cellPaint = /* @__PURE__ */ new Map(), cellFor = (rowId, t, r, average) => {
|
|
920
|
+
if (r === null) return null;
|
|
921
|
+
let paint = t === 0 ? ANCHOR_PAINT : average ? averagePaint(r) : cohortPaint(r);
|
|
922
|
+
return cellPaint.set(`cell:${rowId}:t${t}`, paint), { pct: r * 100, fill: cssOf(paint), ...options.format ? {} : { [AUTOMATIC_FORMAT]: !0, format: formatAutomaticPercent(1, smallRateDecimals(r * 100), !1, options.locale?.language) } };
|
|
923
|
+
}, reverseRows = segmentSort === "reverse", shownSupports = derived.averages?.flatMap((a, t) => derived.cohorts.some((row) => missingCohortRate(row, t, basis)) ? [] : [{ support: a.support, t }]) ?? [], supports = shownSupports.map((a) => a.support), averageSupportSuffix = supports.length === 0 ? "" : supports[0] === supports[supports.length - 1] ? `(${chartString(options, "support", { count: String(supports[0]) })})` : `(${chartString(options, "supportRange", { first: String(supports[0]), last: String(supports[supports.length - 1]) })})`, averageLabel = [chartString(options, "weightedAverage"), averageSupportSuffix].filter(Boolean).join(" "), averageRow = derived.averages ? [
|
|
924
|
+
{
|
|
925
|
+
id: AVERAGE_ROW_ID,
|
|
926
|
+
label: averageLabel,
|
|
927
|
+
values: derived.averages.map((a, t) => cellFor(AVERAGE_ROW_ID, t, a.value, !0))
|
|
928
|
+
}
|
|
929
|
+
] : [], hostData = {
|
|
930
|
+
categories: periodIds.map((id, t) => ({ id, label: periodNames[t] })),
|
|
931
|
+
series: [
|
|
932
|
+
...reverseRows ? averageRow : [],
|
|
933
|
+
...derived.cohorts.map((row, index) => ({
|
|
934
|
+
id: row.id,
|
|
935
|
+
label: cohortLabel(index),
|
|
936
|
+
values: Array.from({ length: periodCount }, (_, t) => t >= row.observedPeriods ? null : cellFor(row.id, t, row.retention[t], !1))
|
|
937
|
+
})),
|
|
938
|
+
...reverseRows ? [] : averageRow
|
|
939
|
+
]
|
|
940
|
+
}, baseFootnotes = [
|
|
941
|
+
...authoredNotes(options),
|
|
942
|
+
...derived.cohorts.some((row) => row.retention.some((_, t) => missingCohortRate(row, t, basis))) ? [disclosureNote(chartString(options, "hatchMissing"))] : [],
|
|
943
|
+
...cohortNotes(basis, derived.averages, shownSupports, notMeaningful, unsupportedAveragePeriods, periodNames, methodNote, options)
|
|
944
|
+
], build = (extra) => (
|
|
945
|
+
// Only the author's own notes keep a number; the rest are derived.
|
|
946
|
+
layoutHeatmap(hostData, withAuthoredFootnotes({
|
|
947
|
+
...stripAnswered(options),
|
|
948
|
+
// One decimal width for every cell. The engine's own default drops the
|
|
949
|
+
// decimal on whole numbers, which puts "60%" next to "55.2%" in one column
|
|
950
|
+
// and costs the eye the alignment it scans by; integer percentages also
|
|
951
|
+
// fit a 24-column triangle where "55.2%" does not. The unrounded ratio
|
|
952
|
+
// stays in `derived`, so precision is never lost, only display width.
|
|
953
|
+
format: options.format ?? "12",
|
|
954
|
+
// Continuous ramp, in-cell values. Every cell carries an explicit fill
|
|
955
|
+
// from the pinned ramp above, so the engine's own observed-maximum anchor
|
|
956
|
+
// never reaches the ink.
|
|
957
|
+
scale: "continuous",
|
|
958
|
+
variant: "value",
|
|
959
|
+
// The key names the pinned ramp, not the host's observed one.
|
|
960
|
+
heatKey: {
|
|
961
|
+
chartType: "cohort",
|
|
962
|
+
items: [
|
|
963
|
+
...[0, 0.25, 0.5, 0.75, 1].map((r) => ({
|
|
964
|
+
id: `scale:${r * 100}`,
|
|
965
|
+
// The top swatch also paints cells above their own base.
|
|
966
|
+
label: r === 1 && derived.cohorts.some((cohort) => cohort.retention.some((value) => value !== null && value > 1)) ? "100%+" : `${r * 100}%`,
|
|
967
|
+
paint: cohortPaint(r),
|
|
968
|
+
...rampTint(r) >= 0.8 ? { stroke: { token: "neutralMark" } } : {}
|
|
969
|
+
})),
|
|
970
|
+
// Period 0 is grey, not the ramp's 100%: the key says why.
|
|
971
|
+
{ id: "scale:base", label: chartString(options, "periodBase", { period: periodNames[0] }), paint: ANCHOR_PAINT },
|
|
972
|
+
// The average row rides its own grey ramp; its swatch shows the
|
|
973
|
+
// ramp at 50%, so the key covers every fill drawn.
|
|
974
|
+
...derived.averages ? [{ id: "scale:average", label: chartString(options, "averageGrey"), paint: averagePaint(0.5) }] : []
|
|
975
|
+
]
|
|
976
|
+
},
|
|
977
|
+
highlight: withAverageRow(options.highlight, derived.averages !== void 0),
|
|
978
|
+
...reverseRows ? { sort: { segments: "reverse" } } : {},
|
|
979
|
+
// A row name too long for the band is cut before its base, never the base.
|
|
980
|
+
rowSuffix: Object.fromEntries(baseSuffix)
|
|
981
|
+
}, [...baseFootnotes, ...extra], options.footnotes))
|
|
982
|
+
), host = build([]), lost = countSuppressed(host, derived, methodNote);
|
|
983
|
+
if (lost.total > 0) {
|
|
984
|
+
host = build([disclosureNote(suppressionNote(lost, options))]);
|
|
985
|
+
let second = countSuppressed(host, derived, methodNote);
|
|
986
|
+
if (second.total !== lost.total || second.drawn !== lost.drawn) {
|
|
987
|
+
host = build([disclosureNote(suppressionNote(second, options))]);
|
|
988
|
+
let third = countSuppressed(host, derived, methodNote);
|
|
989
|
+
third.total !== second.total || third.drawn !== second.drawn ? (host = build([disclosureNote(chartString(options, "uncountedSuppressed"))]), lost = countSuppressed(host, derived, methodNote)) : lost = third;
|
|
990
|
+
} else
|
|
991
|
+
lost = second;
|
|
992
|
+
}
|
|
993
|
+
let rowIndex = /* @__PURE__ */ new Map();
|
|
994
|
+
derived.cohorts.forEach((row, index) => rowIndex.set(row.id, index));
|
|
995
|
+
let periodIndex = /* @__PURE__ */ new Map();
|
|
996
|
+
periodIds.forEach((id, t) => periodIndex.set(id, t));
|
|
997
|
+
let cells = [], unobserved = 0;
|
|
998
|
+
for (let node of host.scene) {
|
|
999
|
+
if (node.part !== "cell" || node.t !== "rect") continue;
|
|
1000
|
+
let rowId = node.owner?.seriesId, periodId = node.owner?.categoryId;
|
|
1001
|
+
if (rowId === void 0 || periodId === void 0) continue;
|
|
1002
|
+
let t = periodIndex.get(periodId), isAverage = rowId === AVERAGE_ROW_ID, row = isAverage ? null : derived.cohorts[rowIndex.get(rowId)], notReached = row !== null && t >= row.observedPeriods;
|
|
1003
|
+
notReached && (unobserved += 1);
|
|
1004
|
+
let retention = isAverage ? derived.averages[t].value : notReached ? null : row.retention[t], missing = isAverage ? derived.cohorts.some((row2) => missingCohortRate(row2, t, basis)) : missingCohortRate(row, t, basis);
|
|
1005
|
+
cells.push({
|
|
1006
|
+
rowId,
|
|
1007
|
+
periodId,
|
|
1008
|
+
periodIndex: t,
|
|
1009
|
+
rowLabel: isAverage ? chartString(options, "weightedAverage") : data.cohorts[rowIndex.get(rowId)].label ?? rowId,
|
|
1010
|
+
periodLabel: periodNames[t],
|
|
1011
|
+
kind: isAverage ? "average" : "cohort",
|
|
1012
|
+
rect: node.rect,
|
|
1013
|
+
nodeId: node.id,
|
|
1014
|
+
retention
|
|
1015
|
+
}), node.display = withState(
|
|
1016
|
+
node.display,
|
|
1017
|
+
retention === null ? missing ? chartString(options, "noObservation") : notReached ? chartString(options, "notReached") : isAverage ? chartString(options, "noContributor") : "n.m." : supportState(isAverage ? derived.averages[t].support : null, options)
|
|
1018
|
+
), restoreCohortCellPaint(node, cellPaint.get(node.id), retention, notReached);
|
|
1019
|
+
}
|
|
1020
|
+
if (restoreCohortLabelPaints(host, cellPaint), cells.sort(compareCells), lost.total > 0) {
|
|
1021
|
+
let where = lost.emptyColumns.length > 0 ? `; ${lost.emptyColumns.map((t) => `'${periodNames[t]}'`).join(", ")} lost every one of theirs` : "";
|
|
1022
|
+
warnings.push({
|
|
1023
|
+
code: "cohort-values-suppressed",
|
|
1024
|
+
severity: "warn",
|
|
1025
|
+
message: `${lost.total} of ${lost.drawn} cells are too small to carry their percentage${where}; those cells read from colour alone, and the exhibit says so in a footnote`,
|
|
1026
|
+
suggest: "widen the canvas, show fewer periods, or read the exact rates from the derived output"
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
if (derived.averages) {
|
|
1030
|
+
let placed = host.labels.find((label) => label.id === `series:${AVERAGE_ROW_ID}`);
|
|
1031
|
+
placed && !placed.hidden && !placed.lines.join(" ").includes(averageSupportSuffix) && warnings.push({
|
|
1032
|
+
code: "cohort-average-support-truncated",
|
|
1033
|
+
severity: "warn",
|
|
1034
|
+
message: `the row band was too narrow for '${averageLabel}' \u2014 the computed row now reads like one more cohort, with no sign that its support falls from ${supports[0]} to ${supports[supports.length - 1]}`,
|
|
1035
|
+
suggest: "widen the canvas or shorten the cohort labels so the average row keeps its support range"
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
let truncated = [];
|
|
1039
|
+
for (let row of derived.cohorts) {
|
|
1040
|
+
let placed = host.labels.find((label) => label.id === `series:${row.id}`);
|
|
1041
|
+
!placed || placed.hidden || placed.lines.join(" ").includes(baseSuffix.get(row.id)) || truncated.push(row.id);
|
|
1042
|
+
}
|
|
1043
|
+
return truncated.length > 0 && warnings.push({
|
|
1044
|
+
code: "cohort-base-truncated",
|
|
1045
|
+
severity: "warn",
|
|
1046
|
+
message: `the row band was too narrow for the cohort base of ${truncated.map((id) => `'${id}'`).join(", ")} \u2014 the n is cut off, so those rows read without an anchor`,
|
|
1047
|
+
suggest: "shorten the cohort labels, widen the canvas, or move the base into the subtitle"
|
|
1048
|
+
}), pushAll(warnings, host.warnings), {
|
|
1049
|
+
...host,
|
|
1050
|
+
type: "cohort",
|
|
1051
|
+
marks: { cells },
|
|
1052
|
+
derived,
|
|
1053
|
+
a11y: {
|
|
1054
|
+
title: accessibleTitle(options.title, chartString(options, "title", { measure: cohortMeasure(options).toLocaleLowerCase(options.locale?.language ?? "en"), cohorts: String(derived.cohorts.length), periods: String(periodCount) })),
|
|
1055
|
+
counts: [
|
|
1056
|
+
structureCount("cohorts", derived.cohorts.length),
|
|
1057
|
+
structureCount("periods", derived.periodCount),
|
|
1058
|
+
structureCount("cells", unobserved, chartString(options, "cells", { count: String(unobserved) })),
|
|
1059
|
+
...derived.averages ? [derived.averages[0], derived.averages[derived.averages.length - 1]].flatMap((a) => a.value === null ? [] : [structureCount("cohorts", a.support, chartString(options, "support", { count: String(a.support) }))]) : []
|
|
1060
|
+
],
|
|
1061
|
+
desc: describe(derived, periodNames, unobserved, options)
|
|
1062
|
+
},
|
|
1063
|
+
warnings
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
function restoreCohortCellPaint(node, paint, retention, notReached) {
|
|
1067
|
+
paint ? node.fill = paint : retention === null && !notReached && (node.fill = NM_PAINT, node.pattern = "hatch45");
|
|
1068
|
+
}
|
|
1069
|
+
function restoreCohortLabelPaints(host, cellPaint) {
|
|
1070
|
+
for (let target of [...host.scene.filter((node) => node.t === "text"), ...host.labels]) {
|
|
1071
|
+
let paint = cellPaint.get(`cell:${target.owner.seriesId}:${target.owner.categoryId}`);
|
|
1072
|
+
paint && "ink" in target && "token" in target.ink && target.ink.theme?.kind === "contrast-ink" && (target.ink = { ...target.ink, theme: { ...target.ink.theme, fill: paint } });
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
function compareCells(a, b) {
|
|
1076
|
+
return a.rowId !== b.rowId ? a.rowId < b.rowId ? -1 : 1 : a.periodIndex - b.periodIndex;
|
|
1077
|
+
}
|
|
1078
|
+
function supportState(support, options) {
|
|
1079
|
+
return support === null ? void 0 : chartString(options, "support", { count: String(support) });
|
|
1080
|
+
}
|
|
1081
|
+
function withState(display, state) {
|
|
1082
|
+
let value = display && "value" in display ? display.value : void 0;
|
|
1083
|
+
return value === void 0 ? state === void 0 ? void 0 : { state } : state === void 0 ? { value } : { value, state };
|
|
1084
|
+
}
|
|
1085
|
+
function periodLabels(periodLabel, count, options) {
|
|
1086
|
+
let initial = (periodLabel ?? "").trim().charAt(0).toUpperCase();
|
|
1087
|
+
return Array.from({ length: count }, (_, t) => initial === "" ? chartString(options, "period", { period: String(t) }) : `${initial}${t}`);
|
|
1088
|
+
}
|
|
1089
|
+
function cohortNotes(basis, averages, shownSupports, notMeaningful, unsupported, periodNames, methodNote, options) {
|
|
1090
|
+
let notes = [
|
|
1091
|
+
...methodNote || basis === "previous" ? [chartString(options, "formulaCount", { formula: cohortFormula(options, basis).replace(/[.!?]$/, "") })] : [],
|
|
1092
|
+
// The anchor column's value is stated ONCE here rather than repeated in
|
|
1093
|
+
// every cell. With the note off the anchor cells count like any other in
|
|
1094
|
+
// the suppression note (countSuppressed).
|
|
1095
|
+
...methodNote ? [disclosureNote(chartString(options, "anchorNote", { period: periodNames[0] }))] : []
|
|
1096
|
+
];
|
|
1097
|
+
if (notMeaningful.length > 0 && notes.push(disclosureNote(chartString(options, "hatchNm", { periods: notMeaningful.join(", ") }))), averages) {
|
|
1098
|
+
notes.push(
|
|
1099
|
+
basis === "cohort" ? chartString(options, "averageBase") : chartString(options, "averagePrevious")
|
|
1100
|
+
);
|
|
1101
|
+
let first = shownSupports[0], last = shownSupports[shownSupports.length - 1];
|
|
1102
|
+
first && last && notes.push(
|
|
1103
|
+
first.support === last.support ? chartString(options, "everySupport", { count: String(first.support) }) : chartString(options, "averageSupports", { first: String(first.support), firstPeriod: periodNames[first.t], last: String(last.support), lastPeriod: periodNames[last.t] })
|
|
1104
|
+
), unsupported.length > 0 && notes.push(
|
|
1105
|
+
// The note says hatched, not blank: an unsupported average is painted
|
|
1106
|
+
// like the unmeasurable cells it has none of, and the note has to
|
|
1107
|
+
// name the mark the reader is looking at.
|
|
1108
|
+
chartString(options, "unsupportedAverage", { periods: unsupported.map((t) => periodNames[t]).join(", ") })
|
|
1109
|
+
);
|
|
1110
|
+
}
|
|
1111
|
+
return notes;
|
|
1112
|
+
}
|
|
1113
|
+
function suppressionNote(lost, options) {
|
|
1114
|
+
return lost.total >= lost.drawn ? chartString(options, "allSuppressed", { count: String(lost.drawn) }) : chartString(options, "someSuppressed", { count: String(lost.total), total: String(lost.drawn) });
|
|
1115
|
+
}
|
|
1116
|
+
var NM_PAINT = { token: "neutral", tint: 0.55 };
|
|
1117
|
+
function countSuppressed(host, derived, methodNote) {
|
|
1118
|
+
let visible = new Set(host.labels.filter((label) => !label.hidden).map((label) => label.id)), drawnPer = /* @__PURE__ */ new Map(), lostPer = /* @__PURE__ */ new Map(), count = (rowId, t, value) => {
|
|
1119
|
+
value !== null && (t === 0 && methodNote || (drawnPer.set(t, (drawnPer.get(t) ?? 0) + 1), visible.has(`point:${rowId}:t${t}`) || lostPer.set(t, (lostPer.get(t) ?? 0) + 1)));
|
|
1120
|
+
};
|
|
1121
|
+
for (let row of derived.cohorts)
|
|
1122
|
+
for (let t = 0; t < row.observedPeriods; t++) count(row.id, t, row.retention[t] ?? null);
|
|
1123
|
+
(derived.averages ?? []).forEach((average, t) => count(AVERAGE_ROW_ID, t, average.value));
|
|
1124
|
+
let drawn = 0, total = 0, emptyColumns = [];
|
|
1125
|
+
for (let [t, n] of [...drawnPer.entries()].sort((a, b) => a[0] - b[0])) {
|
|
1126
|
+
let lost = lostPer.get(t) ?? 0;
|
|
1127
|
+
drawn += n, total += lost, lost === n && emptyColumns.push(t);
|
|
1128
|
+
}
|
|
1129
|
+
return { total, drawn, emptyColumns };
|
|
1130
|
+
}
|
|
1131
|
+
function withAverageRow(highlight, hasAverages) {
|
|
1132
|
+
return hasAverages ? [...highlight === void 0 ? [] : Array.isArray(highlight) ? highlight : [highlight], AVERAGE_ROW_ID] : highlight;
|
|
1133
|
+
}
|
|
1134
|
+
function stripAnswered(options) {
|
|
1135
|
+
let rest = { ...options };
|
|
1136
|
+
for (let key of ANSWERED_HERE) delete rest[key];
|
|
1137
|
+
return delete rest.basis, delete rest.averages, delete rest.methodNote, keepShownNotes(options, rest);
|
|
1138
|
+
}
|
|
1139
|
+
function describe(derived, periodNames, unobserved, options) {
|
|
1140
|
+
let first = derived.cohorts[0], last = derived.cohorts[derived.cohorts.length - 1], pct = (v) => `${formatAutomaticNumber(v * 100, { decimals: autoDecimals(v * 100), locale: options.locale?.language })}%`, at = (index) => {
|
|
1141
|
+
let row = derived.cohorts[index], t = row.observedPeriods - 1, r = row.retention[t] ?? null;
|
|
1142
|
+
return r === null ? chartString(options, "atPeriod", { value: chartString(options, missingCohortRate(row, t, derived.basis) ? "missing" : "notMeaningful"), period: periodNames[t] }) : chartString(options, "atPeriod", { value: pct(r), period: periodNames[t] });
|
|
1143
|
+
}, average = (a, t) => a.value === null ? derived.cohorts.some((row) => missingCohortRate(row, t, derived.basis)) ? chartString(options, "missingAt", { period: periodNames[t] }) : chartString(options, "blankAverage") : chartString(options, "valueSupport", { value: pct(a.value), count: String(a.support) }), basisWord = cohortFormula(options, derived.basis);
|
|
1144
|
+
return chartString(options, "descStart", { measure: cohortMeasure(options).toLocaleLowerCase(options.locale?.language ?? "en"), cohorts: String(derived.cohorts.length), periods: String(derived.periodCount), formula: basisWord }) + chartString(options, "descReach", { first: at(0), last: at(derived.cohorts.length - 1) }) + chartString(options, "descBlank", { count: String(unobserved) }) + (derived.averages ? chartString(options, "descAverage", { first: average(derived.averages[0], 0), last: average(derived.averages[derived.averages.length - 1], derived.averages.length - 1) }) : "") + chartString(options, "descBases", { first: String(first.base), last: String(last.base) });
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
// src/core/charts/cohort/core.ts
|
|
1148
|
+
var cohortCore = {
|
|
1149
|
+
type: "cohort",
|
|
1150
|
+
sizing: chartSizing("cohort"),
|
|
1151
|
+
title: "Cohort retention triangle",
|
|
1152
|
+
summary: "Cohorts by periods-since-start: counts in, every retention rate derived, weighted averages that are never the mean of percentages",
|
|
1153
|
+
aliases: ["retention"],
|
|
1154
|
+
layout: layoutCohort,
|
|
1155
|
+
defaults: { basis: "cohort", averages: !1, variant: "heatmap" },
|
|
1156
|
+
annotationKinds: []
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
export {
|
|
1160
|
+
cohortCore
|
|
1161
|
+
};
|