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,1592 @@
|
|
|
1
|
+
import {
|
|
2
|
+
compactBulletRefusals
|
|
3
|
+
} from "./chunk-JYBT2JNY.js";
|
|
4
|
+
import {
|
|
5
|
+
valueLineExtent
|
|
6
|
+
} from "./chunk-QPWRHDLZ.js";
|
|
7
|
+
import {
|
|
8
|
+
warnMissingValue
|
|
9
|
+
} from "./chunk-5LGSRWFC.js";
|
|
10
|
+
import {
|
|
11
|
+
labelOn
|
|
12
|
+
} from "./chunk-VJ3FCGQF.js";
|
|
13
|
+
import {
|
|
14
|
+
runAnnotatePass
|
|
15
|
+
} from "./chunk-KZS46KDY.js";
|
|
16
|
+
import {
|
|
17
|
+
rowLabelBand
|
|
18
|
+
} from "./chunk-X4YNDLVA.js";
|
|
19
|
+
import {
|
|
20
|
+
fittedLabel,
|
|
21
|
+
gutterBudget,
|
|
22
|
+
stepDownFont
|
|
23
|
+
} from "./chunk-ZQF34VPS.js";
|
|
24
|
+
import {
|
|
25
|
+
breakUnsupported
|
|
26
|
+
} from "./chunk-3QWZAEW5.js";
|
|
27
|
+
import {
|
|
28
|
+
cardFrameTheme,
|
|
29
|
+
cardSize
|
|
30
|
+
} from "./chunk-XJI6SWFS.js";
|
|
31
|
+
import {
|
|
32
|
+
categoryTargetFields,
|
|
33
|
+
spliceAnnotationNodes
|
|
34
|
+
} from "./chunk-CDZHNLO6.js";
|
|
35
|
+
import {
|
|
36
|
+
BAND_PAD
|
|
37
|
+
} from "./chunk-HZI56ASJ.js";
|
|
38
|
+
import {
|
|
39
|
+
rowDrivenHeight
|
|
40
|
+
} from "./chunk-GZTNTHSW.js";
|
|
41
|
+
import {
|
|
42
|
+
structureCount
|
|
43
|
+
} from "./chunk-LFX7W4B7.js";
|
|
44
|
+
import {
|
|
45
|
+
bandFor
|
|
46
|
+
} from "./chunk-263SZKIL.js";
|
|
47
|
+
import {
|
|
48
|
+
emptyIdRecord
|
|
49
|
+
} from "./chunk-LINZPU5D.js";
|
|
50
|
+
import {
|
|
51
|
+
CARD_MIN_WIDTH,
|
|
52
|
+
applyAxisBounds,
|
|
53
|
+
applyValueAxisTitleInk,
|
|
54
|
+
bandScale,
|
|
55
|
+
chartSizing,
|
|
56
|
+
heightOmitted,
|
|
57
|
+
layoutValueAxis,
|
|
58
|
+
linearScale,
|
|
59
|
+
niceDomain,
|
|
60
|
+
planValueAxisTitle,
|
|
61
|
+
rowSizing,
|
|
62
|
+
straightBreakGlyph,
|
|
63
|
+
valueAxisTitleRequest
|
|
64
|
+
} from "./chunk-RL3NUWMY.js";
|
|
65
|
+
import {
|
|
66
|
+
PRIORITY,
|
|
67
|
+
authoredFootnoteCount,
|
|
68
|
+
authoredNotes,
|
|
69
|
+
composedTextRole,
|
|
70
|
+
createOccupiedIndex,
|
|
71
|
+
fitText,
|
|
72
|
+
frameTextOptions,
|
|
73
|
+
labelCtx,
|
|
74
|
+
labelsToNodes,
|
|
75
|
+
normalizeLegendOption,
|
|
76
|
+
plotHeightAfter,
|
|
77
|
+
rectContains,
|
|
78
|
+
rectsOverlap,
|
|
79
|
+
round2,
|
|
80
|
+
rowLabelX,
|
|
81
|
+
solveFrame,
|
|
82
|
+
solveLabels
|
|
83
|
+
} from "./chunk-SS42FJVN.js";
|
|
84
|
+
import {
|
|
85
|
+
formatterFromExample,
|
|
86
|
+
parseFormatExample
|
|
87
|
+
} from "./chunk-RGZGLKFB.js";
|
|
88
|
+
import {
|
|
89
|
+
MINUS,
|
|
90
|
+
autoDecimals,
|
|
91
|
+
chartStrings,
|
|
92
|
+
formatAutomaticNumber,
|
|
93
|
+
formatAutomaticPercent
|
|
94
|
+
} from "./chunk-53OYF4ZT.js";
|
|
95
|
+
import {
|
|
96
|
+
cellMeta,
|
|
97
|
+
cellValue,
|
|
98
|
+
isPctCell
|
|
99
|
+
} from "./chunk-O3VN6BTL.js";
|
|
100
|
+
import {
|
|
101
|
+
REFERENCE_LABEL_CLEARANCE,
|
|
102
|
+
bulletBandPaints,
|
|
103
|
+
contrastInkPaint,
|
|
104
|
+
emphasisWeight,
|
|
105
|
+
focusColor,
|
|
106
|
+
markRolePaint,
|
|
107
|
+
mixedPaint,
|
|
108
|
+
paintColor,
|
|
109
|
+
readerFloorPx,
|
|
110
|
+
resolveSemanticPaletteTheme,
|
|
111
|
+
resolveTheme,
|
|
112
|
+
secondaryType,
|
|
113
|
+
semanticPalettePaint,
|
|
114
|
+
separationStroke,
|
|
115
|
+
signedFillPaint,
|
|
116
|
+
strokeToken,
|
|
117
|
+
tableHeadFloorPx,
|
|
118
|
+
textScaleOf
|
|
119
|
+
} from "./chunk-CWDHCSL2.js";
|
|
120
|
+
import {
|
|
121
|
+
TEXT_CONTRAST_FLOOR,
|
|
122
|
+
contrastRatio
|
|
123
|
+
} from "./chunk-HA4IPWMM.js";
|
|
124
|
+
import {
|
|
125
|
+
DEFAULT_TARGET,
|
|
126
|
+
MAGNITUDE_CEILING,
|
|
127
|
+
NormalizeError,
|
|
128
|
+
TARGET_SIZE,
|
|
129
|
+
accessibleTitle,
|
|
130
|
+
resolveHighlight,
|
|
131
|
+
resolveSize,
|
|
132
|
+
resolveSubtitle
|
|
133
|
+
} from "./chunk-SGD3ZHID.js";
|
|
134
|
+
import {
|
|
135
|
+
maxOf,
|
|
136
|
+
minOf,
|
|
137
|
+
pushAll
|
|
138
|
+
} from "./chunk-WYJEOMNY.js";
|
|
139
|
+
import {
|
|
140
|
+
defaultMeasurer
|
|
141
|
+
} from "./chunk-AG2CJ4JY.js";
|
|
142
|
+
|
|
143
|
+
// src/core/strings/bullet.ts
|
|
144
|
+
var EN = {
|
|
145
|
+
// reader-facing wording linked only by its consumers.
|
|
146
|
+
band: "Band",
|
|
147
|
+
start: "Start",
|
|
148
|
+
end: "End",
|
|
149
|
+
category: "Category",
|
|
150
|
+
attainment: "Attainment",
|
|
151
|
+
betterCapital: "Better",
|
|
152
|
+
worseCapital: "Worse",
|
|
153
|
+
bulletTargetTitle: "Bullet chart: {v1} KPIs in percent of {v2}",
|
|
154
|
+
kpisCount: "{v1} KPIs",
|
|
155
|
+
kpiRowsCount: "{v1} KPI rows",
|
|
156
|
+
bulletTargetDesc: "Bullet chart with {v1} KPI rows on one scale in percent of {v2} from 0 to {v3}%",
|
|
157
|
+
bulletBandsDesc: ". Bands mark below 80% of {v1}, 80 to 100%, and at or above {v2}; one line marks 100%. ",
|
|
158
|
+
bulletMirroredBandsDesc: ". Bands mark more than 20% off {v1}, up to 20% off, and on {v2} or better: below 80%, 80 to 100% and 100% and above where higher is better, above 120%, 100 to 120% and up to 100% where lower is better; one line marks 100%. ",
|
|
159
|
+
bulletLowerBandsDesc: ". Bands mark more than 20% off {v1}, up to 20% off, and on {v2} or better, where lower is better: above 120%, 100 to 120% and up to 100%; one line marks 100%. ",
|
|
160
|
+
bulletNeutralBandsDesc: "Neutral rows have no better side: up to 20% off {v1} runs from 80 to 120%, more than 20% off lies beyond, and only the line marks on {v1}. ",
|
|
161
|
+
bulletNeutralOnlyBandsDesc: ". No side is better: bands mark up to 20% off {v1}, from 80 to 120%, and more than 20% off beyond that; one line marks 100%. ",
|
|
162
|
+
bulletBelowLower: "Below {v1}, lower is better",
|
|
163
|
+
aboveTarget: "Above {v1}",
|
|
164
|
+
belowTarget: "Below {v1}",
|
|
165
|
+
bulletDescStart: "Bullet chart with {v1} KPI rows: a dark bar shows the actual value",
|
|
166
|
+
bulletTargetTick: " and a vertical tick marks the {v1}.",
|
|
167
|
+
bulletShadingDesc: " Background bands shade from darker grey (poor) to lighter grey (good); rows where lower is better invert the shading.",
|
|
168
|
+
bulletSeparateScale: " Each row is drawn on its own scale, so bar lengths compare within a row, not across rows.",
|
|
169
|
+
bulletTitle: "Bullet chart: {v1} KPIs vs {v2}",
|
|
170
|
+
none: "none",
|
|
171
|
+
horizontal: "horizontal",
|
|
172
|
+
top: "top",
|
|
173
|
+
left: "left",
|
|
174
|
+
lowerBetterHint: " \xB7 lower is better",
|
|
175
|
+
middle3: "Middle",
|
|
176
|
+
middle5: "Middle",
|
|
177
|
+
lowerMiddle: "Lower middle",
|
|
178
|
+
upperMiddle: "Upper middle",
|
|
179
|
+
belowTarget80: "below 80% of {v1}",
|
|
180
|
+
atOrAboveTarget: "at or above {v1}",
|
|
181
|
+
offTargetOver20: "more than 20% off {v1}",
|
|
182
|
+
offTargetUpTo20: "up to 20% off {v1}",
|
|
183
|
+
onTargetOrBetter: "on {v1} or better",
|
|
184
|
+
ofTarget: "of {v1}",
|
|
185
|
+
toneGood: "good",
|
|
186
|
+
toneBad: "bad",
|
|
187
|
+
toneWarn: "warn",
|
|
188
|
+
toneNeutral: "neutral",
|
|
189
|
+
// column heads and the first key band of the percent-of-target rows.
|
|
190
|
+
actualColumn: "Actual",
|
|
191
|
+
shareColumn: "% of {v1}",
|
|
192
|
+
deltaColumn: "vs {v1}",
|
|
193
|
+
below80: "below 80%",
|
|
194
|
+
// target and gap column heads beside KPI rows, and the line under each gap.
|
|
195
|
+
targetColumn: "Target",
|
|
196
|
+
gapColumn: "Gap to {v1}",
|
|
197
|
+
gapBelow: "below {v1}",
|
|
198
|
+
gapAbove: "above {v1}",
|
|
199
|
+
gapOn: "on {v1}"
|
|
200
|
+
}, DE = {
|
|
201
|
+
// reader-facing wording linked only by its consumers.
|
|
202
|
+
band: "Band",
|
|
203
|
+
start: "Start",
|
|
204
|
+
end: "Ende",
|
|
205
|
+
category: "Kategorie",
|
|
206
|
+
attainment: "Zielerreichung",
|
|
207
|
+
betterCapital: "Besser",
|
|
208
|
+
worseCapital: "Schlechter",
|
|
209
|
+
bulletTargetTitle: "Bullet-Diagramm: {v1} {v1|KPI|KPIs} als Prozent von {v2}",
|
|
210
|
+
kpisCount: "{v1} {v1|KPI|KPIs}",
|
|
211
|
+
kpiRowsCount: "{v1} {v1|KPI-Zeile|KPI-Zeilen}",
|
|
212
|
+
bulletTargetDesc: "Bullet-Diagramm mit {v1} {v1|KPI-Zeile|KPI-Zeilen} auf einer Skala als Prozent von {v2} von 0 bis {v3} %",
|
|
213
|
+
bulletBandsDesc: ". B\xE4nder zeigen unter 80 % von {v1}, 80 bis 100 %, sowie {v2} oder h\xF6her. Eine Linie zeigt 100 %. ",
|
|
214
|
+
bulletMirroredBandsDesc: ". B\xE4nder zeigen mehr als 20 % vom {v1} entfernt, bis 20 % entfernt sowie {v2} erreicht oder besser: unter 80 %, 80 bis 100 % und \xFCber 100 %, wo h\xF6here Werte g\xFCnstiger sind, \xFCber 120 %, 100 bis 120 % und bis 100 %, wo niedrigere Werte g\xFCnstiger sind. Eine Linie zeigt 100 %. ",
|
|
215
|
+
bulletLowerBandsDesc: ". B\xE4nder zeigen mehr als 20 % vom {v1} entfernt, bis 20 % entfernt sowie {v2} erreicht oder besser, wo niedrigere Werte g\xFCnstiger sind: \xFCber 120 %, 100 bis 120 % und bis 100 %. Eine Linie zeigt 100 %. ",
|
|
216
|
+
bulletNeutralBandsDesc: "Neutrale Zeilen haben keine bessere Seite: bis 20 % vom {v1} entfernt reicht von 80 bis 120 %, mehr als 20 % entfernt liegt au\xDFerhalb, und nur die Linie zeigt {v1} erreicht. ",
|
|
217
|
+
bulletNeutralOnlyBandsDesc: ". Keine Seite ist g\xFCnstiger: B\xE4nder zeigen bis 20 % vom {v1} entfernt, von 80 bis 120 %, und mehr als 20 % entfernt au\xDFerhalb davon. Eine Linie zeigt 100 %. ",
|
|
218
|
+
bulletBelowLower: "Unter {v1}, niedriger ist besser",
|
|
219
|
+
aboveTarget: "\xDCber {v1}",
|
|
220
|
+
belowTarget: "Unter {v1}",
|
|
221
|
+
bulletDescStart: "Bullet-Diagramm mit {v1} {v1|KPI-Zeile|KPI-Zeilen}: Ein dunkler Balken zeigt den Istwert",
|
|
222
|
+
bulletTargetTick: " und ein senkrechter Strich zeigt {v1}.",
|
|
223
|
+
bulletShadingDesc: " Hintergrundb\xE4nder reichen von dunklerem Grau (schlecht) bis hellerem Grau (gut). Zeilen mit g\xFCnstigeren niedrigen Werten kehren die Schattierung um.",
|
|
224
|
+
bulletSeparateScale: " Jede Zeile nutzt ihre eigene Skala. Balkenl\xE4ngen sind innerhalb einer Zeile vergleichbar, aber nicht zwischen Zeilen.",
|
|
225
|
+
bulletTitle: "Bullet-Diagramm: {v1} {v1|KPI|KPIs} vs {v2}",
|
|
226
|
+
none: "keine",
|
|
227
|
+
horizontal: "horizontal",
|
|
228
|
+
top: "oben",
|
|
229
|
+
left: "links",
|
|
230
|
+
lowerBetterHint: " \xB7 niedriger ist besser",
|
|
231
|
+
middle3: "Mittel",
|
|
232
|
+
middle5: "Mitte",
|
|
233
|
+
lowerMiddle: "Untere Mitte",
|
|
234
|
+
upperMiddle: "Obere Mitte",
|
|
235
|
+
belowTarget80: "unter 80 % von {v1}",
|
|
236
|
+
atOrAboveTarget: "{v1} oder h\xF6her",
|
|
237
|
+
offTargetOver20: "mehr als 20 % vom {v1} entfernt",
|
|
238
|
+
offTargetUpTo20: "bis 20 % vom {v1} entfernt",
|
|
239
|
+
onTargetOrBetter: "{v1} erreicht oder besser",
|
|
240
|
+
ofTarget: "von {v1}",
|
|
241
|
+
toneGood: "gut",
|
|
242
|
+
toneBad: "schlecht",
|
|
243
|
+
toneWarn: "Warnung",
|
|
244
|
+
toneNeutral: "neutral",
|
|
245
|
+
// column heads and the first key band of the percent-of-target rows.
|
|
246
|
+
actualColumn: "Ist",
|
|
247
|
+
shareColumn: "% von {v1}",
|
|
248
|
+
deltaColumn: "vs {v1}",
|
|
249
|
+
below80: "unter 80 %",
|
|
250
|
+
// target and gap column heads beside KPI rows, and the line under each gap.
|
|
251
|
+
targetColumn: "Ziel",
|
|
252
|
+
gapColumn: "Abweichung vom {v1}",
|
|
253
|
+
gapBelow: "unter {v1}",
|
|
254
|
+
gapAbove: "\xFCber {v1}",
|
|
255
|
+
gapOn: "{v1} erreicht"
|
|
256
|
+
}, { chartString } = chartStrings(EN, DE);
|
|
257
|
+
|
|
258
|
+
// src/core/charts/bullet/columnHead.ts
|
|
259
|
+
var HEAD_EM = 12, HEAD_PREFIX = "header:";
|
|
260
|
+
function fitHead(text, font, bodyW, measure, env) {
|
|
261
|
+
return fitText(text, font, Math.max(bodyW, HEAD_EM * font.size), 1, measure, { target: env.target, textScale: env.textScale, typeRole: "footnote" });
|
|
262
|
+
}
|
|
263
|
+
function headRequest(key, order, head, right, y, h, onKey) {
|
|
264
|
+
let rect = { x: right - head.w, y: Math.max(0, y), w: head.w, h };
|
|
265
|
+
return {
|
|
266
|
+
id: `${HEAD_PREFIX}${order}:${key}`,
|
|
267
|
+
kind: "annotation",
|
|
268
|
+
role: "category",
|
|
269
|
+
align: "end",
|
|
270
|
+
owner: {},
|
|
271
|
+
text: head.lines[0],
|
|
272
|
+
lines: head.lines,
|
|
273
|
+
font: head.font,
|
|
274
|
+
...head.title !== void 0 ? { title: head.title } : {},
|
|
275
|
+
typeRole: "footnote",
|
|
276
|
+
priority: PRIORITY.total,
|
|
277
|
+
pad: 0,
|
|
278
|
+
candidates: [{ slot: "columnHead", rect, penalty: 0, ...onKey ? { overLegend: !0 } : {} }]
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function asColumnHeads(nodes) {
|
|
282
|
+
nodes.forEach((node, index) => {
|
|
283
|
+
node.t === "text" && node.id.startsWith(`label:${HEAD_PREFIX}`) && (nodes[index] = { ...node, part: "tableHeader" });
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// src/core/charts/bullet/targetScale.ts
|
|
288
|
+
function targetWord(options) {
|
|
289
|
+
return chartString(options, "target");
|
|
290
|
+
}
|
|
291
|
+
var BANDS = (target, mirrored, options) => [
|
|
292
|
+
// One key template: the share bounds alone; an authored belowTarget80 string still wins.
|
|
293
|
+
{ from: 0, to: 80, paint: { token: "ink", tint: 0.873 }, label: mirrored ? chartString(options, "offTargetOver20", { v1: target }) : options?.strings?.belowTarget80 !== void 0 ? chartString(options, "belowTarget80", { v1: target }) : chartString(options, "below80") },
|
|
294
|
+
{ from: 80, to: 100, paint: { token: "ink", tint: 0.742 }, label: mirrored ? chartString(options, "offTargetUpTo20", { v1: target }) : "80\u2013100%" },
|
|
295
|
+
// A signed ground, so it takes the fill role, which falls back to good.
|
|
296
|
+
{
|
|
297
|
+
from: 100,
|
|
298
|
+
to: null,
|
|
299
|
+
paint: { token: "goodFill", tint: 0.68 },
|
|
300
|
+
label: chartString(options, mirrored ? "onTargetOrBetter" : "atOrAboveTarget", { v1: target })
|
|
301
|
+
}
|
|
302
|
+
];
|
|
303
|
+
function targetBands(directions, target, options) {
|
|
304
|
+
let bands = BANDS(target, directions.some((direction) => direction !== "higherIsBetter"), options);
|
|
305
|
+
return directions.every((direction) => direction === "neutral") ? bands.slice(0, 2) : bands;
|
|
306
|
+
}
|
|
307
|
+
function zoneSpans(band, direction, hi) {
|
|
308
|
+
return (direction === "lowerIsBetter" ? [{ from: band.to === null ? 0 : 200 - band.to, to: 200 - band.from }] : direction !== "neutral" ? [{ from: band.from, to: band.to ?? hi }] : band.to === null ? [] : band.from === 0 ? [{ from: 0, to: band.to }, { from: 200 - band.to, to: hi }] : [{ from: band.from, to: 200 - band.from }]).flatMap((span) => {
|
|
309
|
+
let to = Math.min(span.to, hi);
|
|
310
|
+
return to > span.from ? [{ from: span.from, to }] : [];
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
var AXIS_MAX = 120, OVERFLOW_BREAK_INSET = 8, AXIS_TICKS = [0, 50, 80, 100, 120], TARGET_ROW_PITCH = 40, SIDE_BAND_H = 18, SIDE_BAR_H = 7, STACK_BAND_H = 14, STACK_BAR_H = 6, TARGET_REACH = 2, ROW_GAP = 12, STACK_ROW_GAP = 5, AXIS_GAP = 4, LEFT_GAP = 10, RIGHT_GAP = 18, COLUMN_GAP = 16, VALUE_GAP = 10, BAND_GAP = 4, STACK_BAND_GAP = 3, LINE_GAP = 1, SIDE_PLOT_SHARE = 0.5, SIDE_PLOT_FLOOR = 0.45;
|
|
314
|
+
function targetBandLegendItems(directions, target, options) {
|
|
315
|
+
return targetBands(directions, target, options).map((band, index) => ({
|
|
316
|
+
id: `band:target-${index}`,
|
|
317
|
+
label: band.label,
|
|
318
|
+
paint: band.paint,
|
|
319
|
+
key: "box",
|
|
320
|
+
stroke: band.paint
|
|
321
|
+
}));
|
|
322
|
+
}
|
|
323
|
+
function percentOfTarget(row) {
|
|
324
|
+
if (!(row.value === null || row.target === null || row.value < 0 || row.target <= 0))
|
|
325
|
+
return 100 * row.value / row.target;
|
|
326
|
+
}
|
|
327
|
+
function layoutTargetScale(input) {
|
|
328
|
+
let { rows, options, theme, size, measure, frame: frameResult, occupied, warnings, highlights, labelOn: labelOn2 } = input, plot0 = frameResult.plot, locale = options.locale?.language, target = targetWord(options), renderTarget = options.target ?? DEFAULT_TARGET, textScale = textScaleOf(options), family = theme.type.family, noteSize = Math.max(theme.type.footnote.size, readerFloorPx(renderTarget, "label", textScale)), nameFont = { family, ...theme.type.label, weight: 600 }, valueFont = { family, ...theme.type.label }, shareFont = { family, ...theme.type.label, weight: emphasisWeight(theme) }, noteFont = { family, ...theme.type.footnote, size: noteSize }, deltaFont = { ...noteFont }, headerFont = { family, ...theme.type.footnote, size: Math.max(theme.type.footnote.size, tableHeadFloorPx(renderTarget, textScale), readerFloorPx(renderTarget, "label", textScale)) }, tickFont = { family, ...theme.type.axis, size: Math.min(secondaryType(theme).size, Math.max(theme.type.footnote.size, readerFloorPx(renderTarget, "secondary", textScale))) }, nameLineH = nameFont.size * 1.2, noteLineH = noteFont.size * 1.2, line1H = Math.max(measure("0", nameFont).height, measure("0", valueFont).height), line2H = Math.max(measure("0", noteFont).height, measure("0", deltaFont).height), shares = rows.map((row) => percentOfTarget(row)), shareText = (share) => share > 0 && share < 0.5 ? "<1%" : formatAutomaticPercent(share, 0, !1, locale), valueTexts = rows.map((row) => labelOn2("point") ? input.valueText(row) : null), shareTexts = shares.map((share) => share === void 0 || !labelOn2("point") ? null : shareText(share)), deltas = rows.map((row) => labelOn2("annotation") ? input.deltaVsTarget[row.id] : void 0), deltaTexts = rows.map((row, index) => deltas[index] === void 0 ? null : input.deltaText(row, deltas[index])), deltaBodies = rows.map((row, index) => deltas[index] === void 0 ? null : input.deltaBody(row, deltas[index])), widest = (texts, font) => Math.max(0, maxOf(texts.map((text) => text ? measure(text, font).width : 0))), valueW = widest(valueTexts, valueFont), shareW = widest(shareTexts, shareFont), deltaBodyW = widest(deltaBodies, deltaFont), deltaW = widest(deltaTexts, deltaFont), headEnv = { target: renderTarget, textScale }, columns = [
|
|
329
|
+
{ key: "actual", head: chartString(options, "actualColumn"), w: valueW },
|
|
330
|
+
{ key: "share", head: chartString(options, "shareColumn", { v1: target }), w: shareW },
|
|
331
|
+
{ key: "delta", head: chartString(options, "deltaColumn", { v1: target }), w: deltaBodyW }
|
|
332
|
+
].filter((column) => column.w > 0).map((column) => {
|
|
333
|
+
let fitted = fitHead(column.head, headerFont, column.w, measure, headEnv);
|
|
334
|
+
return { ...column, fitted, w: Math.max(column.w, fitted.w) };
|
|
335
|
+
}), rightW = columns.reduce((sum, column) => sum + column.w, 0) + COLUMN_GAP * Math.max(0, columns.length - 1), wider = { wider: gutterBudget(plot0.w * 0.3, plot0.w) }, parts = rows.map((row) => input.targetParts(row)), notesAt = (cap) => rows.map((row, index) => {
|
|
336
|
+
let text = input.targetText(row), w = measure(text, noteFont).width, split = parts[index].map((part, at) => at === 0 ? part : part.replace(/^\s*·\s*/, "")), lines = w <= cap || split.length < 2 || split.some((part) => measure(part, noteFont).width > cap) ? [text] : split;
|
|
337
|
+
return { ...lines.length === 1 && w > cap ? rowLabelBand([{ label: text }], noteFont, cap, 2, noteLineH, measure, { target: renderTarget, typeRole: "label", wider: cap }).labels[0] : { lines, w: Math.max(...lines.map((line) => measure(line, noteFont).width)), h: lines.length * noteLineH, font: noteFont }, text };
|
|
338
|
+
}), sideNamesAt = (cap, maxLines) => rowLabelBand(rows, nameFont, cap, maxLines, nameLineH, measure, { target: renderTarget, typeRole: "axis", ...maxLines === 1 ? wider : { wider: cap } }), leftOf = (names, notes) => labelOn2("category") ? Math.max(names.width, maxOf(notes.map((note) => note.w))) : 0, sidePlotW = (leftW2) => plot0.w - (leftW2 ? leftW2 + LEFT_GAP : 0) - (rightW ? rightW + RIGHT_GAP : 0), sideNames = sideNamesAt(plot0.w * 0.3, 1), sideNotes = notesAt(gutterBudget(plot0.w * 0.3, plot0.w)), sideLeft = leftOf(sideNames, sideNotes);
|
|
339
|
+
if (labelOn2("category") && sidePlotW(sideLeft) < SIDE_PLOT_SHARE * size.width) {
|
|
340
|
+
let longestWord = Math.max(
|
|
341
|
+
0,
|
|
342
|
+
maxOf(rows.flatMap((row) => row.label.split(/\s+/).map((word) => measure(word, nameFont).width))),
|
|
343
|
+
maxOf(parts.flatMap((split) => split.map((part, at) => measure(at === 0 ? part : part.replace(/^\s*·\s*/, ""), noteFont).width)))
|
|
344
|
+
), cap = Math.max(size.width / 6, longestWord, sideLeft - (SIDE_PLOT_SHARE * size.width - sidePlotW(sideLeft)));
|
|
345
|
+
cap < sideLeft && (sideNames = sideNamesAt(cap, 2), sideNotes = notesAt(cap), sideLeft = leftOf(sideNames, sideNotes));
|
|
346
|
+
}
|
|
347
|
+
let cut = (labels) => labels.some((label) => label.title !== void 0);
|
|
348
|
+
labelOn2("category") && cut(sideNames.labels) && (sideNames = sideNamesAt(sideLeft || plot0.w * 0.3, Math.max(2, maxOf(rows.map((row) => row.label.split(/\s+/).length)))), sideLeft = leftOf(sideNames, sideNotes));
|
|
349
|
+
let sideWhole = !(labelOn2("category") && (cut(sideNames.labels) || cut(sideNotes))), sideFits = sidePlotW(sideLeft) >= Math.max(80, SIDE_PLOT_FLOOR * size.width) && sideWhole, stackValuesW = valueW + (valueW && shareW ? VALUE_GAP : 0) + shareW, namesAboveValues = !1, stackNames = sideNames;
|
|
350
|
+
if (labelOn2("category")) {
|
|
351
|
+
let nameW = plot0.w - stackValuesW - (stackValuesW ? LEFT_GAP : 0);
|
|
352
|
+
namesAboveValues = rows.some((row) => row.label.split(/\s+/).some((word) => measure(word, nameFont).width > nameW)), namesAboveValues && (nameW = plot0.w);
|
|
353
|
+
let maxLines = Math.max(2, maxOf(rows.map((row) => row.label.split(/\s+/).length)));
|
|
354
|
+
stackNames = rowLabelBand(rows, nameFont, nameW, maxLines, nameLineH, measure, { target: renderTarget, typeRole: "axis" });
|
|
355
|
+
}
|
|
356
|
+
let stackNotes = notesAt(plot0.w), stackNameH = labelOn2("category") ? Math.max(0, maxOf(stackNames.labels.map((name) => name.h))) : 0, stackValueOffset = namesAboveValues ? stackNameH + LINE_GAP : 0, stackHeaderH = Math.max(stackValuesW > 0 ? stackValueOffset + line1H : 0, stackNameH, line1H), stackNoteH = Math.max(line2H, maxOf(labelOn2("category") ? stackNotes.map((note) => note.h) : [])), stackLeftW = labelOn2("category") ? Math.max(0, maxOf(stackNotes.map((note) => note.w))) : 0, deltaSeparate = stackLeftW + RIGHT_GAP + deltaW > plot0.w, stackBandTop = stackHeaderH + STACK_BAND_GAP, stackNoteTop = stackBandTop + STACK_BAND_H + STACK_BAND_GAP, stackBlockH = stackNoteTop + (labelOn2("category") || deltaW ? stackNoteH + (deltaSeparate ? line2H + 2 : 0) : 0), sideBandCenter = labelOn2("category") ? (nameLineH + LINE_GAP + noteLineH) / 2 : SIDE_BAND_H / 2 + TARGET_REACH, sideBlockH = Math.max(
|
|
357
|
+
sideBandCenter + SIDE_BAND_H / 2 + TARGET_REACH,
|
|
358
|
+
maxOf(labelOn2("category") ? rows.map((_, index) => sideNames.labels[index].h + LINE_GAP + sideNotes[index].h) : [])
|
|
359
|
+
), sideRowH = (index) => labelOn2("category") ? Math.max(sideBandCenter + SIDE_BAND_H / 2 + TARGET_REACH, sideNames.labels[index].h + LINE_GAP + sideNotes[index].h) : sideBlockH, sideRowsH = () => rows.reduce((sum, _, index) => sum + sideRowH(index), 0), tickH = measure("0%", tickFont).height, headerH = measure("0", headerFont).height, legendRect = frameResult.legend?.rect, legendRight = Math.max(-1 / 0, maxOf(frameResult.nodes.filter((node) => node.t === "text" && node.part === "legendLabel").map((node) => node.t === "text" ? node.x + Math.max(...node.lines.map((line) => measure(line, node.font).width)) : -1 / 0))), legendLast = frameResult.nodes.filter((node) => node.t === "text" && node.part === "legendLabel").at(-1), headsFor = (stacked2) => stacked2 ? columns.filter((column) => column.key === "share") : columns, headsW = (stacked2) => {
|
|
360
|
+
let heads2 = headsFor(stacked2);
|
|
361
|
+
return stacked2 ? Math.max(0, maxOf(heads2.map((column) => column.fitted.w))) : rightW;
|
|
362
|
+
}, headsOnKey = (stacked2) => legendRect !== void 0 && legendLast !== void 0 && legendRight + 2 * COLUMN_GAP <= plot0.x + plot0.w - headsW(stacked2), headLineH = (stacked2) => headsFor(stacked2).length > 0 && !headsOnKey(stacked2) ? headerH + BAND_GAP : 0, chromeFor = (stacked2) => headLineH(stacked2) + TARGET_REACH + AXIS_GAP + tickH, availFor = (stacked2) => plotHeightAfter(frameResult, size.height, plot0.h - chromeFor(stacked2)), fixedHeight = options[TARGET_SIZE]?.fixed.height ?? !heightOmitted(options.size), stacked = !sideFits && !(fixedHeight && sideWhole && sidePlotW(sideLeft) >= 80 && rows.length * stackBlockH > availFor(!0) && sideRowsH() < rows.length * stackBlockH), blockH = stacked ? stackBlockH : sideBlockH, availH = availFor(stacked), naturalPitch = Math.max(TARGET_ROW_PITCH, blockH + (stacked ? STACK_ROW_GAP : ROW_GAP)), span = (pitch) => (rows.length - 1) * pitch + blockH, rowHeights = rows.map((_, index) => stacked ? blockH : sideRowH(index)), minimumRowsH = rowHeights.reduce((sum, h) => sum + h, 0), uniform = Math.min(naturalPitch, (availH - blockH) / Math.max(1, rows.length - 1)), rowTops = [];
|
|
363
|
+
if (uniform >= blockH || rows.length === 1) rows.forEach((_, index) => rowTops.push(index * Math.max(blockH, uniform)));
|
|
364
|
+
else {
|
|
365
|
+
let gap = Math.max(0, (availH - minimumRowsH) / Math.max(1, rows.length - 1));
|
|
366
|
+
rowHeights.reduce((top, h) => (rowTops.push(top), top + h + gap), 0);
|
|
367
|
+
}
|
|
368
|
+
let rowsH = rowTops.at(-1) + rowHeights.at(-1), grown = input.grow(size.height - availH, span(naturalPitch));
|
|
369
|
+
if (grown) return grown;
|
|
370
|
+
let leftW = stacked ? stackLeftW : sideLeft, rowsTop = plot0.y + headLineH(stacked) + (stacked ? 0 : TARGET_REACH), plot = {
|
|
371
|
+
x: stacked ? plot0.x : plot0.x + (leftW ? leftW + LEFT_GAP : 0),
|
|
372
|
+
y: rowsTop,
|
|
373
|
+
w: stacked ? plot0.w : Math.max(10, sidePlotW(leftW)),
|
|
374
|
+
h: rowsH
|
|
375
|
+
}, bandH = stacked ? STACK_BAND_H : SIDE_BAND_H, barH = stacked ? STACK_BAR_H : SIDE_BAR_H, bandCenterAt = (index) => rowsTop + rowTops[index] + (stacked ? stackBandTop + STACK_BAND_H / 2 : sideBandCenter), hi = AXIS_MAX, x = linearScale([0, hi], [plot.x, plot.x + plot.w]), beyond = rows.filter((_, index) => (shares[index] ?? 0) > hi);
|
|
376
|
+
beyond.length > 0 && warnings.push({
|
|
377
|
+
code: "bullet-share-beyond-scale",
|
|
378
|
+
severity: "info",
|
|
379
|
+
message: `${beyond.map((row) => `'${row.id}'`).join(", ")} beyond ${hi}% of target: the bar is cut at the axis end and the share printed beside it`
|
|
380
|
+
});
|
|
381
|
+
let rowsBottom = rowsTop + rowsH, nodes = [...frameResult.nodes], headRequests = [], heads = headsFor(stacked);
|
|
382
|
+
if (heads.length > 0) {
|
|
383
|
+
let onKey = headsOnKey(stacked), legendFontH = legendLast?.t === "text" ? measure("0", legendLast.font).height : headerH, headY = onKey && legendLast?.t === "text" ? legendLast.y + (legendFontH - headerH) / 2 : plot0.y, right = plot0.x + plot0.w;
|
|
384
|
+
(stacked ? heads.map((column) => ({ column, right })) : [...heads].reverse().map((column) => {
|
|
385
|
+
let at = { column, right };
|
|
386
|
+
return right -= column.w + COLUMN_GAP, at;
|
|
387
|
+
}).reverse()).forEach(({ column, right: end }, order) => headRequests.push(headRequest(column.key, order, column.fitted, end, headY, headerH, onKey)));
|
|
388
|
+
}
|
|
389
|
+
let rowBandIds = new Map(rows.map((row) => [row.id, []])), directions = rows.map((row) => row.direction);
|
|
390
|
+
targetBands(directions, target, options).forEach((band, index) => {
|
|
391
|
+
let id = `band:target-${index}`;
|
|
392
|
+
rows.forEach((row, ri) => {
|
|
393
|
+
zoneSpans(band, row.direction, hi).forEach((span2, part) => {
|
|
394
|
+
let x0 = x(span2.from), rect = { x: x0, y: bandCenterAt(ri) - bandH / 2, w: Math.max(0.5, x(span2.to) - x0), h: bandH }, bandId = part === 0 ? `${id}:${row.id}` : `${id}:${row.id}:${part}`;
|
|
395
|
+
nodes.push({ t: "rect", id: bandId, rect, fill: band.paint, owner: {}, part: "band" }), occupied.claim(rect, "mark", {}), rowBandIds.get(row.id).push(bandId);
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
let anyTarget = rows.some((row) => row.target !== null), targetX = x(100), targetStroke = strokeToken(theme, "data"), targetReach = stacked ? Math.max(0, Math.min(TARGET_REACH, STACK_BAND_GAP - REFERENCE_LABEL_CLEARANCE)) : TARGET_REACH;
|
|
400
|
+
anyTarget && rows.forEach((row, index) => {
|
|
401
|
+
let y1 = bandCenterAt(index) - bandH / 2 - targetReach, y2 = bandCenterAt(index) + bandH / 2 + targetReach;
|
|
402
|
+
nodes.push({
|
|
403
|
+
t: "line",
|
|
404
|
+
id: index === 0 ? "target:shared" : `target:shared:${row.id}`,
|
|
405
|
+
x1: targetX,
|
|
406
|
+
x2: targetX,
|
|
407
|
+
y1,
|
|
408
|
+
y2,
|
|
409
|
+
stroke: { token: "ink" },
|
|
410
|
+
width: targetStroke,
|
|
411
|
+
owner: {},
|
|
412
|
+
part: "target"
|
|
413
|
+
}), occupied.claim({ x: targetX - targetStroke, y: y1, w: 2 * targetStroke, h: y2 - y1 }, "mark", {});
|
|
414
|
+
});
|
|
415
|
+
let axisTicks = [], tickY = (stacked ? rowsBottom : bandCenterAt(rows.length - 1) + bandH / 2 + TARGET_REACH) + AXIS_GAP, tickLabels = AXIS_TICKS.map((tick) => {
|
|
416
|
+
let strong = tick === 100, font = strong ? { ...tickFont, weight: emphasisWeight(theme) } : tickFont, text = formatAutomaticPercent(tick, 0, !1, locale), w = measure(text, font).width, left = tick === 0 ? x(0) : tick === hi ? x(hi) - w : x(tick) - w / 2;
|
|
417
|
+
return { tick, strong, font, text, w, left: Math.min(Math.max(left, plot0.x), plot0.x + plot0.w - w) };
|
|
418
|
+
}), clear = (label, others, gap) => others.every((other) => label.left + label.w + gap <= other.left || other.left + other.w + gap <= label.left);
|
|
419
|
+
{
|
|
420
|
+
let full = tickLabels.find((entry) => entry.tick === 100), end = tickLabels.find((entry) => entry.tick === hi), overlap = full.left + full.w + 2 - end.left;
|
|
421
|
+
overlap > 0 && overlap <= full.w / 4 && (full.left -= overlap);
|
|
422
|
+
}
|
|
423
|
+
let kept = [];
|
|
424
|
+
for (let label of tickLabels.filter((entry) => entry.tick === 100 || entry.tick === 0 || entry.tick === hi))
|
|
425
|
+
clear(label, kept, 2) && kept.push(label);
|
|
426
|
+
let inner = tickLabels.filter((entry) => !kept.includes(entry) && entry.tick !== 0 && entry.tick !== hi && entry.tick !== 100);
|
|
427
|
+
inner.every((label, index) => clear(label, [...kept, ...inner.filter((_, other) => other !== index)], label.w)) && kept.push(...inner), tickLabels.filter((label) => kept.includes(label)).forEach((label, index) => {
|
|
428
|
+
let id = `axis:x:tick:${index}`;
|
|
429
|
+
nodes.push({
|
|
430
|
+
t: "text",
|
|
431
|
+
id,
|
|
432
|
+
x: label.left,
|
|
433
|
+
y: tickY,
|
|
434
|
+
lines: [label.text],
|
|
435
|
+
align: "start",
|
|
436
|
+
font: label.font,
|
|
437
|
+
ink: { token: label.strong ? "ink" : "inkMuted" },
|
|
438
|
+
owner: {},
|
|
439
|
+
part: "tick",
|
|
440
|
+
typeRole: "secondary"
|
|
441
|
+
}), occupied.claim({ x: label.left, y: tickY, w: label.w, h: tickH }, "axis", {}), axisTicks.push({ at: label.tick, pos: x(label.tick), labelId: id });
|
|
442
|
+
});
|
|
443
|
+
let marks = { rows: [] }, requests = [], placedAnnotations = [], inks = /* @__PURE__ */ new Map(), fonts = /* @__PURE__ */ new Map(), columnRight = /* @__PURE__ */ new Map();
|
|
444
|
+
for (let head of headRequests)
|
|
445
|
+
fonts.set(head.id, headerFont), inks.set(head.id, { token: "inkMuted" }), requests.push(head);
|
|
446
|
+
{
|
|
447
|
+
let right = plot0.x + plot0.w;
|
|
448
|
+
for (let column of [...columns].reverse())
|
|
449
|
+
columnRight.set(column.key, right), right -= column.w + COLUMN_GAP;
|
|
450
|
+
}
|
|
451
|
+
let measurePaint = (row) => row.meta?.fill ? { css: row.meta.fill } : highlights.has(row.id) ? { token: "focus" } : { token: "markInk" }, request = (id, kind, owner, text, font, rect, extra = {}) => {
|
|
452
|
+
fonts.set(id, font), requests.push({
|
|
453
|
+
id,
|
|
454
|
+
kind,
|
|
455
|
+
owner,
|
|
456
|
+
text,
|
|
457
|
+
lines: [text],
|
|
458
|
+
font,
|
|
459
|
+
priority: PRIORITY.endpoint,
|
|
460
|
+
candidates: [{ slot: kind === "category" ? "left" : "rowEnd", rect, penalty: 0 }],
|
|
461
|
+
...extra
|
|
462
|
+
});
|
|
463
|
+
}, bandPaints = targetBands(directions, target, options).map((band) => band.paint);
|
|
464
|
+
rows.forEach((row, index) => {
|
|
465
|
+
let top = rowsTop + rowTops[index], barCenter = bandCenterAt(index), valueCenter = stacked ? top + stackValueOffset + line1H / 2 : barCenter, owner = { categoryId: row.id }, share = shares[index], fill = measurePaint(row), fillCss = paintColor(theme, fill), backing = bandPaints.reduce((nearest, paint) => {
|
|
466
|
+
let css = paintColor(theme, paint);
|
|
467
|
+
return contrastRatio(fillCss, css) < contrastRatio(fillCss, nearest) ? css : nearest;
|
|
468
|
+
}, theme.color.background), barStyle = {
|
|
469
|
+
fill,
|
|
470
|
+
...separationStroke(fillCss, backing, theme),
|
|
471
|
+
separation: { fill, backing: { token: "background" }, alternateBackings: bandPaints }
|
|
472
|
+
}, barNodeId;
|
|
473
|
+
if (share !== void 0 && share > 0) {
|
|
474
|
+
let y = barCenter - barH / 2, display = { value: valueTexts[index] ?? input.valueText(row) ?? "" };
|
|
475
|
+
if (barNodeId = `bar:${row.id}`, share <= hi) {
|
|
476
|
+
let rect = { x: x(0), y, w: Math.max(0.5, x(share) - x(0)), h: barH };
|
|
477
|
+
nodes.push({ t: "rect", id: barNodeId, rect, ...barStyle, owner, part: "bar", display }), occupied.claim(rect, "mark", owner);
|
|
478
|
+
} else {
|
|
479
|
+
let end = x(hi), cut2 = end - OVERFLOW_BREAK_INSET, rect = { x: x(0), y, w: Math.max(0.5, cut2 - 2 - x(0)), h: barH }, tail = { x: cut2 + 2, y, w: end - cut2 - 2, h: barH };
|
|
480
|
+
nodes.push({ t: "rect", id: barNodeId, rect, ...barStyle, owner, part: "bar", display }), nodes.push({ t: "rect", id: `${barNodeId}:beyond`, rect: tail, ...barStyle, owner, part: "barBeyondBreak" });
|
|
481
|
+
let glyph = straightBreakGlyph(theme, { x: cut2, y: barCenter }, `${barNodeId}:break`, owner, { token: "axis" }, "barBreak");
|
|
482
|
+
nodes.push(...glyph.nodes), occupied.claim(rect, "mark", owner), occupied.claim(tail, "mark", owner), occupied.claim(glyph.rect, "axis", owner, "barBreak");
|
|
483
|
+
}
|
|
484
|
+
} else share === void 0 && row.value !== null && warnings.push({
|
|
485
|
+
code: "bullet-target-share-undefined",
|
|
486
|
+
severity: "warn",
|
|
487
|
+
message: `row '${row.id}': no share of target without a positive value and a positive target; no bar was drawn`,
|
|
488
|
+
owner
|
|
489
|
+
});
|
|
490
|
+
let noteTop = stacked ? top + stackNoteTop : top + (labelOn2("category") ? sideNames.labels[index].h : 0) + LINE_GAP;
|
|
491
|
+
if (labelOn2("category")) {
|
|
492
|
+
let name = (stacked ? stackNames : sideNames).labels[index];
|
|
493
|
+
request(
|
|
494
|
+
`category:${row.id}`,
|
|
495
|
+
"category",
|
|
496
|
+
owner,
|
|
497
|
+
row.label,
|
|
498
|
+
nameFont,
|
|
499
|
+
{ x: plot0.x, y: top, w: name.w, h: name.h },
|
|
500
|
+
{ ...fittedLabel(name, nameFont), priority: PRIORITY.endpoint + (highlights.has(row.id) ? PRIORITY.highlightBonus : 0) }
|
|
501
|
+
);
|
|
502
|
+
let note = (stacked ? stackNotes : sideNotes)[index];
|
|
503
|
+
request(
|
|
504
|
+
`target:${row.id}`,
|
|
505
|
+
"annotation",
|
|
506
|
+
owner,
|
|
507
|
+
note.text,
|
|
508
|
+
noteFont,
|
|
509
|
+
{ x: plot0.x, y: noteTop, w: note.w, h: note.h },
|
|
510
|
+
{ ...fittedLabel(note, noteFont), role: "note" }
|
|
511
|
+
), inks.set(`target:${row.id}`, { token: "inkMuted" });
|
|
512
|
+
}
|
|
513
|
+
let shareRight = stacked ? plot0.x + plot0.w : columnRight.get("share"), valueText = valueTexts[index];
|
|
514
|
+
if (valueText) {
|
|
515
|
+
let size1 = measure(valueText, valueFont), right = stacked ? plot0.x + plot0.w - (shareW ? shareW + VALUE_GAP : 0) : columnRight.get("actual");
|
|
516
|
+
request(
|
|
517
|
+
`point:${row.id}`,
|
|
518
|
+
"point",
|
|
519
|
+
owner,
|
|
520
|
+
valueText,
|
|
521
|
+
valueFont,
|
|
522
|
+
{ x: right - size1.width, y: valueCenter - size1.height / 2, w: size1.width, h: size1.height }
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
let shareLabel = shareTexts[index];
|
|
526
|
+
if (shareLabel && shareRight !== void 0) {
|
|
527
|
+
let size2 = measure(shareLabel, shareFont);
|
|
528
|
+
request(
|
|
529
|
+
`share:${row.id}`,
|
|
530
|
+
"annotation",
|
|
531
|
+
owner,
|
|
532
|
+
shareLabel,
|
|
533
|
+
shareFont,
|
|
534
|
+
{ x: shareRight - size2.width, y: valueCenter - size2.height / 2, w: size2.width, h: size2.height },
|
|
535
|
+
{ role: "value" }
|
|
536
|
+
), inks.set(`share:${row.id}`, { token: "ink" });
|
|
537
|
+
}
|
|
538
|
+
let delta = deltas[index], deltaLabel = stacked ? deltaTexts[index] : deltaBodies[index];
|
|
539
|
+
if (deltaLabel && delta !== void 0) {
|
|
540
|
+
let size3 = measure(deltaLabel, deltaFont), labelId = `delta:${row.id}`, tone = input.deltaTone(row, delta), right = stacked ? plot0.x + plot0.w : columnRight.get("delta"), y = stacked ? noteTop + (deltaSeparate ? stackNoteH + 2 : 0) : valueCenter - size3.height / 2;
|
|
541
|
+
request(
|
|
542
|
+
labelId,
|
|
543
|
+
"annotation",
|
|
544
|
+
owner,
|
|
545
|
+
deltaLabel,
|
|
546
|
+
deltaFont,
|
|
547
|
+
{ x: right - size3.width, y, w: size3.width, h: size3.height },
|
|
548
|
+
{ role: composedTextRole(deltaLabel, "note"), priority: PRIORITY.extreme }
|
|
549
|
+
), inks.set(labelId, { token: tone === "neutral" ? "ink" : tone }), placedAnnotations.push({
|
|
550
|
+
id: `delta-target:${row.id}`,
|
|
551
|
+
kind: "delta",
|
|
552
|
+
computedText: deltaLabel,
|
|
553
|
+
tone,
|
|
554
|
+
nodeIds: [],
|
|
555
|
+
labelId,
|
|
556
|
+
derivation: {
|
|
557
|
+
basis: "derived",
|
|
558
|
+
op: "annotation-delta@1",
|
|
559
|
+
inputs: [
|
|
560
|
+
{ ref: `${row.id}:value`, value: row.value },
|
|
561
|
+
{ ref: `${row.id}:target`, value: row.target }
|
|
562
|
+
],
|
|
563
|
+
raw: delta
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
marks.rows.push({
|
|
568
|
+
id: row.id,
|
|
569
|
+
bandNodeIds: rowBandIds.get(row.id),
|
|
570
|
+
...barNodeId ? { barNodeId } : {},
|
|
571
|
+
...anyTarget && row.target !== null ? { targetNodeId: index > 0 ? `target:shared:${row.id}` : "target:shared" } : {},
|
|
572
|
+
rect: { x: plot.x, y: top, w: plot.w, h: rowHeights[index] }
|
|
573
|
+
});
|
|
574
|
+
});
|
|
575
|
+
let solveCtx = labelCtx(theme, size, options, {
|
|
576
|
+
measure,
|
|
577
|
+
plot,
|
|
578
|
+
labelPad: 0
|
|
579
|
+
}), solved = solveLabels(requests, occupied, solveCtx);
|
|
580
|
+
pushAll(warnings, solved.warnings);
|
|
581
|
+
for (let label of solved.placed) {
|
|
582
|
+
let ink = inks.get(label.id);
|
|
583
|
+
ink && (label.ink = ink);
|
|
584
|
+
}
|
|
585
|
+
let labelNodes = labelsToNodes(theme, solved.placed, (label) => fonts.get(label.id) ?? nameFont);
|
|
586
|
+
asColumnHeads(labelNodes), pushAll(nodes, labelNodes);
|
|
587
|
+
let shareById = emptyIdRecord();
|
|
588
|
+
rows.forEach((row, index) => {
|
|
589
|
+
let share = shares[index];
|
|
590
|
+
share !== void 0 && (shareById[row.id] = Math.round(share * 100) / 100);
|
|
591
|
+
});
|
|
592
|
+
let describeRow = (row, index) => {
|
|
593
|
+
let share = shares[index], value = input.valueText(row) ?? "n/a", delta = input.deltaVsTarget[row.id];
|
|
594
|
+
return `${row.label} ${value}` + (share === void 0 ? "" : `, ${shareText(share)} ${chartString(options, "ofTarget", { v1: target })}, ${input.targetText(row)}`) + (delta === void 0 ? "" : ` (${input.deltaText(row, delta)}, ${chartString(options, { good: "toneGood", bad: "toneBad", warn: "toneWarn", neutral: "toneNeutral" }[input.deltaTone(row, delta)])})`);
|
|
595
|
+
};
|
|
596
|
+
return {
|
|
597
|
+
type: "bullet",
|
|
598
|
+
...input.paintWarningRules?.length ? { paintWarningRules: input.paintWarningRules } : {},
|
|
599
|
+
size,
|
|
600
|
+
sizing: rowSizing("bullet", size, {
|
|
601
|
+
chromeH: size.height - availH,
|
|
602
|
+
minimumRowsH,
|
|
603
|
+
naturalRowsH: span(naturalPitch),
|
|
604
|
+
// Stacked rows keep 160 px of band and their widest text line; side by side, 80 px of plot.
|
|
605
|
+
minWidth: stacked ? size.width - plot.w + Math.max(160, stackLeftW, deltaW, stackValuesW) : size.width - plot.w + 80
|
|
606
|
+
}),
|
|
607
|
+
plot,
|
|
608
|
+
scene: nodes,
|
|
609
|
+
labels: solved.placed,
|
|
610
|
+
axes: [
|
|
611
|
+
{
|
|
612
|
+
axis: "y",
|
|
613
|
+
ticks: rows.map((row, index) => ({
|
|
614
|
+
at: row.id,
|
|
615
|
+
pos: rowsTop + rowTops[index] + line1H / 2,
|
|
616
|
+
labelId: labelOn2("category") ? `category:${row.id}` : void 0
|
|
617
|
+
}))
|
|
618
|
+
},
|
|
619
|
+
{ axis: "x", ticks: axisTicks }
|
|
620
|
+
],
|
|
621
|
+
annotations: placedAnnotations,
|
|
622
|
+
legend: frameResult.legend,
|
|
623
|
+
frame: frameResult.frame,
|
|
624
|
+
marks,
|
|
625
|
+
derived: { deltaVsTarget: input.deltaVsTarget, percentOfTarget: shareById },
|
|
626
|
+
a11y: {
|
|
627
|
+
title: accessibleTitle(options.title, chartString(options, "bulletTargetTitle", { v1: rows.length, v2: target })),
|
|
628
|
+
titleCounts: [structureCount("rows", rows.length, chartString(options, "kpisCount", { v1: rows.length }))],
|
|
629
|
+
counts: [structureCount("rows", rows.length, chartString(options, "kpiRowsCount", { v1: rows.length }))],
|
|
630
|
+
desc: chartString(options, "bulletTargetDesc", { v1: rows.length, v2: target, v3: hi }) + // A card of neutral rows only draws no better side, so it has its own band text.
|
|
631
|
+
(directions.every((direction) => direction === "neutral") ? chartString(options, "bulletNeutralOnlyBandsDesc", { v1: target }) : chartString(options, directions.includes("lowerIsBetter") ? directions.includes("higherIsBetter") ? "bulletMirroredBandsDesc" : "bulletLowerBandsDesc" : "bulletBandsDesc", { v1: target, v2: target }) + (directions.includes("neutral") ? chartString(options, "bulletNeutralBandsDesc", { v1: target }) : "")) + `${rows.map(describeRow).join("; ")}.`
|
|
632
|
+
},
|
|
633
|
+
warnings,
|
|
634
|
+
debug: {
|
|
635
|
+
occupied: occupied.snapshot(),
|
|
636
|
+
decisions: solved.decisions
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// src/core/charts/bullet/layout.ts
|
|
642
|
+
var LABEL_GAP = 5, CAT_BAND_GAP = 10, CAPSULE_GAP = 8, COLUMNS_GAP = 18, COLUMN_GAP2 = 16, LINE_GAP2 = 1, ROW_BAND = 30, ROW_BAND_MAX = 56, ROW_AIR = 16, ROW_PITCH_MAX = 240, EDGE_TICK = 3, BAR_FRACTION = 1 / 3, NAME_WEIGHT = 600, BANDS_UNEXPLAINED = "qualitative bands carry meaning the reader cannot decode \u2014 label the bands or explain them in a footnote";
|
|
643
|
+
function bandAmount(row, index, count) {
|
|
644
|
+
let semanticIndex = row.direction === "lowerIsBetter" ? count - 1 - index : index;
|
|
645
|
+
return count === 1 ? 0.5 : semanticIndex / (count - 1);
|
|
646
|
+
}
|
|
647
|
+
function bandLadder(theme, count, palette, warnings, light) {
|
|
648
|
+
let measure = semanticPalettePaint(theme, palette, "neutral"), good = semanticPalettePaint(theme, palette, "neutralLight"), poor = mixedPaint(measure, good, 0.75);
|
|
649
|
+
return bulletBandPaints(theme, count, poor, good, warnings, light).map((paint, index) => ({
|
|
650
|
+
token: "token" in paint ? paint.token : "neutral",
|
|
651
|
+
theme: { kind: "bullet-band", poor, good, count, index, ...light ? { light: !0 } : {} }
|
|
652
|
+
}));
|
|
653
|
+
}
|
|
654
|
+
function measureStyle(theme, fill, bands) {
|
|
655
|
+
let css = paintColor(theme, fill), backing = bands.reduce((nearest, band) => {
|
|
656
|
+
let candidate = paintColor(theme, band);
|
|
657
|
+
return contrastRatio(css, candidate) < contrastRatio(css, nearest) ? candidate : nearest;
|
|
658
|
+
}, theme.color.background);
|
|
659
|
+
return { fill, ...separationStroke(css, backing, theme), separation: { fill, backing: { token: "background" }, alternateBackings: bands } };
|
|
660
|
+
}
|
|
661
|
+
function legendItemsForBands(rows, paint) {
|
|
662
|
+
let byLabel = /* @__PURE__ */ new Map();
|
|
663
|
+
for (let row of rows)
|
|
664
|
+
row.bands.forEach((band, index) => {
|
|
665
|
+
if (!band.label) return;
|
|
666
|
+
let signature = JSON.stringify([band.label, paint(row, index)]);
|
|
667
|
+
if (byLabel.has(signature)) return;
|
|
668
|
+
let amount = bandAmount(row, index, row.bands.length);
|
|
669
|
+
byLabel.set(signature, {
|
|
670
|
+
id: `band:${band.label}${[...byLabel.values()].some((item) => item.label === band.label) ? ":" + index : ""}`,
|
|
671
|
+
label: band.label,
|
|
672
|
+
paint: paint(row, index),
|
|
673
|
+
key: "box",
|
|
674
|
+
amount
|
|
675
|
+
});
|
|
676
|
+
});
|
|
677
|
+
return [...byLabel.values()].sort((a, b) => a.amount - b.amount || (a.label < b.label ? -1 : a.label > b.label ? 1 : 0)).map(({ amount: _amount, ...item }) => item);
|
|
678
|
+
}
|
|
679
|
+
var RAMP_WORD_KEYS = [
|
|
680
|
+
["worseCapital", "betterCapital"],
|
|
681
|
+
["worseCapital", "middle3", "betterCapital"],
|
|
682
|
+
["worseCapital", "lowerMiddle", "upperMiddle", "betterCapital"],
|
|
683
|
+
["worseCapital", "lowerMiddle", "middle5", "upperMiddle", "betterCapital"]
|
|
684
|
+
];
|
|
685
|
+
function rampApplies(rows) {
|
|
686
|
+
let banded = rows.filter((row) => row.bands.length > 0), n = banded[0]?.bands.length ?? 0;
|
|
687
|
+
return banded.length > 0 && n >= 2 && n <= 5 && banded.every((row) => row.bands.length === n && row.direction !== "neutral" && row.bands.every((band) => !band.tone));
|
|
688
|
+
}
|
|
689
|
+
function rampKey(rows, options, paint, labelsKey, warnings) {
|
|
690
|
+
let mode = options.bandKey === "row" ? "auto" : options.bandKey ?? "auto";
|
|
691
|
+
if (mode === "labels") return;
|
|
692
|
+
let banded = rows.filter((row) => row.bands.length > 0), applies = rampApplies(rows);
|
|
693
|
+
if (mode === "ramp" && !applies && warnings.push({
|
|
694
|
+
code: "band-key-ramp-unavailable",
|
|
695
|
+
severity: "warn",
|
|
696
|
+
message: "bandKey ramp needs the same 2 to 5 bands on every banded row, no band tone and no neutral row; the key keeps the band labels",
|
|
697
|
+
suggest: "Give the banded rows the same band count, or set bandKey to 'labels' or 'auto'."
|
|
698
|
+
}), !applies) return;
|
|
699
|
+
let bothWays = banded.some((row) => row.direction === "lowerIsBetter") && banded.some((row) => row.direction === "higherIsBetter"), labels = labelsKey.map((item) => item.label);
|
|
700
|
+
if (!(mode === "auto" && !(bothWays && new Set(labels).size < labels.length)))
|
|
701
|
+
return rampItems(rows, options, paint);
|
|
702
|
+
}
|
|
703
|
+
function rampItems(rows, options, paint) {
|
|
704
|
+
let banded = rows.filter((row) => row.bands.length > 0), n = banded[0].bands.length, authored = options.strings?.bandKey, words = authored?.length === n ? authored : RAMP_WORD_KEYS[n - 2].map((key) => chartString(options, key)), reference = banded.find((row) => row.direction === "higherIsBetter") ?? banded[0];
|
|
705
|
+
return words.map((label, index) => ({
|
|
706
|
+
id: `band:ramp:${index}`,
|
|
707
|
+
label,
|
|
708
|
+
paint: paint(reference.direction === "higherIsBetter" ? reference : { ...reference, direction: "higherIsBetter" }, index),
|
|
709
|
+
key: "box"
|
|
710
|
+
}));
|
|
711
|
+
}
|
|
712
|
+
function attainmentKey(options) {
|
|
713
|
+
let band = (options.annotations ?? []).find((ann) => ann.kind === "band" && ann.style === "attainment");
|
|
714
|
+
if (!band || band.kind !== "band") return [];
|
|
715
|
+
let lower = band.direction === "lowerIsBetter", target = targetWord(options);
|
|
716
|
+
return [
|
|
717
|
+
// The key draws the band's own fill.
|
|
718
|
+
{ id: "attainment:good", label: lower ? chartString(options, "bulletBelowLower", { v1: target }) : chartString(options, "aboveTarget", { v1: target }), paint: signedFillPaint("good") },
|
|
719
|
+
{ id: "attainment:bad", label: lower ? chartString(options, "aboveTarget", { v1: target }) : chartString(options, "belowTarget", { v1: target }), paint: signedFillPaint("bad") }
|
|
720
|
+
];
|
|
721
|
+
}
|
|
722
|
+
function hasBandExplanation(options) {
|
|
723
|
+
if (authoredNotes(options).some((footnote) => footnote.trim().length > 0)) return !0;
|
|
724
|
+
let subtitle = resolveSubtitle(options.subtitle);
|
|
725
|
+
if (!subtitle) return !1;
|
|
726
|
+
let text = [subtitle.company, subtitle.measure, subtitle.period].filter(Boolean).join(" "), namesEncoding = /\b(?:bands?|ranges?|thresholds?|grey|gray)\b/i.test(text), namesAllTiers = /\bpoor\b/i.test(text) && /\bsatisfactory\b/i.test(text) && /\bgood\b/i.test(text), mapsShadeEndpoints = /\bdark\b/i.test(text) && /\bpoor\b/i.test(text) && /\blight\b/i.test(text) && /\bgood\b/i.test(text);
|
|
727
|
+
return namesEncoding && namesAllTiers || mapsShadeEndpoints;
|
|
728
|
+
}
|
|
729
|
+
function buildBandLadders(rows, theme, palette, warnings, light) {
|
|
730
|
+
let paintWarningRules = [], ladders = /* @__PURE__ */ new Map();
|
|
731
|
+
for (let count of new Set(rows.map((row) => row.bands.length))) {
|
|
732
|
+
let before = warnings.filter((warning) => warning.code !== "band-lightness-insufficient").length, ladder = bandLadder(theme, count, palette, warnings, light);
|
|
733
|
+
ladders.set(count, ladder);
|
|
734
|
+
let source = ladder[0] && "token" in ladder[0] ? ladder[0].theme : void 0;
|
|
735
|
+
source?.kind === "bullet-band" && paintWarningRules.push({ kind: "bullet-band-lightness", before, count, poor: source.poor, good: source.good, ...light ? { light: !0 } : {} });
|
|
736
|
+
}
|
|
737
|
+
return { ladders, paintWarningRules };
|
|
738
|
+
}
|
|
739
|
+
function resolveBulletAnchor(ref, anchorByRow, zeroXById) {
|
|
740
|
+
let norm = typeof ref == "string" ? { categoryId: ref, edge: "total" } : ref;
|
|
741
|
+
if (!("categoryId" in norm)) return null;
|
|
742
|
+
let at = anchorByRow.get(norm.categoryId);
|
|
743
|
+
return at ? norm.edge === "start" ? { ...at, x: zeroXById.get(norm.categoryId) } : at : null;
|
|
744
|
+
}
|
|
745
|
+
function sharedDomainSeeds(sharedScale, options, annotations) {
|
|
746
|
+
if (!sharedScale) return { lo: 0, hi: 0 };
|
|
747
|
+
let line = valueLineExtent(annotations);
|
|
748
|
+
return {
|
|
749
|
+
lo: Math.min(0, options.valueAxis?.min ?? 0, line?.lo ?? 0),
|
|
750
|
+
hi: Math.max(0, options.valueAxis?.max ?? 0, line?.hi ?? 0)
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
function bulletAnnotations(options, sharedScale, warnings) {
|
|
754
|
+
return (options.annotations ?? []).filter((annotation) => sharedScale || annotation.kind !== "diff" && annotation.kind !== "cagr" && annotation.kind !== "valueLine" ? !0 : annotation.kind === "valueLine" ? (warnings.push({
|
|
755
|
+
code: "comparison-shared-scale",
|
|
756
|
+
severity: "warn",
|
|
757
|
+
message: "valueLine needs bullet rows on one shared scale; no line was drawn",
|
|
758
|
+
suggest: "use sharedScale: true only when the rows measure the same unit",
|
|
759
|
+
...annotation.id ? { owner: { annotationId: annotation.id } } : {}
|
|
760
|
+
}), !1) : (warnings.push({
|
|
761
|
+
code: "comparison-shared-scale",
|
|
762
|
+
severity: "warn",
|
|
763
|
+
message: `${annotation.kind} needs comparable bullet rows on one shared scale; no arrow was drawn`,
|
|
764
|
+
suggest: "use sharedScale: true only when the rows measure the same unit",
|
|
765
|
+
...annotation.id ? { owner: { annotationId: annotation.id } } : {}
|
|
766
|
+
}), !1));
|
|
767
|
+
}
|
|
768
|
+
var BAND_TRIES = /* @__PURE__ */ Symbol("bandTries"), REGULAR_NAMES = /* @__PURE__ */ Symbol("regularNames"), ROW_KEY_OFF = /* @__PURE__ */ Symbol("rowKeyOff");
|
|
769
|
+
function layoutBullet(data, options = {}) {
|
|
770
|
+
let warnings = [];
|
|
771
|
+
breakUnsupported("bullet", options, warnings);
|
|
772
|
+
let theme = resolveSemanticPaletteTheme(resolveTheme(options.theme), options.palette, warnings), compact = options.density === "compact";
|
|
773
|
+
warnings.push(...compactBulletRefusals(options));
|
|
774
|
+
let compactFloor = chartSizing("bullet", options), size = resolveSize(compact ? cardSize(options, { width: compactFloor.minWidth, height: compactFloor.minHeight }) : options.size ?? "dashboard"), target = options.target ?? DEFAULT_TARGET, stepTo = (font, size2, role) => ({ ...font, size: Math.min(font.size, Math.max(size2, readerFloorPx(target, role, textScaleOf(options)))) }), measure = options.measure ?? defaultMeasurer, fmt = options.format ? formatterFromExample(options.format, options.locale?.language) : (v) => formatAutomaticNumber(v, { locale: options.locale?.language, decimals: autoDecimals(v) }), highlights = new Set(resolveHighlight(options.highlight)), labelOn2 = (kind) => !compact && labelOn(options, kind);
|
|
775
|
+
if (!data || !Array.isArray(data.rows) || data.rows.length === 0)
|
|
776
|
+
throw new NormalizeError("empty-data", "rows", "bullet requires at least one row");
|
|
777
|
+
let seen = /* @__PURE__ */ new Set(), rows = data.rows.map((r, i) => {
|
|
778
|
+
if (!r?.id) throw new NormalizeError("missing-id", `rows[${i}]`, "bullet row requires an id");
|
|
779
|
+
if (seen.has(r.id))
|
|
780
|
+
throw new NormalizeError("duplicate-id", `rows[${i}]`, `duplicate row id '${r.id}'`);
|
|
781
|
+
seen.add(r.id);
|
|
782
|
+
let targetFormat = cellMeta(r.target ?? null)?.format, valueFormat = cellMeta(r.value)?.format ?? options.format;
|
|
783
|
+
targetFormat && (!valueFormat || JSON.stringify(parseFormatExample(targetFormat)) !== JSON.stringify(parseFormatExample(valueFormat))) && warnings.push({
|
|
784
|
+
code: "bullet-target-format-ignored",
|
|
785
|
+
severity: "warn",
|
|
786
|
+
message: `row '${r.id}': target.format is ignored; target and value use the row's format`,
|
|
787
|
+
field: ["data", "rows", i, "target", "format"],
|
|
788
|
+
suggest: "Set the shared format on the row value or options.format, then remove target.format."
|
|
789
|
+
});
|
|
790
|
+
let rawBands = (r.bands ?? []).map(
|
|
791
|
+
(band2) => typeof band2 == "number" ? { to: band2 } : { to: band2.to, ...band2.tone ? { tone: band2.tone } : {}, ...band2.label?.trim() ? { label: band2.label.trim() } : {} }
|
|
792
|
+
).filter((band2) => Number.isFinite(band2.to)), bounded = rawBands.filter((band2) => Math.abs(band2.to) <= MAGNITUDE_CEILING);
|
|
793
|
+
bounded.length < rawBands.length && warnings.push({
|
|
794
|
+
code: "band-magnitude",
|
|
795
|
+
severity: "warn",
|
|
796
|
+
message: `row '${r.id}': band thresholds beyond \xB11e15 dropped \u2014 rescale the unit instead`,
|
|
797
|
+
owner: { categoryId: r.id }
|
|
798
|
+
});
|
|
799
|
+
let positive = bounded.filter((band2) => band2.to > 0);
|
|
800
|
+
positive.length < bounded.length && warnings.push({
|
|
801
|
+
code: "band-nonpositive",
|
|
802
|
+
severity: "warn",
|
|
803
|
+
message: `row '${r.id}': non-positive band thresholds dropped (bands measure from 0)`,
|
|
804
|
+
owner: { categoryId: r.id }
|
|
805
|
+
});
|
|
806
|
+
let bands = [...positive].sort((a, b) => a.to - b.to);
|
|
807
|
+
return bands.map((band2) => band2.to).join(",") !== positive.map((band2) => band2.to).join(",") && warnings.push({
|
|
808
|
+
code: "bands-unsorted",
|
|
809
|
+
severity: "info",
|
|
810
|
+
message: `row '${r.id}': bands re-sorted ascending`,
|
|
811
|
+
owner: { categoryId: r.id }
|
|
812
|
+
}), cellValue(r.value) === null && warnMissingValue(warnings, `row '${r.id}'`, { categoryId: r.id }, "no bar; the bands and target still draw"), {
|
|
813
|
+
id: r.id,
|
|
814
|
+
label: r.label ?? r.id,
|
|
815
|
+
date: r.date,
|
|
816
|
+
value: cellValue(r.value),
|
|
817
|
+
isPct: isPctCell(r.value),
|
|
818
|
+
meta: cellMeta(r.value),
|
|
819
|
+
target: cellValue(r.target ?? null),
|
|
820
|
+
bands,
|
|
821
|
+
direction: r.direction ?? "higherIsBetter"
|
|
822
|
+
};
|
|
823
|
+
}), targetScale = options.sharedScale === "percentOfTarget", allBanded = rows.every((row) => row.bands.length > 0), unitOf = (row) => `${row.isPct}|${row.meta?.format ?? ""}`, bandsOf = (row) => row.bands.map((band2) => band2.to).join("|"), alike = rows.every((row) => unitOf(row) === unitOf(rows[0]) && bandsOf(row) === bandsOf(rows[0])), sharedScale = targetScale || (typeof options.sharedScale == "boolean" ? options.sharedScale : !allBanded || alike);
|
|
824
|
+
options.sharedScale === void 0 && allBanded && !alike && rows.length > 1 && warnings.push({
|
|
825
|
+
code: "bullet-row-scales",
|
|
826
|
+
severity: "warn",
|
|
827
|
+
message: "each bullet row runs on its own scale, because the rows differ in unit or bands; bar lengths compare within a row, not across rows",
|
|
828
|
+
suggest: "set sharedScale: false to confirm per-row scales, or sharedScale: true when the rows measure the same unit"
|
|
829
|
+
}), !targetScale && !sharedScale && (options.valueAxis?.show || options.valueAxis?.min !== void 0 || options.valueAxis?.max !== void 0) && warnings.push({
|
|
830
|
+
code: "value-axis-row-scale",
|
|
831
|
+
severity: "warn",
|
|
832
|
+
message: "valueAxis is ignored while bullet rows are normalized to their own scales \u2014 one absolute axis cannot describe differently scaled rows",
|
|
833
|
+
suggest: "set sharedScale: true to keep one absolute axis across rows"
|
|
834
|
+
});
|
|
835
|
+
let rowFmt = (row) => (v) => row.meta?.format ? formatterFromExample(row.meta.format, options.locale?.language)(v) : row.isPct ? formatAutomaticPercent(v, autoDecimals(v), !1, options.locale?.language) : fmt(v), valueTextOf = (row) => {
|
|
836
|
+
if (row.value === null || row.meta?.label === !1) return null;
|
|
837
|
+
let base = rowFmt(row)(row.value);
|
|
838
|
+
return typeof row.meta?.label == "string" ? row.meta.label.replace(/\$\{value\}/g, base) : base;
|
|
839
|
+
}, deltaBody = (row, d) => {
|
|
840
|
+
let sign = d < 0 ? MINUS : "+", body = row.isPct ? formatAutomaticNumber(Math.abs(d), { locale: options.locale?.language, decimals: autoDecimals(d), suffix: "pp" }) : rowFmt(row)(Math.abs(d));
|
|
841
|
+
return `${sign}${body}`;
|
|
842
|
+
}, deltaText = (row, d) => `${deltaBody(row, d)} vs ${targetWord(options)}`, deltaTone = (row, d) => row.direction === "neutral" ? "neutral" : row.bands.some((band2) => band2.tone) ? (row.value === null ? row.bands.at(-1) : bandFor(row.value, row.bands)).tone ?? "neutral" : d === 0 || d > 0 == (row.direction === "higherIsBetter") ? "good" : "bad", deltaVsTarget = emptyIdRecord();
|
|
843
|
+
for (let row of rows)
|
|
844
|
+
row.value !== null && row.target !== null && (deltaVsTarget[row.id] = round2(row.value - row.target));
|
|
845
|
+
let tickFont = { family: theme.type.family, ...theme.type.axis }, labelFont = { family: theme.type.family, ...theme.type.label }, capsuleFont = labelFont, valueBaseFont = { ...labelFont, weight: emphasisWeight(theme) }, targetFont = { ...tickFont, size: Math.max(readerFloorPx(target, "label", textScaleOf(options)), tickFont.size) }, minimumRowH = Math.max(28, measure("0", labelFont).height + 6, measure("0", tickFont).height + 4), bandFraction = options.bandFraction ?? 0.7, targetValues = new Set(rows.flatMap((row) => row.target === null ? [] : [row.target])), firstTargetRow = rows.find((row) => row.target !== null)?.id, cols = !1, targetPrints = (row) => !cols && labelOn2("annotation") && row.target !== null && (!(sharedScale && targetValues.size === 1) || row.id === firstTargetRow), targetAir = rows.some((row, ri) => ri > 0 && targetPrints(row)) ? measure("0", targetFont).height + 2 : 0, airRowH = targetAir === 0 ? 0 : bandFraction < 1 ? Math.ceil(targetAir / (1 - bandFraction)) : Math.ceil(2 * targetAir), naturalRowH = compact ? minimumRowH : Math.max(44, minimumRowH, airRowH), minimumPitch = targetAir === 0 ? minimumRowH : Math.max(minimumRowH, Math.ceil(2 * (measure("0", targetFont).height + 1))), occupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), framed = options.title !== void 0 && options.title !== !1 || options.subtitle !== void 0 || options.source !== void 0 || authoredNotes(options).length > 0, margin = compact && !framed ? { top: 0, right: 1, bottom: 0, left: 1, ...options.margin } : { top: 16, right: 20, bottom: 12, left: 20, ...options.margin };
|
|
846
|
+
if (targetScale)
|
|
847
|
+
return layoutBulletOnTargetScale(data, options, {
|
|
848
|
+
rows,
|
|
849
|
+
theme,
|
|
850
|
+
size,
|
|
851
|
+
measure,
|
|
852
|
+
margin,
|
|
853
|
+
occupied,
|
|
854
|
+
warnings,
|
|
855
|
+
highlights,
|
|
856
|
+
labelOn: labelOn2,
|
|
857
|
+
rowFmt,
|
|
858
|
+
deltaText,
|
|
859
|
+
deltaBody,
|
|
860
|
+
deltaTone,
|
|
861
|
+
deltaVsTarget
|
|
862
|
+
});
|
|
863
|
+
let keyMode = options.bandKey ?? "auto", rowKeyOff = options[ROW_KEY_OFF] === !0, bandedRows = rows.filter((row) => row.bands.length > 0), namesEveryBand = bandedRows.length > 0 && bandedRows.every((row) => row.bands.every((band2) => band2.label !== void 0)), rowWanted = !rowKeyOff && !compact && labelOn2("annotation") && namesEveryBand && (keyMode === "row" || keyMode === "auto" && rows.length <= 4 && options.bandFraction === void 0);
|
|
864
|
+
rowWanted && options.bandFraction !== void 0 && warnings.push({
|
|
865
|
+
code: "band-fraction-row-ignored",
|
|
866
|
+
severity: "warn",
|
|
867
|
+
message: "bandFraction is ignored while bandKey is 'row': rows that name their bands keep their own band height",
|
|
868
|
+
field: ["options", "bandFraction"],
|
|
869
|
+
suggest: "Remove bandFraction, or set bandKey to 'auto' or 'labels' to size the bands with it."
|
|
870
|
+
}), keyMode === "row" && !compact && !rowWanted && warnings.push({
|
|
871
|
+
code: "band-key-row-unavailable",
|
|
872
|
+
severity: "warn",
|
|
873
|
+
message: "bandKey row needs a name on every band, rows side by side with the target column, and room for each name above its band; the key names the bands",
|
|
874
|
+
suggest: "Name every band or widen the chart, or set bandKey to 'auto'."
|
|
875
|
+
});
|
|
876
|
+
let { ladders, paintWarningRules } = buildBandLadders(rows, theme, options.palette, warnings, rowWanted), bandPaint = (row, index) => row.bands[index].tone ? markRolePaint(row.bands[index].tone, !0) : ladders.get(row.bands.length)[row.direction === "lowerIsBetter" ? row.bands.length - 1 - index : index], labelsKey = legendItemsForBands(rows, bandPaint), builtIn = { locale: options.locale }, targetHead = targetWord(options) !== targetWord(builtIn) && options.strings?.targetColumn === void 0 ? targetWord(options) : chartString(options, "targetColumn"), bandLegendItems = [
|
|
877
|
+
...rowWanted ? [
|
|
878
|
+
{ id: "key:actual", label: chartString(options, "actualColumn"), paint: { token: "markInk" }, key: "box" },
|
|
879
|
+
{ id: "key:target", label: targetHead, paint: { token: "ink" }, key: "tick", width: strokeToken(theme, "data") },
|
|
880
|
+
...rampApplies(rows) ? rampItems(rows, options, bandPaint) : []
|
|
881
|
+
] : rampKey(rows, options, bandPaint, labelsKey, warnings) ?? labelsKey,
|
|
882
|
+
...attainmentKey(options)
|
|
883
|
+
], legendInput;
|
|
884
|
+
if (bandLegendItems.length > 0 && options.legend !== "none" && !compact) {
|
|
885
|
+
let legendOpts = normalizeLegendOption(options.legend, { position: rowWanted ? "bottom" : "top" }), items = bandLegendItems;
|
|
886
|
+
if (legendOpts.order) {
|
|
887
|
+
let orderIndex = (id) => {
|
|
888
|
+
let index = legendOpts.order.indexOf(id);
|
|
889
|
+
return index === -1 ? Number.MAX_SAFE_INTEGER : index;
|
|
890
|
+
};
|
|
891
|
+
items = [...items].sort((a, b) => orderIndex(a.id) - orderIndex(b.id));
|
|
892
|
+
}
|
|
893
|
+
legendInput = { options: legendOpts, items };
|
|
894
|
+
}
|
|
895
|
+
let anyBands = rows.some((row) => row.bands.length > 0);
|
|
896
|
+
anyBands && !legendInput && !compact && !hasBandExplanation(options) && warnings.push({ code: "bands-unexplained", severity: "warn", message: BANDS_UNEXPLAINED });
|
|
897
|
+
let frameResult = solveFrame(
|
|
898
|
+
{
|
|
899
|
+
size,
|
|
900
|
+
margin,
|
|
901
|
+
// Cards keep compact gaps at every width; see FrameInput.cardGaps.
|
|
902
|
+
cardGaps: !0,
|
|
903
|
+
...frameTextOptions(options),
|
|
904
|
+
legend: legendInput,
|
|
905
|
+
theme: cardFrameTheme(theme, options, size.width),
|
|
906
|
+
measure
|
|
907
|
+
},
|
|
908
|
+
occupied
|
|
909
|
+
), plot0 = frameResult.plot, axisTitle = options.valueAxis?.show && sharedScale && labelOn2("axisTitle") ? planValueAxisTitle(options.axisTitles?.primary, theme, measure, plot0.w) : void 0, axisH = options.valueAxis?.show && sharedScale ? measure("0", tickFont).height + 8 + (axisTitle ? axisTitle.height + 2 : 0) : 0, inset = compact ? 0 : 2, topAir = rows.length > 0 && targetPrints(rows[0]) ? measure("0", targetFont).height + 2 : 0, availH = plotHeightAfter(frameResult, size.height, plot0.h - axisH - 2 * inset - topAir), rowsH = Math.min(availH, rows.length * naturalRowH), stepEst = Math.max(rowsH / rows.length, minimumPitch), regularNames = options[REGULAR_NAMES] === !0, nameFont = regularNames ? tickFont : { ...tickFont, weight: NAME_WEIGHT }, catFont = stepEst >= tickFont.size * 1.2 + 4 ? nameFont : stepTo(nameFont, theme.type.footnote.size, "axis"), lineH = catFont.size * 1.2, card = size.width < 480, catMaxLines = card || stepEst >= 2 * lineH + 4 ? 2 : 1, capW = card ? Math.min(80, Math.max(24, plot0.w * 0.3)) : Math.max(24, plot0.w * 0.26), fitNames = (maxLines2, font = catFont) => rowLabelBand(
|
|
910
|
+
labelOn2("category") ? rows : [],
|
|
911
|
+
font,
|
|
912
|
+
capW,
|
|
913
|
+
maxLines2,
|
|
914
|
+
lineH,
|
|
915
|
+
measure,
|
|
916
|
+
{ wider: card ? capW : gutterBudget(24, plot0.w), shrink: stepDownFont(theme, font, "axis", target, textScaleOf(options)), target, textScale: textScaleOf(options), typeRole: "axis", footnoteRefs: { count: authoredFootnoteCount(options), warnings } }
|
|
917
|
+
), sideNames = (font = catFont) => {
|
|
918
|
+
let band2 = fitNames(catMaxLines, font);
|
|
919
|
+
return band2.labels.some((label) => label.title !== void 0) ? fitNames(2, font) : band2;
|
|
920
|
+
}, fitted = fitNames(catMaxLines), { labels: catLines, width: catBandW } = fitted.labels.some((label) => label.title !== void 0) ? fitNames(2) : fitted, capsulesOn = labelOn2("annotation"), capsuleTexts = /* @__PURE__ */ new Map(), capsuleColW = 0;
|
|
921
|
+
if (capsulesOn)
|
|
922
|
+
for (let row of rows) {
|
|
923
|
+
let d = deltaVsTarget[row.id];
|
|
924
|
+
if (d === void 0) continue;
|
|
925
|
+
let text = deltaText(row, d);
|
|
926
|
+
capsuleTexts.set(row.id, text), capsuleColW = Math.max(capsuleColW, measure(text, capsuleFont).width);
|
|
927
|
+
}
|
|
928
|
+
let annotations = bulletAnnotations(options, sharedScale, warnings), cagrColW = annotations.some((ann) => ann.kind === "cagr") ? measure("\u2212100.0% p.a.", { ...labelFont, weight: emphasisWeight(theme) }).width + 48 : 0, valueW = labelOn2("point") ? Math.max(0, maxOf(rows.map((row) => {
|
|
929
|
+
let text = valueTextOf(row);
|
|
930
|
+
return text ? measure(text, valueBaseFont).width : 0;
|
|
931
|
+
}))) : 0, maxLines = Math.max(catMaxLines, ...rows.map((row) => row.label.split(/\s+/).length)), cardBand = (font) => rowLabelBand(
|
|
932
|
+
labelOn2("category") ? rows : [],
|
|
933
|
+
font,
|
|
934
|
+
plot0.w - valueW - CAT_BAND_GAP,
|
|
935
|
+
maxLines,
|
|
936
|
+
lineH,
|
|
937
|
+
measure,
|
|
938
|
+
{ target, textScale: textScaleOf(options), typeRole: "axis", footnoteRefs: { count: authoredFootnoteCount(options), warnings } }
|
|
939
|
+
), cardNames = !compact && annotations.length === 0 && (catLines.some((label) => label.title !== void 0) || plot0.w - catBandW - CAT_BAND_GAP - capsuleColW - CAPSULE_GAP < size.width * 0.55) ? cardBand(catFont) : void 0, cardHeaderH = Math.max(measure("0", labelFont).height, maxOf((cardNames?.labels ?? catLines).map((label) => label.h))), cardBandH = Math.max(16, measure("0", labelFont).height), cardFooterH = targetPrints(rows[0]) || capsuleTexts.size > 0 ? Math.max(measure("0", targetFont).height, measure("0", capsuleFont).height) : 0, cardPitch = cardHeaderH + cardBandH + cardFooterH + 12, fixedHeight = options[TARGET_SIZE]?.fixed.height ?? !heightOmitted(options.size), stacked = cardNames !== void 0 && (!fixedHeight || rows.length * cardPitch <= availH);
|
|
940
|
+
stacked ? (catLines = cardNames.labels, catBandW = cardNames.width, naturalRowH = Math.max(naturalRowH, cardPitch)) : fixedHeight && cardNames && ({ labels: catLines, width: catBandW } = fitted);
|
|
941
|
+
let tallest = (labels) => maxOf(labels.map((label) => label.lines.length));
|
|
942
|
+
if (!regularNames && (catLines.some((label) => label.title !== void 0) || tallest(catLines) > 1 && tallest(catLines) > tallest((stacked ? cardBand : sideNames)({ ...catFont, weight: tickFont.weight }).labels)))
|
|
943
|
+
return layoutBullet(data, { ...options, [REGULAR_NAMES]: !0 });
|
|
944
|
+
let sidePlotW = Math.max(10, plot0.w - (catBandW ? catBandW + CAT_BAND_GAP : 0) - (capsuleColW ? capsuleColW + CAPSULE_GAP : 0) - cagrColW), noteFont = { family: theme.type.family, ...theme.type.axis, size: Math.min(secondaryType(theme).size, Math.max(theme.type.footnote.size, readerFloorPx(target, "secondary", textScaleOf(options)))) }, colPlan = options.targetColumns !== !1 && !compact && !stacked && cardNames === void 0 && labelOn2("annotation") && annotations.every((ann) => ann.kind !== "cagr") && rows.some((row) => row.target !== null) && catLines.every((label) => label.title === void 0) ? (() => {
|
|
945
|
+
let headerFont = { family: theme.type.family, ...theme.type.footnote, size: Math.max(theme.type.footnote.size, tableHeadFloorPx(target, textScaleOf(options)), readerFloorPx(target, "label", textScaleOf(options))) }, colTargets = rows.map((row) => row.target === null ? null : rowFmt(row)(row.target)), colGaps = rows.map((row) => deltaVsTarget[row.id] === void 0 ? null : deltaBody(row, deltaVsTarget[row.id])), colPositions = rows.map((row) => {
|
|
946
|
+
let d = deltaVsTarget[row.id];
|
|
947
|
+
return d === void 0 ? null : chartString(options, d < 0 ? "gapBelow" : d > 0 ? "gapAbove" : "gapOn", { v1: targetWord(options) });
|
|
948
|
+
}), colDirections = rows.map((row) => !labelOn2("category") || row.direction === "neutral" || row.bands.some((band2) => band2.tone) ? null : chartString(options, row.direction === "lowerIsBetter" ? "lowerBetter" : "higherBetter")), widest = (texts, font) => Math.max(0, maxOf(texts.map((text) => text ? measure(text, font).width : 0))), headEnv = { target, textScale: textScaleOf(options) }, targetBodyW = widest(colTargets, labelFont), gapBodyW = Math.max(widest(colGaps, valueBaseFont), widest(colPositions, noteFont)), colHeads = [
|
|
949
|
+
fitHead(targetHead, headerFont, targetBodyW, measure, headEnv),
|
|
950
|
+
fitHead(chartString(options, "gapColumn", { v1: targetWord(options) }), headerFont, gapBodyW, measure, headEnv)
|
|
951
|
+
], targetColW = Math.max(colHeads[0].w, targetBodyW), gapColW = Math.max(colHeads[1].w, gapBodyW), colsW = targetColW + COLUMN_GAP2 + gapColW, colLeftW = catBandW ? Math.max(catBandW, widest(colDirections, noteFont)) : 0, colPlotW = plot0.w - (colLeftW ? colLeftW + CAT_BAND_GAP : 0) - COLUMNS_GAP - colsW, headerH = measure("0", headerFont).height, noteH2 = measure("0", noteFont).height, colNameH = (ri) => (labelOn2("category") ? catLines[ri].h : 0) + (colDirections[ri] ? LINE_GAP2 + noteH2 : 0), colGapH = (ri) => colGaps[ri] ? measure("0", valueBaseFont).height + (colPositions[ri] ? LINE_GAP2 + noteH2 : 0) : colTargets[ri] ? measure("0", labelFont).height : 0, colBlockH = (ri) => Math.max(colNameH(ri), colGapH(ri)), legendLabels = frameResult.nodes.filter((node) => node.t === "text" && node.part === "legendLabel"), legendLast = legendLabels.at(-1), legendRight = Math.max(-1 / 0, maxOf(legendLabels.map((node) => node.t === "text" ? node.x + Math.max(...node.lines.map((line) => measure(line, node.font).width)) : -1 / 0))), headsOnKey = legendLast?.t === "text" && legendLast.y < plot0.y && legendRight + 2 * COLUMN_GAP2 <= plot0.x + plot0.w - colsW, colTopAir = headsOnKey ? 0 : headerH + 4, colAvailH = plotHeightAfter(frameResult, size.height, plot0.h - axisH - 2 * inset - colTopAir), colPitch = Math.max(44, minimumRowH, Math.ceil(maxOf(rows.map((_, ri) => colBlockH(ri))) + 12));
|
|
952
|
+
return { headerFont, noteFont, colTargets, colGaps, colPositions, colDirections, colHeads, targetColW, gapColW, colsW, colLeftW, colPlotW, headerH, noteH: noteH2, colBlockH, legendLast, headsOnKey, colTopAir, colAvailH, colPitch };
|
|
953
|
+
})() : void 0, colBlockMax = colPlan ? maxOf(rows.map((_, ri) => colPlan.colBlockH(ri))) : 0;
|
|
954
|
+
colPlan && colPlan.colPlotW >= Math.max(80, 0.45 * size.width) && (!fixedHeight || colPlan.colAvailH / rows.length >= colBlockMax + 4) && (cols = !0, targetAir = 0, topAir = colPlan.colTopAir, availH = colPlan.colAvailH, naturalRowH = colPlan.colPitch);
|
|
955
|
+
let cp = colPlan, rowMode = rowWanted && !stacked && cardNames === void 0 && (cols || rows.every((row) => !targetPrints(row))), noteH = measure("0", noteFont).height, nameAir = rowMode ? Math.max(noteH, cols ? cp.headerH : 0) + 3 : 0, edgeTicks = rowMode && !sharedScale, tickAir = edgeTicks ? EDGE_TICK + 1 + noteH : 0, bandBase = Math.max(ROW_BAND, cols ? Math.ceil(colBlockMax) : 0), rowBandH = bandBase, rowAir = ROW_AIR;
|
|
956
|
+
if (rowWanted && !rowMode) return layoutBullet(data, { ...options, [ROW_KEY_OFF]: !0 });
|
|
957
|
+
if (rowMode) {
|
|
958
|
+
topAir = 0, availH = plotHeightAfter(frameResult, size.height, plot0.h - axisH - 2 * inset);
|
|
959
|
+
let natural = nameAir + bandBase + tickAir + ROW_AIR, pitch = natural;
|
|
960
|
+
if (fixedHeight) {
|
|
961
|
+
if (availH / rows.length < natural) return layoutBullet(data, { ...options, [ROW_KEY_OFF]: !0 });
|
|
962
|
+
pitch = Math.min(availH / rows.length, Math.max(natural, ROW_PITCH_MAX)), rowBandH = Math.max(bandBase, Math.min(ROW_BAND_MAX, bandBase + 0.4 * (pitch - natural)));
|
|
963
|
+
}
|
|
964
|
+
rowAir = pitch - nameAir - rowBandH - tickAir, targetAir = 0, naturalRowH = pitch;
|
|
965
|
+
}
|
|
966
|
+
let rawBandPad = options[BAND_PAD] ?? 0, bandPad = rawBandPad > 0 ? Math.max(0, Math.min(rawBandPad, Math.floor(availH - 10))) : 0, plot = {
|
|
967
|
+
x: stacked ? plot0.x : plot0.x + (cols ? cp.colLeftW ? cp.colLeftW + CAT_BAND_GAP : 0 : catBandW ? catBandW + CAT_BAND_GAP : 0),
|
|
968
|
+
y: plot0.y + inset + topAir + bandPad,
|
|
969
|
+
w: stacked ? plot0.w : cols ? cp.colPlotW : sidePlotW,
|
|
970
|
+
h: Math.min(availH - bandPad, rows.length * naturalRowH)
|
|
971
|
+
};
|
|
972
|
+
{
|
|
973
|
+
let grow = rowDrivenHeight({ options, width: size.width, height: size.height, chromeH: size.height - availH, rowsH: rows.length * naturalRowH });
|
|
974
|
+
if (grow !== void 0) return layoutBullet(data, { ...options, size: { width: size.width, height: grow } });
|
|
975
|
+
}
|
|
976
|
+
let capsuleX = stacked ? plot.x + plot.w - capsuleColW : plot.x + plot.w + CAPSULE_GAP, gapShare = Math.max(1 - bandFraction, Math.min(0.5, targetAir / (plot.h / rows.length))), band = rowMode ? {
|
|
977
|
+
step: naturalRowH,
|
|
978
|
+
bandwidth: rowBandH,
|
|
979
|
+
count: rows.length,
|
|
980
|
+
range: [plot.y, plot.y + plot.h],
|
|
981
|
+
position: (index) => plot.y + index * naturalRowH + rowAir / 2 + nameAir,
|
|
982
|
+
center: (index) => plot.y + index * naturalRowH + rowAir / 2 + nameAir + rowBandH / 2
|
|
983
|
+
} : bandScale(rows.length, [plot.y, plot.y + plot.h], {
|
|
984
|
+
paddingInner: gapShare,
|
|
985
|
+
paddingOuter: gapShare / 2
|
|
986
|
+
}), capsuleLabelH = measure("X", capsuleFont).height, capsuleLabelPad = Math.max(0, Math.min(2, (band.step - capsuleLabelH) / 2)), valueFont = band.step >= labelFont.size * 1.2 + 6 ? valueBaseFont : stepTo(valueBaseFont, theme.type.footnote.size, "label"), maxPosW = 0, maxNegW = 0;
|
|
987
|
+
if (labelOn2("point"))
|
|
988
|
+
for (let row of rows) {
|
|
989
|
+
let text = valueTextOf(row);
|
|
990
|
+
if (!text || row.value === null) continue;
|
|
991
|
+
let w = measure(text, valueFont).width;
|
|
992
|
+
row.value >= 0 ? maxPosW = Math.max(maxPosW, w) : maxNegW = Math.max(maxNegW, w);
|
|
993
|
+
}
|
|
994
|
+
let extents = rows.map((row) => {
|
|
995
|
+
let rowLo = 0, rowHi = 0;
|
|
996
|
+
return row.value !== null && (rowLo = Math.min(rowLo, row.value), rowHi = Math.max(rowHi, row.value)), row.target !== null && (rowLo = Math.min(rowLo, row.target), rowHi = Math.max(rowHi, row.target)), row.bands.length > 0 && (rowHi = Math.max(rowHi, row.bands[row.bands.length - 1].to)), { lo: rowLo, hi: rowHi };
|
|
997
|
+
}), seeds = sharedDomainSeeds(sharedScale, options, annotations), lo = Math.min(seeds.lo, minOf(extents.map((extent) => extent.lo))), hi = Math.max(seeds.hi, maxOf(extents.map((extent) => extent.hi))), fP = compact || stacked ? 0 : Math.min(0.35, (maxPosW + LABEL_GAP + 8) / plot.w), fN = lo < 0 && !compact && !stacked ? Math.min(0.35, (maxNegW + LABEL_GAP + 8) / plot.w) : 0, extend = (extentLo, extentHi) => {
|
|
998
|
+
let span = extentHi - extentLo || 1, denom = Math.max(0.3, 1 - fP - (extentLo < 0 ? fN : 0));
|
|
999
|
+
return [
|
|
1000
|
+
extentLo < 0 ? extentLo - span * fN / denom : 0,
|
|
1001
|
+
extentHi + span * fP / denom
|
|
1002
|
+
];
|
|
1003
|
+
}, scaleAt, axisScale = null;
|
|
1004
|
+
if (sharedScale) {
|
|
1005
|
+
applyAxisBounds([lo, hi], [lo, hi], options.valueAxis, warnings);
|
|
1006
|
+
let [loExt, hiExt] = extend(lo, hi), [dLo, dHi] = niceDomain(loExt, hiExt || 1, 5, {
|
|
1007
|
+
dataExtent: [loExt, hiExt || 1],
|
|
1008
|
+
maxWasteFraction: 0.15
|
|
1009
|
+
}), x = linearScale([dLo, dHi], [plot.x, plot.x + plot.w]);
|
|
1010
|
+
axisScale = x, scaleAt = () => x;
|
|
1011
|
+
} else {
|
|
1012
|
+
let rowScales = extents.map((extent) => {
|
|
1013
|
+
let [loExt, hiExt] = extend(extent.lo, extent.hi);
|
|
1014
|
+
return linearScale([loExt, hiExt || 1], [plot.x, plot.x + plot.w]);
|
|
1015
|
+
});
|
|
1016
|
+
scaleAt = (ri) => rowScales[ri];
|
|
1017
|
+
}
|
|
1018
|
+
let zeroX = rows.map((_, ri) => scaleAt(ri)(0)), uniformZeroX = zeroX.every((value) => value === zeroX[0]);
|
|
1019
|
+
if (rowMode && !rows.every((row, ri) => row.bands.every((bandSpec, bi) => measure(bandSpec.label, noteFont).width + 4 <= scaleAt(ri)(bandSpec.to) - scaleAt(ri)(bi === 0 ? 0 : row.bands[bi - 1].to))))
|
|
1020
|
+
return layoutBullet(data, { ...options, [ROW_KEY_OFF]: !0 });
|
|
1021
|
+
let nodes = [...frameResult.nodes], marks = { rows: [] }, labelRequests = [], placedAnnotations = [], axes = [];
|
|
1022
|
+
if (options.valueAxis?.show && axisScale) {
|
|
1023
|
+
let axisResult = layoutValueAxis(
|
|
1024
|
+
{
|
|
1025
|
+
scale: axisScale,
|
|
1026
|
+
plot,
|
|
1027
|
+
orient: "x",
|
|
1028
|
+
gridlines: options.valueAxis.gridlines ?? !1,
|
|
1029
|
+
format: fmt,
|
|
1030
|
+
theme,
|
|
1031
|
+
measure,
|
|
1032
|
+
canvasWidth: size.width
|
|
1033
|
+
},
|
|
1034
|
+
occupied
|
|
1035
|
+
);
|
|
1036
|
+
nodes.push(...axisResult.nodes), axes.push(axisResult.axis), axisTitle && labelRequests.push(valueAxisTitleRequest(axisTitle, { x: plot.x + plot.w, y: plot.y + plot.h + 6 + measure("0", tickFont).height + 2 }, "end", "axis:x:title"));
|
|
1037
|
+
}
|
|
1038
|
+
let baselineId = uniformZeroX && !stacked && !rowMode ? "axis:baseline" : void 0;
|
|
1039
|
+
baselineId ? (nodes.push({
|
|
1040
|
+
t: "line",
|
|
1041
|
+
id: baselineId,
|
|
1042
|
+
x1: zeroX[0],
|
|
1043
|
+
y1: plot.y,
|
|
1044
|
+
x2: zeroX[0],
|
|
1045
|
+
y2: plot.y + plot.h,
|
|
1046
|
+
stroke: { token: "axis" },
|
|
1047
|
+
width: strokeToken(theme, "rule"),
|
|
1048
|
+
owner: {},
|
|
1049
|
+
part: "baseline"
|
|
1050
|
+
}), occupied.claim({ x: zeroX[0] - 1, y: plot.y, w: 2, h: plot.h }, "axis", {})) : rows.forEach((row, ri) => {
|
|
1051
|
+
let rowY = stacked ? plot.y + ri * band.step + cardHeaderH + 3 : band.position(ri), height = stacked ? cardBandH : band.bandwidth;
|
|
1052
|
+
nodes.push({
|
|
1053
|
+
t: "line",
|
|
1054
|
+
id: `baseline:${row.id}`,
|
|
1055
|
+
x1: zeroX[ri],
|
|
1056
|
+
y1: rowY,
|
|
1057
|
+
x2: zeroX[ri],
|
|
1058
|
+
y2: rowY + height,
|
|
1059
|
+
stroke: { token: "axis" },
|
|
1060
|
+
width: strokeToken(theme, "rule"),
|
|
1061
|
+
owner: { categoryId: row.id },
|
|
1062
|
+
part: "baseline"
|
|
1063
|
+
}), occupied.claim(
|
|
1064
|
+
{ x: zeroX[ri] - 1, y: rowY, w: 2, h: height },
|
|
1065
|
+
"axis",
|
|
1066
|
+
{ categoryId: row.id }
|
|
1067
|
+
);
|
|
1068
|
+
});
|
|
1069
|
+
let barPaint = (row) => row.meta?.fill ? { css: row.meta.fill } : highlights.has(row.id) ? semanticPalettePaint(theme, options.palette, "focus") : { token: "markInk" }, barCss = (row) => row.meta?.fill ? row.meta.fill : highlights.has(row.id) ? focusColor(theme) : paintColor(theme, { token: "markInk" }), anchorByRow = /* @__PURE__ */ new Map(), capsuleLabelIds = /* @__PURE__ */ new Map(), columnFonts = /* @__PURE__ */ new Map(), columnInks = /* @__PURE__ */ new Map();
|
|
1070
|
+
if (cols) {
|
|
1071
|
+
let legendFontH = cp.legendLast?.t === "text" ? measure("0", cp.legendLast.font).height : cp.headerH, headY = rowMode ? band.position(0) - 2 - cp.headerH : cp.headsOnKey && cp.legendLast?.t === "text" ? cp.legendLast.y + (legendFontH - cp.headerH) / 2 : plot0.y + inset, gapRight = plot0.x + plot0.w;
|
|
1072
|
+
[[cp.colHeads[0], "target", gapRight - cp.gapColW - COLUMN_GAP2], [cp.colHeads[1], "gap", gapRight]].forEach(([head, key, right], order) => {
|
|
1073
|
+
let request = headRequest(key, order, head, right, headY, cp.headerH, cp.headsOnKey && !rowMode);
|
|
1074
|
+
columnFonts.set(request.id, cp.headerFont), columnInks.set(request.id, { token: "inkMuted" }), labelRequests.push(request);
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
let uniformInside = rows.every((row, ri) => {
|
|
1078
|
+
if (row.value === null || !labelOn2("point")) return !0;
|
|
1079
|
+
let text = valueTextOf(row);
|
|
1080
|
+
if (!text) return !0;
|
|
1081
|
+
let x = scaleAt(ri), vx = x(row.value), left = Math.min(zeroX[ri], vx), barW = Math.max(Math.abs(vx - zeroX[ri]), 0.5), barH = Math.max(3, band.bandwidth * BAR_FRACTION), tsize = measure(text, valueFont), insideX = row.value >= 0 ? left + barW - 6 - tsize.width : left + 6, targetX = row.target !== null ? x(row.target) : null, tickOnInside = targetX !== null && targetX >= insideX - 2 && targetX <= insideX + tsize.width + 2;
|
|
1082
|
+
return tsize.width + 12 <= barW && tsize.height <= barH + 4 && !tickOnInside;
|
|
1083
|
+
}), attainment = (options.annotations ?? []).find((ann) => ann.kind === "band" && ann.style === "attainment"), plan = attainment?.kind === "band" && typeof attainment.value == "number" ? attainment.value : null, washes = plan === null ? [] : rows.flatMap((row, ri) => {
|
|
1084
|
+
if (row.value === null) return [];
|
|
1085
|
+
let [a, b] = [scaleAt(ri)(plan), scaleAt(ri)(row.value)].sort((p, q) => p - q);
|
|
1086
|
+
return [{ x: a, y: band.position(ri) + band.bandwidth / 2 - band.step / 2, w: b - a, h: band.step }];
|
|
1087
|
+
});
|
|
1088
|
+
rows.forEach((row, ri) => {
|
|
1089
|
+
let x = scaleAt(ri), x0 = zeroX[ri], cardTop = plot.y + ri * band.step, rowY = stacked ? cardTop + cardHeaderH + 3 : band.position(ri), bw = stacked ? cardBandH : band.bandwidth, rowCenter = rowY + bw / 2, owner = { categoryId: row.id }, rowRect = { x: plot.x, y: rowY, w: plot.w, h: bw }, bandNodeIds = [], prev = 0;
|
|
1090
|
+
if (row.bands.forEach((bandSpec, bi) => {
|
|
1091
|
+
let bx0 = x(prev), bx1 = x(bandSpec.to), rect = { x: bx0, y: rowY, w: Math.max(bx1 - bx0, 0.5), h: bw }, nodeId = `band:${row.id}:${bi}`;
|
|
1092
|
+
if (nodes.push({
|
|
1093
|
+
t: "rect",
|
|
1094
|
+
id: nodeId,
|
|
1095
|
+
rect,
|
|
1096
|
+
fill: bandPaint(row, bi),
|
|
1097
|
+
owner,
|
|
1098
|
+
part: "band"
|
|
1099
|
+
}), occupied.claim(rect, "mark", owner), bandNodeIds.push(nodeId), rowMode) {
|
|
1100
|
+
let name = bandSpec.label, nsize = measure(name, noteFont), id = `band-name:${row.id}:${bi}`;
|
|
1101
|
+
columnFonts.set(id, noteFont), columnInks.set(id, { token: "inkMuted" }), labelRequests.push({
|
|
1102
|
+
id,
|
|
1103
|
+
kind: "annotation",
|
|
1104
|
+
role: "note",
|
|
1105
|
+
owner,
|
|
1106
|
+
text: name,
|
|
1107
|
+
lines: [name],
|
|
1108
|
+
font: noteFont,
|
|
1109
|
+
priority: PRIORITY.interior,
|
|
1110
|
+
pad: 0,
|
|
1111
|
+
candidates: [{ slot: "bandName", rect: { x: (bx0 + bx1) / 2 - nsize.width / 2, y: rowY - nsize.height - 2, w: nsize.width, h: nsize.height }, penalty: 0 }]
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
prev = bandSpec.to;
|
|
1115
|
+
}), edgeTicks && row.bands.length > 0) {
|
|
1116
|
+
let edges = [0, ...row.bands.map((bandSpec) => bandSpec.to)].map((value) => {
|
|
1117
|
+
let text = rowFmt(row)(value);
|
|
1118
|
+
return { value, text, x: x(value), w: measure(text, noteFont).width };
|
|
1119
|
+
}), clear = (a, b) => b.x - b.w / 2 >= a.x + a.w / 2 + 4, last = edges.at(-1), kept = [edges[0]];
|
|
1120
|
+
for (let edge of edges.slice(1, -1)) clear(kept.at(-1), edge) && clear(edge, last) && kept.push(edge);
|
|
1121
|
+
clear(kept.at(-1), last) && kept.push(last);
|
|
1122
|
+
let y = rowY + bw;
|
|
1123
|
+
edges.forEach((edge) => nodes.push({
|
|
1124
|
+
t: "line",
|
|
1125
|
+
id: `edgeTick:${row.id}:${edge.value}`,
|
|
1126
|
+
x1: edge.x,
|
|
1127
|
+
y1: y,
|
|
1128
|
+
x2: edge.x,
|
|
1129
|
+
y2: y + EDGE_TICK,
|
|
1130
|
+
stroke: { token: "axis" },
|
|
1131
|
+
width: strokeToken(theme, "hair"),
|
|
1132
|
+
owner,
|
|
1133
|
+
part: "edgeTick"
|
|
1134
|
+
})), kept.forEach((edge) => {
|
|
1135
|
+
let id = `edge:${row.id}:${edge.value}`;
|
|
1136
|
+
columnFonts.set(id, noteFont), columnInks.set(id, { token: "inkMuted" }), labelRequests.push({
|
|
1137
|
+
id,
|
|
1138
|
+
kind: "tick",
|
|
1139
|
+
owner: {},
|
|
1140
|
+
text: edge.text,
|
|
1141
|
+
lines: [edge.text],
|
|
1142
|
+
font: noteFont,
|
|
1143
|
+
priority: PRIORITY.interior,
|
|
1144
|
+
pad: 0,
|
|
1145
|
+
candidates: [{ slot: "edge", rect: { x: edge.x - edge.w / 2, y: y + EDGE_TICK + 1, w: edge.w, h: noteH }, penalty: 0 }]
|
|
1146
|
+
});
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
let barNodeId;
|
|
1150
|
+
if (row.value !== null) {
|
|
1151
|
+
let vx = x(row.value), barH = Math.max(3, bw * BAR_FRACTION), rect = {
|
|
1152
|
+
x: Math.min(x0, vx),
|
|
1153
|
+
y: rowCenter - barH / 2,
|
|
1154
|
+
w: Math.max(Math.abs(vx - x0), 0.5),
|
|
1155
|
+
h: barH
|
|
1156
|
+
};
|
|
1157
|
+
if (barNodeId = `bar:${row.id}`, nodes.push({
|
|
1158
|
+
t: "rect",
|
|
1159
|
+
id: barNodeId,
|
|
1160
|
+
rect,
|
|
1161
|
+
...measureStyle(theme, barPaint(row), row.bands.flatMap((bandSpec, bandIndex) => (bandIndex === 0 ? 0 : row.bands[bandIndex - 1].to) < Math.max(0, row.value) && bandSpec.to > Math.min(0, row.value) || row.value === 0 && bandIndex === 0 ? [bandPaint(row, bandIndex)] : [])),
|
|
1162
|
+
owner,
|
|
1163
|
+
part: "bar",
|
|
1164
|
+
display: { value: rowFmt(row)(row.value) }
|
|
1165
|
+
}), occupied.claim(rect, "mark", owner), anchorByRow.set(row.id, { x: vx, y: rowCenter, value: row.value, date: row.date, label: row.label, owner }), labelOn2("point")) {
|
|
1166
|
+
let text = valueTextOf(row);
|
|
1167
|
+
if (text) {
|
|
1168
|
+
let tsize = measure(text, valueFont), positive = row.value >= 0, targetX = row.target !== null ? x(row.target) : null, bandEndX = row.bands.length > 0 ? x(row.bands[row.bands.length - 1].to) : null;
|
|
1169
|
+
labelRequests.push({
|
|
1170
|
+
id: `point:${row.id}`,
|
|
1171
|
+
kind: "point",
|
|
1172
|
+
owner,
|
|
1173
|
+
text,
|
|
1174
|
+
lines: [text],
|
|
1175
|
+
font: valueFont,
|
|
1176
|
+
priority: row.meta?.priority ?? PRIORITY.endpoint + (highlights.has(row.id) ? PRIORITY.highlightBonus : 0),
|
|
1177
|
+
candidates: stacked ? [{ slot: "cardValue", rect: { x: plot.x + plot.w - Math.max(maxPosW, maxNegW), y: cardTop, w: tsize.width, h: tsize.height }, penalty: 0 }] : [
|
|
1178
|
+
...rowMode ? pastEnd(rect, positive, tsize, targetX, row, x) : [],
|
|
1179
|
+
...endCandidates(rect, positive, tsize, barCss(row), targetX, bandEndX, uniformInside && !rowMode).map((candidate) => ({ ...candidate, penalty: candidate.penalty + (rowMode ? 1 : 0), insidePaint: row.meta?.fill ? { css: row.meta.fill } : { token: highlights.has(row.id) ? "focus" : "markInk" } }))
|
|
1180
|
+
]
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
} else row.target !== null && anchorByRow.set(row.id, { x: x(row.target), y: rowCenter, value: row.target, owner });
|
|
1185
|
+
let targetNodeId;
|
|
1186
|
+
if (row.target !== null) {
|
|
1187
|
+
let tx = x(row.target), targetStroke = strokeToken(theme, "data");
|
|
1188
|
+
if (targetNodeId = `target:${row.id}`, nodes.push({
|
|
1189
|
+
t: "line",
|
|
1190
|
+
id: targetNodeId,
|
|
1191
|
+
x1: tx,
|
|
1192
|
+
y1: rowY + bw * 0.08,
|
|
1193
|
+
x2: tx,
|
|
1194
|
+
y2: rowY + bw * 0.92,
|
|
1195
|
+
stroke: { token: "ink" },
|
|
1196
|
+
width: targetStroke,
|
|
1197
|
+
owner,
|
|
1198
|
+
part: "target",
|
|
1199
|
+
display: { value: rowFmt(row)(row.target) }
|
|
1200
|
+
}), occupied.claim({ x: tx - Math.max(1.5, targetStroke / 2 + 0.5), y: rowY + bw * 0.08, w: Math.max(3, targetStroke + 1), h: bw * 0.84 }, "mark", owner), cols) {
|
|
1201
|
+
let text = cp.colTargets[ri], tsize = measure(text, labelFont), id = `target-value:${row.id}`;
|
|
1202
|
+
columnFonts.set(id, labelFont), columnInks.set(id, { token: "ink" }), labelRequests.push({
|
|
1203
|
+
id,
|
|
1204
|
+
kind: "annotation",
|
|
1205
|
+
owner,
|
|
1206
|
+
text,
|
|
1207
|
+
lines: [text],
|
|
1208
|
+
font: labelFont,
|
|
1209
|
+
role: "value",
|
|
1210
|
+
priority: PRIORITY.interior,
|
|
1211
|
+
pad: 0,
|
|
1212
|
+
candidates: [{ slot: "targetColumn", rect: { x: plot0.x + plot0.w - cp.gapColW - COLUMN_GAP2 - tsize.width, y: rowCenter - cp.colBlockH(ri) / 2, w: tsize.width, h: tsize.height }, penalty: 0 }]
|
|
1213
|
+
});
|
|
1214
|
+
} else if (targetPrints(row)) {
|
|
1215
|
+
let text = `${stacked ? `${targetWord(options)} ` : ""}${rowFmt(row)(row.target)}`, tsize = measure(text, targetFont), seat = (slot, rx, ry, penalty) => ({ slot, rect: { x: rx, y: ry, w: tsize.width, h: tsize.height }, penalty }), above = rowY - tsize.height - 1;
|
|
1216
|
+
labelRequests.push({
|
|
1217
|
+
id: `target-value:${row.id}`,
|
|
1218
|
+
kind: "annotation",
|
|
1219
|
+
owner,
|
|
1220
|
+
text,
|
|
1221
|
+
lines: [text],
|
|
1222
|
+
font: targetFont,
|
|
1223
|
+
role: "value",
|
|
1224
|
+
priority: PRIORITY.interior,
|
|
1225
|
+
pad: 0,
|
|
1226
|
+
// An attainment wash fills the whole row pitch: a seat on it is not taken.
|
|
1227
|
+
candidates: stacked ? [seat("cardTarget", plot.x, rowY + bw + 3, 0)] : [
|
|
1228
|
+
seat("aboveTick", tx - tsize.width / 2, above, 0),
|
|
1229
|
+
seat("aboveTickEnd", tx - tsize.width, above, 1),
|
|
1230
|
+
seat("aboveTickStart", tx, above, 1)
|
|
1231
|
+
].filter((candidate) => !washes.some((wash) => rectsOverlap(wash, candidate.rect)))
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
let capsuleText = cols ? cp.colGaps[ri] ?? void 0 : capsuleTexts.get(row.id);
|
|
1236
|
+
if (capsuleText !== void 0 && cols) {
|
|
1237
|
+
let tsize = measure(capsuleText, valueBaseFont), top = rowCenter - cp.colBlockH(ri) / 2, right = plot0.x + plot0.w;
|
|
1238
|
+
columnFonts.set(`delta:${row.id}`, valueBaseFont), labelRequests.push({
|
|
1239
|
+
id: `delta:${row.id}`,
|
|
1240
|
+
kind: "annotation",
|
|
1241
|
+
role: composedTextRole(capsuleText, "note"),
|
|
1242
|
+
owner,
|
|
1243
|
+
text: capsuleText,
|
|
1244
|
+
lines: [capsuleText],
|
|
1245
|
+
font: valueBaseFont,
|
|
1246
|
+
priority: PRIORITY.extreme,
|
|
1247
|
+
candidates: [{ slot: "gapColumn", rect: { x: right - tsize.width, y: top, w: tsize.width, h: tsize.height }, penalty: 0 }]
|
|
1248
|
+
});
|
|
1249
|
+
let position = cp.colPositions[ri];
|
|
1250
|
+
if (position) {
|
|
1251
|
+
let psize = measure(position, cp.noteFont), id = `gap-position:${row.id}`;
|
|
1252
|
+
columnFonts.set(id, cp.noteFont), columnInks.set(id, { token: "inkMuted" }), labelRequests.push({
|
|
1253
|
+
id,
|
|
1254
|
+
kind: "annotation",
|
|
1255
|
+
role: "note",
|
|
1256
|
+
owner,
|
|
1257
|
+
text: position,
|
|
1258
|
+
lines: [position],
|
|
1259
|
+
font: cp.noteFont,
|
|
1260
|
+
priority: PRIORITY.interior,
|
|
1261
|
+
pad: 0,
|
|
1262
|
+
candidates: [{ slot: "gapColumn", rect: { x: right - psize.width, y: top + tsize.height + LINE_GAP2, w: psize.width, h: psize.height }, penalty: 0 }]
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
if (capsuleText !== void 0) {
|
|
1267
|
+
let d = deltaVsTarget[row.id], tone = deltaTone(row, d), tsize = measure(capsuleText, capsuleFont), labelId = `delta:${row.id}`;
|
|
1268
|
+
capsuleLabelIds.set(labelId, tone), cols || labelRequests.push({
|
|
1269
|
+
id: labelId,
|
|
1270
|
+
kind: "annotation",
|
|
1271
|
+
role: composedTextRole(capsuleText, "note"),
|
|
1272
|
+
owner,
|
|
1273
|
+
text: capsuleText,
|
|
1274
|
+
lines: [capsuleText],
|
|
1275
|
+
font: capsuleFont,
|
|
1276
|
+
priority: PRIORITY.extreme,
|
|
1277
|
+
candidates: [
|
|
1278
|
+
{
|
|
1279
|
+
slot: "rowEnd",
|
|
1280
|
+
rect: {
|
|
1281
|
+
x: capsuleX,
|
|
1282
|
+
y: stacked ? rowY + bw + 3 : rowCenter - tsize.height / 2,
|
|
1283
|
+
w: tsize.width,
|
|
1284
|
+
h: tsize.height
|
|
1285
|
+
},
|
|
1286
|
+
penalty: 0
|
|
1287
|
+
}
|
|
1288
|
+
]
|
|
1289
|
+
}), placedAnnotations.push({
|
|
1290
|
+
id: `delta-target:${row.id}`,
|
|
1291
|
+
kind: "delta",
|
|
1292
|
+
computedText: capsuleText,
|
|
1293
|
+
tone,
|
|
1294
|
+
nodeIds: [],
|
|
1295
|
+
labelId,
|
|
1296
|
+
// '+7 vs target' is a subtraction, and both of its operands are right
|
|
1297
|
+
// here, so the derivation lists them as inputs: a receipt for the one
|
|
1298
|
+
// number on a bullet row a reader cannot get any other way.
|
|
1299
|
+
derivation: {
|
|
1300
|
+
basis: "derived",
|
|
1301
|
+
op: "annotation-delta@1",
|
|
1302
|
+
inputs: [
|
|
1303
|
+
{ ref: `${row.id}:value`, value: row.value },
|
|
1304
|
+
{ ref: `${row.id}:target`, value: row.target }
|
|
1305
|
+
],
|
|
1306
|
+
raw: d
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
if (labelOn2("category")) {
|
|
1311
|
+
let cl = catLines[ri];
|
|
1312
|
+
labelRequests.push({
|
|
1313
|
+
id: `category:${row.id}`,
|
|
1314
|
+
kind: "category",
|
|
1315
|
+
owner,
|
|
1316
|
+
text: row.label,
|
|
1317
|
+
...fittedLabel(cl, catFont),
|
|
1318
|
+
font: catFont,
|
|
1319
|
+
priority: PRIORITY.endpoint + (highlights.has(row.id) ? PRIORITY.highlightBonus : 0),
|
|
1320
|
+
candidates: [
|
|
1321
|
+
{
|
|
1322
|
+
slot: "left",
|
|
1323
|
+
rect: {
|
|
1324
|
+
x: stacked ? plot.x : rowLabelX(plot0.x, cols ? cp.colLeftW : catBandW, cl.w, options.rowLabels?.align ?? "left"),
|
|
1325
|
+
y: stacked ? cardTop : cols ? rowCenter - cp.colBlockH(ri) / 2 : rowCenter - cl.h / 2,
|
|
1326
|
+
w: cl.w,
|
|
1327
|
+
h: cl.h
|
|
1328
|
+
},
|
|
1329
|
+
penalty: 0
|
|
1330
|
+
}
|
|
1331
|
+
]
|
|
1332
|
+
});
|
|
1333
|
+
let direction = cols ? cp.colDirections[ri] : null;
|
|
1334
|
+
if (direction) {
|
|
1335
|
+
let dsize = measure(direction, cp.noteFont), id = `direction:${row.id}`;
|
|
1336
|
+
columnFonts.set(id, cp.noteFont), columnInks.set(id, { token: "inkMuted" }), labelRequests.push({
|
|
1337
|
+
id,
|
|
1338
|
+
kind: "annotation",
|
|
1339
|
+
role: "note",
|
|
1340
|
+
owner,
|
|
1341
|
+
text: direction,
|
|
1342
|
+
lines: [direction],
|
|
1343
|
+
font: cp.noteFont,
|
|
1344
|
+
priority: PRIORITY.interior,
|
|
1345
|
+
pad: 0,
|
|
1346
|
+
candidates: [{ slot: "left", rect: { x: rowLabelX(plot0.x, cp.colLeftW, dsize.width, options.rowLabels?.align ?? "left"), y: rowCenter - cp.colBlockH(ri) / 2 + cl.h + LINE_GAP2, w: dsize.width, h: dsize.height }, penalty: 0 }]
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
marks.rows.push({ id: row.id, bandNodeIds, barNodeId, targetNodeId, rect: rowRect });
|
|
1351
|
+
});
|
|
1352
|
+
let solveCtx = labelCtx(theme, size, options, {
|
|
1353
|
+
measure,
|
|
1354
|
+
plot,
|
|
1355
|
+
labelPad: capsuleTexts.size > 0 ? capsuleLabelPad : 2
|
|
1356
|
+
}), solved = solveLabels(labelRequests, occupied, solveCtx);
|
|
1357
|
+
applyValueAxisTitleInk(solved.placed), pushAll(warnings, solved.warnings);
|
|
1358
|
+
let hiddenCapsules = solved.placed.filter((label) => label.id.startsWith("delta:") && label.hidden);
|
|
1359
|
+
if (hiddenCapsules.length > 0 && warnings.push({
|
|
1360
|
+
code: "bullet-delta-overflow",
|
|
1361
|
+
severity: "warn",
|
|
1362
|
+
message: `${hiddenCapsules.length} target delta label${hiddenCapsules.length === 1 ? "" : "s"} cannot fit at this canvas size`,
|
|
1363
|
+
suggest: "increase chart height or suppress delta annotations explicitly"
|
|
1364
|
+
}), rowMode && solved.placed.some((label) => label.hidden)) return layoutBullet(data, { ...options, [ROW_KEY_OFF]: !0 });
|
|
1365
|
+
if (cols && solved.placed.some((label) => label.hidden)) return layoutBullet(data, { ...options, targetColumns: !1 });
|
|
1366
|
+
let hiddenTargets = solved.placed.filter((label) => label.id.startsWith("target-value:") && label.hidden);
|
|
1367
|
+
hiddenTargets.length > 0 && warnings.push({
|
|
1368
|
+
code: "bullet-target-overflow",
|
|
1369
|
+
severity: "warn",
|
|
1370
|
+
message: `${hiddenTargets.length} target value${hiddenTargets.length === 1 ? "" : "s"} cannot print by ${hiddenTargets.length === 1 ? "its tick" : "their ticks"} at this canvas size`,
|
|
1371
|
+
suggest: `give each row ${naturalRowH}px (increase chart height) or turn annotation labels off`
|
|
1372
|
+
});
|
|
1373
|
+
for (let label of solved.placed) {
|
|
1374
|
+
label.slot === "pastEnd" && (label.halo = !0);
|
|
1375
|
+
let tone = capsuleLabelIds.get(label.id);
|
|
1376
|
+
tone && (label.ink = { token: tone === "neutral" ? "ink" : tone });
|
|
1377
|
+
let ink = columnInks.get(label.id);
|
|
1378
|
+
ink && (label.ink = ink);
|
|
1379
|
+
}
|
|
1380
|
+
let zeroXById = new Map(rows.map((row, ri) => [row.id, zeroX[ri]])), annResult = runAnnotatePass({
|
|
1381
|
+
annotations,
|
|
1382
|
+
valueAxis: "horizontal",
|
|
1383
|
+
resolve: (ref) => resolveBulletAnchor(ref, anchorByRow, zeroXById),
|
|
1384
|
+
defaultSpan: rows.length >= 2 ? { from: rows[0].id, to: rows[rows.length - 1].id } : void 0,
|
|
1385
|
+
occupied,
|
|
1386
|
+
plot: cagrColW ? { ...plot, w: plot0.x + plot0.w - plot.x } : plot,
|
|
1387
|
+
bandCeiling: plot0.y,
|
|
1388
|
+
theme,
|
|
1389
|
+
measure,
|
|
1390
|
+
format: options.format,
|
|
1391
|
+
locale: options.locale?.language,
|
|
1392
|
+
strings: options.strings,
|
|
1393
|
+
valueLinePercentLevels: options.unit === "%" || rows.some((row) => row.value !== null) && rows.every((row) => row.value === null || row.isPct),
|
|
1394
|
+
solveCtx,
|
|
1395
|
+
...axisScale ? { xScale: axisScale } : {},
|
|
1396
|
+
...categoryTargetFields(rows.map((row) => row.id), plot, (i) => band.position(i) + band.bandwidth / 2, "y")
|
|
1397
|
+
}), bandTries = options[BAND_TRIES] ?? 0;
|
|
1398
|
+
if (annResult.bandNeed > 0 && bandTries < 2)
|
|
1399
|
+
return layoutBullet(data, {
|
|
1400
|
+
...options,
|
|
1401
|
+
[BAND_PAD]: rawBandPad + Math.ceil(annResult.bandNeed),
|
|
1402
|
+
[BAND_TRIES]: bandTries + 1
|
|
1403
|
+
});
|
|
1404
|
+
pushAll(warnings, annResult.warnings);
|
|
1405
|
+
let allLabels = [...solved.placed, ...annResult.labels];
|
|
1406
|
+
if (!compact) {
|
|
1407
|
+
let ruleNodes = [], contentBottom = (ri) => stacked ? plot.y + ri * band.step + cardHeaderH + 3 + cardBandH + (cardFooterH > 0 ? 3 + cardFooterH : 0) : band.position(ri) + band.bandwidth + tickAir, rowTop = (ri) => stacked ? plot.y + ri * band.step : band.position(ri) - nameAir;
|
|
1408
|
+
for (let ri = 0; ri + 1 < rows.length; ri++) {
|
|
1409
|
+
let top = contentBottom(ri), bottom = rowTop(ri + 1);
|
|
1410
|
+
if (bottom - top < 2) continue;
|
|
1411
|
+
let y = (top + bottom) / 2;
|
|
1412
|
+
if (annResult.nodes.some((node) => node.t === "line" && Math.abs(node.y1 - node.y2) < 0.5 && Math.abs(node.y1 - y) < 4)) continue;
|
|
1413
|
+
let cuts = allLabels.filter((label) => !label.hidden && label.rect.y - 1 <= y && y <= label.rect.y + label.rect.h + 1).map((label) => [label.rect.x - REFERENCE_LABEL_CLEARANCE, label.rect.x + label.rect.w + REFERENCE_LABEL_CLEARANCE]).sort((a, b) => a[0] - b[0]), from = plot0.x, end = plot0.x + plot0.w, pieces = [];
|
|
1414
|
+
for (let [cutFrom, cutTo] of cuts)
|
|
1415
|
+
cutFrom > from && pieces.push([from, Math.min(cutFrom, end)]), from = Math.max(from, cutTo);
|
|
1416
|
+
from < end && pieces.push([from, end]), pieces.filter(([a, b]) => b - a >= 2).forEach(([a, b], pi) => ruleNodes.push({
|
|
1417
|
+
t: "line",
|
|
1418
|
+
id: `rowRule:${rows[ri + 1].id}${pi ? `:${pi}` : ""}`,
|
|
1419
|
+
x1: a,
|
|
1420
|
+
y1: y,
|
|
1421
|
+
x2: b,
|
|
1422
|
+
y2: y,
|
|
1423
|
+
stroke: { token: "grid" },
|
|
1424
|
+
width: strokeToken(theme, "hair"),
|
|
1425
|
+
owner: {},
|
|
1426
|
+
part: "rowRule"
|
|
1427
|
+
}));
|
|
1428
|
+
}
|
|
1429
|
+
nodes.splice(frameResult.nodes.length, 0, ...ruleNodes);
|
|
1430
|
+
}
|
|
1431
|
+
spliceAnnotationNodes(nodes, annResult.nodes);
|
|
1432
|
+
for (let label of allLabels) {
|
|
1433
|
+
if (label.hidden || label.kind !== "point" || label.slot.startsWith("inside")) continue;
|
|
1434
|
+
let wash = annResult.nodes.find((node) => node.t === "rect" && node.part === "attainment" && rectsOverlap(node.rect, label.rect));
|
|
1435
|
+
wash?.t === "rect" && (rectContains(wash.rect, label.rect) ? label.ink = contrastInkPaint(wash.fill) : (label.halo = !0, label.ink = { token: "ink" }));
|
|
1436
|
+
}
|
|
1437
|
+
let labelNodes = labelsToNodes(
|
|
1438
|
+
theme,
|
|
1439
|
+
allLabels,
|
|
1440
|
+
(l) => columnFonts.get(l.id) ?? (l.kind === "category" ? catFont : l.id.startsWith("delta:") ? capsuleFont : l.kind === "point" ? valueFont : l.id.startsWith("target-value:") ? targetFont : labelFont)
|
|
1441
|
+
);
|
|
1442
|
+
asColumnHeads(labelNodes), pushAll(nodes, labelNodes);
|
|
1443
|
+
let a11yRows = rows.map((row) => {
|
|
1444
|
+
let f = rowFmt(row), v = row.value !== null ? f(row.value) : "n/a", t = row.target !== null ? ` vs ${targetWord(options)} ${f(row.target)}` + (deltaVsTarget[row.id] !== void 0 ? ` (${deltaText(row, deltaVsTarget[row.id])}, ${chartString(options, { good: "toneGood", bad: "toneBad", warn: "toneWarn", neutral: "toneNeutral" }[deltaTone(row, deltaVsTarget[row.id])])})` : "") : "";
|
|
1445
|
+
return `${row.label} ${v}${t}`;
|
|
1446
|
+
}).join("; "), a11yDesc = chartString(options, "bulletDescStart", { v1: rows.length }) + chartString(options, "bulletTargetTick", { v1: targetWord(options) }) + (anyBands ? chartString(options, "bulletShadingDesc") : "") + (sharedScale || rows.length < 2 ? "" : chartString(options, "bulletSeparateScale")) + ` ${a11yRows}.`;
|
|
1447
|
+
return {
|
|
1448
|
+
type: "bullet",
|
|
1449
|
+
...paintWarningRules.length ? { paintWarningRules } : {},
|
|
1450
|
+
size,
|
|
1451
|
+
sizing: rowSizing("bullet", size, {
|
|
1452
|
+
chromeH: size.height - availH,
|
|
1453
|
+
minimumRowsH: rows.length * Math.min(
|
|
1454
|
+
Math.max(stacked ? cardPitch : minimumPitch, maxOf(catLines.map((label) => label.h))),
|
|
1455
|
+
stacked && plot0.w - fitted.width - CAT_BAND_GAP - capsuleColW - CAPSULE_GAP - cagrColW >= 80 ? Math.max(minimumPitch, maxOf(fitted.labels.map((label) => label.h))) : 1 / 0
|
|
1456
|
+
),
|
|
1457
|
+
naturalRowsH: rows.length * naturalRowH,
|
|
1458
|
+
// The compact mark prints no value, so the value's width sets no floor there.
|
|
1459
|
+
// Stacked cards measure their name/value row and keep at least 160 px of mark width.
|
|
1460
|
+
// The unlabelled density:'compact' mark retains its separate 120 px contract.
|
|
1461
|
+
// The type floor moved to 320 for the percent-of-target rows (core.ts); these layouts keep 480.
|
|
1462
|
+
// The columns give way below their fit, so the side-by-side rows set the floor.
|
|
1463
|
+
minWidth: compact ? 0 : Math.max(0, stacked ? size.width - plot.w + Math.max(160, catBandW + Math.max(maxPosW, maxNegW) + CAT_BAND_GAP) : size.width - sidePlotW + Math.max(80, maxOf(rows.map((row) => {
|
|
1464
|
+
let text = labelOn2("point") ? valueTextOf(row) : void 0;
|
|
1465
|
+
return text ? measure(text, valueFont).width + 2 * LABEL_GAP : 0;
|
|
1466
|
+
}))))
|
|
1467
|
+
}),
|
|
1468
|
+
plot,
|
|
1469
|
+
scene: nodes,
|
|
1470
|
+
labels: allLabels,
|
|
1471
|
+
axes: [
|
|
1472
|
+
{
|
|
1473
|
+
axis: "y",
|
|
1474
|
+
...baselineId ? { baselineNodeId: baselineId } : {},
|
|
1475
|
+
ticks: rows.map((row, i) => ({
|
|
1476
|
+
at: row.id,
|
|
1477
|
+
pos: band.center(i),
|
|
1478
|
+
labelId: labelOn2("category") ? `category:${row.id}` : void 0
|
|
1479
|
+
}))
|
|
1480
|
+
},
|
|
1481
|
+
...axes
|
|
1482
|
+
],
|
|
1483
|
+
annotations: [...placedAnnotations, ...annResult.placed],
|
|
1484
|
+
legend: frameResult.legend,
|
|
1485
|
+
frame: frameResult.frame,
|
|
1486
|
+
marks,
|
|
1487
|
+
derived: { deltaVsTarget },
|
|
1488
|
+
a11y: {
|
|
1489
|
+
titleCounts: [structureCount("rows", rows.length, chartString(options, "kpisCount", { v1: rows.length }))],
|
|
1490
|
+
title: accessibleTitle(options.title, chartString(options, "bulletTitle", { v1: rows.length, v2: targetWord(options) })),
|
|
1491
|
+
counts: [structureCount("rows", rows.length, chartString(options, "kpiRowsCount", { v1: rows.length }))],
|
|
1492
|
+
desc: a11yDesc
|
|
1493
|
+
},
|
|
1494
|
+
warnings,
|
|
1495
|
+
debug: {
|
|
1496
|
+
occupied: occupied.snapshot(),
|
|
1497
|
+
decisions: [...solved.decisions, ...annResult.decisions]
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1500
|
+
function pastEnd(rect, positive, tsize, targetX, row, scale) {
|
|
1501
|
+
let x = positive ? rect.x + rect.w + LABEL_GAP : rect.x - LABEL_GAP - tsize.width, clearOfTick = targetX === null || targetX < x - REFERENCE_LABEL_CLEARANCE || targetX > x + tsize.width + REFERENCE_LABEL_CLEARANCE, inPlot = x >= plot.x && x + tsize.width <= plot.x + plot.w, inkCss = paintColor(theme, { token: theme.labels?.ink === "muted" ? "inkMuted" : "ink" }), readable = row.bands.every((bandSpec, bi) => {
|
|
1502
|
+
let from = scale(bi === 0 ? 0 : row.bands[bi - 1].to);
|
|
1503
|
+
return !(scale(bandSpec.to) > x && from < x + tsize.width) || contrastRatio(inkCss, paintColor(theme, bandPaint(row, bi))) >= TEXT_CONTRAST_FLOOR;
|
|
1504
|
+
});
|
|
1505
|
+
return clearOfTick && inPlot && readable ? [{ slot: "pastEnd", rect: { x, y: rect.y + rect.h / 2 - tsize.height / 2, w: tsize.width, h: tsize.height }, penalty: 0 }] : [];
|
|
1506
|
+
}
|
|
1507
|
+
function endCandidates(rect, positive, tsize, fillCss, targetX, bandEndX, allowInside) {
|
|
1508
|
+
let cy = rect.y + rect.h / 2, pad = 6, fits = tsize.width + 2 * pad <= rect.w && tsize.height <= rect.h + 4, insideX = positive ? rect.x + rect.w - pad - tsize.width : rect.x + pad, tickOnInside = targetX !== null && targetX >= insideX - REFERENCE_LABEL_CLEARANCE && targetX <= insideX + tsize.width + REFERENCE_LABEL_CLEARANCE, inside = {
|
|
1509
|
+
slot: "insideEnd",
|
|
1510
|
+
rect: {
|
|
1511
|
+
x: insideX,
|
|
1512
|
+
y: cy - tsize.height / 2,
|
|
1513
|
+
w: tsize.width,
|
|
1514
|
+
h: tsize.height
|
|
1515
|
+
},
|
|
1516
|
+
penalty: 0,
|
|
1517
|
+
insideFill: fillCss
|
|
1518
|
+
}, outside = {
|
|
1519
|
+
slot: "outsideEnd",
|
|
1520
|
+
rect: { x: positive ? Math.max(rect.x + rect.w, bandEndX ?? rect.x + rect.w, targetX ?? rect.x + rect.w) + pad : Math.min(rect.x, targetX ?? rect.x) - pad - tsize.width, y: cy - tsize.height / 2, w: tsize.width, h: tsize.height },
|
|
1521
|
+
penalty: 1
|
|
1522
|
+
};
|
|
1523
|
+
return fits && !tickOnInside && allowInside ? [inside, outside] : [outside];
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
function layoutBulletOnTargetScale(data, options, ctx) {
|
|
1527
|
+
let { rows, theme, size, measure, occupied, warnings, rowFmt } = ctx;
|
|
1528
|
+
rows.some((row) => row.bands.length > 0) && warnings.push({
|
|
1529
|
+
code: "bullet-bands-target-scale",
|
|
1530
|
+
severity: "info",
|
|
1531
|
+
message: "the percent-of-target scale draws its three shared bands; the rows' own bands were not drawn"
|
|
1532
|
+
}), (options.valueAxis?.show || options.valueAxis?.min !== void 0 || options.valueAxis?.max !== void 0) && warnings.push({
|
|
1533
|
+
code: "value-axis-target-scale",
|
|
1534
|
+
severity: "warn",
|
|
1535
|
+
message: "valueAxis is ignored on the percent-of-target scale, which draws its own axis from 0 to 120%"
|
|
1536
|
+
}), (options.annotations ?? []).length > 0 && warnings.push({
|
|
1537
|
+
code: "bullet-annotations-target-scale",
|
|
1538
|
+
severity: "warn",
|
|
1539
|
+
message: "annotations name value units and are not drawn on the percent-of-target scale"
|
|
1540
|
+
});
|
|
1541
|
+
let legend = options.density === "compact" || options.legend === "none" ? void 0 : { options: normalizeLegendOption(options.legend, { position: "top" }), items: targetBandLegendItems(rows.map((row) => row.direction), targetWord(options), options) }, frame = solveFrame(
|
|
1542
|
+
{ size, margin: ctx.margin, cardGaps: !0, ...frameTextOptions(options), legend, theme: cardFrameTheme(theme, options, size.width), measure },
|
|
1543
|
+
occupied
|
|
1544
|
+
), valueText = (row) => {
|
|
1545
|
+
if (row.value === null || row.meta?.label === !1) return null;
|
|
1546
|
+
let base = rowFmt(row)(row.value);
|
|
1547
|
+
return typeof row.meta?.label == "string" ? row.meta.label.replace(/\$\{value\}/g, base) : base;
|
|
1548
|
+
}, targetParts = (row) => [
|
|
1549
|
+
row.target === null ? `no ${targetWord(options)}` : `${targetWord(options)} ${rowFmt(row)(row.target)}`,
|
|
1550
|
+
...row.direction === "lowerIsBetter" ? [chartString(options, "lowerBetterHint")] : []
|
|
1551
|
+
];
|
|
1552
|
+
return layoutTargetScale({
|
|
1553
|
+
rows,
|
|
1554
|
+
options,
|
|
1555
|
+
theme,
|
|
1556
|
+
size,
|
|
1557
|
+
measure,
|
|
1558
|
+
frame,
|
|
1559
|
+
occupied,
|
|
1560
|
+
warnings,
|
|
1561
|
+
highlights: ctx.highlights,
|
|
1562
|
+
labelOn: ctx.labelOn,
|
|
1563
|
+
valueText,
|
|
1564
|
+
targetText: (row) => targetParts(row).join(""),
|
|
1565
|
+
targetParts,
|
|
1566
|
+
deltaText: (row, d) => ctx.deltaText(row, d),
|
|
1567
|
+
deltaBody: (row, d) => ctx.deltaBody(row, d),
|
|
1568
|
+
deltaTone: (row, d) => ctx.deltaTone(row, d),
|
|
1569
|
+
deltaVsTarget: ctx.deltaVsTarget,
|
|
1570
|
+
grow: (chromeH, rowsH) => {
|
|
1571
|
+
let height = rowDrivenHeight({ options, width: size.width, height: size.height, chromeH, rowsH });
|
|
1572
|
+
return height === void 0 ? void 0 : layoutBullet(data, { ...options, size: { width: size.width, height } });
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
// src/core/charts/bullet/core.ts
|
|
1578
|
+
var bulletCore = {
|
|
1579
|
+
type: "bullet",
|
|
1580
|
+
// The percent-of-target rows stack down to a 320 px card; the other bullet
|
|
1581
|
+
// layouts report their own 480 px floor (layout.ts).
|
|
1582
|
+
sizing: { ...chartSizing("bullet"), minWidth: CARD_MIN_WIDTH },
|
|
1583
|
+
title: "Bullet (KPI rows)",
|
|
1584
|
+
summary: "Bullet-graph KPI rows \u2014 qualitative bands, dark measure bar, target tick, delta vs target",
|
|
1585
|
+
layout: layoutBullet,
|
|
1586
|
+
defaults: {},
|
|
1587
|
+
annotationKinds: ["callout", "note", "delta", "abs", "diff", "cagr", "valueLine", "band"]
|
|
1588
|
+
};
|
|
1589
|
+
|
|
1590
|
+
export {
|
|
1591
|
+
bulletCore
|
|
1592
|
+
};
|