boardplot 0.0.0-stage → 0.52.5
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 +18 -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-VUNSFKZY.js +137 -0
- package/dist/annotateEngine-H7OW4H3W.js +30 -0
- package/dist/build-identity.json +6 -0
- package/dist/chunk-24WB3HMB.js +621 -0
- package/dist/chunk-263SZKIL.js +8 -0
- package/dist/chunk-27QQEWNV.js +18 -0
- package/dist/chunk-2AKWCMS4.js +24 -0
- package/dist/chunk-2DHJJ2EN.js +24 -0
- package/dist/chunk-2EQE4E3I.js +22 -0
- package/dist/chunk-2GELJH37.js +88 -0
- package/dist/chunk-2JAWQ7VV.js +3874 -0
- package/dist/chunk-2LMCD3ZR.js +6 -0
- package/dist/chunk-2MTWKMEG.js +841 -0
- package/dist/chunk-2SGIHKKU.js +33 -0
- package/dist/chunk-2UVTHU7A.js +1146 -0
- package/dist/chunk-33CBPK5Q.js +2800 -0
- package/dist/chunk-33PLBIMA.js +176 -0
- package/dist/chunk-35DZP2R2.js +22 -0
- package/dist/chunk-3D3D3D23.js +25 -0
- package/dist/chunk-3EZRM4YM.js +92 -0
- package/dist/chunk-3GZECHOK.js +802 -0
- package/dist/chunk-3HHNQPAH.js +68 -0
- package/dist/chunk-3I6RANBJ.js +1058 -0
- package/dist/chunk-3SIRPKMP.js +12 -0
- package/dist/chunk-3W23F7EY.js +185 -0
- package/dist/chunk-3XQ635KD.js +24 -0
- package/dist/chunk-3ZCKEANJ.js +24 -0
- package/dist/chunk-4DNOEV3Q.js +25857 -0
- package/dist/chunk-4GB7TBY7.js +373 -0
- package/dist/chunk-4SM2ONUC.js +18 -0
- package/dist/chunk-5C7TWNYZ.js +79 -0
- package/dist/chunk-5DJXJXDE.js +58 -0
- package/dist/chunk-5ENRZX6I.js +687 -0
- package/dist/chunk-5KWXRYAT.js +294 -0
- package/dist/chunk-5T5YW52S.js +47 -0
- package/dist/chunk-627P6T25.js +936 -0
- package/dist/chunk-62FR4FYJ.js +23 -0
- package/dist/chunk-6JUJ2DU3.js +67 -0
- package/dist/chunk-6KWIQ5KF.js +18 -0
- package/dist/chunk-6UBEGKIQ.js +25 -0
- package/dist/chunk-6XE3GVGU.js +116 -0
- package/dist/chunk-76ANFJOI.js +227 -0
- package/dist/chunk-7IFLQMJL.js +160 -0
- package/dist/chunk-7JVAQX6C.js +28 -0
- package/dist/chunk-7QDAHY5M.js +63 -0
- package/dist/chunk-7VXZDB45.js +149 -0
- package/dist/chunk-7X65ZQN4.js +38 -0
- package/dist/chunk-A2FHZH7E.js +1410 -0
- package/dist/chunk-A372DLQX.js +54 -0
- package/dist/chunk-A3ULWR5N.js +76 -0
- package/dist/chunk-A4QZXLXF.js +7 -0
- package/dist/chunk-A5JWFZVU.js +1467 -0
- package/dist/chunk-A5LZUYK4.js +59 -0
- package/dist/chunk-A6XCAQ52.js +89 -0
- package/dist/chunk-A7A4PDG5.js +24 -0
- package/dist/chunk-A7IEVBYI.js +35 -0
- package/dist/chunk-ACXX2JNL.js +6 -0
- package/dist/chunk-AFK47A6O.js +25 -0
- package/dist/chunk-ALKTNXMR.js +3650 -0
- package/dist/chunk-AOQ6VF5H.js +6 -0
- package/dist/chunk-ASAON7G4.js +648 -0
- package/dist/chunk-ATTE3FYC.js +24 -0
- package/dist/chunk-AZOUSKZD.js +728 -0
- package/dist/chunk-B2EBEXIS.js +113 -0
- package/dist/chunk-B67K5X4M.js +58 -0
- package/dist/chunk-BBL3R5YZ.js +186 -0
- package/dist/chunk-BIDIGDGH.js +6 -0
- package/dist/chunk-BKYMLFUG.js +69 -0
- package/dist/chunk-BLFWUMTD.js +12 -0
- package/dist/chunk-BM6SFFWF.js +6 -0
- package/dist/chunk-BUPLB3EX.js +129 -0
- package/dist/chunk-BVWU6GOB.js +47 -0
- package/dist/chunk-BW5VLBSZ.js +15 -0
- package/dist/chunk-C64FBRJO.js +290 -0
- package/dist/chunk-CAE2HK2G.js +295 -0
- package/dist/chunk-CCQNL33L.js +446 -0
- package/dist/chunk-CDZHNLO6.js +42 -0
- package/dist/chunk-COKHNEJP.js +24 -0
- package/dist/chunk-COYPDRJK.js +21 -0
- package/dist/chunk-CRZKGHZ6.js +1810 -0
- package/dist/chunk-CS4DHFNG.js +128 -0
- package/dist/chunk-CYDZP5W6.js +1589 -0
- package/dist/chunk-D4BIV6WG.js +1072 -0
- package/dist/chunk-D4SOADBD.js +19 -0
- package/dist/chunk-DCCJRLAJ.js +422 -0
- package/dist/chunk-DFKTS6XJ.js +75 -0
- package/dist/chunk-DGDOGOTQ.js +25 -0
- package/dist/chunk-DLC23CKC.js +53 -0
- package/dist/chunk-DRTA6JG5.js +160 -0
- package/dist/chunk-DVKBU23L.js +97 -0
- package/dist/chunk-E2HEVF23.js +692 -0
- package/dist/chunk-EC2NAYPQ.js +24 -0
- package/dist/chunk-EKQK5D6G.js +14 -0
- package/dist/chunk-EKQMYG2B.js +2353 -0
- package/dist/chunk-ELYU6TRQ.js +98 -0
- package/dist/chunk-EQT3EPTB.js +203 -0
- package/dist/chunk-ERAIVAK5.js +1359 -0
- package/dist/chunk-ETHWK2RZ.js +16 -0
- package/dist/chunk-EWVKBRLV.js +72 -0
- package/dist/chunk-F77BNDAT.js +43 -0
- package/dist/chunk-FGAGGPFF.js +566 -0
- package/dist/chunk-FIANWJXX.js +19 -0
- package/dist/chunk-FIWNDOMO.js +6 -0
- package/dist/chunk-FOKEGVPB.js +24 -0
- package/dist/chunk-FT3F72C3.js +30 -0
- package/dist/chunk-FT47HQ5U.js +47 -0
- package/dist/chunk-GDOW2KNP.js +19 -0
- package/dist/chunk-GDQ3NGDZ.js +17 -0
- package/dist/chunk-GH3ZMBFX.js +563 -0
- package/dist/chunk-GQPESFAF.js +3378 -0
- package/dist/chunk-GQS46LC3.js +50 -0
- package/dist/chunk-GULJ6KVT.js +587 -0
- package/dist/chunk-GWQIXU37.js +2774 -0
- package/dist/chunk-GZ2VNM4L.js +24 -0
- package/dist/chunk-GZ4RHGIW.js +836 -0
- package/dist/chunk-H4H4O62O.js +46 -0
- package/dist/chunk-H57TJD3B.js +72 -0
- package/dist/chunk-H7UZZ7KP.js +24 -0
- package/dist/chunk-HAAUJDGB.js +83 -0
- package/dist/chunk-HFG76JTS.js +296 -0
- package/dist/chunk-HJXXFPOL.js +211 -0
- package/dist/chunk-HTYFQHRC.js +24 -0
- package/dist/chunk-HUF6TQ2J.js +24 -0
- package/dist/chunk-HUFCSX2Y.js +89 -0
- package/dist/chunk-HX3MQ3H4.js +26 -0
- package/dist/chunk-HZQEQ34U.js +296 -0
- package/dist/chunk-I322G5UG.js +888 -0
- package/dist/chunk-IDDA5INB.js +60 -0
- package/dist/chunk-IDTLHPTK.js +60 -0
- package/dist/chunk-II7652VA.js +2918 -0
- package/dist/chunk-IN4QT33I.js +38 -0
- package/dist/chunk-IV2UXZXX.js +16 -0
- package/dist/chunk-IXSZ7OKR.js +133 -0
- package/dist/chunk-IYEFEBRN.js +41 -0
- package/dist/chunk-IZ35GMGB.js +2543 -0
- package/dist/chunk-IZCOG3FS.js +28 -0
- package/dist/chunk-JA755JHN.js +379 -0
- package/dist/chunk-JETXFF3M.js +33 -0
- package/dist/chunk-JFBEAUJ6.js +24 -0
- package/dist/chunk-JFG4DHKQ.js +48 -0
- package/dist/chunk-JL5BRMDT.js +179 -0
- package/dist/chunk-JLCAWQ3H.js +195 -0
- package/dist/chunk-JLZM7XMZ.js +525 -0
- package/dist/chunk-JMH5MD5A.js +19 -0
- package/dist/chunk-JRPI64AQ.js +3066 -0
- package/dist/chunk-JSX3C6LL.js +344 -0
- package/dist/chunk-JY4R3GML.js +83 -0
- package/dist/chunk-JYBT2JNY.js +61 -0
- package/dist/chunk-K2HNV4LE.js +2008 -0
- package/dist/chunk-KAXJFL7N.js +43 -0
- package/dist/chunk-KDMKHR5A.js +32 -0
- package/dist/chunk-KFFNCDX6.js +19 -0
- package/dist/chunk-KKWZWP67.js +24 -0
- package/dist/chunk-KOJ5QETJ.js +8 -0
- package/dist/chunk-KPMGGE4W.js +51 -0
- package/dist/chunk-KS7DXCXH.js +27 -0
- package/dist/chunk-KSYVTEKR.js +24 -0
- package/dist/chunk-KU4YS6HN.js +61 -0
- package/dist/chunk-KYELSLDJ.js +40 -0
- package/dist/chunk-LC3PSQJJ.js +383 -0
- package/dist/chunk-LC6DYCTG.js +85 -0
- package/dist/chunk-LNKY5Z2X.js +23 -0
- package/dist/chunk-LO2DANS6.js +302 -0
- package/dist/chunk-M4SPKUZE.js +7 -0
- package/dist/chunk-M4YLED7M.js +17 -0
- package/dist/chunk-M6KTNAND.js +746 -0
- package/dist/chunk-MCOIEWW6.js +54 -0
- package/dist/chunk-MDYLOIS2.js +48 -0
- package/dist/chunk-MEISCROL.js +24 -0
- package/dist/chunk-MFLH5ZDQ.js +69 -0
- package/dist/chunk-MIXKQJ64.js +935 -0
- package/dist/chunk-MJMJEURO.js +359 -0
- package/dist/chunk-MNJ2DHU6.js +526 -0
- package/dist/chunk-NEVSQGOI.js +63 -0
- package/dist/chunk-NG5IGZXC.js +1179 -0
- package/dist/chunk-NLOMCLKI.js +3303 -0
- package/dist/chunk-NMCOUVN5.js +24 -0
- package/dist/chunk-NT3HAZYT.js +51 -0
- package/dist/chunk-NXNQQ3DS.js +382 -0
- package/dist/chunk-NYEY6W5R.js +569 -0
- package/dist/chunk-OAPCJO6W.js +23 -0
- package/dist/chunk-OH7FA4TF.js +251 -0
- package/dist/chunk-OLNORNCT.js +331 -0
- package/dist/chunk-OQEBOVUO.js +30 -0
- package/dist/chunk-ORUJI3VB.js +83 -0
- package/dist/chunk-PEN2DK7T.js +49 -0
- package/dist/chunk-PGIQMQRU.js +1650 -0
- package/dist/chunk-PTVOXB5T.js +39 -0
- package/dist/chunk-PUVGWJQ5.js +24 -0
- package/dist/chunk-PWROWDZS.js +137 -0
- package/dist/chunk-Q6XJOJTY.js +29 -0
- package/dist/chunk-QBR6IKIX.js +50 -0
- package/dist/chunk-QETGGFH2.js +30 -0
- package/dist/chunk-QG6MOQLI.js +2934 -0
- package/dist/chunk-QGCEHR6S.js +13 -0
- package/dist/chunk-QHFQHQDC.js +43 -0
- package/dist/chunk-QHRE2M6V.js +26 -0
- package/dist/chunk-QKL7IY42.js +38 -0
- package/dist/chunk-QN6JHMGU.js +44 -0
- package/dist/chunk-QNHZXFRA.js +347 -0
- package/dist/chunk-QPWRHDLZ.js +17 -0
- package/dist/chunk-QVABTUDS.js +80 -0
- package/dist/chunk-QXILAMAU.js +28 -0
- package/dist/chunk-QZAT46PP.js +95 -0
- package/dist/chunk-R3WI7ZLE.js +545 -0
- package/dist/chunk-R5SWC3EW.js +30 -0
- package/dist/chunk-RJQ5YS3Q.js +40 -0
- package/dist/chunk-RNOD2UWF.js +613 -0
- package/dist/chunk-RNXITK5M.js +24 -0
- package/dist/chunk-ROXO4R3J.js +16 -0
- package/dist/chunk-RQ5DNYLG.js +10 -0
- package/dist/chunk-RSWVH7DB.js +24 -0
- package/dist/chunk-RTJXOIIQ.js +12 -0
- package/dist/chunk-RZNYW7UP.js +133 -0
- package/dist/chunk-S4F27M7N.js +37 -0
- package/dist/chunk-S4ONWRJE.js +28 -0
- package/dist/chunk-S53OGZL6.js +168 -0
- package/dist/chunk-S5ADHIZK.js +2508 -0
- package/dist/chunk-S62M63LU.js +19 -0
- package/dist/chunk-S7VDRUED.js +62 -0
- package/dist/chunk-SGD3ZHID.js +250 -0
- package/dist/chunk-SGSPYHFE.js +40 -0
- package/dist/chunk-SLTMRTXV.js +597 -0
- package/dist/chunk-SXGTRZFN.js +26 -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-TNEHPP3H.js +18 -0
- package/dist/chunk-TPYV2FTV.js +25 -0
- package/dist/chunk-TPZB2YWR.js +25 -0
- package/dist/chunk-TSR5YDPS.js +1266 -0
- package/dist/chunk-TTR7EWNH.js +170 -0
- package/dist/chunk-TVHLKVUO.js +24 -0
- package/dist/chunk-TXINIAFL.js +198 -0
- package/dist/chunk-TXZBBZOG.js +58 -0
- package/dist/chunk-UEU46Q3D.js +300 -0
- package/dist/chunk-UMDEWWXT.js +33 -0
- package/dist/chunk-UQSVWO7Z.js +334 -0
- package/dist/chunk-UZF3G2FN.js +942 -0
- package/dist/chunk-V422EKLW.js +24 -0
- package/dist/chunk-V4DYVLOO.js +433 -0
- package/dist/chunk-V4VC25UL.js +128 -0
- package/dist/chunk-V667FCIJ.js +12 -0
- package/dist/chunk-VABRPZVC.js +43 -0
- package/dist/chunk-VB2MJLET.js +19 -0
- package/dist/chunk-VDAKTZQP.js +18 -0
- package/dist/chunk-VDAZPGR2.js +79 -0
- package/dist/chunk-VXZFQKBJ.js +21 -0
- package/dist/chunk-VYMGZ27S.js +133 -0
- package/dist/chunk-W2RGSGRR.js +131 -0
- package/dist/chunk-W7UZXD5D.js +1109 -0
- package/dist/chunk-WDUNR2VI.js +2718 -0
- package/dist/chunk-WHSTEAVP.js +229 -0
- package/dist/chunk-WJMUMN3I.js +127 -0
- package/dist/chunk-WLZ54FWG.js +120 -0
- package/dist/chunk-WMJPFLF3.js +2980 -0
- package/dist/chunk-WRHFBCVY.js +24 -0
- package/dist/chunk-WVSNSWBJ.js +47 -0
- package/dist/chunk-WYJEOMNY.js +31 -0
- package/dist/chunk-WYJMV62X.js +24 -0
- package/dist/chunk-WZGJSQKN.js +29 -0
- package/dist/chunk-WZL4EEBS.js +11 -0
- package/dist/chunk-X7TXGKRX.js +272 -0
- package/dist/chunk-XB4KZ6WO.js +81 -0
- package/dist/chunk-XDLQRSSH.js +266 -0
- package/dist/chunk-XDS4UZGR.js +113 -0
- package/dist/chunk-XEGRWWNO.js +30 -0
- package/dist/chunk-XO5ONLVM.js +420 -0
- package/dist/chunk-XPWRD424.js +24 -0
- package/dist/chunk-XTNV2YMB.js +50 -0
- package/dist/chunk-XW5J5JAX.js +42 -0
- package/dist/chunk-XY5O74BH.js +33 -0
- package/dist/chunk-XYONCO5Q.js +984 -0
- package/dist/chunk-Y4PXIJMD.js +829 -0
- package/dist/chunk-YAYRRKC7.js +24 -0
- package/dist/chunk-YEDYBMCW.js +210 -0
- package/dist/chunk-YFG4E3N2.js +1161 -0
- package/dist/chunk-YHTO46W2.js +2670 -0
- package/dist/chunk-YI2ZVTCB.js +38 -0
- package/dist/chunk-YKO3VCTF.js +24 -0
- package/dist/chunk-YP3I6W7T.js +24 -0
- package/dist/chunk-YQ2B3YVF.js +687 -0
- package/dist/chunk-YS6KMYM4.js +91 -0
- package/dist/chunk-YTSSXSZR.js +197 -0
- package/dist/chunk-Z256ACGC.js +27 -0
- package/dist/chunk-Z2MGTKDR.js +20 -0
- package/dist/chunk-Z5VSLLNY.js +23 -0
- package/dist/chunk-Z7X3RGGA.js +22 -0
- package/dist/chunk-ZF43WRG3.js +29 -0
- package/dist/chunk-ZJKOLOVF.js +1754 -0
- package/dist/chunk-ZQ4VFQID.js +76 -0
- package/dist/chunk-ZSLGN6CO.js +89 -0
- package/dist/chunk-ZVTFZF4V.js +542 -0
- package/dist/cli/index.js +9 -0
- package/dist/core-5Z6UW5DS.js +31 -0
- package/dist/core-6ANZ2OWO.js +40 -0
- package/dist/core-6LLJNZ4O.js +37 -0
- package/dist/core-CPN2HF75.js +33 -0
- package/dist/core-CS7AKNME.js +37 -0
- package/dist/core-DBRILYNB.js +38 -0
- package/dist/core-DU77ZYPR.js +34 -0
- package/dist/core-E6YD7VU4.js +32 -0
- package/dist/core-EE55P6XK.js +56 -0
- package/dist/core-FFLPH5XK.js +41 -0
- package/dist/core-IV26EL5C.js +32 -0
- package/dist/core-IZVZ2B7Y.js +34 -0
- package/dist/core-JQV7STNF.js +34 -0
- package/dist/core-KBH3EJZV.js +32 -0
- package/dist/core-KFBW5PRT.js +36 -0
- package/dist/core-KWGXHBJE.js +37 -0
- package/dist/core-MZMR2DF4.js +32 -0
- package/dist/core-OK2ZY5OJ.js +29 -0
- package/dist/core-OV5MPTZP.js +43 -0
- package/dist/core-OW5V74Q4.js +40 -0
- package/dist/core-PL64QPOH.js +57 -0
- package/dist/core-PVINU5JJ.js +33 -0
- package/dist/core-QUYSNTC7.js +34 -0
- package/dist/core-RE3L6YCM.js +29 -0
- package/dist/core-RUA3EWW3.js +39 -0
- package/dist/core-RY6IFRKM.js +35 -0
- package/dist/core-SCWEVNUY.js +34 -0
- package/dist/core-SE67HHFG.js +55 -0
- package/dist/core-T5Q4DSH2.js +32 -0
- package/dist/core-TJX3I7KH.js +37 -0
- package/dist/core-ULUA5ZB2.js +55 -0
- package/dist/core-WLVU2HWX.js +46 -0
- package/dist/core-WQPHNVNY.js +51 -0
- package/dist/core-XXIOJY2X.js +52 -0
- package/dist/core-ZH7XTJTD.js +39 -0
- package/dist/core-ZHE7N4NS.js +50 -0
- package/dist/core-ZJYLJWZQ.js +38 -0
- package/dist/dataTable-IL7HVDHL.js +58 -0
- package/dist/engine-MYLZI5VH.js +961 -0
- package/dist/fixtures.d.ts +1 -0
- package/dist/fixtures.js +40 -0
- package/dist/fontTables-ZYBUCJ5N.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 +363 -0
- package/dist/main-ISJ53IS5.js +568 -0
- package/dist/mcp/server.js +1023 -0
- package/dist/module-SVEW5ZUE.js +137233 -0
- package/dist/react/bar.d.ts +1 -0
- package/dist/react/bar.js +80 -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 +64 -0
- package/dist/react/bullet.d.ts +1 -0
- package/dist/react/bullet.js +71 -0
- package/dist/react/butterfly.d.ts +1 -0
- package/dist/react/butterfly.js +65 -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 +69 -0
- package/dist/react/column.d.ts +1 -0
- package/dist/react/column.js +85 -0
- package/dist/react/combo.d.ts +1 -0
- package/dist/react/combo.js +85 -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 +71 -0
- package/dist/react/dot.d.ts +1 -0
- package/dist/react/dot.js +69 -0
- package/dist/react/export.d.ts +1 -0
- package/dist/react/export.js +657 -0
- package/dist/react/funnel.d.ts +1 -0
- package/dist/react/funnel.js +62 -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 +66 -0
- package/dist/react/heatmap.d.ts +1 -0
- package/dist/react/heatmap.js +67 -0
- package/dist/react/histogram.d.ts +1 -0
- package/dist/react/histogram.js +85 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +503 -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 +82 -0
- package/dist/react/line.d.ts +1 -0
- package/dist/react/line.js +80 -0
- package/dist/react/mekko.d.ts +1 -0
- package/dist/react/mekko.js +70 -0
- package/dist/react/pareto.d.ts +1 -0
- package/dist/react/pareto.js +89 -0
- package/dist/react/pie.d.ts +1 -0
- package/dist/react/pie.js +63 -0
- package/dist/react/prepare.d.ts +1 -0
- package/dist/react/prepare.js +277 -0
- package/dist/react/pvm.d.ts +1 -0
- package/dist/react/pvm.js +67 -0
- package/dist/react/pyramid.d.ts +1 -0
- package/dist/react/pyramid.js +66 -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 +62 -0
- package/dist/react/slope.d.ts +1 -0
- package/dist/react/slope.js +63 -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 +370 -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 +68 -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 +64 -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 +67 -0
- package/dist/resvg-ZOVDIZTV.js +23 -0
- package/dist/rows.d.ts +1 -0
- package/dist/rows.js +23 -0
- package/dist/rowsModule-3Y4I3M3E.js +27 -0
- package/dist/schema-2BMZOHXI.js +22 -0
- package/dist/schema-2GUBWOBC.js +26 -0
- package/dist/schema-34ZELWRQ.js +25 -0
- package/dist/schema-3BHL2B76.js +22 -0
- package/dist/schema-4735XAZX.js +29 -0
- package/dist/schema-5YTNQ6JY.js +22 -0
- package/dist/schema-7J3NAIN2.js +27 -0
- package/dist/schema-AOJJ7JZB.js +22 -0
- package/dist/schema-CVMV4LRA.js +22 -0
- package/dist/schema-D3RCMN3T.js +22 -0
- package/dist/schema-E2ISJ65D.js +23 -0
- package/dist/schema-E6YOSOWB.js +28 -0
- package/dist/schema-EQQB43AY.js +22 -0
- package/dist/schema-EVLLL5UF.js +22 -0
- package/dist/schema-EYQ5IBLF.js +23 -0
- package/dist/schema-EYZVD73N.js +22 -0
- package/dist/schema-G4KFMQBL.js +22 -0
- package/dist/schema-GH7IKSOU.js +23 -0
- package/dist/schema-IF5N3J56.js +42 -0
- package/dist/schema-IG7JIR4H.js +23 -0
- package/dist/schema-JJYJOQTT.js +23 -0
- package/dist/schema-KFC4WYH4.js +32 -0
- package/dist/schema-L7263JMT.js +25 -0
- package/dist/schema-MEAFRXVH.js +53 -0
- package/dist/schema-P63S63GE.js +23 -0
- package/dist/schema-P7LJFJAJ.js +22 -0
- package/dist/schema-PA2MXYY4.js +23 -0
- package/dist/schema-PDZ6256H.js +23 -0
- package/dist/schema-PNC3Z7AH.js +25 -0
- package/dist/schema-QEVSIMGO.js +22 -0
- package/dist/schema-QJJPRRE7.js +22 -0
- package/dist/schema-S3EQKVOT.js +23 -0
- package/dist/schema-STGL44TL.js +22 -0
- package/dist/schema-T4NE2EAO.js +22 -0
- package/dist/schema-TQYTESG3.js +22 -0
- package/dist/schema-W376PAJG.js +22 -0
- package/dist/schema-XYYDUUHS.js +26 -0
- package/dist/specValidation-NVBIZMEE.js +48 -0
- package/dist/theme.d.ts +1 -0
- package/dist/theme.js +24 -0
- package/dist/themeShapeRules-5C2463YH.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 +56 -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 +302 -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 +380 -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 +45 -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 +223 -0
- package/dist/types/core/types/cell.d.ts +82 -0
- package/dist/types/core/types/data.d.ts +309 -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 +65 -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 +58 -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 +222 -0
- package/docs/FONTS.md +68 -0
- package/docs/TELEMETRY.md +94 -0
- package/docs/manual.md +838 -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 +1088 -0
- package/docs/reference/funnel.md +121 -0
- package/docs/reference/gantt.md +132 -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 +703 -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,2670 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addRatioTierRequests,
|
|
3
|
+
finalizeRatioTier,
|
|
4
|
+
prepareRatioTier,
|
|
5
|
+
ratioTierA11y,
|
|
6
|
+
ratioTierCanRender,
|
|
7
|
+
ratioTierMetrics,
|
|
8
|
+
ratioTierSpacingWarnings
|
|
9
|
+
} from "./chunk-JSX3C6LL.js";
|
|
10
|
+
import {
|
|
11
|
+
FORCE_CATEGORY_RANKS,
|
|
12
|
+
STAIRCASE_MAX_PAD,
|
|
13
|
+
categoryNotesDiffer,
|
|
14
|
+
categoryRanksLint,
|
|
15
|
+
rankNotes,
|
|
16
|
+
runStaircase,
|
|
17
|
+
seatStaircase,
|
|
18
|
+
settleStaircase,
|
|
19
|
+
staircaseDirection,
|
|
20
|
+
staircaseOn,
|
|
21
|
+
staircaseRoom,
|
|
22
|
+
staircaseState,
|
|
23
|
+
withCategoryRanks
|
|
24
|
+
} from "./chunk-X7TXGKRX.js";
|
|
25
|
+
import {
|
|
26
|
+
ANOMALY_FLAG_GAP,
|
|
27
|
+
ANOMALY_FLAG_H,
|
|
28
|
+
anomalyCorridor,
|
|
29
|
+
anomalyLegendItems,
|
|
30
|
+
anomalyReceipt,
|
|
31
|
+
anomalyRuleLines,
|
|
32
|
+
anomalyRuleReserve,
|
|
33
|
+
chartString as chartString2,
|
|
34
|
+
columnAnomalyModel,
|
|
35
|
+
columnCorridorPaint,
|
|
36
|
+
drawAnomalyRules,
|
|
37
|
+
emitAnomalyFlag,
|
|
38
|
+
refuseColumnEncodings
|
|
39
|
+
} from "./chunk-V4DYVLOO.js";
|
|
40
|
+
import {
|
|
41
|
+
DEFAULT_OTHERS_SHADE
|
|
42
|
+
} from "./chunk-RQ5DNYLG.js";
|
|
43
|
+
import {
|
|
44
|
+
applyCategoryViewport,
|
|
45
|
+
liveWindowOptions,
|
|
46
|
+
viewportMeanSpan
|
|
47
|
+
} from "./chunk-EQT3EPTB.js";
|
|
48
|
+
import {
|
|
49
|
+
chosenValueIndices,
|
|
50
|
+
emitBarMark,
|
|
51
|
+
groupedOffsets,
|
|
52
|
+
pickedValues,
|
|
53
|
+
rangeWhisker,
|
|
54
|
+
signColorOverrides,
|
|
55
|
+
signPaint,
|
|
56
|
+
stackConnectors,
|
|
57
|
+
totalLabelCandidates,
|
|
58
|
+
withValueLabelDefaults
|
|
59
|
+
} from "./chunk-HFG76JTS.js";
|
|
60
|
+
import {
|
|
61
|
+
axisBreakHeightOrderWarning,
|
|
62
|
+
axisBreakInvalid,
|
|
63
|
+
breakStyleRefusal,
|
|
64
|
+
stackBreakReversesOrder
|
|
65
|
+
} from "./chunk-ORUJI3VB.js";
|
|
66
|
+
import {
|
|
67
|
+
REFERENCE_MARKER_R,
|
|
68
|
+
breakAxisScale,
|
|
69
|
+
rankValueLabels,
|
|
70
|
+
referenceCasing,
|
|
71
|
+
referenceMarkerKey,
|
|
72
|
+
referenceMarkerPaint,
|
|
73
|
+
referenceTickGeometry,
|
|
74
|
+
withBandValueNotes
|
|
75
|
+
} from "./chunk-XDS4UZGR.js";
|
|
76
|
+
import {
|
|
77
|
+
restValueHiding,
|
|
78
|
+
restValuesHidden
|
|
79
|
+
} from "./chunk-EKQK5D6G.js";
|
|
80
|
+
import {
|
|
81
|
+
cellFields,
|
|
82
|
+
normalizeCategorySeries
|
|
83
|
+
} from "./chunk-QN6JHMGU.js";
|
|
84
|
+
import {
|
|
85
|
+
resolveCellRange
|
|
86
|
+
} from "./chunk-VDAZPGR2.js";
|
|
87
|
+
import {
|
|
88
|
+
STACK_ROOM,
|
|
89
|
+
bandValueLabelUniformity,
|
|
90
|
+
compactValueLabelFont,
|
|
91
|
+
digitSeat,
|
|
92
|
+
digitSeatEdge,
|
|
93
|
+
fitsInside,
|
|
94
|
+
groupedValueLabelPolicy,
|
|
95
|
+
haloOverRules,
|
|
96
|
+
keepValuesWithoutAxis,
|
|
97
|
+
linesSize,
|
|
98
|
+
raiseOverRules,
|
|
99
|
+
segmentLabelCandidates,
|
|
100
|
+
segmentTooShort,
|
|
101
|
+
valueRowCrowded,
|
|
102
|
+
valueShareLines,
|
|
103
|
+
warnShareParts,
|
|
104
|
+
warnSliverLabels
|
|
105
|
+
} from "./chunk-HJXXFPOL.js";
|
|
106
|
+
import {
|
|
107
|
+
roundingUnavailable,
|
|
108
|
+
sumConsistentShares
|
|
109
|
+
} from "./chunk-HAAUJDGB.js";
|
|
110
|
+
import {
|
|
111
|
+
accumulateStack,
|
|
112
|
+
averageMarkerLine,
|
|
113
|
+
averageOfUnaddedSums,
|
|
114
|
+
averageOfWholeShares,
|
|
115
|
+
compositionBasis,
|
|
116
|
+
grandTotalRequested,
|
|
117
|
+
mixedSignsWarning,
|
|
118
|
+
netLineName,
|
|
119
|
+
onePartDrawn,
|
|
120
|
+
overfullShareSum,
|
|
121
|
+
overfullWarning,
|
|
122
|
+
plottedMean,
|
|
123
|
+
printsValue,
|
|
124
|
+
sk,
|
|
125
|
+
sortSegments,
|
|
126
|
+
stackParts,
|
|
127
|
+
stackTotalFormatter,
|
|
128
|
+
warnIncompleteStacks
|
|
129
|
+
} from "./chunk-TTR7EWNH.js";
|
|
130
|
+
import {
|
|
131
|
+
valueLineExtent
|
|
132
|
+
} from "./chunk-QPWRHDLZ.js";
|
|
133
|
+
import {
|
|
134
|
+
isIncomplete,
|
|
135
|
+
warnShareRoundingDrift
|
|
136
|
+
} from "./chunk-7QDAHY5M.js";
|
|
137
|
+
import {
|
|
138
|
+
emitEventLane,
|
|
139
|
+
percentLevels,
|
|
140
|
+
runAnnotatePass,
|
|
141
|
+
settleEventLane
|
|
142
|
+
} from "./chunk-GQS46LC3.js";
|
|
143
|
+
import {
|
|
144
|
+
stepDownFont
|
|
145
|
+
} from "./chunk-EWVKBRLV.js";
|
|
146
|
+
import {
|
|
147
|
+
chartPalette
|
|
148
|
+
} from "./chunk-SXGTRZFN.js";
|
|
149
|
+
import {
|
|
150
|
+
restLabel,
|
|
151
|
+
restSum,
|
|
152
|
+
topNCut
|
|
153
|
+
} from "./chunk-KDMKHR5A.js";
|
|
154
|
+
import {
|
|
155
|
+
yearSpan,
|
|
156
|
+
yearSpanFromLabels
|
|
157
|
+
} from "./chunk-XTNV2YMB.js";
|
|
158
|
+
import {
|
|
159
|
+
NO_STACK_MEAN,
|
|
160
|
+
NO_STACK_TOTAL,
|
|
161
|
+
stackAdds
|
|
162
|
+
} from "./chunk-6KWIQ5KF.js";
|
|
163
|
+
import {
|
|
164
|
+
categoryTargetFields,
|
|
165
|
+
spliceAnnotationNodes
|
|
166
|
+
} from "./chunk-CDZHNLO6.js";
|
|
167
|
+
import {
|
|
168
|
+
BAND_PAD,
|
|
169
|
+
VALUE_LINE_RESERVE,
|
|
170
|
+
hiddenValueLineReserve
|
|
171
|
+
} from "./chunk-5C7TWNYZ.js";
|
|
172
|
+
import {
|
|
173
|
+
structureCount
|
|
174
|
+
} from "./chunk-B2EBEXIS.js";
|
|
175
|
+
import {
|
|
176
|
+
DIGIT_SEAT,
|
|
177
|
+
PLOT_FLOOR_PX,
|
|
178
|
+
ROTATED_NAME_AIR,
|
|
179
|
+
applyAxisBounds,
|
|
180
|
+
applyValueAxisTitleInk,
|
|
181
|
+
axisTitleAllowed,
|
|
182
|
+
bandScale,
|
|
183
|
+
brokenLinearScale,
|
|
184
|
+
categoryBreakGlyph,
|
|
185
|
+
categoryLineAlign,
|
|
186
|
+
categoryRowTop,
|
|
187
|
+
hangingLabelReserve,
|
|
188
|
+
invalidLinearBreakReason,
|
|
189
|
+
layoutValueAxis,
|
|
190
|
+
linearScale,
|
|
191
|
+
longDayMonths,
|
|
192
|
+
measureValueAxisWidth,
|
|
193
|
+
niceDomain,
|
|
194
|
+
noteName,
|
|
195
|
+
planCategoryRow,
|
|
196
|
+
planValueAxisTitle,
|
|
197
|
+
plotFloorRows,
|
|
198
|
+
plotFloorShare,
|
|
199
|
+
rotatedClaimRect,
|
|
200
|
+
rotatedLeftOverhang,
|
|
201
|
+
seatRoom,
|
|
202
|
+
valueAxisTitleBand,
|
|
203
|
+
valueAxisTitleRequest,
|
|
204
|
+
valueAxisTitleText,
|
|
205
|
+
valueAxisUnit,
|
|
206
|
+
verticalNameRect,
|
|
207
|
+
yearRowRequests
|
|
208
|
+
} from "./chunk-GQPESFAF.js";
|
|
209
|
+
import {
|
|
210
|
+
PARTIAL_KEY,
|
|
211
|
+
POINTED_NOTES,
|
|
212
|
+
PRIORITY,
|
|
213
|
+
SERIES_VALUE_GAP,
|
|
214
|
+
TEXT_ASCENT,
|
|
215
|
+
authoredFootnoteCount,
|
|
216
|
+
authoredNotes,
|
|
217
|
+
categoryLabelsAndMarks,
|
|
218
|
+
composedTextRole,
|
|
219
|
+
createOccupiedIndex,
|
|
220
|
+
dataOrder,
|
|
221
|
+
fitText,
|
|
222
|
+
fixedPlotChrome,
|
|
223
|
+
frameTextOptions,
|
|
224
|
+
labelCtx,
|
|
225
|
+
labelsToNodes,
|
|
226
|
+
leaderTerminus,
|
|
227
|
+
lineBox,
|
|
228
|
+
normalizeLegendOption,
|
|
229
|
+
noteLine,
|
|
230
|
+
othersShadeUnavailableWarnings,
|
|
231
|
+
partialAxisWords,
|
|
232
|
+
partialFootnotes,
|
|
233
|
+
partialIds,
|
|
234
|
+
partialKeyForced,
|
|
235
|
+
partialLegendKeys,
|
|
236
|
+
partialPattern,
|
|
237
|
+
plotChromeFloor,
|
|
238
|
+
plotHeightAfter,
|
|
239
|
+
rectSeriesAdjacentWarnings,
|
|
240
|
+
saysToDate,
|
|
241
|
+
scenarioLegendKeys,
|
|
242
|
+
segmentHitsRect,
|
|
243
|
+
solveFrame,
|
|
244
|
+
solveLabels,
|
|
245
|
+
toDateFits,
|
|
246
|
+
toDateFont,
|
|
247
|
+
toDateLabel,
|
|
248
|
+
toDateRoom
|
|
249
|
+
} from "./chunk-2JAWQ7VV.js";
|
|
250
|
+
import {
|
|
251
|
+
disclosuresShown,
|
|
252
|
+
knownPartsLead,
|
|
253
|
+
rankKeyShown,
|
|
254
|
+
recordFreedChrome
|
|
255
|
+
} from "./chunk-YTSSXSZR.js";
|
|
256
|
+
import {
|
|
257
|
+
formatStatWithSpec,
|
|
258
|
+
formatWithSpec,
|
|
259
|
+
formatterFromExample,
|
|
260
|
+
parseFormatExample,
|
|
261
|
+
roundedNumber,
|
|
262
|
+
seriesRasterFormatter,
|
|
263
|
+
withChartMarks
|
|
264
|
+
} from "./chunk-ASAON7G4.js";
|
|
265
|
+
import {
|
|
266
|
+
NOT_AVAILABLE,
|
|
267
|
+
NOT_MEANINGFUL,
|
|
268
|
+
cagr,
|
|
269
|
+
chartString,
|
|
270
|
+
currentSmallValues,
|
|
271
|
+
formatAuthoredPercent,
|
|
272
|
+
formatAutomaticPercent,
|
|
273
|
+
formatShare,
|
|
274
|
+
localeStrings,
|
|
275
|
+
notApplicableGlyph,
|
|
276
|
+
numberRange,
|
|
277
|
+
shareSetFormatter,
|
|
278
|
+
stringFields,
|
|
279
|
+
withLocaleStrings
|
|
280
|
+
} from "./chunk-YQ2B3YVF.js";
|
|
281
|
+
import {
|
|
282
|
+
REFERENCE_LABEL_CLEARANCE,
|
|
283
|
+
canvasMargin,
|
|
284
|
+
colorRolePaints,
|
|
285
|
+
colorblindPaint,
|
|
286
|
+
contrastInkPaint,
|
|
287
|
+
dashToken,
|
|
288
|
+
effectiveFill,
|
|
289
|
+
emphasisWeight,
|
|
290
|
+
hatchGroundPaint,
|
|
291
|
+
headingWeight,
|
|
292
|
+
joinHatchPeers,
|
|
293
|
+
labelsOffKeepsNames,
|
|
294
|
+
linePath,
|
|
295
|
+
markRolePaint,
|
|
296
|
+
markRoleToken,
|
|
297
|
+
mutedMarkPaint,
|
|
298
|
+
namesOnly,
|
|
299
|
+
orderedRampPaint,
|
|
300
|
+
paintColor,
|
|
301
|
+
panelTypeClass,
|
|
302
|
+
rampSlots,
|
|
303
|
+
recedingSeriesId,
|
|
304
|
+
resolveSurface,
|
|
305
|
+
resolveTheme,
|
|
306
|
+
ribbonPath,
|
|
307
|
+
secondaryFont,
|
|
308
|
+
seriesPaint,
|
|
309
|
+
stackApartPaint,
|
|
310
|
+
stackRampPaint,
|
|
311
|
+
strokeToken,
|
|
312
|
+
textBreaksLine,
|
|
313
|
+
textScaleOf,
|
|
314
|
+
themeForWidth,
|
|
315
|
+
withSegmentSeams
|
|
316
|
+
} from "./chunk-II7652VA.js";
|
|
317
|
+
import {
|
|
318
|
+
DEFAULT_TARGET,
|
|
319
|
+
NormalizeError,
|
|
320
|
+
accessibleTitle,
|
|
321
|
+
normalizeScenario,
|
|
322
|
+
resolveHighlight,
|
|
323
|
+
resolveSize,
|
|
324
|
+
scaleTextPx
|
|
325
|
+
} from "./chunk-SGD3ZHID.js";
|
|
326
|
+
import {
|
|
327
|
+
maxOf,
|
|
328
|
+
minOf,
|
|
329
|
+
pushAll
|
|
330
|
+
} from "./chunk-WYJEOMNY.js";
|
|
331
|
+
import {
|
|
332
|
+
defaultMeasurer
|
|
333
|
+
} from "./chunk-TXINIAFL.js";
|
|
334
|
+
|
|
335
|
+
// src/core/charts/column/model.ts
|
|
336
|
+
var PANEL_KEYED = /* @__PURE__ */ Symbol.for("boardplot.panelKeyed"), TICK_LABEL_RESERVE = /* @__PURE__ */ Symbol("tickLabelReserve"), PY_TICK_LEAD = 12;
|
|
337
|
+
|
|
338
|
+
// src/core/charts/column/domain.ts
|
|
339
|
+
function resolveColumnEnv(options, warnings) {
|
|
340
|
+
let size = resolveSize(options.size), theme = themeForWidth(resolveTheme(options.theme), panelTypeClass(options) ?? size.width), paletteRamp = chartPalette(theme, options.palette, warnings);
|
|
341
|
+
return {
|
|
342
|
+
options,
|
|
343
|
+
theme,
|
|
344
|
+
palette: paletteRamp ? options.palette : void 0,
|
|
345
|
+
size,
|
|
346
|
+
measure: options.measure ?? defaultMeasurer,
|
|
347
|
+
pctFmt: options.shareLabels?.format ? formatterFromExample(options.shareLabels.format, options.locale?.language) : (p) => formatShare(p, options.locale?.language),
|
|
348
|
+
authoredPctFmt: (p) => formatAuthoredPercent(p, options.locale?.language),
|
|
349
|
+
highlights: new Set(resolveHighlight(options.highlight)),
|
|
350
|
+
density: options.labelDensity ?? "smart"
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function kindSetting(options, kind) {
|
|
354
|
+
let l = options.labels;
|
|
355
|
+
if (l === !1) return kind === "category" && labelsOffKeepsNames(options);
|
|
356
|
+
let v = l?.[kind];
|
|
357
|
+
return v === void 0 ? !0 : v;
|
|
358
|
+
}
|
|
359
|
+
function pyTickKeyed(domain, legend) {
|
|
360
|
+
let ref = domain.pyRef;
|
|
361
|
+
return !ref || kindSetting(domain.options, "tick") !== !0 ? !1 : legend?.items.some((item) => item.id === ref.id) === !0 || domain.options[PANEL_KEYED] === !0;
|
|
362
|
+
}
|
|
363
|
+
function contentOf(options, kind, dflt) {
|
|
364
|
+
let s = kindSetting(options, kind);
|
|
365
|
+
return s === !1 ? null : Array.isArray(s) ? s : dflt;
|
|
366
|
+
}
|
|
367
|
+
function toDateOnValues(domain) {
|
|
368
|
+
let ids = /* @__PURE__ */ new Set(), { options, cats, dataSeries, variant } = domain;
|
|
369
|
+
if (partialKeyForced(options) || !cats.some((c) => c.partial === !0)) return ids;
|
|
370
|
+
let words = options.strings?.toDate ?? chartString(options, "toDate");
|
|
371
|
+
if (!toDateFits(words, domain.theme, domain.measure, domain.size.width / Math.max(1, cats.length))) return ids;
|
|
372
|
+
let grouped = variant === "grouped", segments = dataSeries.length > 1 && contentOf(options, "segment", ["absolute"]) !== null, content = grouped ? contentOf(options, "point", ["absolute"]) : domain.gtContent;
|
|
373
|
+
if (dataSeries.length === 0 || variant === "stacked100" || (grouped ? dataSeries.length > 1 : segments) || !content?.includes("absolute")) return ids;
|
|
374
|
+
let only = dataSeries[0], picked = grouped && options.valueLabels !== void 0 ? chosenValueIndices(options.valueLabels, cats.map((_, ci) => only.vals[ci]?.v ?? null)) : void 0;
|
|
375
|
+
return cats.forEach((c, ci) => {
|
|
376
|
+
if (c.partial !== !0 || saysToDate(c.label ?? c.id, words) || domain.mixedSignCats.has(c.id) || (grouped ? only.vals[ci]?.v === null || only.vals[ci]?.v === void 0 : !domain.stacks[ci].hasValue) || (grouped ? only.vals[ci].v < 0 : !(domain.posTopP[ci] > 0 || domain.negBotP[ci] === 0)) || picked && !picked.has(ci) && typeof only.vals[ci]?.labelOverride != "string") return;
|
|
377
|
+
let populated = dataSeries.filter((s) => s.vals[ci]?.v !== null && s.vals[ci]?.v !== void 0), override = populated.length === 1 ? populated[0].vals[ci].labelOverride : void 0;
|
|
378
|
+
override === !1 || typeof override == "string" && override.trim() === "" || ids.add(c.id);
|
|
379
|
+
}), ids;
|
|
380
|
+
}
|
|
381
|
+
function partialNamedOnValues(domain) {
|
|
382
|
+
let named = toDateOnValues(domain);
|
|
383
|
+
return named.size > 0 && domain.cats.every((c, ci) => c.partial !== !0 || named.has(c.id) || (domain.variant === "grouped" ? domain.dataSeries.every((s) => s.vals[ci]?.v === null || s.vals[ci]?.v === void 0) : !domain.stacks[ci].hasValue));
|
|
384
|
+
}
|
|
385
|
+
function normalizeColumnData(data, warnings) {
|
|
386
|
+
let { cats, series } = normalizeCategorySeries("column", data, (s, cells, cats2) => ({
|
|
387
|
+
id: s.id,
|
|
388
|
+
label: s.label ?? s.id,
|
|
389
|
+
role: s.role ?? "data",
|
|
390
|
+
scenario: normalizeScenario(s.scenario, `series[${s.id}].scenario`),
|
|
391
|
+
direction: s.direction ?? "higherIsBetter",
|
|
392
|
+
colorRole: s.colorRole,
|
|
393
|
+
fill: s.fill,
|
|
394
|
+
format: s.format,
|
|
395
|
+
unit: s.unit,
|
|
396
|
+
vals: cells.map((cell, ci) => ({
|
|
397
|
+
...cellFields(cell, `series[${s.id}].values[${ci}]`),
|
|
398
|
+
range: resolveCellRange(cell, `series[${s.id}].values[${ci}]`, warnings, { seriesId: s.id, categoryId: cats2[ci]?.id })
|
|
399
|
+
}))
|
|
400
|
+
}));
|
|
401
|
+
return { cats, seriesNorm: series };
|
|
402
|
+
}
|
|
403
|
+
function orderColumnCategories(options, categories, seriesNorm, series, warnings) {
|
|
404
|
+
let cats = categories, dataSeries = series, anomalySpec = options.anomaly;
|
|
405
|
+
dataSeries = sortSegments(dataSeries, options.sort?.segments, (s) => s.vals.reduce((a, x) => a + (x.v ?? 0), 0));
|
|
406
|
+
let catTotal = (ci) => dataSeries.reduce((a, s) => a + (s.vals[ci].v ?? 0), 0), applyOrder = (order) => {
|
|
407
|
+
cats = order.map((i) => cats[i]);
|
|
408
|
+
for (let s of seriesNorm) s.vals = order.map((i) => s.vals[i]);
|
|
409
|
+
}, catSort = options.sort?.categories;
|
|
410
|
+
if (catSort && catSort !== "sheet") {
|
|
411
|
+
let order = cats.map((_, i) => i);
|
|
412
|
+
if (catSort === "reverse") order.reverse();
|
|
413
|
+
else {
|
|
414
|
+
let dir = catSort === "asc" ? 1 : -1;
|
|
415
|
+
order.sort((a, b) => (catTotal(a) - catTotal(b)) * dir || a - b);
|
|
416
|
+
}
|
|
417
|
+
applyOrder(order);
|
|
418
|
+
}
|
|
419
|
+
let othersId = null, topN = anomalySpec ? void 0 : options.topN;
|
|
420
|
+
if (anomalySpec && options.topN && options.topN.n > 0 && cats.length > options.topN.n && warnings.push({
|
|
421
|
+
code: "anomaly-topn-ignored",
|
|
422
|
+
severity: "warn",
|
|
423
|
+
message: `topN ignored: an anomaly rule is computed over every period, and an aggregated '${options.topN.restLabel ?? options.strings?.others ?? "Others"}' bucket has no score`,
|
|
424
|
+
suggest: "drop options.topN, or drop options.anomaly and rank instead of flag"
|
|
425
|
+
}), topN && topN.n > 0 && cats.length > topN.n) {
|
|
426
|
+
let { kept: keptIdx, dropped: dropIdx } = topNCut(cats.map((_, i) => Math.abs(catTotal(i))), topN.n);
|
|
427
|
+
if (topN.rest === !1 || dropIdx.length === 0)
|
|
428
|
+
applyOrder(keptIdx);
|
|
429
|
+
else {
|
|
430
|
+
for (seriesNorm.some((series2) => dropIdx.some((i) => series2.vals[i].range)) && warnings.push({
|
|
431
|
+
code: "range-topn-omitted",
|
|
432
|
+
severity: "warn",
|
|
433
|
+
message: "topN Others aggregates values but not ranges; dropped-item ranges were omitted",
|
|
434
|
+
suggest: "set topN.rest to false or pre-aggregate a defensible range upstream"
|
|
435
|
+
}), othersId = "others"; cats.some((c) => c.id === othersId); ) othersId = `_${othersId}`;
|
|
436
|
+
let othersVals = seriesNorm.map((s) => restSum(dropIdx.map((i) => s.vals[i].v)));
|
|
437
|
+
applyOrder(keptIdx), cats = [...cats, { id: othersId, label: restLabel(topN, options.strings, dropIdx.length) }], seriesNorm.forEach((s, k) => {
|
|
438
|
+
s.vals = [...s.vals, { v: othersVals[k], isPct: !1 }];
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return { cats, dataSeries, othersId };
|
|
443
|
+
}
|
|
444
|
+
function columnScenarios(options, variant, cats, dataSeries, refSeries, warnings) {
|
|
445
|
+
let stackedLike = variant !== "grouped", refStyle = options.referenceStyle ?? "tick", labelGateOpen = (kind) => options.labels !== !1 && options.labels?.[kind] !== !1, pyReferences = refSeries.filter((series) => series.scenario === "PY"), integrable = variant === "stacked" && refStyle === "tick" && options.grandTotalLabels !== !1 && labelGateOpen("grandTotal") && labelGateOpen("annotation") && labelGateOpen("tick"), pyRef = integrable && pyReferences.length === 1 ? pyReferences[0] : void 0;
|
|
446
|
+
integrable && pyReferences.length > 1 && warnings.push({
|
|
447
|
+
code: "integrated-variance-reference-ambiguous",
|
|
448
|
+
severity: "warn",
|
|
449
|
+
message: "integrated stacked variance needs exactly one PY reference; multiple PY references keep the legacy ticks without growth labels",
|
|
450
|
+
suggest: "Keep one PY reference series or use an explicit scaled variance tier."
|
|
451
|
+
});
|
|
452
|
+
let uniformScenario = /* @__PURE__ */ new Map();
|
|
453
|
+
return stackedLike && dataSeries.length > 1 && cats.forEach((cat, ci) => {
|
|
454
|
+
let scenarios = dataSeries.filter((s) => s.vals[ci].v !== null).map((s) => s.vals[ci].scenario ?? s.scenario), scenario = scenarios[0];
|
|
455
|
+
scenario !== void 0 && scenarios.every((candidate) => candidate === scenario) && uniformScenario.set(cat.id, scenario);
|
|
456
|
+
}), variant === "stacked100" && dataSeries.length === 1 && warnings.push({
|
|
457
|
+
code: "stacked100-single-series",
|
|
458
|
+
severity: "warn",
|
|
459
|
+
message: "a 100% composition of a single series is always 100% \u2014 use variant:'stacked' or 'grouped' to show the level"
|
|
460
|
+
}), { pyRef, uniformScenario };
|
|
461
|
+
}
|
|
462
|
+
function columnLines(options, stackedLike, dataSeries, warnings, basesGiven = !1) {
|
|
463
|
+
let connectorsOn = options.connectors !== void 0 && options.connectors !== !1;
|
|
464
|
+
connectorsOn && !stackedLike && warnings.push({
|
|
465
|
+
code: "connectors-ignored",
|
|
466
|
+
severity: "warn",
|
|
467
|
+
message: "connectors apply only to stacked and stacked100 column charts; ignored for grouped"
|
|
468
|
+
});
|
|
469
|
+
let connectorDashed = typeof options.connectors == "object" && options.connectors.style === "dashed", connectorScope = typeof options.connectors == "object" ? options.connectors.scope ?? "all" : "all", connectorSeries = connectorScope === "all" ? null : new Set(connectorScope), netLineRequested = options.netLine !== void 0 && options.netLine !== !1, netLineSeriesId = typeof options.netLine == "object" ? options.netLine.seriesId : void 0, netLineSteps = typeof options.netLine == "object" ? options.netLine.connectors ?? !0 : !0, netLineSeries = netLineSeriesId ? dataSeries.find((series) => series.id === netLineSeriesId) : void 0, netLineOn = netLineRequested && stackedLike;
|
|
470
|
+
if (netLineOn && options.variant === "stacked100" && !netLineSeriesId && !basesGiven && (netLineOn = !1, warnings.push({
|
|
471
|
+
code: "net-line-ignored",
|
|
472
|
+
severity: "warn",
|
|
473
|
+
message: "netLine on stacked100 marks the 100% edge every column reaches; ignored",
|
|
474
|
+
suggest: "remove netLine, or name the series whose share boundary it traces with netLine.seriesId",
|
|
475
|
+
field: ["options", "netLine"],
|
|
476
|
+
fix: [{ op: "remove", path: "/options/netLine" }]
|
|
477
|
+
})), netLineRequested && !stackedLike && warnings.push({
|
|
478
|
+
code: "net-line-ignored",
|
|
479
|
+
severity: "warn",
|
|
480
|
+
message: "netLine applies only to stacked and stacked100 column charts; ignored for grouped"
|
|
481
|
+
}), options.shareLabels !== void 0 && !stackedLike && warnings.push({
|
|
482
|
+
code: "share-labels-ignored",
|
|
483
|
+
severity: "warn",
|
|
484
|
+
message: "shareLabels applies only to stacked and stacked100 column charts, whose columns are wholes; ignored for grouped",
|
|
485
|
+
suggest: "use variant 'stacked' to print each segment's share of its column"
|
|
486
|
+
}), options.seriesLabels !== void 0 && !stackedLike && warnings.push({
|
|
487
|
+
code: "series-labels-ignored",
|
|
488
|
+
severity: "warn",
|
|
489
|
+
message: "seriesLabels applies only to stacked and stacked100 column charts; ignored for grouped",
|
|
490
|
+
suggest: "use a legend to name grouped series"
|
|
491
|
+
}), netLineOn && netLineSeriesId && !netLineSeries && (netLineOn = !1, warnings.push({
|
|
492
|
+
code: "net-line-series-missing",
|
|
493
|
+
severity: "warn",
|
|
494
|
+
message: `netLine seriesId '${netLineSeriesId}' is not a plotted data series; net line omitted`,
|
|
495
|
+
owner: { seriesId: netLineSeriesId }
|
|
496
|
+
})), netLineOn) {
|
|
497
|
+
let values = dataSeries.flatMap(
|
|
498
|
+
(series) => series.vals.flatMap((value) => value.v === null ? [] : [value.v])
|
|
499
|
+
), hasPositive = values.some((value) => value > 0), hasNegative = values.some((value) => value < 0), outermost = netLineSeries ? dataSeries.at(-1)?.id === netLineSeries.id : hasPositive !== hasNegative;
|
|
500
|
+
hasPositive !== hasNegative && outermost && warnings.push({
|
|
501
|
+
code: "netline-redundant",
|
|
502
|
+
severity: "warn",
|
|
503
|
+
message: "netLine traces the visible outer edge of a single-signed stack and adds no information",
|
|
504
|
+
...netLineSeries ? { owner: { seriesId: netLineSeries.id } } : {},
|
|
505
|
+
suggest: "Pick an inner boundary series with netLine.seriesId, or drop netLine."
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
return { connectorsOn, connectorDashed, connectorSeries, netLineOn, netLineSeries, netLineSteps };
|
|
509
|
+
}
|
|
510
|
+
function weightedTotal(cats, dataSeries, warnings) {
|
|
511
|
+
let ti = cats.findIndex((c) => c.role === "total");
|
|
512
|
+
if (ti < 0 || dataSeries.some((s) => s.vals[ti].v !== null)) return;
|
|
513
|
+
let total = cats[ti], name = (c) => c.label ?? c.id, groups = cats.flatMap((_, ci) => ci === ti ? [] : [ci]), base = (ci) => cats[ci].total100;
|
|
514
|
+
if (groups.length === 0 || groups.some((ci) => !(base(ci) > 0))) {
|
|
515
|
+
warnings.push({
|
|
516
|
+
code: "total-not-computed",
|
|
517
|
+
severity: "warn",
|
|
518
|
+
message: `the total column '${name(total)}' has no values, and not every other column carries a total100 base to weight it by`,
|
|
519
|
+
suggest: "give each group its respondent base in categories[].total100, or author the total values"
|
|
520
|
+
});
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
let n = groups.reduce((a, ci) => a + base(ci), 0), values = {};
|
|
524
|
+
for (let s of dataSeries) {
|
|
525
|
+
let missing = groups.filter((ci) => s.vals[ci].v === null);
|
|
526
|
+
if (missing.length > 0) {
|
|
527
|
+
warnings.push({
|
|
528
|
+
code: "total-not-computed",
|
|
529
|
+
severity: "warn",
|
|
530
|
+
message: `'${name(total)}' has no value for '${s.label}': no observation in ${missing.map((ci) => `'${name(cats[ci])}'`).join(", ")}`,
|
|
531
|
+
owner: { seriesId: s.id, categoryId: total.id },
|
|
532
|
+
suggest: "author the missing group values, or the total value itself"
|
|
533
|
+
});
|
|
534
|
+
continue;
|
|
535
|
+
}
|
|
536
|
+
let share = (ci) => s.vals[ci].isPct ? s.vals[ci].v : s.vals[ci].v / base(ci) * 100, v = groups.reduce((a, ci) => a + base(ci) * share(ci), 0) / n;
|
|
537
|
+
s.vals[ti] = { ...s.vals[ti], v, isPct: !0 }, values[s.id] = v;
|
|
538
|
+
}
|
|
539
|
+
if (Object.keys(values).length !== 0)
|
|
540
|
+
return cats[ti] = { ...total, total100: n }, warnings.push({
|
|
541
|
+
code: "total-weighted",
|
|
542
|
+
severity: "info",
|
|
543
|
+
message: `'${name(total)}' is the base-weighted share of all ${n} in ${groups.length} columns, not the mean of their shares`
|
|
544
|
+
}), { categoryId: total.id, total100: n, values };
|
|
545
|
+
}
|
|
546
|
+
var RIBBON_CROWDED = 6;
|
|
547
|
+
function columnRibbons(options, variant, stackedLike, dataSeries, warnings) {
|
|
548
|
+
if (!(options.ribbons !== void 0 && options.ribbons !== !1)) return { ribbonsOn: !1, ribbonRank: !1 };
|
|
549
|
+
if (!stackedLike)
|
|
550
|
+
return warnings.push({
|
|
551
|
+
code: "ribbons-ignored",
|
|
552
|
+
severity: "warn",
|
|
553
|
+
message: "ribbons apply only to stacked and stacked100 column charts; ignored for grouped",
|
|
554
|
+
suggest: "use variant 'stacked'"
|
|
555
|
+
}), { ribbonsOn: !1, ribbonRank: !1 };
|
|
556
|
+
let order = (typeof options.ribbons == "object" ? options.ribbons.order : void 0) ?? (variant === "stacked100" ? "sheet" : "rank");
|
|
557
|
+
return order === "rank" && dataSeries.length > RIBBON_CROWDED && warnings.push({
|
|
558
|
+
code: "ribbon-crowded",
|
|
559
|
+
severity: "warn",
|
|
560
|
+
message: `${dataSeries.length} series draw ribbons; above ${RIBBON_CROWDED} their crossings become hard to follow`,
|
|
561
|
+
suggest: `keep the ${RIBBON_CROWDED} largest series and fold the rest into one Others series upstream, or drop ribbons`
|
|
562
|
+
}), { ribbonsOn: !0, ribbonRank: order === "rank" };
|
|
563
|
+
}
|
|
564
|
+
function columnBasis(variant, cats, dataSeries, warnings, ranked = !1) {
|
|
565
|
+
let nmCats100 = /* @__PURE__ */ new Set(), naCats100 = /* @__PURE__ */ new Set(), mixedSignCats = /* @__PURE__ */ new Set(), basisByCat = cats.map((c, ci) => {
|
|
566
|
+
if (variant === "grouped") return 0;
|
|
567
|
+
let { basis, nm, na } = compositionBasis(dataSeries.map((s) => s.vals[ci]), c.total100);
|
|
568
|
+
return nm ? ((variant === "stacked100" ? nmCats100 : mixedSignCats).add(c.id), 0) : basis <= 0 && (variant === "stacked" || !na) ? 0 : basis <= 0 ? (naCats100.add(c.id), warnings.push({
|
|
569
|
+
code: "percent-basis-nonpositive",
|
|
570
|
+
severity: "warn",
|
|
571
|
+
message: `category '${c.id}': non-positive 100% basis \u2014 nothing to compose, category marked n/a`,
|
|
572
|
+
owner: { categoryId: c.id }
|
|
573
|
+
}), 0) : basis;
|
|
574
|
+
});
|
|
575
|
+
nmCats100.size > 0 && warnings.push(mixedSignsWarning([...nmCats100], cats.length));
|
|
576
|
+
let overfull = variant !== "stacked100" ? [] : cats.flatMap((c, ci) => {
|
|
577
|
+
if (nmCats100.has(c.id) || naCats100.has(c.id)) return [];
|
|
578
|
+
let sum = overfullShareSum(dataSeries.map((s) => s.vals[ci]), basisByCat[ci]);
|
|
579
|
+
return sum === void 0 ? [] : [{ id: c.id, sum }];
|
|
580
|
+
});
|
|
581
|
+
for (let row of overfull) nmCats100.add(row.id);
|
|
582
|
+
overfull.length > 0 && warnings.push(overfullWarning(overfull, nmCats100.size + naCats100.size === cats.length, "give every part as a share of the same whole, or use variant 'grouped' for shares that overlap, such as answers to a multi-select question"));
|
|
583
|
+
let plottedOf = (s, ci) => {
|
|
584
|
+
let val = s.vals[ci];
|
|
585
|
+
if (val.v === null) return null;
|
|
586
|
+
if (variant !== "stacked100") return val.v;
|
|
587
|
+
if (nmCats100.has(cats[ci].id)) return 0;
|
|
588
|
+
if (val.isPct) return val.v;
|
|
589
|
+
let b = basisByCat[ci];
|
|
590
|
+
return b > 0 ? val.v / b * 100 : 0;
|
|
591
|
+
}, rangeOf = (s, ci) => {
|
|
592
|
+
let val = s.vals[ci];
|
|
593
|
+
if (!val.range) return;
|
|
594
|
+
if (variant !== "stacked100" || val.isPct) return val.range;
|
|
595
|
+
let basis = basisByCat[ci];
|
|
596
|
+
if (basis <= 0) return;
|
|
597
|
+
let scale = (value) => value / basis * 100;
|
|
598
|
+
return {
|
|
599
|
+
low: scale(val.range.low),
|
|
600
|
+
high: scale(val.range.high),
|
|
601
|
+
...val.range.mid === void 0 ? {} : { mid: scale(val.range.mid) }
|
|
602
|
+
};
|
|
603
|
+
}, absOf = (s, ci) => {
|
|
604
|
+
let val = s.vals[ci];
|
|
605
|
+
if (val.v === null) return null;
|
|
606
|
+
if (!val.isPct || variant !== "stacked100") return val.v;
|
|
607
|
+
let b = basisByCat[ci];
|
|
608
|
+
return b > 0 ? val.v * b / 100 : null;
|
|
609
|
+
}, stacks = cats.map(
|
|
610
|
+
(_, ci) => accumulateStack(dataSeries.map((series) => plottedOf(series, ci)), ranked)
|
|
611
|
+
), stackTotals = {};
|
|
612
|
+
cats.forEach((c, ci) => {
|
|
613
|
+
stackTotals[c.id] = dataSeries.reduce((a, s) => a + (absOf(s, ci) ?? 0), 0);
|
|
614
|
+
});
|
|
615
|
+
let percents;
|
|
616
|
+
variant === "stacked100" && (percents = {}, cats.forEach((c, ci) => {
|
|
617
|
+
let row = {};
|
|
618
|
+
for (let s of dataSeries) {
|
|
619
|
+
let p = plottedOf(s, ci);
|
|
620
|
+
p !== null && (row[s.id] = p);
|
|
621
|
+
}
|
|
622
|
+
percents[c.id] = row;
|
|
623
|
+
}));
|
|
624
|
+
let emptyCats = new Set(variant === "grouped" ? [] : cats.filter((_, ci) => dataSeries.every((s) => s.vals[ci].v === null)).map((c) => c.id)), incompleteCats = new Set(variant === "grouped" ? [] : cats.filter((c, ci) => !emptyCats.has(c.id) && isIncomplete(dataSeries.map((s) => s.vals[ci].v))).map((c) => c.id));
|
|
625
|
+
return { nmCats100, naCats100, mixedSignCats, incompleteCats, emptyCats, plottedOf, rangeOf, absOf, shareOf: (s, ci) => {
|
|
626
|
+
let c = cats[ci];
|
|
627
|
+
if (basisByCat[ci] <= 0 || incompleteCats.has(c.id) && c.total100 === void 0) return null;
|
|
628
|
+
if (variant === "stacked100") return plottedOf(s, ci);
|
|
629
|
+
let val = s.vals[ci];
|
|
630
|
+
return val.v === null || val.isPct ? null : val.v / basisByCat[ci] * 100;
|
|
631
|
+
}, stacks, stackTotals, percents };
|
|
632
|
+
}
|
|
633
|
+
function integratedVarianceValues(pyRef, cats, dataSeries, stackTotals, stacks, roundedForDisplay, warnings, locale) {
|
|
634
|
+
let growthSpec = parseFormatExample("88.8%"), growthFormatter = formatterFromExample("88.8%", locale), integratedDirection = dataSeries.every(
|
|
635
|
+
(series) => series.direction === "lowerIsBetter"
|
|
636
|
+
) ? "lowerIsBetter" : "higherIsBetter", pyGrowth = /* @__PURE__ */ new Map(), partial = cats.filter((category, ci) => category.partial === !0 && stacks[ci].hasValue && pyRef.vals[ci].v !== null);
|
|
637
|
+
return partial.length > 0 && warnings.push({
|
|
638
|
+
code: "partial-period-comparison",
|
|
639
|
+
severity: "warn",
|
|
640
|
+
message: `the growth against '${pyRef.label}' of ${partial.map((c) => `'${c.label ?? c.id}'`).join(", ")} compares a partial period as if it were complete`,
|
|
641
|
+
owner: { seriesId: pyRef.id },
|
|
642
|
+
suggest: "give the reference the same partial span (month to date against the same days last year), or say in the title that the period is still running"
|
|
643
|
+
}), cats.forEach((category, ci) => {
|
|
644
|
+
let reference = pyRef.vals[ci].v;
|
|
645
|
+
if (!stacks[ci].hasValue || reference === null) return;
|
|
646
|
+
let current = stackTotals[category.id], displayedCurrent = roundedForDisplay(current), displayedReference = roundedForDisplay(reference), growthPct = displayedReference > 0 && reference > 0 ? (current / reference - 1) * 100 : null, displayedGrowthPct = growthPct === null ? null : roundedNumber(growthPct, growthSpec), tone = growthPct === null || growthPct === 0 ? "neutral" : growthPct > 0 == (integratedDirection === "higherIsBetter") ? "good" : "bad", text = growthPct === null || displayedGrowthPct === null ? "n.m." : `${growthPct > 0 ? "+" : growthPct < 0 ? "\u2212" : ""}${growthFormatter(Math.abs(displayedGrowthPct))}`;
|
|
647
|
+
if (pyGrowth.set(category.id, {
|
|
648
|
+
categoryId: category.id,
|
|
649
|
+
referenceSeriesId: pyRef.id,
|
|
650
|
+
current,
|
|
651
|
+
reference,
|
|
652
|
+
displayedCurrent,
|
|
653
|
+
displayedReference,
|
|
654
|
+
growthPct,
|
|
655
|
+
displayedGrowthPct,
|
|
656
|
+
tone,
|
|
657
|
+
text
|
|
658
|
+
}), displayedReference <= 0 && warnings.push({
|
|
659
|
+
code: "ref-nonpositive",
|
|
660
|
+
severity: "warn",
|
|
661
|
+
message: `category '${category.id}': displayed PY reference ${displayedReference} \u2264 0 \u2014 growth suppressed and marked n.m.`,
|
|
662
|
+
owner: { categoryId: category.id, seriesId: pyRef.id }
|
|
663
|
+
}), displayedGrowthPct !== null && displayedReference > 0) {
|
|
664
|
+
let fromPrintedTotals = roundedNumber(
|
|
665
|
+
(displayedCurrent / displayedReference - 1) * 100,
|
|
666
|
+
growthSpec
|
|
667
|
+
);
|
|
668
|
+
fromPrintedTotals !== displayedGrowthPct && warnings.push({
|
|
669
|
+
code: "integrated-growth-rounding-gap",
|
|
670
|
+
severity: "info",
|
|
671
|
+
message: `category '${category.id}': growth ${growthFormatter(displayedGrowthPct)} is computed from the unrounded totals; dividing the printed ${displayedCurrent} by the printed ${displayedReference} gives ${growthFormatter(fromPrintedTotals)}`,
|
|
672
|
+
owner: { categoryId: category.id, seriesId: pyRef.id }
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
}), pyGrowth;
|
|
676
|
+
}
|
|
677
|
+
function columnValueDomain(va, variant, cats, dataSeries, refSeries, plottedOf, rangeOf, stacks, lineExtent, warnings) {
|
|
678
|
+
let stackedLike = variant !== "grouped", rendered = [], posTopP = [], negBotP = [], lo = Math.min(0, lineExtent?.lo ?? 0), hi = Math.max(0, lineExtent?.hi ?? 0);
|
|
679
|
+
if (cats.forEach((_, ci) => {
|
|
680
|
+
let stack = stacks[ci], p = stackedLike ? stack.positive : 0, n = stackedLike ? stack.negative : 0;
|
|
681
|
+
for (let si = 0; si < dataSeries.length; si++) {
|
|
682
|
+
let s = dataSeries[si], v = plottedOf(s, ci);
|
|
683
|
+
if (v === null) continue;
|
|
684
|
+
let start = stackedLike ? stack.segments[si].start : 0, range = rangeOf(s, ci);
|
|
685
|
+
rendered.push(stackedLike ? stack.segments[si].end : v), range && (lo = Math.min(lo, start + range.low, start + range.high), hi = Math.max(hi, start + range.low, start + range.high), rendered.push(start + range.low, start + range.high), range.mid !== void 0 && rendered.push(start + range.mid)), stackedLike || (p = Math.max(p, v), n = Math.min(n, v));
|
|
686
|
+
}
|
|
687
|
+
posTopP[ci] = p, negBotP[ci] = n, lo = Math.min(lo, n), hi = Math.max(hi, p);
|
|
688
|
+
}), variant !== "stacked100")
|
|
689
|
+
for (let s of refSeries)
|
|
690
|
+
cats.forEach((_, ci) => {
|
|
691
|
+
let v = plottedOf(s, ci);
|
|
692
|
+
v !== null && (rendered.push(v), lo = Math.min(lo, v), hi = Math.max(hi, v));
|
|
693
|
+
});
|
|
694
|
+
else
|
|
695
|
+
refSeries.some((s) => s.vals.some((val) => val.v !== null)) && warnings.push({
|
|
696
|
+
code: "reference-unsupported-stacked100",
|
|
697
|
+
severity: "warn",
|
|
698
|
+
message: "reference series omitted: a 100% axis shows composition, not level \u2014 show plan/PY targets on the absolute companion chart"
|
|
699
|
+
});
|
|
700
|
+
let dLo, dHi;
|
|
701
|
+
if (variant === "stacked100")
|
|
702
|
+
dLo = Math.min(0, lo), dHi = Math.max(100, hi);
|
|
703
|
+
else {
|
|
704
|
+
let lo2 = lo < 0 ? lo * 1.08 : 0, hi2 = hi > 0 ? hi * 1.08 : 0;
|
|
705
|
+
lo2 === 0 && hi2 === 0 && (hi2 = 1), [dLo, dHi] = niceDomain(lo2, hi2, 5, {
|
|
706
|
+
dataExtent: [lo, hi],
|
|
707
|
+
maxWasteFraction: 0.15
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
[dLo, dHi] = applyAxisBounds([dLo, dHi], [Math.min(lo, 0), Math.max(hi, 0)], va, warnings);
|
|
711
|
+
let step = va.tickStep;
|
|
712
|
+
if (step !== void 0 && step > 0) {
|
|
713
|
+
let from = Math.floor(dLo / step + 1e-9), to = Math.ceil(dHi / step - 1e-9);
|
|
714
|
+
if (to - from >= 1 && to - from <= 20) {
|
|
715
|
+
let stepTicks = Array.from({ length: to - from + 1 }, (_, i) => Number(((from + i) * step).toFixed(10)));
|
|
716
|
+
return { posTopP, negBotP, dLo: stepTicks[0], dHi: stepTicks.at(-1), stepTicks, rendered };
|
|
717
|
+
}
|
|
718
|
+
warnings.push({
|
|
719
|
+
code: "tick-step-ignored",
|
|
720
|
+
severity: "warn",
|
|
721
|
+
message: `valueAxis.tickStep ${step} would draw ${to - from} intervals over the value domain; the nice ticks are drawn instead`,
|
|
722
|
+
suggest: "pick a step that gives 1 to 20 intervals"
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
return { posTopP, negBotP, dLo, dHi, rendered };
|
|
726
|
+
}
|
|
727
|
+
function columnAxisBreak(options, anomaly, renderedBreakValues, meanValue, averageMark, corridorShown, dLo, dHi, warnings) {
|
|
728
|
+
let va = options.valueAxis ?? {}, drawnBy = /* @__PURE__ */ new Map(), add = (value, cause) => {
|
|
729
|
+
renderedBreakValues.push(value), drawnBy.has(value) || drawnBy.set(value, cause);
|
|
730
|
+
};
|
|
731
|
+
for (let annotation of options.annotations ?? [])
|
|
732
|
+
if (annotation.kind === "valueLine") {
|
|
733
|
+
let value = annotation.value === void 0 || annotation.value === "mean" ? meanValue : annotation.value;
|
|
734
|
+
value !== void 0 && add(value, typeof annotation.value == "number" ? "the valueLine annotation" : "the valueLine annotation (its default value is the mean)");
|
|
735
|
+
} else annotation.kind === "indicator100" && add(100, "the indicator100 annotation");
|
|
736
|
+
if (averageMark !== void 0 && add(averageMark, "options.averageMarker"), corridorShown.low && anomaly?.corridor?.low != null && add(anomaly.corridor.low, "the options.anomaly corridor"), corridorShown.high && anomaly?.corridor?.high != null && add(anomaly.corridor.high, "the options.anomaly corridor"), va.break && anomaly)
|
|
737
|
+
warnings.push({
|
|
738
|
+
code: "anomaly-axis-break-ignored",
|
|
739
|
+
severity: "warn",
|
|
740
|
+
message: "valueAxis.break dropped: a deviation corridor cannot be read across a broken value axis",
|
|
741
|
+
suggest: "drop valueAxis.break, or drop options.anomaly and keep the break"
|
|
742
|
+
});
|
|
743
|
+
else if (va.break) {
|
|
744
|
+
let reason = breakStyleRefusal(va.break) ?? invalidLinearBreakReason([dLo, dHi], va.break, renderedBreakValues, (value) => drawnBy.get(value));
|
|
745
|
+
if (reason) warnings.push(axisBreakInvalid("column", reason));
|
|
746
|
+
else return { from: va.break.from, to: va.break.to };
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
function columnAnnotationList(options, variant, averageMark, statFmt, span) {
|
|
750
|
+
let annList = options.annotations ?? [];
|
|
751
|
+
if (averageMark !== void 0) {
|
|
752
|
+
let side = options[VALUE_LINE_RESERVE] ? "right" : "left";
|
|
753
|
+
annList = [...annList, { ...averageMarkerLine(annList, averageMark, statFmt, span, options.strings?.average), side }];
|
|
754
|
+
}
|
|
755
|
+
return variant === "stacked100" && kindSetting(options, "percentIndicator") !== !1 && options.valueAxis?.show !== !0 && !annList.some((a) => a.kind === "indicator100") && (annList = [
|
|
756
|
+
...annList,
|
|
757
|
+
{ kind: "indicator100", side: "right", id: "indicator100-auto", priority: PRIORITY.endpoint }
|
|
758
|
+
]), annList;
|
|
759
|
+
}
|
|
760
|
+
function resolveColumnDomain(data, options, warnings) {
|
|
761
|
+
let env = resolveColumnEnv(options, warnings), normalized = normalizeColumnData(data, warnings), { seriesNorm } = normalized, variant = options.valueAxis?.percent ? "stacked100" : options.variant ?? "grouped", valueSpec = rasterFormatter(options.format, seriesNorm.map((s) => [s.id, s.vals.map((val) => val.v), s.vals.map((val) => val.range ? [val.range.low, val.range.high, val.range.mid] : null)]), options.locale?.language, options.unit, options.target, variant !== "grouped"), fmt = valueSpec.fmt, statFmt = (v) => formatStatWithSpec(v, valueSpec.spec), plotted = seriesNorm.filter((s) => s.role !== "reference"), refSeries = seriesNorm.filter((s) => s.role === "reference");
|
|
762
|
+
if (plotted.length === 0)
|
|
763
|
+
throw new NormalizeError("empty-data", "series", "column requires at least one data-role series");
|
|
764
|
+
let signColor = options.signColor === !0;
|
|
765
|
+
refuseColumnEncodings(variant, signColor, options.anomaly, plotted);
|
|
766
|
+
let pctLevels = percentLevels(plotted), { cats, dataSeries, othersId } = orderColumnCategories(options, normalized.cats, seriesNorm, plotted, warnings), stackedLike = variant !== "grouped", { pyRef, uniformScenario } = columnScenarios(options, variant, cats, dataSeries, refSeries, warnings), lines = columnLines(options, stackedLike, dataSeries, warnings, cats.some((cat) => cat.total100 !== void 0)), va = options.valueAxis ?? {}, viewportOn = options.window !== void 0 || options.viewDomain !== void 0;
|
|
767
|
+
viewportOn && refuseUnorderedViewport(options, othersId);
|
|
768
|
+
let ribbons = columnRibbons(options, variant, stackedLike, dataSeries, warnings), computedTotal = variant === "stacked100" ? weightedTotal(cats, dataSeries, warnings) : void 0, ranked = ribbons.ribbonsOn && ribbons.ribbonRank, source = columnBasis(variant, cats, dataSeries, viewportOn ? [] : warnings, ranked), anomaly, anomalyValues = [];
|
|
769
|
+
options.anomaly && ({ anomaly, values: anomalyValues } = columnAnomalyModel(options.anomaly, cats, dataSeries[0], source.absOf, fmt, statFmt, options.locale?.language, warnings, options.strings));
|
|
770
|
+
let addsOver = (series) => !stackedLike || stackAdds(series.map((s) => ({ label: s.label, unit: s.unit, pctCells: s.vals.some((val) => val.isPct) })), options.unit, options.sharesOfOneWhole), partsAdd = addsOver(dataSeries), meanValue = partsAdd ? plottedMean("all", stackedLike, cats.length, dataSeries, (series, _, ci) => source.plottedOf(series, ci)) : void 0, averageMarkerScope = typeof options.averageMarker == "object" ? options.averageMarker.scope : "all", averageMarkerRequested = options.averageMarker !== void 0 && options.averageMarker !== !1 && !averageOfWholeShares(variant, averageMarkerScope, warnings) && !averageOfUnaddedSums(addsOver(averageMarkerScope === "all" ? dataSeries : dataSeries.filter((s) => averageMarkerScope.includes(s.id))), warnings), averageMark = averageMarkerRequested ? plottedMean(averageMarkerScope, stackedLike, cats.length, dataSeries, (series, _, ci) => source.plottedOf(series, ci)) : void 0;
|
|
771
|
+
averageMarkerRequested && averageMark === void 0 && warnings.push({
|
|
772
|
+
code: "average-marker-empty",
|
|
773
|
+
severity: "warn",
|
|
774
|
+
message: "averageMarker scope has no plotted values; marker omitted"
|
|
775
|
+
});
|
|
776
|
+
let population = viewportOn ? applyCategoryViewport({
|
|
777
|
+
domain: options.viewDomain,
|
|
778
|
+
window: options.window,
|
|
779
|
+
categories: cats,
|
|
780
|
+
series: seriesNorm,
|
|
781
|
+
plotted: [],
|
|
782
|
+
basis: [],
|
|
783
|
+
targets: [],
|
|
784
|
+
annotations: options.annotations
|
|
785
|
+
}) : void 0;
|
|
786
|
+
population && (options = liveWindowOptions({ ...options, annotations: population.annotations }, population.sampling));
|
|
787
|
+
let meanSpan = viewportMeanSpan(population), basis = population ? columnBasis(variant, cats, dataSeries, warnings, ranked) : source, pyGrowth = pyRef ? integratedVarianceValues(pyRef, cats, dataSeries, basis.stackTotals, basis.stacks, (value) => roundedNumber(value, valueSpec.spec), warnings, options.locale?.language) : /* @__PURE__ */ new Map(), lineExtent = valueLineExtent(options.annotations), { rendered, ...extent } = columnValueDomain(va, variant, cats, dataSeries, refSeries, basis.plottedOf, basis.rangeOf, basis.stacks, lineExtent, warnings), corridor = anomalyCorridor(anomaly, anomalyValues, extent.dLo, extent.dHi, statFmt, warnings, options.strings), grandTotalsRequested = grandTotalRequested(options.grandTotalLabels, variant, warnings, partsAdd), gtContent = grandTotalsRequested ? contentOf(options, "grandTotal", ["absolute"]) : null;
|
|
788
|
+
options.grandTotalLabels === !0 && options.labels === !1 && grandTotalsRequested && warnings.push({
|
|
789
|
+
code: "grand-total-labels-off",
|
|
790
|
+
severity: "warn",
|
|
791
|
+
message: "grandTotalLabels is true, but labels: false turns the grand totals off. Use a labels setting that leaves grand totals on: omit labels, or set labels to an object that does not set grandTotal to false.",
|
|
792
|
+
suggest: "Omit labels, or set labels.grandTotal to true and turn other label kinds off by name."
|
|
793
|
+
});
|
|
794
|
+
let sharesOn = variant === "stacked100" && contentOf(options, "segment", ["percent"])?.includes("percent") === !0;
|
|
795
|
+
warnIncompleteStacks(variant, cats, basis.incompleteCats, gtContent !== null, sharesOn, "columns", warnings, disclosuresShown(options));
|
|
796
|
+
let shareSet = shareSetFormatter(cats.flatMap((_, ci) => dataSeries.flatMap((s) => s.vals[ci].isPct ? [] : basis.shareOf(s, ci) ?? [])), options.locale?.language), wholes = sharesOn ? cats.flatMap((c, ci) => basis.nmCats100.has(c.id) || basis.naCats100.has(c.id) || basis.incompleteCats.has(c.id) || c.total100 !== void 0 || dataSeries.some((s) => s.vals[ci].isPct) ? [] : [{ c, parts: dataSeries.flatMap((s) => {
|
|
797
|
+
let share = basis.plottedOf(s, ci);
|
|
798
|
+
return share === null ? [] : [{ s, share }];
|
|
799
|
+
}) }]) : [], shareTexts = /* @__PURE__ */ new Map(), roundingAdjustments = [];
|
|
800
|
+
if (options.rounding !== "nearest") {
|
|
801
|
+
let spec = options.shareLabels?.format ? parseFormatExample(options.shareLabels.format) : void 0;
|
|
802
|
+
for (let { c, parts } of wholes) {
|
|
803
|
+
let rounded = sumConsistentShares(parts.map((part) => part.share), options.locale?.language, spec && withChartMarks(spec, options.locale?.language), shareSet.decimals);
|
|
804
|
+
rounded?.warning ? warnings.push(roundingUnavailable(c.label ?? c.id, rounded.warning)) : rounded && parts.forEach((part, index) => {
|
|
805
|
+
shareTexts.set(shareKey(c.id, part.s.id), rounded.texts[index]), rounded.moved[index] && roundingAdjustments.push({
|
|
806
|
+
whole: c.label ?? c.id,
|
|
807
|
+
part: part.s.label,
|
|
808
|
+
share: Math.round(part.share * 1e4) / 1e4,
|
|
809
|
+
nearest: spec ? formatWithSpec(part.share, withChartMarks(spec, options.locale?.language)) : shareSet.format(part.share),
|
|
810
|
+
printed: rounded.texts[index]
|
|
811
|
+
});
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
} else sharesOn && warnShareRoundingDrift(warnings, wholes.map(({ c, parts }) => ({ name: c.label ?? c.id, shares: parts.map((part) => part.share), decimals: shareSet.decimals })));
|
|
815
|
+
let activeBreak = columnAxisBreak(options, anomaly, rendered, meanValue, averageMark, corridor.corridorShown, extent.dLo, extent.dHi, warnings), { stepTicks, ...span } = extent, checked = activeBreak, stepAcross = !stepTicks || !checked || stepTicks.filter((v) => v < checked.from).length >= 2 && stepTicks.filter((v) => v > checked.to).length >= 2;
|
|
816
|
+
if (!stepAcross) {
|
|
817
|
+
warnings.push({
|
|
818
|
+
code: "tick-step-ignored",
|
|
819
|
+
severity: "warn",
|
|
820
|
+
message: `valueAxis.tickStep ${va.tickStep} leaves one side of the axis break with only its end tick; the break's own ticks are drawn instead`,
|
|
821
|
+
suggest: "pick a smaller tickStep, or drop the axis break",
|
|
822
|
+
field: ["options", "valueAxis", "tickStep"]
|
|
823
|
+
});
|
|
824
|
+
let { tickStep: _rejected, ...nice } = va, { rendered: niceRendered, ...niceExtent } = columnValueDomain(nice, variant, cats, dataSeries, refSeries, basis.plottedOf, basis.rangeOf, basis.stacks, lineExtent, []);
|
|
825
|
+
({ stepTicks, ...span } = niceExtent);
|
|
826
|
+
let checks = [];
|
|
827
|
+
activeBreak = columnAxisBreak(options, anomaly, niceRendered, meanValue, averageMark, corridor.corridorShown, span.dLo, span.dHi, checks), warnings.push(...checks.map((warning) => warning.code === "axis-break-invalid" ? { ...warning, severity: "warn", message: `${warning.message}; the chart is drawn without the break` } : warning));
|
|
828
|
+
}
|
|
829
|
+
return {
|
|
830
|
+
// The shares print at the chart's one precision ("9%" beside "50%"), unless shareLabels.format sets one.
|
|
831
|
+
...env,
|
|
832
|
+
...options.shareLabels?.format ? {} : { pctFmt: shareSet.format },
|
|
833
|
+
shareTexts,
|
|
834
|
+
roundingAdjustments,
|
|
835
|
+
options,
|
|
836
|
+
cats,
|
|
837
|
+
seriesNorm,
|
|
838
|
+
dataSeries,
|
|
839
|
+
refSeries,
|
|
840
|
+
othersId,
|
|
841
|
+
valueSpec,
|
|
842
|
+
fmt,
|
|
843
|
+
totalFmt: stackTotalFormatter(variant, valueSpec.spec, fmt),
|
|
844
|
+
statFmt,
|
|
845
|
+
variant,
|
|
846
|
+
refStyle: options.referenceStyle ?? "tick",
|
|
847
|
+
signColor,
|
|
848
|
+
pyRef,
|
|
849
|
+
pyGrowth,
|
|
850
|
+
uniformScenario,
|
|
851
|
+
pctLevels,
|
|
852
|
+
...lines,
|
|
853
|
+
...ribbons,
|
|
854
|
+
computedTotal,
|
|
855
|
+
va,
|
|
856
|
+
...basis,
|
|
857
|
+
anomaly,
|
|
858
|
+
...span,
|
|
859
|
+
...stepTicks && stepAcross ? { stepTicks } : {},
|
|
860
|
+
meanValue,
|
|
861
|
+
averageMark,
|
|
862
|
+
meanSpan,
|
|
863
|
+
...corridor,
|
|
864
|
+
activeBreak,
|
|
865
|
+
gtContent,
|
|
866
|
+
partsAdd,
|
|
867
|
+
...partsAdd ? {} : { meanMissing: NO_STACK_MEAN },
|
|
868
|
+
annList: columnAnnotationList(options, variant, averageMark, !options.format && (variant === "stacked100" || options.unit === "%" || pctLevels) ? (v) => formatStatWithSpec(v, { ...valueSpec.spec, suffix: "%" }) : statFmt, meanSpan()),
|
|
869
|
+
seriesCagr: stackedLike ? seriesCagrs(options, cats, dataSeries, basis.absOf, warnings) : /* @__PURE__ */ new Map()
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
function seriesCagrs(options, cats, dataSeries, absOf, warnings) {
|
|
873
|
+
let out = /* @__PURE__ */ new Map(), asked = options.seriesLabels?.cagr;
|
|
874
|
+
if (!asked) return out;
|
|
875
|
+
let span = asked === !0 ? {} : asked, warn = (code, message, suggest) => warnings.push({ code, severity: "warn", message, suggest }), fi = span.from === void 0 ? 0 : cats.findIndex((c) => c.id === span.from), ti = span.to === void 0 ? cats.length - 1 : cats.findIndex((c) => c.id === span.to);
|
|
876
|
+
if (fi < 0 || ti < 0)
|
|
877
|
+
return warn("series-cagr-no-span", `seriesLabels.cagr names a category that is not in the data: '${fi < 0 ? span.from : span.to}'; no series CAGR is printed`, "use category ids for from and to"), out;
|
|
878
|
+
let from = cats[fi], to = cats[ti], years = yearSpan(from.date, to.date) ?? yearSpanFromLabels(from.label, to.label);
|
|
879
|
+
if (from.partial || to.partial || years === null || years <= 0)
|
|
880
|
+
return warn(
|
|
881
|
+
"series-cagr-no-span",
|
|
882
|
+
`seriesLabels.cagr from '${from.label ?? from.id}' to '${to.label ?? to.id}' ${from.partial || to.partial ? "ends on a partial period" : "spans no measured years"}; no series CAGR is printed`,
|
|
883
|
+
"give the categories ISO dates or year-bearing labels, and anchor the span on complete periods"
|
|
884
|
+
), out;
|
|
885
|
+
let spec = typeof span == "object" && span.format !== void 0 ? withChartMarks({ ...parseFormatExample(span.format), signed: !0 }, options.locale?.language) : void 0, only = options.seriesLabels?.only === void 0 ? void 0 : new Set(options.seriesLabels.only);
|
|
886
|
+
for (let s of dataSeries) {
|
|
887
|
+
if (only && !only.has(s.id)) continue;
|
|
888
|
+
let a = absOf(s, fi), b = absOf(s, ti), rate = a === null || b === null ? null : cagr(a, b, years);
|
|
889
|
+
if (rate === null) {
|
|
890
|
+
warn("series-cagr-undefined", `'${s.label}' has no CAGR from '${from.label ?? from.id}' to '${to.label ?? to.id}': a missing value, a start at or below zero or a negative end; its name prints alone`, "label the growth of this series in the text, or leave it out of seriesLabels.only");
|
|
891
|
+
continue;
|
|
892
|
+
}
|
|
893
|
+
let period = fi !== 0 || ti !== cats.length - 1 ? ` ${from.label ?? from.id}\u2013${to.label ?? to.id}:` : "", text = `${s.label}${period} ${spec ? formatWithSpec(rate, spec) : formatAutomaticPercent(rate, 1, !0, options.locale?.language)} p.a.`, ref = (end, category) => `${end}:categoryId=${category.id}/seriesId=${s.id}`;
|
|
894
|
+
out.set(s.id, {
|
|
895
|
+
text,
|
|
896
|
+
placed: {
|
|
897
|
+
id: `seriesCagr:${s.id}`,
|
|
898
|
+
kind: "cagr",
|
|
899
|
+
computedText: text,
|
|
900
|
+
nodeIds: [],
|
|
901
|
+
labelId: `seriesEdge:${s.id}`,
|
|
902
|
+
derivation: {
|
|
903
|
+
basis: "derived",
|
|
904
|
+
op: "annotation-cagr@1",
|
|
905
|
+
inputs: [
|
|
906
|
+
{ ref: ref("from", from), value: a },
|
|
907
|
+
{ ref: ref("to", to), value: b },
|
|
908
|
+
{ ref: "years", value: years, state: `${from.date ?? from.label ?? from.id} \u2192 ${to.date ?? to.label ?? to.id}` }
|
|
909
|
+
],
|
|
910
|
+
raw: rate
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
return out;
|
|
916
|
+
}
|
|
917
|
+
function refuseUnorderedViewport(options, othersId) {
|
|
918
|
+
let sorted = options.sort?.categories !== void 0 && options.sort.categories !== "sheet";
|
|
919
|
+
if (!sorted && othersId === null && !options.topN) return;
|
|
920
|
+
let field = options.window !== void 0 ? "options.window" : "options.viewDomain";
|
|
921
|
+
throw new NormalizeError(
|
|
922
|
+
"viewport-unordered",
|
|
923
|
+
field,
|
|
924
|
+
`${field.slice(8)} keeps a span of periods in their own order; ${sorted ? `sort.categories '${options.sort.categories}'` : "topN"} reorders or folds the categories`,
|
|
925
|
+
`drop ${sorted ? "sort.categories" : "topN"}, or drop ${field.slice(8)}`
|
|
926
|
+
);
|
|
927
|
+
}
|
|
928
|
+
var rasterFormatters = /* @__PURE__ */ new Map();
|
|
929
|
+
function remembered(format) {
|
|
930
|
+
let texts = /* @__PURE__ */ new Map();
|
|
931
|
+
return (value) => {
|
|
932
|
+
let text = texts.get(value);
|
|
933
|
+
return text === void 0 && texts.set(value, text = format(value)), text;
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
function rasterFormatter(example, seriesValues, locale, unit, target, shared) {
|
|
937
|
+
let key = JSON.stringify([example, locale, unit, target, currentSmallValues(), seriesValues, shared]), known = rasterFormatters.get(key);
|
|
938
|
+
if (known) return known;
|
|
939
|
+
let made = seriesRasterFormatter(example, seriesValues.flatMap(([, values]) => values), locale, unit, target, void 0, shared), bySeries = /* @__PURE__ */ new Map(), formatter = {
|
|
940
|
+
...made,
|
|
941
|
+
fmt: remembered(made.fmt),
|
|
942
|
+
fmtSigned: remembered(made.fmtSigned),
|
|
943
|
+
fmtPercent: remembered(made.fmtPercent),
|
|
944
|
+
forSeries: (series, cellFormat) => {
|
|
945
|
+
let seriesKey = JSON.stringify([series.id, series.format, series.unit, cellFormat]), format = bySeries.get(seriesKey);
|
|
946
|
+
return format || bySeries.set(seriesKey, format = remembered(made.forSeries(series, cellFormat))), format;
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
return rasterFormatters.size >= 64 && rasterFormatters.clear(), rasterFormatters.set(key, formatter), formatter;
|
|
950
|
+
}
|
|
951
|
+
var RIGHT_EDGE_GAP = 8;
|
|
952
|
+
function edgeNameFont(labelFont, domain) {
|
|
953
|
+
return domain.variant === "stacked100" ? { ...labelFont, weight: headingWeight(domain.theme) } : labelFont;
|
|
954
|
+
}
|
|
955
|
+
function rightEdgeSeriesLabels(domain) {
|
|
956
|
+
return edgePlan(domain).names;
|
|
957
|
+
}
|
|
958
|
+
function edgeNamesReplaceKey(domain) {
|
|
959
|
+
return edgePlan(domain).replaceKey;
|
|
960
|
+
}
|
|
961
|
+
var KEY_EDGE_SERIES = /* @__PURE__ */ Symbol("keyEdgeSeries"), edgePlans = /* @__PURE__ */ new WeakMap();
|
|
962
|
+
function edgePlan(domain) {
|
|
963
|
+
let plan = edgePlans.get(domain);
|
|
964
|
+
return plan || edgePlans.set(domain, plan = planEdgeNames(domain)), plan;
|
|
965
|
+
}
|
|
966
|
+
function planEdgeNames(domain) {
|
|
967
|
+
let { options } = domain, authored = options.seriesLabels;
|
|
968
|
+
if (authored === void 0 || domain.variant === "grouped") return { names: [], replaceKey: !1 };
|
|
969
|
+
let only = authored.only === void 0 ? void 0 : new Set(authored.only), names = domain.dataSeries.filter((series) => only === void 0 || only.has(series.id)).map((series) => ({ id: series.id, label: domain.seriesCagr.get(series.id)?.text ?? series.label }));
|
|
970
|
+
if (!(options.legend !== void 0 && options.legend !== "none" && panelTypeClass(options) === void 0 && options[KEY_EDGE_SERIES] !== !0) || names.length === 0 || names.length < domain.dataSeries.length) return { names, replaceKey: !1 };
|
|
971
|
+
let { theme, measure, size } = domain, labelFont = edgeNameFont({ family: theme.type.family, ...theme.type.label }, domain), gutter = maxOf(names.map((series) => measure(series.label, labelFont).width)) + RIGHT_EDGE_GAP, margin = { ...canvasMargin(theme, size.width), ...options.margin }, axis = domain.va.show ? measureValueAxisWidth([domain.dLo, domain.dHi], domain.fmt, theme, measure, 5, domain.valueSpec.spec, domain.stepTicks) : 0, step = (size.width - margin.left - margin.right - axis) / Math.max(1, domain.cats.length);
|
|
972
|
+
return gutter <= step ? { names, replaceKey: !0 } : { names: [], replaceKey: !1 };
|
|
973
|
+
}
|
|
974
|
+
function shareKey(categoryId, seriesId) {
|
|
975
|
+
return `${categoryId}\0${seriesId}`;
|
|
976
|
+
}
|
|
977
|
+
function shareTextOf(domain, categoryId, seriesId, pct, authored) {
|
|
978
|
+
return authored ? domain.authoredPctFmt(pct) : domain.shareTexts.get(shareKey(categoryId, seriesId)) ?? domain.pctFmt(pct);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
// src/core/charts/column/marks.ts
|
|
982
|
+
function segmentHatchGround(part, pattern, fill) {
|
|
983
|
+
if (!(part !== "segment" && part !== "bar" || pattern !== "hatch45"))
|
|
984
|
+
return hatchGroundPaint(fill);
|
|
985
|
+
}
|
|
986
|
+
function columnRibbons2(domain, paints, area, nodes) {
|
|
987
|
+
let { cats, dataSeries, stacks, theme } = domain, { band, y } = area, surface = resolveSurface(theme), opacity = domain.ribbonRank ? surface.ribbonAlpha : surface.ribbonSheetAlpha, fills = [], edges = [], out = [];
|
|
988
|
+
for (let ci = 0; ci < cats.length - 1; ci++) {
|
|
989
|
+
let left = cats[ci], right = cats[ci + 1];
|
|
990
|
+
if (left.breakAfter || left.gapAfter !== void 0 && left.gapAfter !== !1 && left.gapAfter !== 0 || right.role === "total") continue;
|
|
991
|
+
let x1 = band.position(ci) + band.bandwidth, x2 = band.position(ci + 1);
|
|
992
|
+
dataSeries.forEach((s, si) => {
|
|
993
|
+
let a = stacks[ci].segments[si], b = stacks[ci + 1].segments[si];
|
|
994
|
+
if (!a || !b || a.value === 0 || b.value === 0 || Math.sign(a.value) !== Math.sign(b.value)) return;
|
|
995
|
+
let top1 = y(Math.max(a.start, a.end)), bottom1 = y(Math.min(a.start, a.end)), top2 = y(Math.max(b.start, b.end)), bottom2 = y(Math.min(b.start, b.end)), owner = { seriesId: s.id, categoryId: left.id }, id = `ribbon:${left.id}:${right.id}:${s.id}`;
|
|
996
|
+
fills.push({
|
|
997
|
+
t: "path",
|
|
998
|
+
id,
|
|
999
|
+
d: ribbonPath(x1, top1, bottom1, x2, top2, bottom2, !1, domain.ribbonRank),
|
|
1000
|
+
fill: paints.cell(s, s.vals[ci], left, si),
|
|
1001
|
+
opacity,
|
|
1002
|
+
owner,
|
|
1003
|
+
part: "ribbon"
|
|
1004
|
+
}), edges.push({
|
|
1005
|
+
t: "path",
|
|
1006
|
+
id: `${id}:edge`,
|
|
1007
|
+
d: ribbonPath(x1, top1, bottom1, x2, top2, bottom2, !0, domain.ribbonRank),
|
|
1008
|
+
stroke: { token: "background" },
|
|
1009
|
+
width: strokeToken(theme, "hair"),
|
|
1010
|
+
owner,
|
|
1011
|
+
part: "ribbonEdge"
|
|
1012
|
+
}), out.push({ seriesId: s.id, from: left.id, to: right.id, left: { x: x1, top: top1, bottom: bottom1 }, right: { x: x2, top: top2, bottom: bottom2 }, nodeId: id });
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
return pushAll(nodes, fills), pushAll(nodes, edges), out;
|
|
1016
|
+
}
|
|
1017
|
+
function flagMarkerAt(domain, paints, area, rect, value, insidePaint, insidePattern) {
|
|
1018
|
+
let { plot } = area.frame, insideFill = effectiveFill(paints.css(insidePaint), insidePattern, domain.theme), up = value >= 0, base = up ? rect.y - ANOMALY_FLAG_GAP : rect.y + rect.h + ANOMALY_FLAG_GAP, tip = up ? base - ANOMALY_FLAG_H : base + ANOMALY_FLAG_H, outside = !0;
|
|
1019
|
+
return (up ? tip < plot.y : tip > plot.y + plot.h) && (outside = !1, base = up ? rect.y + ANOMALY_FLAG_GAP + ANOMALY_FLAG_H : rect.y + rect.h - ANOMALY_FLAG_GAP - ANOMALY_FLAG_H, tip = up ? rect.y + ANOMALY_FLAG_GAP : rect.y + rect.h - ANOMALY_FLAG_GAP), {
|
|
1020
|
+
cx: rect.x + rect.w / 2,
|
|
1021
|
+
base,
|
|
1022
|
+
tip,
|
|
1023
|
+
up,
|
|
1024
|
+
outside,
|
|
1025
|
+
value,
|
|
1026
|
+
insideFill,
|
|
1027
|
+
insidePaint,
|
|
1028
|
+
...insidePattern ? { insidePattern } : {}
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
function columnBars(domain, paints, area, marks, nodes, claims) {
|
|
1032
|
+
let { cats, dataSeries, variant, plottedOf, rangeOf, absOf, valueSpec, anomaly, stacks } = domain, { band, y, y0 } = area, rangeMarks = [], rangeNodes = [], bars = [], subCenters = /* @__PURE__ */ new Map(), segEdges = /* @__PURE__ */ new Map(), flagMarkers = /* @__PURE__ */ new Map(), emit = (input) => emitBarMark({ axis: "y", theme: domain.theme, scale: y, activeBreak: domain.activeBreak, css: paints.css }, nodes, claims, input), queueRangeWhisker = (seriesId, categoryId, cx, markWidth, range, offset = 0) => {
|
|
1033
|
+
let whisker = rangeWhisker(domain.theme, { seriesId, categoryId, axis: "y", center: cx, markSize: markWidth, range, offset, scale: y, activeBreak: domain.activeBreak, fmt: domain.fmt });
|
|
1034
|
+
rangeNodes.push(...whisker.nodes);
|
|
1035
|
+
for (let claim of whisker.claims) claims.claim(claim.rect, claim.kind, claim.owner, claim.part);
|
|
1036
|
+
rangeMarks.push(whisker.mark);
|
|
1037
|
+
}, groupSlots = groupedOffsets(band.bandwidth, dataSeries.length);
|
|
1038
|
+
return cats.forEach((c, ci) => {
|
|
1039
|
+
let bx = band.position(ci), bw = band.bandwidth, stack = stacks[ci], segs = [];
|
|
1040
|
+
if (dataSeries.forEach((s, si) => {
|
|
1041
|
+
let val = s.vals[ci], owner = { seriesId: s.id, categoryId: c.id }, nodeId = `mark:${s.id}:${c.id}`;
|
|
1042
|
+
if (variant === "grouped") {
|
|
1043
|
+
let v2 = plottedOf(s, ci), group = groupSlots[si], subW = group.size, x = bx + group.offset;
|
|
1044
|
+
if (subCenters.set(sk(s.id, c.id), x + subW / 2), v2 === null) return;
|
|
1045
|
+
let yv = y(v2), rect2 = { x, y: Math.min(yv, y0), w: subW, h: Math.max(Math.abs(yv - y0), 0.5) }, fill = paints.cell(s, val, c, si), pattern = paints.pattern(s, val, c);
|
|
1046
|
+
emit({
|
|
1047
|
+
nodeId,
|
|
1048
|
+
rect: rect2,
|
|
1049
|
+
start: 0,
|
|
1050
|
+
end: v2,
|
|
1051
|
+
fill,
|
|
1052
|
+
pattern,
|
|
1053
|
+
outline: paints.outline(c),
|
|
1054
|
+
owner,
|
|
1055
|
+
part: "bar",
|
|
1056
|
+
displayValue: valueSpec.forSeries(s, s.vals[ci]?.format)(absOf(s, ci)),
|
|
1057
|
+
...anomaly?.flagByCategory.has(c.id) ? { displayState: "flagged" } : {}
|
|
1058
|
+
}), marks.bars.push({ seriesId: s.id, categoryId: c.id, rect: rect2, nodeId });
|
|
1059
|
+
let flagHere = anomaly?.flagByCategory.get(c.id);
|
|
1060
|
+
flagHere && flagMarkers.set(c.id, flagMarkerAt(domain, paints, area, rect2, flagHere.value, fill, pattern));
|
|
1061
|
+
let range2 = rangeOf(s, ci);
|
|
1062
|
+
range2 && queueRangeWhisker(s.id, c.id, x + subW / 2, subW, range2), bars.push({ s, si, c, ci, v: v2, rect: rect2 });
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
let segment = stack.segments[si];
|
|
1066
|
+
if (!segment) return;
|
|
1067
|
+
let { value: v, start: v0, end: v1 } = segment;
|
|
1068
|
+
segEdges.set(sk(s.id, c.id), { v0, v1, v });
|
|
1069
|
+
let range = rangeOf(s, ci);
|
|
1070
|
+
if (range && queueRangeWhisker(s.id, c.id, bx + bw / 2, bw, range, v0), v === 0) {
|
|
1071
|
+
typeof val.labelOverride == "string" && bars.push({ s, si, c, ci, v, rect: { x: bx, y: y(v0), w: bw, h: 0 } });
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
let rect = { x: bx, y: y(Math.max(v0, v1)), w: bw, h: Math.max(Math.abs(y(v0) - y(v1)), 0.5) };
|
|
1075
|
+
emit({
|
|
1076
|
+
nodeId,
|
|
1077
|
+
rect,
|
|
1078
|
+
start: v0,
|
|
1079
|
+
end: v1,
|
|
1080
|
+
fill: paints.cell(s, val, c, si),
|
|
1081
|
+
pattern: paints.pattern(s, val, c),
|
|
1082
|
+
outline: paints.outline(c),
|
|
1083
|
+
owner,
|
|
1084
|
+
part: "segment",
|
|
1085
|
+
displayValue: variant === "stacked100" ? shareTextOf(domain, c.id, s.id, v, val.isPct) : valueSpec.forSeries(s, s.vals[ci]?.format)(absOf(s, ci))
|
|
1086
|
+
}), segs.push({ seriesId: s.id, rect, nodeId }), bars.push({ s, si, c, ci, v, rect });
|
|
1087
|
+
}), variant === "grouped") return;
|
|
1088
|
+
let stackTop = y(stack.positive), stackBot = y(stack.negative);
|
|
1089
|
+
marks.bars.push({
|
|
1090
|
+
categoryId: c.id,
|
|
1091
|
+
rect: { x: bx, y: stackTop, w: bw, h: Math.max(stackBot - stackTop, 0.5) },
|
|
1092
|
+
segments: segs
|
|
1093
|
+
});
|
|
1094
|
+
}), { rangeMarks, rangeNodes, bars, subCenters, segEdges, flagMarkers };
|
|
1095
|
+
}
|
|
1096
|
+
function anomalyFurniture(domain, paints, area, flagMarkers, nodes, claims) {
|
|
1097
|
+
let { theme, measure, cats, corridorShown, statFmt } = domain, anomaly = domain.anomaly, { plot, y } = area;
|
|
1098
|
+
drawAnomalyRules(theme, {
|
|
1099
|
+
rules: anomalyRuleLines(theme, anomaly, corridorShown, statFmt, paints.corridor, domain.options.strings),
|
|
1100
|
+
statFmt,
|
|
1101
|
+
plot,
|
|
1102
|
+
y,
|
|
1103
|
+
labelX: plot.x + plot.w + 4,
|
|
1104
|
+
font: { family: theme.type.family, ...theme.type.label },
|
|
1105
|
+
measure,
|
|
1106
|
+
nodes,
|
|
1107
|
+
claims
|
|
1108
|
+
});
|
|
1109
|
+
let anomalyMarks = [], flagSeries = domain.dataSeries[0];
|
|
1110
|
+
return cats.forEach((c) => {
|
|
1111
|
+
let flag = anomaly.flagByCategory.get(c.id), geom = flagMarkers.get(c.id);
|
|
1112
|
+
if (!flag || !geom) return;
|
|
1113
|
+
let nodeId = `mark:${flagSeries.id}:${c.id}`, markerPaint = geom.outside ? paints.corridor : contrastInkPaint(geom.insidePaint, geom.insidePattern), markerNodeId = emitAnomalyFlag(nodes, claims, geom, markerPaint, { seriesId: flagSeries.id, categoryId: c.id }, domain.fmt(flag.value));
|
|
1114
|
+
anomalyMarks.push({
|
|
1115
|
+
categoryId: c.id,
|
|
1116
|
+
nodeId,
|
|
1117
|
+
markerNodeId,
|
|
1118
|
+
labelId: `point:${flagSeries.id}:${c.id}`,
|
|
1119
|
+
score: flag.score
|
|
1120
|
+
});
|
|
1121
|
+
}), anomalyMarks;
|
|
1122
|
+
}
|
|
1123
|
+
function referenceMarks(domain, paints, area, refTickYs, nodes, claims) {
|
|
1124
|
+
let { theme, measure, cats, refSeries, variant, plottedOf, refStyle, pyRef, pyGrowth, valueSpec } = domain, { band, y } = area, referenceTicks = [];
|
|
1125
|
+
if (variant === "stacked100")
|
|
1126
|
+
return cats.forEach((c, ci) => {
|
|
1127
|
+
let glyph = domain.nmCats100.has(c.id) ? NOT_MEANINGFUL : domain.naCats100.has(c.id) ? notApplicableGlyph(domain.options.strings) : null;
|
|
1128
|
+
if (!glyph) return;
|
|
1129
|
+
let font = { family: theme.type.family, ...theme.type.label }, size = measure(glyph, font), cx = band.center(ci), rect = { x: cx - size.width / 2, y: area.y0 - size.height - 6, w: size.width, h: size.height };
|
|
1130
|
+
nodes.push({
|
|
1131
|
+
t: "text",
|
|
1132
|
+
id: `nm:${c.id}`,
|
|
1133
|
+
x: cx,
|
|
1134
|
+
y: rect.y,
|
|
1135
|
+
lines: [glyph],
|
|
1136
|
+
align: "middle",
|
|
1137
|
+
typeRole: "label",
|
|
1138
|
+
font,
|
|
1139
|
+
ink: { token: "inkMuted" },
|
|
1140
|
+
owner: { categoryId: c.id },
|
|
1141
|
+
part: "nmMarker",
|
|
1142
|
+
display: { state: domain.nmCats100.has(c.id) ? NOT_MEANINGFUL : NOT_AVAILABLE }
|
|
1143
|
+
}), claims.claim(rect, "label", { categoryId: c.id });
|
|
1144
|
+
}), referenceTicks;
|
|
1145
|
+
let tickLabels = contentOf(domain.options, "tick", ["absolute", "series"]) !== null, outside = outsideTickReach(domain, band, 0) !== void 0;
|
|
1146
|
+
for (let s of refSeries)
|
|
1147
|
+
cats.forEach((c, ci) => {
|
|
1148
|
+
let v = plottedOf(s, ci);
|
|
1149
|
+
if (v === null) return;
|
|
1150
|
+
let ry = y(v);
|
|
1151
|
+
refStyle !== "marker" && refTickYs.set(c.id, [...refTickYs.get(c.id) ?? [], ry]);
|
|
1152
|
+
let bx = band.position(ci), bw = band.bandwidth, cx = band.center(ci), owner = { seriesId: s.id, categoryId: c.id }, nodeId = `ref:${s.id}:${c.id}`, integrated = pyRef?.id === s.id && pyGrowth.has(c.id), reach = outsideTickReach(domain, band, ci) ?? 8, out = integrated || outside && reach >= 4, tickGeometry = referenceTickGeometry("vertical", bx, ry, out ? bw : -2, bw + (integrated ? 8 : out ? reach : 2));
|
|
1153
|
+
refStyle === "marker" ? nodes.push({
|
|
1154
|
+
t: "circle",
|
|
1155
|
+
id: nodeId,
|
|
1156
|
+
cx: bx + bw / 2,
|
|
1157
|
+
cy: ry,
|
|
1158
|
+
...referenceMarkerPaint(theme, paints.ref(s)),
|
|
1159
|
+
owner,
|
|
1160
|
+
part: "referenceMarker",
|
|
1161
|
+
display: { value: valueSpec.forSeries(s, s.vals[ci]?.format)(v) }
|
|
1162
|
+
}) : (nodes.push(referenceCasing(nodeId, tickGeometry.line, strokeToken(theme, "rule"), owner)), nodes.push({
|
|
1163
|
+
t: "line",
|
|
1164
|
+
id: nodeId,
|
|
1165
|
+
...tickGeometry.line,
|
|
1166
|
+
// Plan ticks are quiet furniture: hairline in the axis token.
|
|
1167
|
+
// Explicit series fill/colorRole still wins; 'line' keeps its ink.
|
|
1168
|
+
stroke: paints.refStroke(s),
|
|
1169
|
+
width: strokeToken(theme, "rule"),
|
|
1170
|
+
...refStyle === "line" ? { dash: dashToken(theme, "dotted"), lineCap: "round" } : {},
|
|
1171
|
+
owner,
|
|
1172
|
+
part: refStyle === "tick" ? "referenceTick" : "referenceLine",
|
|
1173
|
+
display: { value: valueSpec.forSeries(s, s.vals[ci]?.format)(v) }
|
|
1174
|
+
}));
|
|
1175
|
+
let claimRect = integrated ? tickGeometry.claim : refStyle === "marker" ? { x: bx + bw / 2 - REFERENCE_MARKER_R - 1, y: ry - REFERENCE_MARKER_R - 1, w: 2 * REFERENCE_MARKER_R + 2, h: 2 * REFERENCE_MARKER_R + 2 } : tickGeometry.claim;
|
|
1176
|
+
integrated ? claims.claim(claimRect, "mark", owner, "referenceTick") : claims.claim(claimRect, "mark", owner, refStyle === "line" ? "referenceLine" : void 0);
|
|
1177
|
+
let labelId = integrated && tickLabels ? `tick:${s.id}:${c.id}` : void 0;
|
|
1178
|
+
referenceTicks.push({
|
|
1179
|
+
seriesId: s.id,
|
|
1180
|
+
categoryId: c.id,
|
|
1181
|
+
rect: claimRect,
|
|
1182
|
+
nodeId,
|
|
1183
|
+
...integrated ? { anchor: { x: cx, y: ry }, value: v } : {},
|
|
1184
|
+
...labelId ? { labelId } : {}
|
|
1185
|
+
});
|
|
1186
|
+
});
|
|
1187
|
+
return referenceTicks;
|
|
1188
|
+
}
|
|
1189
|
+
function netLineMarks(domain, area, nodes, claims) {
|
|
1190
|
+
let { cats, dataSeries, stacks, netLineSeries, netLineSteps, posTopP, negBotP } = domain, { band, y } = area, defaultEdge = posTopP.some((value) => value > 0) ? posTopP : negBotP, edgeValues = cats.map((_, ci) => {
|
|
1191
|
+
if (!netLineSeries) return defaultEdge[ci];
|
|
1192
|
+
let stack = stacks[ci];
|
|
1193
|
+
for (let si = 0; si < dataSeries.length; si++) {
|
|
1194
|
+
let series = dataSeries[si], segment = stack.segments[si];
|
|
1195
|
+
if (!segment) {
|
|
1196
|
+
if (series.id === netLineSeries.id) return;
|
|
1197
|
+
continue;
|
|
1198
|
+
}
|
|
1199
|
+
if (series.id === netLineSeries.id) return segment.end;
|
|
1200
|
+
}
|
|
1201
|
+
}), claimOwner = { annotationId: "netLine" }, line = (id, x1, y1, x2, y2, owner, claim) => {
|
|
1202
|
+
nodes.push({ t: "line", id, x1, y1, x2, y2, stroke: { token: "markInk" }, width: strokeToken(domain.theme, "rule"), owner, part: "netLine" }), claims.claim(claim, "mark", claimOwner, "netLine");
|
|
1203
|
+
};
|
|
1204
|
+
edgeValues.forEach((value, ci) => {
|
|
1205
|
+
if (value === void 0) return;
|
|
1206
|
+
let yy = y(value), x1 = band.position(ci), x2 = x1 + band.bandwidth, owner = {
|
|
1207
|
+
...netLineSeries ? { seriesId: netLineSeries.id } : {},
|
|
1208
|
+
categoryId: cats[ci].id
|
|
1209
|
+
};
|
|
1210
|
+
line(`netLine:${cats[ci].id}:edge`, x1, yy, x2, yy, owner, { x: x1, y: yy - 0.7, w: Math.max(x2 - x1, 1), h: 1.4 });
|
|
1211
|
+
let next = edgeValues[ci + 1];
|
|
1212
|
+
if (!netLineSteps || next === void 0 || cats[ci].breakAfter) return;
|
|
1213
|
+
let nextY = y(next), nextX = band.position(ci + 1), middleX = (x2 + nextX) / 2, pair = `netLine:${cats[ci].id}:${cats[ci + 1].id}`;
|
|
1214
|
+
line(`${pair}:connector-from`, x2, yy, middleX, yy, owner, { x: x2, y: yy - 0.7, w: Math.max(middleX - x2, 1), h: 1.4 }), line(`${pair}:step`, middleX, yy, middleX, nextY, owner, { x: middleX - 0.7, y: Math.min(yy, nextY), w: 1.4, h: Math.max(Math.abs(nextY - yy), 1) }), line(`${pair}:connector-to`, middleX, nextY, nextX, nextY, owner, { x: middleX, y: nextY - 0.7, w: Math.max(nextX - middleX, 1), h: 1.4 });
|
|
1215
|
+
});
|
|
1216
|
+
let last = edgeValues.length - 1;
|
|
1217
|
+
for (; last >= 0 && edgeValues[last] === void 0; ) last--;
|
|
1218
|
+
return last >= 0 ? { x: band.position(last) + band.bandwidth, y: y(edgeValues[last]) } : void 0;
|
|
1219
|
+
}
|
|
1220
|
+
function netInsideStack(domain, ci) {
|
|
1221
|
+
let c = domain.cats[ci];
|
|
1222
|
+
return domain.variant === "stacked" && domain.gtContent !== null && domain.mixedSignCats.has(c.id) && domain.stacks[ci].hasValue && !domain.incompleteCats.has(c.id) && !domain.pyGrowth.has(c.id);
|
|
1223
|
+
}
|
|
1224
|
+
function netTotalTicks(domain, area, nodes, claims, tickYs) {
|
|
1225
|
+
let { cats, stackTotals } = domain, { band, y } = area;
|
|
1226
|
+
cats.forEach((c, ci) => {
|
|
1227
|
+
if (!netInsideStack(domain, ci)) return;
|
|
1228
|
+
let yy = y(stackTotals[c.id]), x1 = band.position(ci) - 2, x2 = band.position(ci) + band.bandwidth + NET_TICK_REACH, owner = { categoryId: c.id, seriesId: "__netTotal" };
|
|
1229
|
+
nodes.push({ t: "line", id: `netTotal:${c.id}`, x1, y1: yy, x2, y2: yy, stroke: { token: "markInk" }, width: strokeToken(domain.theme, "rule"), owner, part: "netTotal" }), claims.claim({ x: x1, y: yy - 0.7, w: x2 - x1, h: 1.4 }, "mark", owner, "netTotal"), tickYs.set(c.id, [...tickYs.get(c.id) ?? [], yy]);
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
var NET_TICK_REACH = 6;
|
|
1233
|
+
function highlightBands(domain, area) {
|
|
1234
|
+
if (domain.dataSeries.length < 2) return [];
|
|
1235
|
+
let { band, plot } = area;
|
|
1236
|
+
return domain.cats.flatMap((c, ci) => {
|
|
1237
|
+
if (!domain.highlights.has(c.id)) return [];
|
|
1238
|
+
let pad = (band.step - band.bandwidth) / 2;
|
|
1239
|
+
return [{
|
|
1240
|
+
t: "rect",
|
|
1241
|
+
id: `highlightBand:${c.id}`,
|
|
1242
|
+
rect: { x: band.position(ci) - pad, y: plot.y, w: band.bandwidth + 2 * pad, h: plot.h },
|
|
1243
|
+
fill: { token: "focus", tint: 0.88 },
|
|
1244
|
+
owner: { categoryId: c.id },
|
|
1245
|
+
part: "highlightBand"
|
|
1246
|
+
}];
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
function layoutColumnMarks(domain, paints, area) {
|
|
1250
|
+
let { theme, size, va, anomaly } = domain, { frame, plot, y, y0 } = area, claims = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), nodes = [...frame.nodes, ...highlightBands(domain, area)], axes = [];
|
|
1251
|
+
if (area.ruleH > 0 && claims.claim(
|
|
1252
|
+
{ x: frame.plot.x, y: frame.plot.y, w: frame.plot.w, h: area.ruleH },
|
|
1253
|
+
"annotation",
|
|
1254
|
+
{ annotationId: "anomaly:rule" }
|
|
1255
|
+
), va.show) {
|
|
1256
|
+
let axisResult = layoutValueAxis(
|
|
1257
|
+
{
|
|
1258
|
+
scale: breakAxisScale(y, domain.stepTicks),
|
|
1259
|
+
plot,
|
|
1260
|
+
orient: "y",
|
|
1261
|
+
// A 100% stack names its shares on the segments; the axis needs only
|
|
1262
|
+
// its ends and the half (0, 50, 100%), not a tick every 20%.
|
|
1263
|
+
...domain.variant === "stacked100" && domain.dLo === 0 && Math.abs(domain.dHi - 100) < 1e-6 ? { tickCount: 2 } : {},
|
|
1264
|
+
...domain.stepTicks && !domain.activeBreak ? { ticks: domain.stepTicks } : {},
|
|
1265
|
+
gridlines: va.gridlines ?? !1,
|
|
1266
|
+
format: area.axisFmt,
|
|
1267
|
+
...area.axisSpec ? { formatSpec: area.axisSpec } : {},
|
|
1268
|
+
theme,
|
|
1269
|
+
measure: domain.measure
|
|
1270
|
+
},
|
|
1271
|
+
claims
|
|
1272
|
+
);
|
|
1273
|
+
nodes.push(...axisResult.nodes), axes.push(axisResult.axis);
|
|
1274
|
+
}
|
|
1275
|
+
let baseline = (id, x1, x2) => ({
|
|
1276
|
+
t: "line",
|
|
1277
|
+
id,
|
|
1278
|
+
x1,
|
|
1279
|
+
y1: y0,
|
|
1280
|
+
x2,
|
|
1281
|
+
y2: y0,
|
|
1282
|
+
stroke: { token: "axis" },
|
|
1283
|
+
width: strokeToken(theme, "rule"),
|
|
1284
|
+
owner: {},
|
|
1285
|
+
part: "baseline"
|
|
1286
|
+
});
|
|
1287
|
+
nodes.push(baseline("axis:baseline", Math.max(0.6, plot.x), Math.min(size.width - 0.6, plot.x + plot.w))), claims.claim({ x: plot.x, y: y0 - 0.5, w: plot.w, h: 1 }, "axis", {});
|
|
1288
|
+
let ribbons = domain.ribbonsOn ? columnRibbons2(domain, paints, area, nodes) : [];
|
|
1289
|
+
domain.connectorsOn && domain.variant !== "grouped" && stackConnectors({ ...domain, axis: "y", scale: area.y, band: area.band }, nodes, claims);
|
|
1290
|
+
let marks = { bars: [], referenceTicks: [], ...ribbons.length > 0 ? { ribbons } : {} }, { rangeNodes, ...bars } = columnBars(domain, paints, area, marks, nodes, claims);
|
|
1291
|
+
if (rangeNodes.length > 0 && (pushAll(nodes, rangeNodes), marks.ranges = bars.rangeMarks), nodes.push(baseline("axis:baseline:over", plot.x, plot.x + plot.w)), domain.cats.forEach((c, ci) => {
|
|
1292
|
+
if (c.role !== "total" || ci === 0) return;
|
|
1293
|
+
let { band } = area, x = (band.position(ci - 1) + band.bandwidth + band.position(ci)) / 2;
|
|
1294
|
+
nodes.push({ t: "line", id: `totalDivider:${c.id}`, x1: x, y1: plot.y, x2: x, y2: y0, stroke: { token: "leader" }, width: strokeToken(theme, "rule"), owner: { categoryId: c.id }, part: "totalDivider" }), claims.claim({ x: x - 1, y: plot.y, w: 2, h: y0 - plot.y }, "axis", { categoryId: c.id }, "totalDivider");
|
|
1295
|
+
}), domain.cats.forEach((c, ci) => {
|
|
1296
|
+
if (!c.breakAfter || ci === domain.cats.length - 1) return;
|
|
1297
|
+
let { band } = area, glyph = categoryBreakGlyph(theme, { x: (band.position(ci) + band.bandwidth + band.position(ci + 1)) / 2, y: y0 }, "x", `axis:x:categoryBreak:${c.id}`);
|
|
1298
|
+
nodes.push(...glyph.nodes), claims.claim(glyph.rect, "axis", {}, "categoryBreak");
|
|
1299
|
+
}), anomaly) {
|
|
1300
|
+
let anomalyMarks = anomalyFurniture(domain, paints, area, bars.flagMarkers, nodes, claims);
|
|
1301
|
+
anomalyMarks.length > 0 && (marks.anomaly = anomalyMarks);
|
|
1302
|
+
}
|
|
1303
|
+
let refTickYs = /* @__PURE__ */ new Map();
|
|
1304
|
+
marks.referenceTicks = referenceMarks(domain, paints, area, refTickYs, nodes, claims);
|
|
1305
|
+
let netLineEnd = domain.netLineOn ? netLineMarks(domain, area, nodes, claims) : void 0;
|
|
1306
|
+
return domain.netLineOn || netTotalTicks(domain, area, nodes, claims, refTickYs), domain.annList.forEach((ann, n) => {
|
|
1307
|
+
if (ann.kind !== "valueLine") return;
|
|
1308
|
+
let annId = ann.id ?? `valueLine-${n + 1}`, v = ann.value === "mean" || ann.value === void 0 ? domain.meanValue : ann.value;
|
|
1309
|
+
v !== void 0 && claims.claim({ x: plot.x, y: y(v) - 1, w: plot.w, h: 2 }, "annotation", {
|
|
1310
|
+
annotationId: annId
|
|
1311
|
+
}, "referenceLine");
|
|
1312
|
+
}), { nodes, claims, axes, marks, ...bars, refTickYs, netLineEnd };
|
|
1313
|
+
}
|
|
1314
|
+
function outsideTickReach(domain, band, ci) {
|
|
1315
|
+
if (domain.variant !== "stacked" || domain.refStyle !== "tick" || contentOf(domain.options, "segment", ["absolute"]) === null) return;
|
|
1316
|
+
let bx = band.position(ci);
|
|
1317
|
+
return Math.min(8, (ci + 1 < domain.cats.length ? band.position(ci + 1) : bx + band.step) - bx - band.bandwidth - 2);
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
// src/core/charts/column/labels.ts
|
|
1321
|
+
function composeLines(domain, content, abs, pct, catLabel, serLabel, authoredPct, valueFmt, ids) {
|
|
1322
|
+
let parts = [];
|
|
1323
|
+
for (let c of content)
|
|
1324
|
+
c === "absolute" && abs !== null ? parts.push([c, valueFmt(abs)]) : c === "percent" && pct !== null ? parts.push([c, ids ? shareTextOf(domain, ids.categoryId, ids.seriesId, pct, authoredPct) : authoredPct ? domain.authoredPctFmt(pct) : domain.pctFmt(pct)]) : c === "category" && catLabel ? parts.push([c, catLabel]) : c === "series" && serLabel && parts.push([c, serLabel]);
|
|
1325
|
+
return valueShareLines(parts);
|
|
1326
|
+
}
|
|
1327
|
+
function composeText(...args) {
|
|
1328
|
+
return composeLines(...args).join(" ");
|
|
1329
|
+
}
|
|
1330
|
+
function emptyCategoryMarkers(domain, area, requests) {
|
|
1331
|
+
if (domain.variant === "grouped") return;
|
|
1332
|
+
let { band, tickFont } = area, na = notApplicableGlyph(domain.options.strings);
|
|
1333
|
+
domain.cats.forEach((c, ci) => {
|
|
1334
|
+
if (!domain.emptyCats.has(c.id) || domain.naCats100.has(c.id)) return;
|
|
1335
|
+
let size = domain.measure(na, tickFont);
|
|
1336
|
+
requests.push({
|
|
1337
|
+
id: `na:${c.id}`,
|
|
1338
|
+
kind: "segment",
|
|
1339
|
+
role: "value",
|
|
1340
|
+
owner: { categoryId: c.id },
|
|
1341
|
+
text: na,
|
|
1342
|
+
lines: [na],
|
|
1343
|
+
typeRole: "label",
|
|
1344
|
+
font: tickFont,
|
|
1345
|
+
priority: PRIORITY.endpoint,
|
|
1346
|
+
candidates: [{ slot: "aboveBaseline", rect: { x: band.center(ci) - size.width / 2, y: area.y0 - size.height - 6, w: size.width, h: size.height }, penalty: 0 }]
|
|
1347
|
+
});
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
function seatsOrBox(seats, rect, tsize, suppressed) {
|
|
1351
|
+
return seats.length > 0 || !suppressed ? seats : [{ slot: "insideCenter", rect: { x: rect.x + rect.w / 2 - tsize.width / 2, y: rect.y + rect.h / 2 - tsize.height / 2, w: tsize.width, h: tsize.height }, penalty: 0 }];
|
|
1352
|
+
}
|
|
1353
|
+
function valueLines(domain, place, content, pct) {
|
|
1354
|
+
let { s, c, ci } = place, val = s.vals[ci], valueFmt = val.isPct && !val.format && !s.format ? domain.valueSpec.fmtPercent : domain.valueSpec.forSeries(s, val.format), lines = composeLines(domain, content, domain.absOf(s, ci), pct, c.label ?? c.id, s.label, pct !== null && val.isPct, valueFmt, { categoryId: c.id, seriesId: s.id }), text = lines.join(" ");
|
|
1355
|
+
return typeof val.labelOverride == "string" && (text = val.labelOverride.replace(/\$\{value\}/g, text), lines = [text]), !text && val.labelOverride !== !1 ? null : { text, lines };
|
|
1356
|
+
}
|
|
1357
|
+
function cellValueText(domain, s, ci) {
|
|
1358
|
+
let val = s.vals[ci], abs = domain.absOf(s, ci);
|
|
1359
|
+
if (abs === null) return null;
|
|
1360
|
+
let text = (val.isPct && !val.format && !s.format ? domain.valueSpec.fmtPercent : domain.valueSpec.forSeries(s, val.format))(abs);
|
|
1361
|
+
return typeof val.labelOverride == "string" ? val.labelOverride.replace(/\$\{value\}/g, text) : text;
|
|
1362
|
+
}
|
|
1363
|
+
function pointRequests(domain, paints, area, scene, requests, warnings) {
|
|
1364
|
+
let { options, measure, highlights, cats, dataSeries, anomaly, rangeOf } = domain, { labelFont, band, y } = area, content = contentOf(options, "point", ["absolute"]);
|
|
1365
|
+
content?.includes("percent") && warnings.push({
|
|
1366
|
+
code: "label-part-unavailable",
|
|
1367
|
+
severity: "warn",
|
|
1368
|
+
message: "grouped columns are not parts of a whole, so the value labels print no percent part",
|
|
1369
|
+
suggest: "use variant 'stacked' or 'stacked100' to print each column's share, or drop 'percent' from labels.point"
|
|
1370
|
+
});
|
|
1371
|
+
let pendingPoints = [], mode = options.valueLabels, chosen = mode === void 0 ? void 0 : new Map(dataSeries.map((s) => [s.id, chosenValueIndices(mode, cats.map((_, ci) => s.vals[ci]?.v ?? null))]));
|
|
1372
|
+
for (let place of content ? scene.bars : []) {
|
|
1373
|
+
let { s, c, ci, v } = place;
|
|
1374
|
+
if (chosen && !chosen.get(s.id)?.has(ci) && typeof s.vals[ci]?.labelOverride != "string" && anomaly?.flagByCategory.has(c.id) !== !0) continue;
|
|
1375
|
+
let text = valueLines(domain, place, content, null)?.text ?? null;
|
|
1376
|
+
if (text === null) continue;
|
|
1377
|
+
let endpoint = ci === 0 || ci === cats.length - 1, hl = highlights.has(c.id) || highlights.has(s.id), flagged = anomaly?.flagByCategory.has(c.id) === !0, priority = s.vals[ci].priority ?? (flagged ? PRIORITY.extreme + PRIORITY.highlightBonus : (endpoint ? PRIORITY.endpoint : PRIORITY.interior + Math.min(99, Math.abs(v))) + (hl ? PRIORITY.highlightBonus : 0));
|
|
1378
|
+
pendingPoints.push({ place, text, priority, protect: hl || flagged, hl });
|
|
1379
|
+
}
|
|
1380
|
+
let compactLabelFont = compactValueLabelFont(labelFont, domain.theme.type.footnote, domain.options.target, textScaleOf(domain.options)), groupSlots = groupedOffsets(band.bandwidth, dataSeries.length), normalSizes = pendingPoints.map((point) => measure(point.text || "0", labelFont)), groupedPolicy = groupedValueLabelPolicy(
|
|
1381
|
+
"vertical",
|
|
1382
|
+
groupSlots[0]?.size ?? band.bandwidth,
|
|
1383
|
+
dataSeries.length,
|
|
1384
|
+
normalSizes,
|
|
1385
|
+
labelFont.size,
|
|
1386
|
+
compactLabelFont.size
|
|
1387
|
+
), crowded = valueRowCrowded(pendingPoints.map(({ place }, i) => {
|
|
1388
|
+
let size = normalSizes[i], above = place.v >= 0;
|
|
1389
|
+
return { x: place.rect.x + place.rect.w / 2 - size.width / 2, y: above ? place.rect.y - size.height - 4 : place.rect.y + place.rect.h + 4, w: size.width, h: size.height };
|
|
1390
|
+
})), steppedForGap = !groupedPolicy.compact && crowded && compactLabelFont.size < labelFont.size, pointFont = groupedPolicy.compact || steppedForGap ? compactLabelFont : labelFont;
|
|
1391
|
+
(groupedPolicy.compact || steppedForGap) && warnings.push({
|
|
1392
|
+
code: "value-labels-font-stepped",
|
|
1393
|
+
severity: "info",
|
|
1394
|
+
message: steppedForGap ? `value labels use the ${pointFont.size}px step: at ${labelFont.size}px neighbouring values stand closer than 6px` : `value labels use the ${pointFont.size}px step: at ${labelFont.size}px some are wider than their ${Math.round(pendingPoints[0]?.place.rect.w ?? 0)}px columns`
|
|
1395
|
+
}), groupedPolicy.firstSeriesOnly && content && warnings.push({
|
|
1396
|
+
code: "value-labels-first-series-only",
|
|
1397
|
+
severity: "info",
|
|
1398
|
+
message: `columns are ${(groupSlots[0]?.size ?? 0).toFixed(1)}px thick, thinner than a value label; only '${dataSeries[0].label ?? dataSeries[0].id}' carries value labels${highlights.size > 0 ? ", plus the highlighted values where they fit" : ""}`,
|
|
1399
|
+
suggest: "give the chart more width, or fewer categories, to label every series"
|
|
1400
|
+
});
|
|
1401
|
+
let lastRanged = [...pendingPoints].reverse().find(({ place }) => rangeOf(place.s, place.ci) !== void 0);
|
|
1402
|
+
if (lastRanged) {
|
|
1403
|
+
let { s, c, ci, rect } = lastRanged.place, range = rangeOf(s, ci), fmt = domain.valueSpec.forSeries(s), text = numberRange(fmt(Math.min(range.low, range.high)), fmt(Math.max(range.low, range.high))), size = measure(text, labelFont), cx = rect.x + rect.w / 2, capY = y(Math.max(range.low, range.high));
|
|
1404
|
+
requests.push({
|
|
1405
|
+
id: `range:${s.id}:${c.id}`,
|
|
1406
|
+
kind: "annotation",
|
|
1407
|
+
role: "value",
|
|
1408
|
+
owner: { seriesId: s.id, categoryId: c.id },
|
|
1409
|
+
text,
|
|
1410
|
+
lines: [text],
|
|
1411
|
+
typeRole: "label",
|
|
1412
|
+
font: labelFont,
|
|
1413
|
+
priority: PRIORITY.valueLine,
|
|
1414
|
+
candidates: [
|
|
1415
|
+
{ slot: "rightOfCap", rect: { x: cx + 8, y: capY - size.height / 2, w: size.width, h: size.height }, penalty: 0 },
|
|
1416
|
+
{ slot: "leftOfCap", rect: { x: cx - 8 - size.width, y: capY - size.height / 2, w: size.width, h: size.height }, penalty: 1 },
|
|
1417
|
+
{ slot: "aboveCap", rect: { x: cx - size.width / 2, y: capY - size.height - 3, w: size.width, h: size.height }, penalty: 2 }
|
|
1418
|
+
]
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
let toDateIds = toDateOnValues(domain), toDate = options.strings?.toDate ?? chartString(options, "toDate"), clampX = (r) => ({ ...r, x: Math.max(area.plot.x, Math.min(r.x, area.plot.x + area.plot.w - r.w)) }), boldFont = { ...pointFont, weight: emphasisWeight(domain.theme) }, seated = pendingPoints.map((point) => {
|
|
1422
|
+
let { s, c, ci, v, rect } = point.place, words = toDateIds.has(c.id) ? toDateLabel(point.text, point.hl ? boldFont : pointFont, toDate, domain.theme, measure) : void 0, tsize = words?.size ?? measure(point.text || "0", point.hl ? boldFont : pointFont), flag = scene.flagMarkers.get(c.id), outset = flag && flag.outside ? ANOMALY_FLAG_GAP + ANOMALY_FLAG_H : 0, natural = rangeOf(s, ci) ? void 0 : pointCandidates(rect, tsize, v < 0, "", y, void 0, outset)[0].rect;
|
|
1423
|
+
return { ...point, words, tsize, outset, natural: natural && clampX(natural) };
|
|
1424
|
+
}), rows = valueSeatRows(seated.map(({ natural, place }) => natural && { rect: natural, negative: place.v < 0 }), scene.bars.map(({ rect }) => rect));
|
|
1425
|
+
for (let [index, { place, text, priority, protect, hl, words, tsize, outset }] of seated.entries()) {
|
|
1426
|
+
let { s, si, c, ci, v, rect } = place;
|
|
1427
|
+
if (groupedPolicy.firstSeriesOnly && si !== 0 && !protect) continue;
|
|
1428
|
+
let val = s.vals[ci], insidePaint = paints.cell(s, val, c, si), insidePattern = paints.pattern(s, val, c);
|
|
1429
|
+
requests.push({
|
|
1430
|
+
id: `point:${s.id}:${c.id}`,
|
|
1431
|
+
kind: "point",
|
|
1432
|
+
owner: { seriesId: s.id, categoryId: c.id },
|
|
1433
|
+
text,
|
|
1434
|
+
lines: words?.lines ?? [text],
|
|
1435
|
+
...words?.request,
|
|
1436
|
+
typeRole: "label",
|
|
1437
|
+
font: pointFont,
|
|
1438
|
+
priority,
|
|
1439
|
+
// Equal priorities seat left to right, not in id order ('s10' before 's9'), so a stagger alternates rows.
|
|
1440
|
+
order: ci,
|
|
1441
|
+
...protect ? { protect } : {},
|
|
1442
|
+
...hl ? { emphasis: !0 } : {},
|
|
1443
|
+
// Columns that touch (a histogram's bins) leave no air between them: a
|
|
1444
|
+
// count as wide as its column sits edge to edge over it.
|
|
1445
|
+
...(options.bandFraction ?? 0) >= 1 ? { pad: 0 } : {},
|
|
1446
|
+
redundant: val.labelOverride === !1,
|
|
1447
|
+
...typeof val.labelOverride == "string" ? { keepWhenDense: !0 } : {},
|
|
1448
|
+
// A point label prints no percent part (label-part-unavailable).
|
|
1449
|
+
...namesOnly(content.filter((part) => part !== "percent"), val.labelOverride),
|
|
1450
|
+
candidates: pointCandidates(rect, tsize, v < 0, paints.inside(s, val, c, si), y, rangeOf(s, ci), outset, rows[index]).map((candidate) => ({ ...candidate, rect: clampX(candidate.rect), insidePaint, insidePattern }))
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
return pointFont;
|
|
1454
|
+
}
|
|
1455
|
+
function planColumnValueLabels(domain, paints, area, scene, requests, warnings, noted = { items: /* @__PURE__ */ new Map(), slivers: /* @__PURE__ */ new Set() }, digits) {
|
|
1456
|
+
if (domain.variant === "grouped") return pointRequests(domain, paints, area, scene, requests, warnings);
|
|
1457
|
+
let { options, measure, highlights } = domain, { labelFont } = area, stacked100 = domain.variant === "stacked100", segment = contentOf(options, "segment", stacked100 ? ["percent"] : ["absolute"]), shares = options.shareLabels, only = shares?.only === void 0 ? void 0 : new Set(shares.only), base = segment && shares && !segment.includes("absolute") ? ["absolute", ...segment] : segment, contentAt = (categoryId) => !base || !shares ? base : !only || only.has(categoryId) ? base.includes("percent") ? base : [...base, "percent"] : base.filter((part) => part !== "percent"), pass = (stepped2) => {
|
|
1458
|
+
let slivers2 = [], tooWide2 = [], pending2 = [], sliverOrder = [], seats = [], noShare2 = /* @__PURE__ */ new Set(), items = /* @__PURE__ */ new Map(), sliverIds = /* @__PURE__ */ new Set(), out = [], anyShare2 = !1;
|
|
1459
|
+
for (let place of segment ? scene.bars : []) {
|
|
1460
|
+
let { s, si, c, ci, v, rect } = place, val = s.vals[ci], content = contentAt(c.id), shareAsked = content.includes("percent");
|
|
1461
|
+
anyShare2 ||= shareAsked;
|
|
1462
|
+
let share = shareAsked ? domain.shareOf(s, ci) : null;
|
|
1463
|
+
shareAsked && share === null && !stacked100 && !domain.mixedSignCats.has(c.id) && val.v !== null && noShare2.add(c.label ?? c.id);
|
|
1464
|
+
let composed = valueLines(domain, place, content, share);
|
|
1465
|
+
if (composed === null) continue;
|
|
1466
|
+
let { text, lines } = composed, font = c.role === "total" ? { ...labelFont, weight: emphasisWeight(domain.theme) } : stepped2 ?? labelFont, tsize = linesSize(lines, font, measure), sliver = !(v === 0 && typeof val.labelOverride == "string") && segmentTooShort(domain.density, rect.h, tsize.height, options.labelPlacements?.[`segment:${s.id}:${c.id}`], STACK_ROOM), hl = highlights.has(c.id) || highlights.has(s.id), restHidden = val.labelOverride === void 0 && !hl && restValuesHidden(options, s.colorRole), owedHere = val.labelOverride !== !1 && !restHidden, printed = share === null ? content.filter((part) => part !== "percent") : content, onePart = !stacked100 && (printsValue(val.labelOverride) ? domain.gtContent?.join() === "absolute" : typeof val.labelOverride != "string" && printed.length === 1 && printed[0] === "absolute") && v !== 0 && onePartDrawn(domain.dataSeries.map((x) => x.vals[ci].v)), inTotal = onePart && domain.gtContent != null;
|
|
1467
|
+
sliver && !hl && owedHere && !inTotal && (slivers2.push(`${s.label} in ${c.label ?? c.id}`), sliverOrder.push(`segment:${s.id}:${c.id}`));
|
|
1468
|
+
let note = `${s.label} ${text} (${noteName(c)})`;
|
|
1469
|
+
owedHere && items.set(`segment:${s.id}:${c.id}`, note), sliver && !hl && owedHere && domain.density !== "minimal" && sliverIds.add(`segment:${s.id}:${c.id}`);
|
|
1470
|
+
let priority = val.priority ?? PRIORITY.interior + Math.min(99, Math.abs(v)) + (hl ? PRIORITY.highlightBonus : 0), leader = domain.density === "full" || v === 0 && typeof val.labelOverride == "string";
|
|
1471
|
+
!leader && !inTotal && !only?.has(c.id) && typeof val.labelOverride != "string" && val.labelOverride !== !1 && !restHidden && !(sliver && !hl) && !fitsInside({ ...rect, h: 1 / 0 }, tsize, 0) && tooWide2.push(c.label ?? c.id), pending2.push({ id: `segment:${s.id}:${c.id}`, owed: owedHere && domain.density !== "minimal", authored: typeof val.labelOverride == "string" });
|
|
1472
|
+
let request = {
|
|
1473
|
+
id: `segment:${s.id}:${c.id}`,
|
|
1474
|
+
kind: "segment",
|
|
1475
|
+
owner: { seriesId: s.id, categoryId: c.id },
|
|
1476
|
+
...onePart ? { printedIn: `grandTotal:${c.id}` } : {},
|
|
1477
|
+
...namesOnly(printed, val.labelOverride),
|
|
1478
|
+
text,
|
|
1479
|
+
lines,
|
|
1480
|
+
...lines.length > 1 ? { align: "middle" } : {},
|
|
1481
|
+
typeRole: "label",
|
|
1482
|
+
font,
|
|
1483
|
+
...stepped2 && c.role !== "total" ? { fontStep: stepped2 } : {},
|
|
1484
|
+
priority,
|
|
1485
|
+
...hl ? { protect: hl } : {},
|
|
1486
|
+
// The sliver gate passes the highlighted value, which the solver drops last.
|
|
1487
|
+
redundant: val.labelOverride === !1 || sliver && !hl,
|
|
1488
|
+
...restHidden ? restValueHiding(note) : {},
|
|
1489
|
+
candidates: seatsOrBox(segmentLabelCandidates(
|
|
1490
|
+
"vertical",
|
|
1491
|
+
rect,
|
|
1492
|
+
tsize,
|
|
1493
|
+
paints.inside(s, val, c, si),
|
|
1494
|
+
{ baseline: area.y0, leaderObstacles: scene.refTickYs.get(c.id), insidePaint: paints.cell(s, val, c, si), insidePattern: paints.pattern(s, val, c), insideOnly: !leader }
|
|
1495
|
+
), rect, tsize, val.labelOverride === !1 || sliver && !hl)
|
|
1496
|
+
}, pinnedDigits = options.labelPlacements?.[request.id] === "insideDigits", seat = (pinnedDigits || digits && sliver && !hl && owedHere && !inTotal && domain.density !== "minimal") && lines.length === 1 ? digitSeat(rect, text, tsize, measure.capHeight?.(font), font.size, digitSeatEdge(domain.theme, paints.pattern(s, val, c))) : void 0, seatCandidate = seat && {
|
|
1497
|
+
slot: "insideDigits",
|
|
1498
|
+
rect: seat,
|
|
1499
|
+
penalty: 0,
|
|
1500
|
+
pad: 0,
|
|
1501
|
+
insideFill: paints.inside(s, val, c, si),
|
|
1502
|
+
insidePaint: paints.cell(s, val, c, si),
|
|
1503
|
+
insidePattern: paints.pattern(s, val, c)
|
|
1504
|
+
};
|
|
1505
|
+
pinnedDigits ? out.push(seatCandidate ? { ...request, candidates: [...request.candidates, seatCandidate] } : request) : (out.push(request), seatCandidate && seats.push({ ...request, redundant: !1, candidates: [seatCandidate] }));
|
|
1506
|
+
}
|
|
1507
|
+
return { slivers: slivers2, sliverOrder, seats, tooWide: tooWide2, pending: pending2, noShare: noShare2, items, sliverIds, out, anyShare: anyShare2 };
|
|
1508
|
+
}, stepped, done = pass();
|
|
1509
|
+
for (; done.tooWide.length > 0; ) {
|
|
1510
|
+
let next = stepDownFont(domain.theme, stepped ?? labelFont, "label", options.target, textScaleOf(options));
|
|
1511
|
+
if (!next) break;
|
|
1512
|
+
stepped = next, done = pass(stepped);
|
|
1513
|
+
}
|
|
1514
|
+
let { slivers, tooWide, pending, noShare, anyShare } = done;
|
|
1515
|
+
for (let [id, note] of done.items) noted.items.set(id, note);
|
|
1516
|
+
for (let id of done.sliverIds) noted.slivers.add(id);
|
|
1517
|
+
if (pushAll(requests, done.out), tooWide.length > 0) {
|
|
1518
|
+
let hidden = new Set(pending.filter((entry) => !entry.authored).map((entry) => entry.id));
|
|
1519
|
+
for (let request of requests) hidden.has(request.id) && (request.redundant = !0);
|
|
1520
|
+
for (let entry of pending) hidden.has(entry.id) && entry.owed && noted.slivers.add(entry.id);
|
|
1521
|
+
warnings.push({
|
|
1522
|
+
code: "segment-labels-hidden",
|
|
1523
|
+
severity: "info",
|
|
1524
|
+
message: `segment values are not printed: some are wider than their column (${[...new Set(tooWide)].slice(0, 5).join(", ")})`,
|
|
1525
|
+
suggest: "widen the chart, use a shorter number format, or set labelDensity 'full' to print them outside on leaders"
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
return digits && tooWide.length === 0 && done.seats.length > 0 ? (digits.requests.push(...done.seats), digits.slivers = done.sliverOrder.map((id, i) => [id, slivers[i]]), digits.warningAt = warnings.length) : warnSliverLabels(warnings, slivers), warnShareParts(warnings, anyShare && !stacked100 ? domain.cats.filter((c) => domain.mixedSignCats.has(c.id) && contentAt(c.id)?.includes("percent")).map((c) => c.label ?? c.id) : [], [...noShare]), labelFont;
|
|
1529
|
+
}
|
|
1530
|
+
function anomalyRuleRequest(domain, area, requests, warnings) {
|
|
1531
|
+
let { anomaly } = domain, { tickFont, frame, plot } = area;
|
|
1532
|
+
if (!anomaly) return;
|
|
1533
|
+
if (!area.ruleOn) {
|
|
1534
|
+
warnings.push({
|
|
1535
|
+
code: "label-hidden",
|
|
1536
|
+
severity: "warn",
|
|
1537
|
+
// The label id is spelled into the message on purpose, so
|
|
1538
|
+
// that `label '<id>'` can be parsed out of every warning carrying this code.
|
|
1539
|
+
message: "label 'anomaly:rule' was suppressed by labels.valueLine while its corridor and flag markers still render \u2014 the reader is shown a threshold with no stated rule",
|
|
1540
|
+
owner: { annotationId: "anomaly:rule" },
|
|
1541
|
+
suggest: "enable labels.valueLine so the corridor explains itself, or drop options.anomaly"
|
|
1542
|
+
});
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
let wrapped = area.ruleWrap, ruleLines = wrapped.lines;
|
|
1546
|
+
wrapped.title !== void 0 && warnings.push({
|
|
1547
|
+
code: "anomaly-rule-truncated",
|
|
1548
|
+
severity: "warn",
|
|
1549
|
+
message: `the anomaly rule sentence does not fit the plot width and was cut: "${area.ruleText}"`,
|
|
1550
|
+
owner: { annotationId: "anomaly:rule" },
|
|
1551
|
+
suggest: "use a wider size, or shorten it with anomaly.label"
|
|
1552
|
+
});
|
|
1553
|
+
let width = Math.max(...ruleLines.map((line) => domain.measure(line, tickFont).width)), height = ruleLines.length * tickFont.size * 1.2, at = (yy) => ({ x: frame.plot.x + 2, y: yy, w: width, h: height });
|
|
1554
|
+
requests.push({
|
|
1555
|
+
id: "anomaly:rule",
|
|
1556
|
+
kind: "tick",
|
|
1557
|
+
// Same annotation id as the reserve claim, so the solver treats that
|
|
1558
|
+
// claim as this label's own instead of as a collision.
|
|
1559
|
+
owner: { annotationId: "anomaly:rule" },
|
|
1560
|
+
text: anomaly.rule,
|
|
1561
|
+
lines: ruleLines,
|
|
1562
|
+
...wrapped.title !== void 0 ? { title: wrapped.title } : {},
|
|
1563
|
+
typeRole: "footnote",
|
|
1564
|
+
font: tickFont,
|
|
1565
|
+
priority: PRIORITY.valueLine,
|
|
1566
|
+
candidates: [
|
|
1567
|
+
// The band reserved for it above the plot. Everything after this is a
|
|
1568
|
+
// fallback for the case where authored furniture took the band.
|
|
1569
|
+
{ slot: "ruleBand", rect: at(frame.plot.y + 2), penalty: 0 },
|
|
1570
|
+
{ slot: "plotTop", rect: at(plot.y + 2), penalty: 1 },
|
|
1571
|
+
{ slot: "plotBottom", rect: at(plot.y + plot.h - height - 2), penalty: 2 }
|
|
1572
|
+
]
|
|
1573
|
+
});
|
|
1574
|
+
}
|
|
1575
|
+
function categoryRequests(domain, area, requests) {
|
|
1576
|
+
let { cats, anomaly } = domain, { catPlan, band } = area, dateTicks = catPlan.dateNumeric, categoryLabelGap = anomaly ? 4 : 6, catX = catPlan.x, keep = catPlan.keep, rotated = catPlan.rotation !== 0, rowY = area.catRowY + categoryLabelGap;
|
|
1577
|
+
cats.forEach((c, ci) => {
|
|
1578
|
+
let info = catPlan.infos[ci], bold = !rotated && (c.role === "total" || domain.highlights.has(c.id)), boldFont = { ...catPlan.font, weight: emphasisWeight(domain.theme) }, w = bold ? Math.max(info.w, ...info.lines.map((line) => domain.measure(line, boldFont).width)) : info.w, at = (yy) => ({ x: catX(ci) - (w - info.w) / 2, y: yy, w, h: info.h }), below = { slot: "below", rect: at(rowY), penalty: 0 }, belowShifted = { slot: "belowShifted", rect: at(rowY + area.gtH + 4), penalty: 1 };
|
|
1579
|
+
requests.push({
|
|
1580
|
+
id: `category:${c.id}`,
|
|
1581
|
+
kind: "category",
|
|
1582
|
+
owner: { categoryId: c.id },
|
|
1583
|
+
text: c.label ?? c.id,
|
|
1584
|
+
lines: info.lines,
|
|
1585
|
+
...categoryLineAlign(catPlan, ci),
|
|
1586
|
+
...info.title !== void 0 ? { title: info.title } : {},
|
|
1587
|
+
typeRole: catPlan.typeRole,
|
|
1588
|
+
font: c.role === "total" ? boldFont : catPlan.font,
|
|
1589
|
+
priority: PRIORITY.endpoint,
|
|
1590
|
+
// A stride-hidden date label is the row's decision (one info lint), not a loss.
|
|
1591
|
+
redundant: !keep[ci],
|
|
1592
|
+
...rotated ? { rotate: catPlan.rotation === 90 ? -90 : -45 } : {},
|
|
1593
|
+
candidates: catPlan.rotation === 90 ? [{ slot: "below", rect: verticalNameRect(band.center(ci), area.catRowY, info.w, catPlan.font), penalty: 0 }] : rotated ? [{ slot: "below", rect: rotatedClaimRect(band.center(ci), area.catRowY + Math.max(categoryLabelGap + 2, info.h * Math.SQRT1_2 / 2 + ROTATED_NAME_AIR), info.h), penalty: 0 }] : dateTicks ? [below] : [below, belowShifted]
|
|
1594
|
+
});
|
|
1595
|
+
}), pushAll(requests, yearRowRequests(catPlan, rowY));
|
|
1596
|
+
}
|
|
1597
|
+
function stackTotalText(domain, ci, format = domain.totalFmt) {
|
|
1598
|
+
let c = domain.cats[ci];
|
|
1599
|
+
if (!domain.gtContent || !domain.stacks[ci].hasValue) return null;
|
|
1600
|
+
let stacked100 = domain.variant === "stacked100";
|
|
1601
|
+
if (domain.nmCats100.has(c.id) || domain.naCats100.has(c.id) || stacked100 && domain.incompleteCats.has(c.id)) return null;
|
|
1602
|
+
let text = composeText(domain, domain.gtContent, domain.stackTotals[c.id], stacked100 ? domain.posTopP[ci] : null, c.label ?? c.id, "", !1, format);
|
|
1603
|
+
if (!text) return null;
|
|
1604
|
+
let net = !domain.netLineOn && netInsideStack(domain, ci);
|
|
1605
|
+
return { text: net ? `${domain.options.strings.net} ${text}` : text, net };
|
|
1606
|
+
}
|
|
1607
|
+
function partialWords(domain, ci) {
|
|
1608
|
+
return domain.variant === "stacked" && domain.incompleteCats.has(domain.cats[ci].id) && disclosuresShown(domain.options) ? domain.options.strings.incomplete : void 0;
|
|
1609
|
+
}
|
|
1610
|
+
function planColumnLabels(domain, area, scene, requests, warnings) {
|
|
1611
|
+
let { measure, highlights, cats, gtContent, stackTotals, variant, posTopP, negBotP, pyRef, pyGrowth, totalFmt } = domain, { strongFont, tickFont, band, y } = area, growthPoints = [], growthOn = kindSetting(domain.options, "growth") !== !1, box = (x, yy, size) => ({ x, y: yy, w: size.width, h: size.height });
|
|
1612
|
+
emptyCategoryMarkers(domain, area, requests);
|
|
1613
|
+
let totalAt = (ci, format = totalFmt) => stackTotalText(domain, ci, format), fullTotals = cats.map((_, ci) => totalAt(ci)), spec = domain.valueSpec.spec, maxTotal = maxOf(cats.map((c) => Math.abs(stackTotals[c.id]))), compactTotals = domain.options.mode === "compact" && variant === "stacked" && spec.magnitude === "none" && !spec.suffix.includes("%") && maxTotal >= 1e3 && fullTotals.some((total) => total && measure(total.text, strongFont).width + 6 > band.step), compactFormat = (value) => Math.abs(value) < 1e3 ? totalFmt(value) : formatWithSpec(value, {
|
|
1614
|
+
...spec,
|
|
1615
|
+
magnitude: Math.abs(value) >= 1e9 ? "bn" : Math.abs(value) >= 1e6 ? "m" : "k",
|
|
1616
|
+
decimals: 1,
|
|
1617
|
+
significantDigits: void 0
|
|
1618
|
+
}), linked = new Map(requests.flatMap((req) => req.printedIn ? [[req.printedIn, req.id]] : [])), authoredPart = (ci) => {
|
|
1619
|
+
let id = linked.get(`grandTotal:${cats[ci].id}`), series = id && domain.dataSeries.find((s) => id === `segment:${s.id}:${cats[ci].id}`);
|
|
1620
|
+
return series && printsValue(series.vals[ci].labelOverride) ? requests.find((req) => req.id === id)?.text : void 0;
|
|
1621
|
+
}, totals = (compactTotals ? cats.map((_, ci) => totalAt(ci, compactFormat)) : fullTotals).map((total, ci) => {
|
|
1622
|
+
let text = total && !total.net ? authoredPart(ci) : void 0;
|
|
1623
|
+
return text ? { ...total, text } : total;
|
|
1624
|
+
}), toDateIds = toDateOnValues(domain), toDate = domain.options.strings?.toDate ?? chartString(domain.options, "toDate"), wordsAt = (ci, text, font) => {
|
|
1625
|
+
let words = toDateIds.has(cats[ci].id) ? toDate : partialWords(domain, ci);
|
|
1626
|
+
return words ? toDateLabel(text, font, words, domain.theme, measure) : void 0;
|
|
1627
|
+
}, seats = (font) => totals.map((total, ci) => {
|
|
1628
|
+
if (!total || total.net) return null;
|
|
1629
|
+
let size = wordsAt(ci, total.text, font)?.size ?? measure(total.text, font), above = posTopP[ci] > 0 || negBotP[ci] === 0, edgeY = y(above ? posTopP[ci] : negBotP[ci]);
|
|
1630
|
+
return { x: band.center(ci) - size.width / 2, y: above ? edgeY - size.height - 4 : edgeY + 4, w: size.width, h: size.height };
|
|
1631
|
+
}), rowFont = valueRowCrowded(seats(strongFont)) ? stepDownFont(domain.theme, strongFont, "label", domain.options.target, textScaleOf(domain.options)) : void 0, totalFont = rowFont ?? strongFont, thinned = domain.dataSeries.length > 1 && valueRowCrowded(seats(totalFont)), valueAlone = gtContent?.join() === "absolute";
|
|
1632
|
+
cats.forEach((c, ci) => {
|
|
1633
|
+
let total = totals[ci];
|
|
1634
|
+
if (!total) return;
|
|
1635
|
+
let { text, net } = total, words = net ? void 0 : wordsAt(ci, text, totalFont), tsize = words?.size ?? measure(text, net ? strongFont : totalFont), above = posTopP[ci] > 0 || negBotP[ci] === 0, cx = band.center(ci), netY = y(stackTotals[c.id]), netX = band.position(ci) + band.bandwidth + NET_TICK_REACH + 3, totalCandidates = net ? [
|
|
1636
|
+
{ slot: "rightOfNet", rect: box(netX, netY - tsize.height / 2, tsize), penalty: 0 },
|
|
1637
|
+
{ slot: "rightOfNetAbove", rect: box(netX, netY - tsize.height - 2, tsize), penalty: 1 },
|
|
1638
|
+
{ slot: "rightOfNetBelow", rect: box(netX, netY + 2, tsize), penalty: 2 },
|
|
1639
|
+
// Dense columns leave no room beside the tick: the net then stands over its column, as a total does.
|
|
1640
|
+
{ slot: "aboveNet", rect: box(cx - tsize.width / 2, y(posTopP[ci]) - tsize.height - 4, tsize), penalty: 3 }
|
|
1641
|
+
] : totalLabelCandidates("vertical", { x: cx, y: y(above ? posTopP[ci] : negBotP[ci]) }, tsize, above ? "positive" : "negative").slice(0, 1).map((candidate) => ({ ...candidate, overRules: !0, rect: { ...candidate.rect, x: Math.max(area.plot.x, Math.min(candidate.rect.x, area.plot.x + area.plot.w - candidate.rect.w)) } })).flatMap((candidate) => {
|
|
1642
|
+
if (!thinned || !above) return [candidate];
|
|
1643
|
+
let { x, w } = candidate.rect, clear = Math.min(...[ci - 1, ci + 1].filter((n) => n >= 0 && n < cats.length && band.position(n) < x + w + 2 && band.position(n) + band.bandwidth > x - 2).map((n) => y(posTopP[n]) - tsize.height - 4));
|
|
1644
|
+
return clear < candidate.rect.y - 0.5 ? [candidate, { ...candidate, slot: "aboveNeighbours", rect: { ...candidate.rect, y: clear }, penalty: candidate.penalty + 1, reach: 4 * lineBox(totalFont) + 8 }] : [candidate];
|
|
1645
|
+
}), skipped = thinned && !net && ci % 2 !== (cats.length - 1) % 2 && !highlights.has(c.id);
|
|
1646
|
+
requests.push({
|
|
1647
|
+
id: `grandTotal:${c.id}`,
|
|
1648
|
+
kind: "grandTotal",
|
|
1649
|
+
...namesOnly(variant === "stacked100" ? gtContent : gtContent?.filter((part) => part !== "percent"), void 0),
|
|
1650
|
+
...net ? { role: "category" } : {},
|
|
1651
|
+
...skipped ? { redundant: !0, suppressedAs: "density", owed: !0 } : {},
|
|
1652
|
+
...!net && !words && valueAlone && linked.has(`grandTotal:${c.id}`) ? { printedIn: linked.get(`grandTotal:${c.id}`) } : {},
|
|
1653
|
+
owner: { categoryId: c.id },
|
|
1654
|
+
text,
|
|
1655
|
+
lines: words?.lines ?? [text],
|
|
1656
|
+
...words?.request,
|
|
1657
|
+
// the note names a total by its one series, else as the stack's total ("Total 60 (Jan)"); a Net names itself.
|
|
1658
|
+
...net ? {} : { noteText: `${domain.dataSeries.length === 1 ? noteName(domain.dataSeries[0]) : chartString(domain.options, "total")} ${compactTotals ? fullTotals[ci].text : text}${words ? ` ${words.lines[1]}` : ""} (${noteName(c)})` },
|
|
1659
|
+
typeRole: "label",
|
|
1660
|
+
font: net ? strongFont : totalFont,
|
|
1661
|
+
...rowFont && !net ? { fontStep: rowFont } : {},
|
|
1662
|
+
priority: PRIORITY.grandTotal + (highlights.has(c.id) ? PRIORITY.highlightBonus : 0),
|
|
1663
|
+
// A highlighted stack's total keeps the full ink under labels.ink 'muted'.
|
|
1664
|
+
...highlights.has(c.id) ? { emphasis: !0 } : {},
|
|
1665
|
+
candidates: totalCandidates
|
|
1666
|
+
});
|
|
1667
|
+
let integrated = growthOn ? pyGrowth.get(c.id) : void 0;
|
|
1668
|
+
if (!integrated) return;
|
|
1669
|
+
let annotationId = `integratedVariance:${integrated.referenceSeriesId}:${c.id}`, growthLabelId = `annotation:${annotationId}`, growthSize = measure(integrated.text, strongFont), yy = totalCandidates[0].rect.y, growthAt = box(cx - growthSize.width / 2, above ? yy - growthSize.height - 4 : yy + tsize.height + 4, growthSize);
|
|
1670
|
+
requests.push({
|
|
1671
|
+
id: growthLabelId,
|
|
1672
|
+
kind: "annotation",
|
|
1673
|
+
role: composedTextRole(integrated.text, "note"),
|
|
1674
|
+
owner: { annotationId, categoryId: c.id },
|
|
1675
|
+
text: integrated.text,
|
|
1676
|
+
lines: [integrated.text],
|
|
1677
|
+
typeRole: "label",
|
|
1678
|
+
font: strongFont,
|
|
1679
|
+
priority: PRIORITY.total,
|
|
1680
|
+
candidates: [{ slot: above ? "aboveTotal" : "belowTotal", rect: growthAt, penalty: 0 }]
|
|
1681
|
+
}), growthPoints.push({
|
|
1682
|
+
...integrated,
|
|
1683
|
+
x: cx,
|
|
1684
|
+
tickY: y(integrated.reference),
|
|
1685
|
+
totalLabelId: `grandTotal:${c.id}`,
|
|
1686
|
+
growthLabelId,
|
|
1687
|
+
referenceLabelId: `tick:${integrated.referenceSeriesId}:${c.id}`,
|
|
1688
|
+
tickNodeId: `ref:${integrated.referenceSeriesId}:${c.id}`
|
|
1689
|
+
});
|
|
1690
|
+
}), anomalyRuleRequest(domain, area, requests, warnings);
|
|
1691
|
+
let tickContent = contentOf(domain.options, "tick", ["absolute", "series"]), pyKeyed = pyTickKeyed(domain, area.frame.legend);
|
|
1692
|
+
for (let s of tickContent && domain.variant !== "stacked100" ? domain.refSeries : []) cats.forEach((c, ci) => {
|
|
1693
|
+
let v = domain.plottedOf(s, ci);
|
|
1694
|
+
if (v === null) return;
|
|
1695
|
+
let integrated = pyRef?.id === s.id && pyGrowth.has(c.id), ry = y(v), bx = band.position(ci), text = composeText(domain, integrated && pyKeyed ? ["absolute"] : tickContent, v, null, c.label ?? c.id, s.label, !1, domain.valueSpec.forSeries(s)), size = measure(text, tickFont), reach = outsideTickReach(domain, band, ci), primaryX = bx + band.bandwidth + (integrated ? PY_TICK_LEAD : reach !== void 0 && reach >= 4 ? reach + 3 : 5);
|
|
1696
|
+
requests.push({
|
|
1697
|
+
id: `tick:${s.id}:${c.id}`,
|
|
1698
|
+
kind: "tick",
|
|
1699
|
+
owner: { seriesId: s.id, categoryId: c.id },
|
|
1700
|
+
text,
|
|
1701
|
+
lines: [text],
|
|
1702
|
+
typeRole: "label",
|
|
1703
|
+
font: tickFont,
|
|
1704
|
+
// A plain reference value takes the seat the column values leave.
|
|
1705
|
+
priority: integrated ? PRIORITY.valueLine : PRIORITY.interior - 1,
|
|
1706
|
+
candidates: [
|
|
1707
|
+
// A dot sits mid-column: its value goes beside the dot first, clear of its ring.
|
|
1708
|
+
...domain.refStyle === "marker" ? [
|
|
1709
|
+
{ slot: "rightOfMarker", rect: box(band.center(ci) + REFERENCE_MARKER_R + 4, ry - size.height / 2, size), penalty: 0 },
|
|
1710
|
+
{ slot: "leftOfMarker", rect: box(band.center(ci) - REFERENCE_MARKER_R - 4 - size.width, ry - size.height / 2, size), penalty: 0.5 }
|
|
1711
|
+
] : [],
|
|
1712
|
+
{ slot: "rightOfTick", rect: box(primaryX, ry - size.height / 2, size), penalty: 1 },
|
|
1713
|
+
{ slot: "rightOfTickAbove", rect: box(primaryX, ry - size.height - 4, size), penalty: 2 },
|
|
1714
|
+
{ slot: "rightOfTickBelow", rect: box(primaryX, ry + 4, size), penalty: 3 },
|
|
1715
|
+
{ slot: "leftOfTick", rect: box(bx - 12 - size.width, ry - size.height / 2, size), penalty: 4 }
|
|
1716
|
+
]
|
|
1717
|
+
});
|
|
1718
|
+
});
|
|
1719
|
+
let end = scene.netLineEnd;
|
|
1720
|
+
if (end) {
|
|
1721
|
+
let text = netLineName(domain.dataSeries, domain.netLineSeries, domain.stacks, domain.options.strings), size = measure(text, strongFont);
|
|
1722
|
+
requests.push({
|
|
1723
|
+
id: "netLine",
|
|
1724
|
+
kind: "valueLine",
|
|
1725
|
+
role: "category",
|
|
1726
|
+
owner: { annotationId: "netLine" },
|
|
1727
|
+
text,
|
|
1728
|
+
lines: [text],
|
|
1729
|
+
typeRole: "label",
|
|
1730
|
+
font: strongFont,
|
|
1731
|
+
priority: PRIORITY.valueLine,
|
|
1732
|
+
candidates: [
|
|
1733
|
+
{ slot: "right", rect: box(end.x + 4, end.y - size.height / 2, size), penalty: 0 },
|
|
1734
|
+
{ slot: "above", rect: box(end.x - size.width, end.y - size.height - 4, size), penalty: 1 }
|
|
1735
|
+
]
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
return rightEdgeSeriesRequests(domain, area, requests), extremeNameRequest(domain, area, scene, requests), area.showCatRow && categoryRequests(domain, area, requests), rankValueLabels(requests, (request) => {
|
|
1739
|
+
let ci = cats.findIndex((c) => c.id === request.owner.categoryId);
|
|
1740
|
+
if (!(ci < 0))
|
|
1741
|
+
return request.kind === "grandTotal" ? stackTotals[cats[ci].id] : domain.dataSeries.find((s) => s.id === request.owner.seriesId)?.vals[ci]?.v;
|
|
1742
|
+
}, domain.density, domain.options.labelPlacements, {
|
|
1743
|
+
categories: cats.length,
|
|
1744
|
+
last: domain.options.mode === "compact" ? cats.at(-1)?.id : void 0,
|
|
1745
|
+
pitch: band.step / (variant === "grouped" ? domain.dataSeries.length : 1),
|
|
1746
|
+
orientation: "vertical",
|
|
1747
|
+
measure
|
|
1748
|
+
}), growthPoints;
|
|
1749
|
+
}
|
|
1750
|
+
function extremeNameRequest(domain, area, scene, requests) {
|
|
1751
|
+
if (domain.options.labels === !1 || !area.showCatRow || area.catPlan.dateNumeric || area.catPlan.keep.every(Boolean)) return;
|
|
1752
|
+
let extreme = scene.bars.reduce((best, place) => !best || Math.abs(place.v) > Math.abs(best.v) ? place : best, void 0);
|
|
1753
|
+
if (!extreme || area.catPlan.keep[extreme.ci]) return;
|
|
1754
|
+
let { c, s, v, rect } = extreme, text = domain.variant === "grouped" && contentOf(domain.options, "point", ["absolute"]) !== null ? c.label ?? c.id : `${c.label ?? c.id} ${domain.valueSpec.forSeries(s)(v)}`, font = { ...area.labelFont, weight: emphasisWeight(domain.theme) }, size = domain.measure(text, font), cx = rect.x + rect.w / 2, endY = v < 0 ? rect.y + rect.h + 4 : rect.y - size.height - 4, box = (x, y) => ({ x, y, w: size.width, h: size.height });
|
|
1755
|
+
requests.push({
|
|
1756
|
+
id: `extreme:${s.id}:${c.id}`,
|
|
1757
|
+
kind: "annotation",
|
|
1758
|
+
role: composedTextRole(text, "note"),
|
|
1759
|
+
owner: { seriesId: s.id, categoryId: c.id },
|
|
1760
|
+
text,
|
|
1761
|
+
lines: [text],
|
|
1762
|
+
typeRole: "label",
|
|
1763
|
+
font,
|
|
1764
|
+
priority: PRIORITY.valueLine,
|
|
1765
|
+
candidates: [
|
|
1766
|
+
{ slot: "atEnd", rect: box(cx - size.width / 2, endY), penalty: 0 },
|
|
1767
|
+
{ slot: "atEndRight", rect: box(rect.x + rect.w + 4, v < 0 ? rect.y + rect.h - size.height : rect.y), penalty: 1 },
|
|
1768
|
+
{ slot: "atEndLeft", rect: box(rect.x - 4 - size.width, v < 0 ? rect.y + rect.h - size.height : rect.y), penalty: 2 }
|
|
1769
|
+
]
|
|
1770
|
+
});
|
|
1771
|
+
}
|
|
1772
|
+
function rightEdgeSeriesRequests(domain, area, requests) {
|
|
1773
|
+
let named = rightEdgeSeriesLabels(domain);
|
|
1774
|
+
if (named.length === 0) return;
|
|
1775
|
+
let { measure, cats, stacks, dataSeries } = domain, { band, y } = area, labelFont = edgeNameFont(area.labelFont, domain), left = domain.options.seriesLabels?.at === "left-edge", edge = left ? 0 : cats.length - 1, stack = stacks[edge];
|
|
1776
|
+
if (!(stack === void 0 || !stack.hasValue))
|
|
1777
|
+
for (let series of named) {
|
|
1778
|
+
let seriesIndex = dataSeries.findIndex((candidate) => candidate.id === series.id), segment = seriesIndex < 0 ? null : stack.segments[seriesIndex];
|
|
1779
|
+
if (!segment) continue;
|
|
1780
|
+
let size = measure(series.label, labelFont), middle = y((segment.start + segment.end) / 2), x = left ? band.position(edge) - RIGHT_EDGE_GAP - size.width : band.position(edge) + band.bandwidth + RIGHT_EDGE_GAP;
|
|
1781
|
+
requests.push({
|
|
1782
|
+
id: `seriesEdge:${series.id}`,
|
|
1783
|
+
kind: "series",
|
|
1784
|
+
owner: { seriesId: series.id, categoryId: cats[edge].id },
|
|
1785
|
+
text: series.label,
|
|
1786
|
+
lines: [series.label],
|
|
1787
|
+
typeRole: "label",
|
|
1788
|
+
font: labelFont,
|
|
1789
|
+
priority: PRIORITY.endpoint,
|
|
1790
|
+
candidates: [
|
|
1791
|
+
{ slot: left ? "leftOfStack" : "rightOfStack", rect: { x, y: middle - size.height / 2, w: size.width, h: size.height }, penalty: 0 }
|
|
1792
|
+
]
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
var SEAT_PAD = 2;
|
|
1797
|
+
function valueSeatRows(naturals, bars) {
|
|
1798
|
+
let spans = (a, b, gap = SEAT_PAD) => b.x < a.x + a.w + gap && a.x < b.x + b.w + gap, step = (rect) => rect.h + 4, first = naturals.map((seat) => {
|
|
1799
|
+
if (!seat) return;
|
|
1800
|
+
let { rect, negative } = seat, edge = negative ? Math.max(rect.y, maxOf(bars.filter((bar) => spans(rect, bar) && bar.y + bar.h + SEAT_PAD > rect.y && bar.y < rect.y).map((bar) => bar.y + bar.h + SEAT_PAD + 0.5))) : Math.min(rect.y + rect.h, minOf(bars.filter((bar) => spans(rect, bar) && bar.y - SEAT_PAD < rect.y + rect.h && bar.y + bar.h > rect.y + rect.h).map((bar) => bar.y - SEAT_PAD - 0.5))) - rect.h, lift = Math.abs(edge - rect.y);
|
|
1801
|
+
return { ...rect, y: edge, lifted: lift > 1e-6 && lift <= step(rect) ? edge : void 0 };
|
|
1802
|
+
});
|
|
1803
|
+
return naturals.map((seat, i) => {
|
|
1804
|
+
let row1 = first[i];
|
|
1805
|
+
if (!seat || !row1) return;
|
|
1806
|
+
let stagger = seat.negative ? row1.y + step(row1) : row1.y - step(row1);
|
|
1807
|
+
for (let [j, other] of first.entries())
|
|
1808
|
+
j === i || !other || naturals[j].negative !== seat.negative || !spans(row1, other, SERIES_VALUE_GAP) || (stagger = seat.negative ? Math.max(stagger, other.y + other.h + SEAT_PAD + 0.5) : Math.min(stagger, other.y - SEAT_PAD - 0.5 - row1.h));
|
|
1809
|
+
return { ...row1.lifted === void 0 ? {} : { lifted: row1.lifted }, stagger };
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
function pointCandidates(rect, tsize, negative, insideFill, y, range, outset = 0, rows) {
|
|
1813
|
+
let cx = rect.x + rect.w / 2, markTop = rect.y, markBot = rect.y + rect.h, beside = range ? [
|
|
1814
|
+
{ slot: "besideWhiskerRight", rect: { x: cx + 9, y: negative ? markBot + 3 : markTop - tsize.height - 3, w: tsize.width, h: tsize.height }, penalty: 0 },
|
|
1815
|
+
{ slot: "besideWhiskerLeft", rect: { x: cx - 9 - tsize.width, y: negative ? markBot + 3 : markTop - tsize.height - 3, w: tsize.width, h: tsize.height }, penalty: 0.5 }
|
|
1816
|
+
] : [], yTop = (range ? Math.min(markTop, y(range.low), y(range.high)) : markTop) - outset, yBot = (range ? Math.max(markBot, y(range.low), y(range.high)) : markBot) + outset, w = tsize.width, h = tsize.height, inside = tsize.width <= rect.w && tsize.height + 4 <= rect.h;
|
|
1817
|
+
return negative ? [
|
|
1818
|
+
...beside,
|
|
1819
|
+
{ slot: "outsideBottom", rect: { x: cx - w / 2, y: yBot + 4, w, h }, penalty: 0, overRules: !0 },
|
|
1820
|
+
...rows?.lifted === void 0 ? [] : [{ slot: "outsideBottomLifted", rect: { x: cx - w / 2, y: rows.lifted, w, h }, penalty: 0.5 }],
|
|
1821
|
+
{
|
|
1822
|
+
slot: "outsideBottomShifted",
|
|
1823
|
+
rect: { x: cx - w / 2, y: rows?.stagger ?? yBot + h + 8, w, h },
|
|
1824
|
+
penalty: 1
|
|
1825
|
+
},
|
|
1826
|
+
...inside ? [{ slot: "insideEnd", rect: { x: cx - w / 2, y: markBot - h - 2, w, h }, penalty: 2, insideFill }] : []
|
|
1827
|
+
] : [
|
|
1828
|
+
...beside,
|
|
1829
|
+
// A reference line across this seat (an average marker) does not move
|
|
1830
|
+
// the value: it crosses the line on a halo, level with its neighbours.
|
|
1831
|
+
{ slot: "outsideTop", rect: { x: cx - w / 2, y: yTop - h - 4, w, h }, penalty: 0, overRules: !0 },
|
|
1832
|
+
...rows?.lifted === void 0 ? [] : [{ slot: "outsideTopLifted", rect: { x: cx - w / 2, y: rows.lifted, w, h }, penalty: 0.5 }],
|
|
1833
|
+
{
|
|
1834
|
+
slot: "outsideTopShifted",
|
|
1835
|
+
rect: { x: cx - w / 2, y: rows?.stagger ?? yTop - 2 * h - 8, w, h },
|
|
1836
|
+
penalty: 1
|
|
1837
|
+
},
|
|
1838
|
+
...inside ? [{ slot: "insideEnd", rect: { x: cx - w / 2, y: markTop + 2, w, h }, penalty: 2, insideFill }] : []
|
|
1839
|
+
];
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
// src/core/charts/column/paints.ts
|
|
1843
|
+
function signWord(s, positive, strings) {
|
|
1844
|
+
return positive === (s.direction !== "lowerIsBetter") ? strings?.better ?? localeStrings().better : strings?.worse ?? localeStrings().worse;
|
|
1845
|
+
}
|
|
1846
|
+
function seriesPattern(s) {
|
|
1847
|
+
return s.scenario === "FC" ? "hatch45" : s.scenario === "PL" ? "outline" : void 0;
|
|
1848
|
+
}
|
|
1849
|
+
function columnPaints(domain, warnings) {
|
|
1850
|
+
let { options, theme, palette, highlights, cats, dataSeries, variant, plottedOf, othersId, signColor, uniformScenario } = domain, resolved = /* @__PURE__ */ new Map(), paintCss = (paint) => {
|
|
1851
|
+
let key = JSON.stringify(paint), css = resolved.get(key);
|
|
1852
|
+
return css === void 0 && resolved.set(key, css = paintColor(theme, paint)), css;
|
|
1853
|
+
}, authored = domain.seriesNorm.filter((s) => dataSeries.includes(s)), roles = colorRolePaints(authored), ownPaints = authored.map((s) => s.fill ? { css: s.fill } : s.colorRole ? roles.get(s.id) : highlights.has(s.id) ? { token: "focus" } : void 0), authoredSlots = rampSlots(theme, ownPaints, palette, { labels: authored.map((s) => s.label), warnings }), stackOwn = (variant === "stacked" || variant === "stacked100") && ownPaints.some(Boolean) ? ownPaints : void 0, quietRest = !!options.seriesRamp && (options.othersShade ?? DEFAULT_OTHERS_SHADE) === "quietest" && authored.some((s) => s.colorRole === "others" && !s.fill);
|
|
1854
|
+
quietRest && warnings.push(...othersShadeUnavailableWarnings(theme, { token: "markInk" }));
|
|
1855
|
+
let slotOf = new Map(authored.map((s, i) => [s.id, authoredSlots[i] ?? i])), receding = recedingSeriesId(dataSeries, highlights), slots = dataSeries.map((s, i) => slotOf.get(s.id) ?? i), marked = authored.some((s) => s.colorRole !== void 0 || highlights.has(s.id) || s.id === receding), stackPlain = (variant === "stacked" || variant === "stacked100") && palette === void 0 && !marked ? authored.filter((s) => !s.fill) : [], actuals = dataSeries.filter((x) => x.scenario === void 0 || x.scenario === "AC"), plans = dataSeries.filter((x) => x.scenario === "PL"), planPartner = new Map(plans.flatMap((plan, k) => actuals[k] ? [[plan.id, actuals[k]]] : [])), seriesIdentityPaint = (s, dataIdx, scenario = s.scenario) => {
|
|
1856
|
+
if (s.fill) return { css: s.fill };
|
|
1857
|
+
if (s.colorRole) return roles.get(s.id) ?? markRolePaint(s.colorRole, !0);
|
|
1858
|
+
if (highlights.has(s.id)) return markRolePaint("focus", !0);
|
|
1859
|
+
if (options.seriesRamp) return orderedRampPaint(authored.length - 1 - authored.indexOf(s), authored.length, quietRest);
|
|
1860
|
+
if (s.id === receding) return mutedMarkPaint();
|
|
1861
|
+
let partner = planPartner.get(s.id);
|
|
1862
|
+
if (partner) return seriesIdentityPaint(partner, dataSeries.indexOf(partner), scenario);
|
|
1863
|
+
let slot = slots[dataIdx] ?? dataIdx;
|
|
1864
|
+
return dataSeries.length === 1 ? seriesPaint(slot, palette, scenario, !0) : stackPlain.length > 1 && stackPlain.includes(s) ? stackRampPaint(stackPlain.indexOf(s), stackPlain.length, slot) : stackOwn && authored.includes(s) ? stackApartPaint(stackOwn, authored.indexOf(s), slot, palette) : seriesPaint(slot, palette);
|
|
1865
|
+
}, restRecedes = dataSeries.length === 1 && cats.some((c, ci) => highlights.has(c.id) && (plottedOf(dataSeries[0], ci) ?? 0) !== 0), seriesBasePaint = (s, dataIdx) => restRecedes && !s.fill && !s.colorRole && !s.scenario ? { token: "rest" } : seriesIdentityPaint(s, dataIdx), cellPaint = (s, val, cat, dataIdx) => val.fill ? { css: val.fill } : othersId !== null && cat.id === othersId ? { token: "othersMark" } : highlights.has(s.id) || highlights.has(cat.id) && dataSeries.length === 1 ? s.fill ? { css: s.fill } : s.colorRole ? roles.get(s.id) ?? markRolePaint(s.colorRole, !0) : markRolePaint("focus", !0) : signColor ? signPaint(s, val.v, options.colorblindSafe) : uniformScenario.has(cat.id) ? seriesIdentityPaint(s, dataIdx, val.scenario ?? s.scenario) : val.scenario ? seriesIdentityPaint(s, dataIdx, val.scenario) : seriesBasePaint(s, dataIdx), scenarioPattern = (s, val, cat) => {
|
|
1866
|
+
let sc = val.scenario ?? s.scenario;
|
|
1867
|
+
if (uniformScenario.get(cat.id) !== "PL")
|
|
1868
|
+
return sc === "FC" ? "hatch45" : sc === "PL" ? "outline" : void 0;
|
|
1869
|
+
}, cellOutline = (cat) => uniformScenario.get(cat.id) === "PL", cellPattern = (s, val, cat) => partialPattern(cat, scenarioPattern(s, val, cat), cellOutline(cat));
|
|
1870
|
+
signColor && signColorOverrides(cats, dataSeries, highlights, othersId, (s, ci) => s.vals[ci], warnings);
|
|
1871
|
+
let paintedCells = [];
|
|
1872
|
+
for (let s of dataSeries)
|
|
1873
|
+
cats.forEach((c, ci) => {
|
|
1874
|
+
let v = plottedOf(s, ci);
|
|
1875
|
+
v !== null && (variant !== "grouped" && v === 0 || paintedCells.push({ s, val: s.vals[ci], c }));
|
|
1876
|
+
});
|
|
1877
|
+
let refPaintOf = (s) => s.fill ? { css: s.fill } : s.colorRole ? { token: markRoleToken(s.colorRole) } : { token: "ink" };
|
|
1878
|
+
return {
|
|
1879
|
+
css: paintCss,
|
|
1880
|
+
cell: cellPaint,
|
|
1881
|
+
pattern: cellPattern,
|
|
1882
|
+
outline: cellOutline,
|
|
1883
|
+
// what the viewer SEES: outline reads as background, hatch as a
|
|
1884
|
+
// mostly-background blend — auto-ink must contrast against that
|
|
1885
|
+
inside: (s, val, cat, dataIdx) => effectiveFill(paintCss(cellPaint(s, val, cat, dataIdx)), cellPattern(s, val, cat), theme),
|
|
1886
|
+
corridor: columnCorridorPaint(options.colorblindSafe),
|
|
1887
|
+
ref: refPaintOf,
|
|
1888
|
+
refStroke: (s) => domain.refStyle === "tick" && !s.fill && !s.colorRole ? { token: "axis" } : refPaintOf(s),
|
|
1889
|
+
identity: seriesIdentityPaint,
|
|
1890
|
+
base: seriesBasePaint,
|
|
1891
|
+
cellPatterns: paintedCells.map(({ s, val, c }) => scenarioPattern(s, val, c)),
|
|
1892
|
+
partialHatch: paintedCells.some(({ s, val, c }) => cellPattern(s, val, c) !== scenarioPattern(s, val, c))
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
// src/core/charts/column/plot.ts
|
|
1897
|
+
var TILED_BANDS = /* @__PURE__ */ Symbol("tiledBands"), SEGMENT_NOTE = /* @__PURE__ */ Symbol("segmentNote"), CATEGORY_NOTES = /* @__PURE__ */ Symbol("categoryNotes"), CAGR_PAD = /* @__PURE__ */ Symbol("cagrPad");
|
|
1898
|
+
function uniformCellLook(domain, paints, s, i) {
|
|
1899
|
+
let looks = domain.cats.flatMap((c, ci) => {
|
|
1900
|
+
let v = domain.plottedOf(s, ci);
|
|
1901
|
+
return v === null || domain.variant !== "grouped" && v === 0 ? [] : [{ paint: paints.cell(s, s.vals[ci], c, i), pattern: paints.pattern(s, s.vals[ci], c) }];
|
|
1902
|
+
}), first = looks[0];
|
|
1903
|
+
if (!first || looks.some((look) => look.pattern !== first.pattern || paints.css(look.paint) !== paints.css(first.paint))) return {};
|
|
1904
|
+
let hatchGround = segmentHatchGround(domain.variant === "grouped" ? "bar" : "segment", first.pattern, first.paint);
|
|
1905
|
+
return { paint: first.paint, pattern: first.pattern, ...hatchGround ? { hatchGround } : {} };
|
|
1906
|
+
}
|
|
1907
|
+
function columnLegendItems(domain, paints) {
|
|
1908
|
+
let { dataSeries, refSeries, variant, refStyle, anomaly, corridorShown, statFmt } = domain, legendUsesSeriesIdentity = domain.uniformScenario.size > 0, seriesItems = domain.signColor ? dataSeries.flatMap((s) => [
|
|
1909
|
+
{
|
|
1910
|
+
id: `${s.id}:above`,
|
|
1911
|
+
label: stringFields(domain.options.strings.aboveZero, { series: s.label, meaning: signWord(s, !0, domain.options.strings) }),
|
|
1912
|
+
paint: signPaint(s, 1, domain.options.colorblindSafe)
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
id: `${s.id}:below`,
|
|
1916
|
+
label: stringFields(domain.options.strings.belowZero, { series: s.label, meaning: signWord(s, !1, domain.options.strings) }),
|
|
1917
|
+
paint: signPaint(s, -1, domain.options.colorblindSafe)
|
|
1918
|
+
}
|
|
1919
|
+
].filter((_, index) => s.vals.some((v) => v.v !== null && (index === 0 ? v.v > 0 : v.v < 0)))) : dataSeries.map((s, i) => ({
|
|
1920
|
+
id: s.id,
|
|
1921
|
+
label: s.label,
|
|
1922
|
+
paint: legendUsesSeriesIdentity ? paints.identity(s, i) : paints.base(s, i),
|
|
1923
|
+
pattern: legendUsesSeriesIdentity ? void 0 : seriesPattern(s),
|
|
1924
|
+
// A series whose every drawn column looks the same is keyed in that look, hatch included.
|
|
1925
|
+
...uniformCellLook(domain, paints, s, i)
|
|
1926
|
+
})), edgeNamed = edgeNamesReplaceKey(domain) ? new Set(rightEdgeSeriesLabels(domain).map((series) => series.id)) : void 0, keyedSeries = edgeNamed ? seriesItems.filter((item) => !edgeNamed.has(item.id)) : seriesItems;
|
|
1927
|
+
return [
|
|
1928
|
+
...keyedSeries,
|
|
1929
|
+
// The scenario the CELLS carry, when no series key already carries it.
|
|
1930
|
+
// `keyPatterns` reads the items just built rather than re-deriving them,
|
|
1931
|
+
// so the two can never disagree about what the legend already says.
|
|
1932
|
+
// suppressed refs (stacked100) must not appear in the legend either —
|
|
1933
|
+
// a swatch for an unrendered mark is a lying legend
|
|
1934
|
+
...variant === "stacked100" ? [] : refSeries.map((s) => ({
|
|
1935
|
+
id: s.id,
|
|
1936
|
+
label: referenceKeyLabel(domain, s),
|
|
1937
|
+
paint: refStyle === "marker" ? paints.ref(s) : paints.refStroke(s),
|
|
1938
|
+
key: "line",
|
|
1939
|
+
...refStyle === "line" ? { dash: dashToken(domain.theme, "dotted"), lineCap: "round", width: strokeToken(domain.theme, "rule") } : { width: strokeToken(domain.theme, "rule") },
|
|
1940
|
+
...refStyle === "marker" ? referenceMarkerKey(domain.theme, paints.ref(s)) : {}
|
|
1941
|
+
})),
|
|
1942
|
+
...scenarioLegendKeys({
|
|
1943
|
+
markPatterns: paints.cellPatterns,
|
|
1944
|
+
keyPatterns: keyedSeries.map((item) => item.pattern),
|
|
1945
|
+
paint: { token: "neutralMark" },
|
|
1946
|
+
strings: domain.options.strings
|
|
1947
|
+
}),
|
|
1948
|
+
...partialLegendKeys(paints.partialHatch && !partialNamedOnValues(domain), domain.options.strings, domain.cats),
|
|
1949
|
+
// The flag marker and the corridor rule carry the anomaly verdict, so the
|
|
1950
|
+
// legend keys them, not only the fill. Key glyphs mirror the actual mark
|
|
1951
|
+
// encoding, so these are drawn as a marker and a dashed line, in the same
|
|
1952
|
+
// paint the furniture uses.
|
|
1953
|
+
...anomalyLegendItems(domain.theme, anomaly, corridorShown, statFmt, paints.corridor, domain.options.strings, domain.options.locale?.language),
|
|
1954
|
+
// An interval whisker is keyed in its shape.
|
|
1955
|
+
...rangeDrawn(domain) ? [{ id: "__range", label: domain.options.strings.range, paint: { token: "ink" }, key: "whisker", width: strokeToken(domain.theme, "rule") }] : []
|
|
1956
|
+
];
|
|
1957
|
+
}
|
|
1958
|
+
var PANEL_GROUP_FRACTION = 0.72, PANEL_GROUP_BAR = 76, COLUMN_FRACTION_MAX = 0.7;
|
|
1959
|
+
function columnBandFraction(plotW, count) {
|
|
1960
|
+
let pitch = plotW / Math.max(1, count);
|
|
1961
|
+
return 0.56 - 0.06 * Math.min(1, Math.max(0, (pitch - 64) / 154));
|
|
1962
|
+
}
|
|
1963
|
+
function referenceKeyLabel(domain, s) {
|
|
1964
|
+
return s.scenario === "PY" && s.label.trim() === "PY" ? chartString2(domain.options, "priorYearKey") : s.label;
|
|
1965
|
+
}
|
|
1966
|
+
function rangeDrawn(domain) {
|
|
1967
|
+
return panelTypeClass(domain.options) === void 0 && domain.dataSeries.some((s) => domain.cats.some((_, ci) => domain.rangeOf(s, ci) !== void 0));
|
|
1968
|
+
}
|
|
1969
|
+
function columnLegend(domain, paints, warnings) {
|
|
1970
|
+
let { options, signColor, anomaly } = domain, referenceDrawn = domain.variant !== "stacked100" && panelTypeClass(options) === void 0 && domain.refSeries.some((s) => s.vals.some((val) => val.v !== null)), legendForcedByEncoding = signColor || anomaly !== void 0 || referenceDrawn || rangeDrawn(domain);
|
|
1971
|
+
legendForcedByEncoding && options.legend === "none" && warnings.push({
|
|
1972
|
+
code: "legend-suppressed-encoding",
|
|
1973
|
+
severity: "warn",
|
|
1974
|
+
message: `legend: 'none' suppressed the only key naming this exhibit's encodings (${[signColor ? "sign colour" : "", anomaly ? "the anomaly corridor and flag marker" : "", referenceDrawn ? "the reference mark" : ""].filter(Boolean).join(", ")}) \u2014 the reader is left to infer them`,
|
|
1975
|
+
suggest: "drop legend: 'none', or drop signColor/anomaly/the reference series"
|
|
1976
|
+
});
|
|
1977
|
+
let effectiveLegend = options.legend === void 0 && legendForcedByEncoding ? "top" : options.legend;
|
|
1978
|
+
if (!effectiveLegend || effectiveLegend === "none" || effectiveLegend === "auto") return;
|
|
1979
|
+
let legendOpts = normalizeLegendOption(effectiveLegend), items = columnLegendItems(domain, paints);
|
|
1980
|
+
if (!(items.length === 0 && edgeNamesReplaceKey(domain))) {
|
|
1981
|
+
if (legendOpts.order) {
|
|
1982
|
+
let oi = (id) => {
|
|
1983
|
+
let k = legendOpts.order.indexOf(id);
|
|
1984
|
+
return k === -1 ? Number.MAX_SAFE_INTEGER : k;
|
|
1985
|
+
};
|
|
1986
|
+
items = [...items].sort((a, b) => oi(a.id) - oi(b.id));
|
|
1987
|
+
}
|
|
1988
|
+
return { options: legendOpts, items };
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
function bandKeyRow(domain, paints, eventKey) {
|
|
1992
|
+
if (!eventKey?.legend?.length) return;
|
|
1993
|
+
let single = domain.dataSeries.length === 1 ? domain.dataSeries[0].id : void 0, items = columnLegendItems(domain, paints).filter((item) => item.id !== single);
|
|
1994
|
+
return { options: { position: "top" }, items };
|
|
1995
|
+
}
|
|
1996
|
+
function solveColumnFrame(domain, paints, warnings, eventKey) {
|
|
1997
|
+
let { options, theme, size, measure, anomaly, corridorShown, statFmt, netLineOn, netLineSeries, variant } = domain, claims = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), decorationFont = { family: theme.type.family, ...theme.type.label, weight: emphasisWeight(theme) }, anomalyRuleLabelWidth = anomaly?.usable ? anomalyRuleReserve(anomalyRuleLines(theme, anomaly, corridorShown, statFmt, { token: "warn" }, options.strings), { family: theme.type.family, ...theme.type.label }, measure) : 0, decorationRight = Math.max(
|
|
1998
|
+
netLineOn ? measure(netLineName(domain.dataSeries, netLineSeries, domain.stacks, options.strings), decorationFont).width + 12 : 0,
|
|
1999
|
+
anomalyRuleLabelWidth
|
|
2000
|
+
), tokenMargin = canvasMargin(theme, size.width), edgeNamesRight = options.seriesLabels?.at !== "left-edge" && rightEdgeSeriesLabels(domain).length > 0, margin = {
|
|
2001
|
+
...tokenMargin,
|
|
2002
|
+
right: Math.max(variant === "stacked100" && !edgeNamesRight ? 56 : tokenMargin.right, decorationRight),
|
|
2003
|
+
bottom: ratioTierCanRender(options.ratioTier, domain.cats, domain.seriesNorm) ? 3 : tokenMargin.bottom,
|
|
2004
|
+
...options.margin
|
|
2005
|
+
}, axisFont = { family: theme.type.family, ...theme.type.axis }, axisReserve = domain.va.show ? measureValueAxisWidth([domain.dLo, domain.dHi], domain.fmt, theme, measure, 5, domain.valueSpec.spec) : 0, categoryWidth = Math.max(0, maxOf(domain.cats.map((c) => measure(c.label ?? c.id, axisFont).width))) + 4;
|
|
2006
|
+
if (domain.cats.length > 0 && categoryWidth > (size.width - margin.left - margin.right - axisReserve) / domain.cats.length) {
|
|
2007
|
+
let gutter = measure("0", axisFont).height;
|
|
2008
|
+
options.margin?.left === void 0 && (margin.left = Math.min(margin.left, gutter)), options.margin?.right === void 0 && (margin.right = Math.max(decorationRight, Math.min(margin.right, gutter)));
|
|
2009
|
+
}
|
|
2010
|
+
margin.right = Math.max(
|
|
2011
|
+
margin.right,
|
|
2012
|
+
options[VALUE_LINE_RESERVE] ?? 0,
|
|
2013
|
+
options[TICK_LABEL_RESERVE] ?? 0
|
|
2014
|
+
);
|
|
2015
|
+
let legend = columnLegend(domain, paints, warnings) ?? bandKeyRow(domain, paints, eventKey);
|
|
2016
|
+
return { frame: solveFrame(
|
|
2017
|
+
{
|
|
2018
|
+
size,
|
|
2019
|
+
margin,
|
|
2020
|
+
...frameTextOptions(options),
|
|
2021
|
+
footnotes: [
|
|
2022
|
+
...partialFootnotes(domain.cats, options.strings, legend?.items.some((item) => item.id === "__partial") || partialNamedOnValues(domain)),
|
|
2023
|
+
...authoredNotes(options),
|
|
2024
|
+
// Above 8 values the note counts them against all drawn values.
|
|
2025
|
+
...noteLine(
|
|
2026
|
+
options.strings.valuesNotOnColumns,
|
|
2027
|
+
options[SEGMENT_NOTE] ?? [],
|
|
2028
|
+
options,
|
|
2029
|
+
domain.dataSeries.reduce((sum, series) => sum + series.vals.filter((cell) => cell.v !== null).length, 0)
|
|
2030
|
+
),
|
|
2031
|
+
...options[CATEGORY_NOTES] ?? [],
|
|
2032
|
+
...partialTotalsNote(domain, options)
|
|
2033
|
+
],
|
|
2034
|
+
legend,
|
|
2035
|
+
...eventKey ? { eventKey } : {},
|
|
2036
|
+
theme,
|
|
2037
|
+
measure
|
|
2038
|
+
},
|
|
2039
|
+
claims
|
|
2040
|
+
), claims };
|
|
2041
|
+
}
|
|
2042
|
+
function partialTotalsNote(domain, options) {
|
|
2043
|
+
return domain.variant !== "stacked" || domain.gtContent === null ? [] : noteLine(knownPartsLead(domain.options), domain.cats.flatMap((c, ci) => {
|
|
2044
|
+
if (!domain.incompleteCats.has(c.id)) return [];
|
|
2045
|
+
let missing = domain.dataSeries.filter((s) => s.vals[ci].v === null).map((s) => s.label);
|
|
2046
|
+
return [`${c.label ?? c.id} ${domain.options.strings.without} ${missing.join(` ${domain.options.strings.and} `)}`];
|
|
2047
|
+
}), options);
|
|
2048
|
+
}
|
|
2049
|
+
var RIBBON_COLUMN = 0.04;
|
|
2050
|
+
function widestSegmentValue(domain) {
|
|
2051
|
+
let { dataSeries, cats, variant, theme, measure } = domain, font = { family: theme.type.family, ...theme.type.label }, widest = 0;
|
|
2052
|
+
for (let s of dataSeries)
|
|
2053
|
+
cats.forEach((_, ci) => {
|
|
2054
|
+
let val = s.vals[ci], v = domain.plottedOf(s, ci);
|
|
2055
|
+
if (v === null) return;
|
|
2056
|
+
let text = variant === "stacked100" ? shareTextOf(domain, cats[ci].id, s.id, v, val.isPct) : domain.valueSpec.forSeries(s, val.format)(domain.absOf(s, ci));
|
|
2057
|
+
widest = Math.max(widest, measure(text, font).width);
|
|
2058
|
+
});
|
|
2059
|
+
return widest;
|
|
2060
|
+
}
|
|
2061
|
+
function columnBand(domain, frame, valueAxisReserve, tickFont, warnings, stair) {
|
|
2062
|
+
let { options, theme, measure, cats, va } = domain, plotX0 = frame.plot.x + (va.show ? valueAxisReserve : 0), plotW0 = va.show ? Math.max(10, frame.plot.w - valueAxisReserve) : frame.plot.w, narrow = domain.ribbonsOn && domain.ribbonRank, ribbonColumn = narrow ? Math.min(0.15, Math.max(RIBBON_COLUMN, (widestSegmentValue(domain) + 8) / plotW0)) : 0, ribbonFraction = ribbonColumn * (cats.length - 1) / (1 - 2 * ribbonColumn), grouped = domain.variant === "grouped" && domain.dataSeries.length > 1, panelGroup = options.bandFraction === void 0 && !narrow && grouped && panelTypeClass(options) !== void 0, bandFraction = panelGroup ? PANEL_GROUP_FRACTION : options.bandFraction ?? (narrow ? Math.min(0.7, Math.max(ribbonColumn, ribbonFraction)) : domain.pyRef ? pyTickKeyed(domain, frame.legend) ? 0.5 : 0.42 : grouped ? COLUMN_FRACTION_MAX : columnBandFraction(plotW0, cats.length)), bandFor = (x0, w) => bandScale(cats.length, [x0, x0 + w], {
|
|
2063
|
+
paddingInner: 1 - bandFraction,
|
|
2064
|
+
// Histogram bins tile the number line: the plot ends at the outer bin edges.
|
|
2065
|
+
paddingOuter: narrow ? bandFraction / 2 : options[TILED_BANDS] === !0 ? (1 - bandFraction) / 2 : (1 - bandFraction) / 2 + 0.05,
|
|
2066
|
+
gapAfter: cats.map((c, ci) => {
|
|
2067
|
+
let authored = c.gapAfter === !0 ? 0.5 : typeof c.gapAfter == "number" ? Math.max(0, c.gapAfter) : 0, gap = cats[ci + 1]?.role === "total" ? Math.max(authored, 0.5) : authored;
|
|
2068
|
+
return c.breakAfter ? Math.max(gap, 0.5) : gap;
|
|
2069
|
+
})
|
|
2070
|
+
}), edgeNames = rightEdgeSeriesLabels(domain), edgeLeft = options.seriesLabels?.at === "left-edge", edgeNeed = edgeNames.length === 0 ? 0 : maxOf(edgeNames.map((series) => measure(series.label, edgeNameFont({ family: theme.type.family, ...theme.type.label }, domain)).width)) + RIGHT_EDGE_GAP, edgeGiven = 0, edgePad = (x0, w) => {
|
|
2071
|
+
let band2 = bandFor(x0, w);
|
|
2072
|
+
return edgeLeft ? band2.position(0) - x0 : x0 + w - (band2.position(cats.length - 1) + band2.bandwidth);
|
|
2073
|
+
}, giveEdgeRoom = () => {
|
|
2074
|
+
if (edgeNeed === 0 || edgeGiven > 0 && edgeGiven + edgePad(plotX0, plotW0) >= edgeNeed) return;
|
|
2075
|
+
let room = edgeNeed - edgeGiven;
|
|
2076
|
+
for (let pass = 0; pass < 4; pass++) {
|
|
2077
|
+
let x0 = edgeLeft ? plotX0 + room : plotX0;
|
|
2078
|
+
room = Math.max(0, Math.ceil(edgeNeed - edgeGiven - edgePad(x0, Math.max(10, plotW0 - room)) + 1));
|
|
2079
|
+
}
|
|
2080
|
+
room = Math.min(plotW0 - 10, room), edgeLeft && (plotX0 += Math.max(0, room)), plotW0 = Math.max(10, plotW0 - room), edgeGiven += Math.max(0, room);
|
|
2081
|
+
};
|
|
2082
|
+
if (giveEdgeRoom(), stair) {
|
|
2083
|
+
let direction = staircaseDirection(domain.posTopP), room = staircaseRoom({
|
|
2084
|
+
names: cats.map((c) => c.label ?? c.id),
|
|
2085
|
+
font: tickFont,
|
|
2086
|
+
measure,
|
|
2087
|
+
direction,
|
|
2088
|
+
edge: direction === "right" ? frame.plot.x + frame.plot.w : plotX0,
|
|
2089
|
+
width: plotW0,
|
|
2090
|
+
centers: (r) => {
|
|
2091
|
+
let b = bandFor(direction === "right" ? plotX0 : plotX0 + r, plotW0 - r);
|
|
2092
|
+
return cats.map((_, ci) => b.center(ci));
|
|
2093
|
+
}
|
|
2094
|
+
});
|
|
2095
|
+
direction === "left" && (plotX0 += room), plotW0 -= room;
|
|
2096
|
+
}
|
|
2097
|
+
let fitColumnWidth = () => {
|
|
2098
|
+
if (options.bandFraction === void 0 && !narrow && !domain.pyRef && !grouped) {
|
|
2099
|
+
let strong = { family: theme.type.family, ...theme.type.label, weight: emphasisWeight(theme) }, widestTotal = Math.max(0, maxOf(cats.map((_, ci) => {
|
|
2100
|
+
let total = stackTotalText(domain, ci), words = partialWords(domain, ci);
|
|
2101
|
+
return total && !total.net ? Math.max(measure(total.text, strong).width, words ? measure(words, toDateFont(theme)).width : 0) : 0;
|
|
2102
|
+
}))), need = Math.max(widestSegmentValue(domain) + 10, widestTotal + 8);
|
|
2103
|
+
for (let pass = 0; pass < 3; pass++) {
|
|
2104
|
+
let width = bandFor(plotX0, plotW0).bandwidth;
|
|
2105
|
+
if (width >= need - 0.01 || bandFraction >= COLUMN_FRACTION_MAX) break;
|
|
2106
|
+
bandFraction = Math.min(COLUMN_FRACTION_MAX, bandFraction * need / width);
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
if (domain.variant === "stacked100" && options.bandFraction === void 0 && !narrow && panelTypeClass(options) === void 0)
|
|
2110
|
+
for (let pass = 0; pass < 3; pass++) {
|
|
2111
|
+
let width = bandFor(plotX0, plotW0).bandwidth;
|
|
2112
|
+
if (width <= STACKED100_COLUMN_MAX + 0.01) break;
|
|
2113
|
+
bandFraction *= STACKED100_COLUMN_MAX / width;
|
|
2114
|
+
}
|
|
2115
|
+
if (panelGroup) {
|
|
2116
|
+
let n = domain.dataSeries.length, cap = PANEL_GROUP_BAR * n + 4 * (n - 1);
|
|
2117
|
+
for (let pass = 0; pass < 3; pass++) {
|
|
2118
|
+
let width = bandFor(plotX0, plotW0).bandwidth;
|
|
2119
|
+
if (width <= cap + 0.01) break;
|
|
2120
|
+
bandFraction *= cap / width;
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
};
|
|
2124
|
+
fitColumnWidth();
|
|
2125
|
+
let pyRef = domain.pyRef;
|
|
2126
|
+
if (pyRef && options.bandFraction === void 0 && !narrow && pyTickKeyed(domain, frame.legend)) {
|
|
2127
|
+
let format = domain.valueSpec.forSeries(pyRef), widest = Math.max(0, maxOf(cats.map((_, ci) => {
|
|
2128
|
+
let v = domain.plottedOf(pyRef, ci);
|
|
2129
|
+
return v === null ? 0 : measure(format(v), tickFont).width;
|
|
2130
|
+
}))), need = PY_TICK_LEAD + widest + 4;
|
|
2131
|
+
for (let pass = 0; pass < 3; pass++) {
|
|
2132
|
+
let probe = bandFor(plotX0, plotW0);
|
|
2133
|
+
if (probe.step - probe.bandwidth >= need - 0.01) break;
|
|
2134
|
+
bandFraction = Math.max(0.3, 1 - need / probe.step);
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
for (let pass = 0; pass < 3; pass++) {
|
|
2138
|
+
let before = plotW0;
|
|
2139
|
+
if (giveEdgeRoom(), plotW0 === before) break;
|
|
2140
|
+
fitColumnWidth();
|
|
2141
|
+
}
|
|
2142
|
+
let band = bandFor(plotX0, plotW0), planRow = (b, ticked2) => {
|
|
2143
|
+
let row = categoryLabelsAndMarks(cats, { count: authoredFootnoteCount(options), warnings }, partialAxisWords(options.strings, options, frame.legend?.items.some((item) => item.id === "__partial") || partialNamedOnValues(domain)));
|
|
2144
|
+
return ticked2?.name(row), withCategoryRanks(planCategoryRow({
|
|
2145
|
+
target: options.target,
|
|
2146
|
+
textScale: textScaleOf(options),
|
|
2147
|
+
...row,
|
|
2148
|
+
centers: cats.map((_, ci) => b.center(ci)),
|
|
2149
|
+
step: b.step,
|
|
2150
|
+
fonts: [tickFont, { ...tickFont, size: tickFont.size - scaleTextPx(1, textScaleOf(options)) }, { family: theme.type.family, ...theme.type.footnote }],
|
|
2151
|
+
secondary: secondaryFont(theme),
|
|
2152
|
+
periods: cats.length > 0 && cats.every((c) => c.date !== void 0),
|
|
2153
|
+
padding: 4,
|
|
2154
|
+
measure,
|
|
2155
|
+
plotHeight: frame.plot.h,
|
|
2156
|
+
reference: { x: frame.plot.x, width: frame.plot.w },
|
|
2157
|
+
// A cut name takes a note mark only where its note prints.
|
|
2158
|
+
// Without the rank key, nominal names keep one name per column (rotate, then ellipsis).
|
|
2159
|
+
// Under notes.show 'ranks' alone a cut name takes no mark, since its note does not print.
|
|
2160
|
+
...disclosuresShown(options) ? { cutMarkFrom: authoredFootnoteCount(options) + 1 } : rankKeyShown(options) ? {} : { everyName: !0 },
|
|
2161
|
+
...ticked2?.plan
|
|
2162
|
+
}), measure, cats.map((c) => c.label ?? c.id), options[FORCE_CATEGORY_RANKS] === !0, rankKeyShown(options));
|
|
2163
|
+
}, catPlan = planRow(band), ticked = longDayMonths(cats, catPlan.stride, options.locale?.language);
|
|
2164
|
+
ticked && (catPlan = planRow(band, ticked));
|
|
2165
|
+
let catOverhang = stair ? 0 : rotatedLeftOverhang(catPlan, cats.map((_, ci) => band.center(ci)), 4);
|
|
2166
|
+
return catOverhang > 0 && (plotX0 += catOverhang, plotW0 -= catOverhang, band = bandFor(plotX0, plotW0), catPlan = planRow(band, ticked)), { band, catPlan };
|
|
2167
|
+
}
|
|
2168
|
+
var CAGR_ON_ARM_ROOM = 26, STACKED100_COLUMN_MAX = 110, CAGR_ON_ARM_MIN = 16;
|
|
2169
|
+
function columnPlotArea(domain, frame, warnings) {
|
|
2170
|
+
let { options, theme, size, measure, variant, va, fmt, valueSpec, cats, dLo, dHi } = domain, axisFmt = variant === "stacked100" ? (v) => formatAutomaticPercent(v, 0, !1, options.locale?.language) : fmt, axisSpec = variant === "stacked100" ? void 0 : valueSpec.spec, valueAxisReserve = va.show ? measureValueAxisWidth([dLo, dHi], axisFmt, theme, measure, 5, axisSpec) : 0, ratioTierPrepared = prepareRatioTier(
|
|
2171
|
+
options.ratioTier,
|
|
2172
|
+
cats,
|
|
2173
|
+
domain.seriesNorm,
|
|
2174
|
+
theme,
|
|
2175
|
+
measure,
|
|
2176
|
+
Math.max(10, frame.plot.w - valueAxisReserve),
|
|
2177
|
+
void 0,
|
|
2178
|
+
options.target,
|
|
2179
|
+
notApplicableGlyph(options.strings),
|
|
2180
|
+
options.locale?.language
|
|
2181
|
+
);
|
|
2182
|
+
pushAll(warnings, ratioTierPrepared.warnings);
|
|
2183
|
+
let tier = ratioTierPrepared.tier, tickFont = { family: theme.type.family, ...theme.type.axis }, labelFont = { family: theme.type.family, ...theme.type.label }, strongFont = { family: theme.type.family, ...theme.type.label, weight: emphasisWeight(theme) }, gtH = measure("0", strongFont).height, partialH = (ci) => {
|
|
2184
|
+
let words = partialWords(domain, ci);
|
|
2185
|
+
return words ? measure(words, toDateFont(theme)).height : 0;
|
|
2186
|
+
}, hasCagr = (options.annotations ?? []).some((a) => a.kind === "cagr"), integratedGrowthH = domain.pyRef && kindSetting(options, "growth") !== !1 ? measure("+88.8%", strongFont).height + 4 : 0, ruleOn = domain.anomaly !== void 0 && kindSetting(options, "valueLine") !== !1, ruleText = ruleOn ? `${domain.anomaly.rule}${domain.corridorNote}` : "", ruleWrap = ruleOn ? fitText(ruleText, tickFont, Math.max(80, frame.plot.w - 8), 4, measure, { target: options.target, textScale: textScaleOf(options), typeRole: "footnote" }) : void 0, ruleH = ruleWrap ? ruleWrap.lines.length * tickFont.size * 1.2 + 6 : 0, axisTitle = va.show && axisTitleAllowed(options.labels) ? planValueAxisTitle(valueAxisTitleText(
|
|
2187
|
+
theme,
|
|
2188
|
+
options.axisTitles?.primary,
|
|
2189
|
+
options,
|
|
2190
|
+
valueAxisUnit(options.unit, domain.dataSeries, variant === "stacked100")
|
|
2191
|
+
), theme, measure, frame.plot.w) : void 0, stair = staircaseOn(options.categoryLabels, options) && kindSetting(options, "category") !== !1 && cats.length > 1, { band, catPlan } = columnBand(domain, frame, valueAxisReserve, tickFont, warnings, stair), showCatRow = kindSetting(options, "category") !== !1 && cats.length > 0 && !stair;
|
|
2192
|
+
showCatRow && pushAll(warnings, catPlan.warnings), showCatRow && catPlan.step === "ranks" && warnings.push(categoryRanksLint(cats.map((c) => c.label ?? c.id), band.step));
|
|
2193
|
+
let tickReserve = showCatRow ? catPlan.rowHeight + 8 : 0, catBandH = tier ? 6 + catPlan.rowHeight + ratioTierMetrics.categoryCaptionGap - theme.space.tierGap : tickReserve, ratioTierHeight = tier?.reserveHeight ?? 0, lowest = Math.min(0, minOf(domain.negBotP)), pointsHang = variant === "grouped" && (kindSetting(options, "point") !== !1 || domain.anomaly !== void 0), hangingEnd = Math.min(0, minOf(cats.map((_, ci) => pointsHang || domain.gtContent && domain.posTopP[ci] <= 0 ? domain.negBotP[ci] : 0))), hangingRoom = showCatRow && options.labels !== !1 ? Math.max(measure("0", labelFont).height, gtH) + 4 + (domain.anomaly ? ANOMALY_FLAG_GAP + ANOMALY_FLAG_H : 0) : 0, axisTitleH = valueAxisTitleBand(axisTitle, theme, measure), cagrRoom = Math.max(CAGR_ON_ARM_MIN, CAGR_ON_ARM_ROOM - axisTitleH - ruleH - integratedGrowthH);
|
|
2194
|
+
hasCagr && cagrRoom < 30 && recordFreedChrome(frame.frame, "cagr-headroom", 30 - cagrRoom);
|
|
2195
|
+
let cagrPad = options[CAGR_PAD] ?? 0;
|
|
2196
|
+
hasCagr && cagrPad > 0 && recordFreedChrome(frame.frame, "cagr-pad", cagrPad);
|
|
2197
|
+
let growthAndCagr = integratedGrowthH + (hasCagr ? cagrRoom + cagrPad : 0), unrowedH = frame.plot.h - catBandH - ratioTierHeight - 8 - axisTitleH - growthAndCagr - ruleH, unrowedPlotH = unrowedH - hangingLabelReserve(unrowedH, [dLo, dHi], hangingEnd, hangingRoom), headerRows = (domain.gtContent ? domain.activeBreak ? gtH + 6 : Math.max(0, maxOf(domain.posTopP.map((top, ci) => top > 0 ? seatRoom(top, [dLo, dHi], gtH + partialH(ci) + 4, unrowedPlotH) : 0))) : 0) + growthAndCagr, axisTitleBand = valueAxisTitleBand(axisTitle, theme, measure, headerRows), rawBandPad = options[BAND_PAD] ?? 0, baseTopPad = 8 + axisTitleBand + headerRows + ruleH + (stair ? staircaseState(options).pad : 0), plotH0NoBand = frame.plot.h - catBandH - ratioTierHeight - baseTopPad, hangingReserveNoBand = hangingLabelReserve(plotH0NoBand, [dLo, dHi], hangingEnd, hangingRoom), minRawH = Math.max(10, options.mode === "compact" ? 80 : 0), bandPad = rawBandPad > 0 ? Math.max(0, Math.min(rawBandPad, Math.floor(plotH0NoBand - hangingReserveNoBand - minRawH))) : 0;
|
|
2198
|
+
for (; bandPad > 0 && frame.plot.h - catBandH - ratioTierHeight - (baseTopPad + bandPad) - hangingLabelReserve(frame.plot.h - catBandH - ratioTierHeight - (baseTopPad + bandPad), [dLo, dHi], hangingEnd, hangingRoom) < minRawH; )
|
|
2199
|
+
bandPad--;
|
|
2200
|
+
let topPad = baseTopPad + bandPad, plotH0 = frame.plot.h - catBandH - ratioTierHeight - topPad, hangingReserve = hangingLabelReserve(plotH0, [dLo, dHi], hangingEnd, hangingRoom);
|
|
2201
|
+
if (!stair && options.categoryLabels !== "staircase" && ["fit", "wrap", "font-down", "stride"].includes(catPlan.step) && !options.annotations?.some((annotation) => annotation.kind === "cagr" || annotation.kind === "event") && ![CAGR_PAD, VALUE_LINE_RESERVE, TICK_LABEL_RESERVE, BAND_PAD].some((marker) => marker in options)) {
|
|
2202
|
+
fixedPlotChrome(frame);
|
|
2203
|
+
let chrome = plotChromeFloor.get(frame.frame);
|
|
2204
|
+
if (chrome !== void 0) {
|
|
2205
|
+
let q = hangingEnd < 0 && hangingRoom > 0 && dHi > dLo ? (hangingEnd - dLo) / (dHi - dLo) : 0, room = hangingEnd < 0 ? hangingRoom : 0, bare = chrome + catBandH + ratioTierHeight + 8 + valueAxisTitleBand(axisTitle, theme, measure) + growthAndCagr + ruleH, unrowed = [[1, -bare], [1 / (1 - q), -(bare + room) / (1 - q)]], headers = [[0, growthAndCagr], [0, axisTitle ? measure("0", tickFont).height / 2 : 0]];
|
|
2206
|
+
if (domain.gtContent && domain.activeBreak) headers.push([0, growthAndCagr + gtH + 6]);
|
|
2207
|
+
else if (domain.gtContent) for (let top of domain.posTopP) {
|
|
2208
|
+
let free = (dHi - top) / (dHi - dLo);
|
|
2209
|
+
if (top > 0 && free >= 0 && free < 1)
|
|
2210
|
+
for (let [a, b] of unrowed) headers.push([-free * a / (1 - free), growthAndCagr + (gtH + 4 - free * b) / (1 - free)]);
|
|
2211
|
+
}
|
|
2212
|
+
let base = chrome + catBandH + ratioTierHeight + 8 + (axisTitle?.height ?? 0) + ruleH, plots = headers.flatMap(([a, b]) => [[1 - a, -base - b], [(1 - a) / (1 - q), (-base - b - room) / (1 - q)]]), height = maxOf(plots.flatMap(([a, b]) => [(PLOT_FLOOR_PX[options.target ?? DEFAULT_TARGET] - b) / a, -b / (a - plotFloorShare(size.width, options))])), plotAtFloor = minOf(plots.map(([a, b]) => a * height + b));
|
|
2213
|
+
q >= 0 && q < 1 && Number.isFinite(height) && Math.min(...unrowed.map(([a, b]) => a * height + b)) >= 0 ? fixedPlotChrome(frame, height - plotAtFloor - chrome) : plotChromeFloor.delete(frame.frame);
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
let plot = {
|
|
2217
|
+
x: frame.plot.x,
|
|
2218
|
+
y: frame.plot.y + topPad,
|
|
2219
|
+
w: frame.plot.w,
|
|
2220
|
+
h: plotHeightAfter(frame, size.height, plotH0 - hangingReserve)
|
|
2221
|
+
}, minPlot = plotFloorRows(options) * measure("0", labelFont).height + 8;
|
|
2222
|
+
frame.frame.plotMinHeight = Math.max(frame.frame.plotMinHeight ?? 0, size.height + (frame.deficit ?? 0) + minPlot - (plotH0NoBand - hangingReserveNoBand)), va.show && (plot.x += valueAxisReserve, plot.w = Math.max(10, plot.w - valueAxisReserve));
|
|
2223
|
+
let y = domain.activeBreak ? brokenLinearScale([dLo, dHi], [plot.y + plot.h, plot.y], domain.activeBreak) : linearScale([dLo, dHi], [plot.y + plot.h, plot.y]);
|
|
2224
|
+
return {
|
|
2225
|
+
frame,
|
|
2226
|
+
axisFmt,
|
|
2227
|
+
axisSpec,
|
|
2228
|
+
tier,
|
|
2229
|
+
tickFont,
|
|
2230
|
+
labelFont,
|
|
2231
|
+
strongFont,
|
|
2232
|
+
gtH,
|
|
2233
|
+
ruleOn,
|
|
2234
|
+
ruleText,
|
|
2235
|
+
ruleWrap,
|
|
2236
|
+
ruleH,
|
|
2237
|
+
axisTitle,
|
|
2238
|
+
axisTitleBand,
|
|
2239
|
+
topPad,
|
|
2240
|
+
band,
|
|
2241
|
+
catPlan,
|
|
2242
|
+
showCatRow,
|
|
2243
|
+
tickReserve,
|
|
2244
|
+
catBandH: catBandH + hangingReserve,
|
|
2245
|
+
// The names may rise to the frame top, under the rule and the axis title.
|
|
2246
|
+
...stair ? { stairTop: frame.plot.y + ruleH + (axisTitle ? axisTitle.height + 8 : 0) } : {},
|
|
2247
|
+
// A date row stays at the plot's bottom band; prose reads under the
|
|
2248
|
+
// lowest column and the value hanging under it.
|
|
2249
|
+
catRowY: catPlan.dateNumeric ? plot.y + plot.h + hangingReserve : categoryRowTop(y, lowest, hangingEnd, hangingRoom),
|
|
2250
|
+
plot,
|
|
2251
|
+
y,
|
|
2252
|
+
y0: y(0)
|
|
2253
|
+
};
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
// src/core/charts/column/layout.ts
|
|
2257
|
+
function clearStraightLeaders(labels, theme) {
|
|
2258
|
+
let visible = labels.filter((label) => !label.hidden), pad = REFERENCE_LABEL_CLEARANCE + strokeToken(theme, "rule") / 2 + 0.01;
|
|
2259
|
+
for (let label of visible) {
|
|
2260
|
+
if (!label.leader || label.leader.curved) continue;
|
|
2261
|
+
let match = /^M(-?[\d.]+) (-?[\d.]+)L(-?[\d.]+) (-?[\d.]+)$/.exec(label.leader.d);
|
|
2262
|
+
if (!match) continue;
|
|
2263
|
+
let [x, y, x2, y2] = match.slice(1).map(Number), dx = x2 - x, dy = y2 - y, cuts = [];
|
|
2264
|
+
for (let other of visible) {
|
|
2265
|
+
let r = other.rect, from2 = 0, to = 1;
|
|
2266
|
+
for (let [at, step, low, high] of [[x, dx, r.x - pad, r.x + r.w + pad], [y, dy, r.y - pad, r.y + r.h + pad]])
|
|
2267
|
+
if (step === 0)
|
|
2268
|
+
(at < low || at > high) && (from2 = 1, to = 0);
|
|
2269
|
+
else {
|
|
2270
|
+
let a = (low - at) / step, b = (high - at) / step;
|
|
2271
|
+
from2 = Math.max(from2, Math.min(a, b)), to = Math.min(to, Math.max(a, b));
|
|
2272
|
+
}
|
|
2273
|
+
from2 < to && cuts.push([from2, to]);
|
|
2274
|
+
}
|
|
2275
|
+
if (!cuts.length) continue;
|
|
2276
|
+
let from = { x, y }, clear = [leaderTerminus(label.rect, { x: label.rect.x - 1, y }), leaderTerminus(label.rect, { x: label.rect.x + label.rect.w + 1, y })].flatMap((end) => [[from, { x: end.x, y }, end], [from, { x, y: end.y }, end]]).sort((a, b) => Math.abs(a[2].x - x) + Math.abs(a[2].y - y) - Math.abs(b[2].x - x) - Math.abs(b[2].y - y)).find((points) => points.slice(1).every((b, i) => visible.every((other) => !segmentHitsRect(points[i], b, other.rect, pad))));
|
|
2277
|
+
if (clear) {
|
|
2278
|
+
label.leader = { d: linePath(clear), curved: !1 };
|
|
2279
|
+
continue;
|
|
2280
|
+
}
|
|
2281
|
+
cuts.sort((a, b) => a[0] - b[0]);
|
|
2282
|
+
let runs = [], start = 0;
|
|
2283
|
+
for (let [from2, to] of cuts)
|
|
2284
|
+
from2 > start && runs.push([start, from2]), start = Math.max(start, to);
|
|
2285
|
+
start < 1 && runs.push([start, 1]);
|
|
2286
|
+
let point = (t) => ({ x: x + t * dx, y: y + t * dy }), d = runs.map(([from2, to]) => linePath([point(from2), point(to)])).join("");
|
|
2287
|
+
label.leader = d ? { d, curved: !1 } : void 0;
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
function annotateColumn(domain, area, scene, occupied, solveCtx, printedLabels) {
|
|
2291
|
+
let { cats, dataSeries, variant, plottedOf, absOf, posTopP, negBotP, stackTotals } = domain, { plot, band, y, y0, topPad } = area, catIndex = new Map(cats.map((c, i) => [c.id, i])), resolveAnchor = (ref) => {
|
|
2292
|
+
let norm = typeof ref == "string" ? { categoryId: ref, edge: "total" } : ref;
|
|
2293
|
+
if (!("categoryId" in norm)) return null;
|
|
2294
|
+
let ci = catIndex.get(norm.categoryId);
|
|
2295
|
+
if (ci === void 0) return null;
|
|
2296
|
+
let c = cats[ci], edge = norm.edge ?? (norm.seriesId ? "end" : "total");
|
|
2297
|
+
if (norm.seriesId) {
|
|
2298
|
+
let reference = domain.refSeries.find((s2) => s2.id === norm.seriesId), tick = scene.marks.referenceTicks.find((m) => m.seriesId === norm.seriesId && m.categoryId === c.id);
|
|
2299
|
+
if (reference && tick) {
|
|
2300
|
+
let v = plottedOf(reference, ci);
|
|
2301
|
+
return v === null ? null : {
|
|
2302
|
+
x: tick.anchor?.x ?? band.center(ci),
|
|
2303
|
+
y: tick.anchor?.y ?? y(v),
|
|
2304
|
+
value: v,
|
|
2305
|
+
format: reference.format,
|
|
2306
|
+
pointValueText: domain.valueSpec.forSeries(reference, reference.vals[ci]?.format)(v),
|
|
2307
|
+
date: c.date,
|
|
2308
|
+
label: c.label,
|
|
2309
|
+
owner: { categoryId: c.id, seriesId: reference.id }
|
|
2310
|
+
};
|
|
2311
|
+
}
|
|
2312
|
+
let s = dataSeries.find((x) => x.id === norm.seriesId);
|
|
2313
|
+
if (!s) return null;
|
|
2314
|
+
let owner = { categoryId: c.id, seriesId: s.id }, series = { format: s.format, ...dataSeries.length > 1 ? { series: { id: s.id, label: s.label } } : {} };
|
|
2315
|
+
if (variant === "grouped") {
|
|
2316
|
+
let v = plottedOf(s, ci);
|
|
2317
|
+
return v === null ? null : {
|
|
2318
|
+
x: scene.subCenters.get(sk(s.id, c.id)) ?? band.center(ci),
|
|
2319
|
+
y: edge === "start" ? y0 : y(v),
|
|
2320
|
+
value: v,
|
|
2321
|
+
pointValueText: domain.valueSpec.forSeries(s, s.vals[ci]?.format)(v),
|
|
2322
|
+
date: c.date,
|
|
2323
|
+
label: c.label ?? c.id,
|
|
2324
|
+
owner,
|
|
2325
|
+
...series
|
|
2326
|
+
};
|
|
2327
|
+
}
|
|
2328
|
+
let e = scene.segEdges.get(sk(s.id, c.id));
|
|
2329
|
+
if (!e) return null;
|
|
2330
|
+
let yy = y(edge === "start" ? e.v0 : edge === "end" ? e.v1 : Math.max(e.v0, e.v1)), value = absOf(s, ci) ?? e.v;
|
|
2331
|
+
return {
|
|
2332
|
+
x: band.center(ci),
|
|
2333
|
+
y: yy,
|
|
2334
|
+
value,
|
|
2335
|
+
pointValueText: domain.valueSpec.forSeries(s, s.vals[ci]?.format)(value),
|
|
2336
|
+
date: c.date,
|
|
2337
|
+
label: c.label ?? c.id,
|
|
2338
|
+
owner,
|
|
2339
|
+
...series
|
|
2340
|
+
};
|
|
2341
|
+
}
|
|
2342
|
+
if (variant === "grouped" && dataSeries.length > 1) {
|
|
2343
|
+
let anchorSeries = dataSeries.find((x) => domain.highlights.has(x.id)) ?? dataSeries[0];
|
|
2344
|
+
return resolveAnchor({ categoryId: c.id, seriesId: anchorSeries.id, ...edge === "start" ? { edge } : {} });
|
|
2345
|
+
}
|
|
2346
|
+
let topPlotted = posTopP[ci] > 0 ? posTopP[ci] : negBotP[ci];
|
|
2347
|
+
return {
|
|
2348
|
+
x: band.center(ci),
|
|
2349
|
+
y: edge === "start" ? y0 : y(topPlotted),
|
|
2350
|
+
value: stackTotals[c.id],
|
|
2351
|
+
pointValueText: domain.totalFmt(stackTotals[c.id]),
|
|
2352
|
+
format: dataSeries.length === 1 ? dataSeries[0].format : void 0,
|
|
2353
|
+
...totalsAdd(domain) ? {} : { noValue: NO_STACK_TOTAL },
|
|
2354
|
+
date: c.date,
|
|
2355
|
+
label: c.label ?? c.id,
|
|
2356
|
+
owner: { categoryId: c.id }
|
|
2357
|
+
};
|
|
2358
|
+
}, annPlot = {
|
|
2359
|
+
x: plot.x,
|
|
2360
|
+
y: plot.y - (topPad - 8 - area.axisTitleBand),
|
|
2361
|
+
w: plot.w,
|
|
2362
|
+
h: plot.h + (topPad - 8 - area.axisTitleBand)
|
|
2363
|
+
}, ceilingRects = [];
|
|
2364
|
+
return area.ruleH > 0 && ceilingRects.push({ x: area.frame.plot.x, y: area.frame.plot.y + 2, w: area.frame.plot.w, h: area.ruleH }), area.axisTitle && domain.va.show && ceilingRects.push({ x: area.frame.plot.x, y: area.frame.plot.y + area.ruleH + 4, w: area.axisTitle.width, h: area.axisTitle.height }), runAnnotatePass({
|
|
2365
|
+
target: domain.options.target,
|
|
2366
|
+
// The growth bracket seats its label on its run.
|
|
2367
|
+
cagrLabelOnArm: !0,
|
|
2368
|
+
// Events belong to the event lane.
|
|
2369
|
+
annotations: domain.annList.filter((annotation) => annotation.kind !== "event"),
|
|
2370
|
+
resolve: resolveAnchor,
|
|
2371
|
+
printedLabels,
|
|
2372
|
+
defaultSpan: cats.length >= 2 ? { from: cats[0].id, to: cats[cats.length - 1].id } : void 0,
|
|
2373
|
+
occupied,
|
|
2374
|
+
plot: annPlot,
|
|
2375
|
+
bandCeiling: area.frame.plot.y,
|
|
2376
|
+
ceilingRects,
|
|
2377
|
+
theme: domain.theme,
|
|
2378
|
+
measure: domain.measure,
|
|
2379
|
+
format: domain.options.format,
|
|
2380
|
+
locale: domain.options.locale?.language,
|
|
2381
|
+
strings: domain.options.strings,
|
|
2382
|
+
percentLevels: percentLevels(dataSeries),
|
|
2383
|
+
valueLinePercentLevels: domain.variant === "stacked100" || domain.options.unit === "%" || domain.pctLevels,
|
|
2384
|
+
solveCtx,
|
|
2385
|
+
yScale: y,
|
|
2386
|
+
meanValue: domain.meanValue,
|
|
2387
|
+
...domain.meanMissing ? { meanMissing: domain.meanMissing } : {},
|
|
2388
|
+
meanSpan: domain.meanSpan,
|
|
2389
|
+
...categoryTargetFields(cats.map((c) => c.id), plot, (i) => band.center(i), "x"),
|
|
2390
|
+
partialCategories: partialIds(cats)
|
|
2391
|
+
});
|
|
2392
|
+
}
|
|
2393
|
+
function totalsAdd(domain) {
|
|
2394
|
+
return domain.dataSeries.length === 1 || domain.variant !== "grouped" && domain.partsAdd;
|
|
2395
|
+
}
|
|
2396
|
+
function columnA11yDesc(domain, area, rangeMarks, points) {
|
|
2397
|
+
let { cats, dataSeries, refSeries, variant, fmt, totalFmt, stackTotals, anomaly } = domain, labelOf = (id) => cats.find((category) => category.id === id)?.label ?? id, oneValueText = (ci) => dataSeries.length === 1 && variant !== "stacked100" ? cellValueText(domain, dataSeries[0], ci) : null, variantName = variant === "grouped" ? chartString2(domain.options, "clustered") : variant === "stacked100" ? chartString2(domain.options, "stacked100") : chartString2(domain.options, "stackedLower");
|
|
2398
|
+
return chartString2(domain.options, "columnDescStart", { v1: variantName, v2: cats.length, v3: dataSeries.length }) + (refSeries.length ? chartString2(domain.options, "referenceSeriesClause", { v1: refSeries.length }) : "") + (totalsAdd(domain) ? chartString2(domain.options, "totalsSentence", { v1: cats.map((c, ci) => `${c.label ?? c.id} ${domain.stacks[ci].hasValue ? oneValueText(ci) ?? totalFmt(stackTotals[c.id]) : NOT_AVAILABLE}`).join(", ") }) : ".") + (points.length ? chartString2(domain.options, "growthVersus", { v1: domain.pyRef.label, v2: points.map((point) => `${labelOf(point.categoryId)} ${point.text}`).join(", ") }) : "") + (rangeMarks.length ? chartString2(domain.options, "rangesClause", { v1: rangeMarks.map((range) => chartString2(domain.options, "namedRange", { v1: range.categoryId, v2: fmt(range.low), v3: fmt(range.high) })).join(", ") }) : "") + (anomaly ? chartString2(domain.options, "anomalyDesc", { v1: anomaly.rule, v2: domain.corridorNote }) + (anomaly.flags.length === 0 ? chartString2(domain.options, "noFlaggedPeriod") : chartString2(domain.options, "flaggedSentence", { v1: anomaly.flags.map((flag) => `${labelOf(flag.categoryId)} ${fmt(flag.value)}`).join(", ") })) : "") + ratioTierA11y(area.tier);
|
|
2399
|
+
}
|
|
2400
|
+
function seatDigits(digits, solved, occupied, ctx, warnings, rules, noted, lines) {
|
|
2401
|
+
let seated = /* @__PURE__ */ new Set(), clear = digits.requests.filter((request) => {
|
|
2402
|
+
let { rect } = request.candidates[0], font = request.fontStep ?? request.font, top = rect.y + rect.h - font.size * TEXT_ASCENT;
|
|
2403
|
+
return !textBreaksLine(lines, rect.x, rect.x + rect.w, top, font.size);
|
|
2404
|
+
});
|
|
2405
|
+
if (clear.length > 0) {
|
|
2406
|
+
let late = solveLabels(clear, occupied, ctx);
|
|
2407
|
+
for (let label of late.placed) {
|
|
2408
|
+
let at = label.hidden === void 0 ? solved.placed.findIndex((other) => other.id === label.id) : -1;
|
|
2409
|
+
if (at < 0) continue;
|
|
2410
|
+
let seat = { [DIGIT_SEAT]: { noted: noted(label.id), lineH: solved.placed[at].rect.h } };
|
|
2411
|
+
solved.placed[at] = { ...label, ...seat };
|
|
2412
|
+
let decision = late.decisions.find((entry) => entry.labelId === label.id), old = solved.decisions.findIndex((entry) => entry.labelId === label.id);
|
|
2413
|
+
decision && old >= 0 && (solved.decisions[old] = decision), seated.add(label.id);
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
let names = [];
|
|
2417
|
+
for (let [id, name] of digits.slivers) seated.has(id) || names.push(name);
|
|
2418
|
+
let warning = [];
|
|
2419
|
+
warnSliverLabels(warning, names), warnings.splice(digits.warningAt, 0, ...warning);
|
|
2420
|
+
for (let rule of rules) rule.before += warning.length;
|
|
2421
|
+
}
|
|
2422
|
+
function assembleColumnGeometry(domain, area, scene, solved, annotated, tierState, pointFont, points, ratioTierResult, occupied, warnings, paintWarningRules, lane) {
|
|
2423
|
+
let { cats, dataSeries, anomaly, stackTotals, percents } = domain, { tickFont, strongFont, labelFont, band, catPlan, showCatRow } = area, { nodes, axes } = scene, allLabels = [...solved.placed, ...annotated.labels], printedTotals = totalsAdd(domain) ? Object.fromEntries(cats.flatMap((c, ci) => domain.stacks[ci].hasValue ? [[c.id, stackTotals[c.id]]] : [])) : {}, integratedAnnotations = points.map((point) => ({
|
|
2424
|
+
id: `integratedVariance:${point.referenceSeriesId}:${point.categoryId}`,
|
|
2425
|
+
kind: "diff",
|
|
2426
|
+
computedText: point.text,
|
|
2427
|
+
tone: point.tone,
|
|
2428
|
+
nodeIds: [],
|
|
2429
|
+
labelId: point.growthLabelId,
|
|
2430
|
+
// The integrated growth figure is percentDelta over the two totals the
|
|
2431
|
+
// panel already plots. Both are on the point; only the string was
|
|
2432
|
+
// reaching the manifest.
|
|
2433
|
+
derivation: {
|
|
2434
|
+
basis: "derived",
|
|
2435
|
+
op: "annotation-diff-relative@1",
|
|
2436
|
+
inputs: [
|
|
2437
|
+
{ ref: `${point.referenceSeriesId}:${point.categoryId}`, value: point.reference },
|
|
2438
|
+
{ ref: `current:${point.categoryId}`, value: point.current }
|
|
2439
|
+
],
|
|
2440
|
+
raw: point.growthPct
|
|
2441
|
+
}
|
|
2442
|
+
}));
|
|
2443
|
+
spliceAnnotationNodes(nodes, annotated.nodes);
|
|
2444
|
+
let totalIds = new Set(domain.cats.filter((c) => c.role === "total").map((c) => c.id)), bandLabelIds = new Set(
|
|
2445
|
+
annotated.placed.filter((ann) => ann.kind === "band").map((ann) => ann.labelId)
|
|
2446
|
+
);
|
|
2447
|
+
if (allLabels.some((label) => !label.hidden && label.leader))
|
|
2448
|
+
for (let label of allLabels) (label.kind === "grandTotal" || label.kind === "total") && (label.halo = !0);
|
|
2449
|
+
clearStraightLeaders(allLabels, domain.theme);
|
|
2450
|
+
for (let label of allLabels)
|
|
2451
|
+
(label.kind === "point" || label.kind === "category") && label.owner.annotationId === void 0 && (domain.highlights.has(label.owner.categoryId ?? "") || domain.highlights.has(label.owner.seriesId ?? "")) && (label.emphasis = !0);
|
|
2452
|
+
let labelNodes = labelsToNodes(
|
|
2453
|
+
domain.theme,
|
|
2454
|
+
allLabels,
|
|
2455
|
+
(l) => tierState?.fontByLabelId.get(l.id) ?? // A total column (categories[].role 'total') prints its head and values bold.
|
|
2456
|
+
(totalIds.has(l.owner.categoryId ?? "") && (l.kind === "segment" || l.kind === "category") ? { ...l.kind === "category" ? catPlan.font : strongFont, weight: emphasisWeight(domain.theme) } : void 0) ?? (bandLabelIds.has(l.id) ? tickFont : l.kind === "grandTotal" || l.kind === "total" ? strongFont : l.kind === "category" ? area.stairTop !== void 0 ? tickFont : catPlan.font : l.kind === "tick" ? tickFont : l.kind === "annotation" || l.kind === "valueLine" ? { ...labelFont, weight: emphasisWeight(domain.theme) } : l.kind === "point" ? pointFont : labelFont),
|
|
2457
|
+
nodes
|
|
2458
|
+
);
|
|
2459
|
+
return pushAll(nodes, labelNodes.filter((node) => node.part === "leader")), pushAll(nodes, labelNodes.filter((node) => node.part !== "leader")), lane && pushAll(nodes, lane.nodes), axes.unshift({
|
|
2460
|
+
axis: "x",
|
|
2461
|
+
baselineNodeId: "axis:baseline",
|
|
2462
|
+
ticks: cats.map((c, i) => ({
|
|
2463
|
+
at: c.id,
|
|
2464
|
+
pos: band.center(i),
|
|
2465
|
+
labelId: showCatRow || area.stairTop !== void 0 ? `category:${c.id}` : void 0
|
|
2466
|
+
}))
|
|
2467
|
+
}), {
|
|
2468
|
+
type: "column",
|
|
2469
|
+
size: domain.size,
|
|
2470
|
+
plot: area.plot,
|
|
2471
|
+
scene: withSegmentSeams(joinHatchPeers(nodes), domain.theme),
|
|
2472
|
+
labels: lane ? [...allLabels, ...lane.labels] : allLabels,
|
|
2473
|
+
axes,
|
|
2474
|
+
annotations: [
|
|
2475
|
+
...integratedAnnotations,
|
|
2476
|
+
...annotated.placed,
|
|
2477
|
+
...lane?.placed ?? [],
|
|
2478
|
+
// Series CAGR records, for the names that were laid out.
|
|
2479
|
+
...[...domain.seriesCagr.values()].map((entry) => entry.placed).filter((placed) => allLabels.some((label) => label.id === placed.labelId))
|
|
2480
|
+
],
|
|
2481
|
+
legend: area.frame.legend,
|
|
2482
|
+
frame: area.frame.frame,
|
|
2483
|
+
marks: scene.marks,
|
|
2484
|
+
derived: {
|
|
2485
|
+
stackTotals: printedTotals,
|
|
2486
|
+
stackParts: stackParts(printedTotals, cats, dataSeries, (si, ci) => domain.absOf(dataSeries[si], ci)),
|
|
2487
|
+
...percents ? { percents } : {},
|
|
2488
|
+
...domain.roundingAdjustments.length > 0 ? { roundingAdjustments: domain.roundingAdjustments } : {},
|
|
2489
|
+
...domain.computedTotal ? { computedTotal: domain.computedTotal } : {},
|
|
2490
|
+
...ratioTierResult ? { ratioTier: ratioTierResult.geometry } : {},
|
|
2491
|
+
...showCatRow ? {
|
|
2492
|
+
tickBand: {
|
|
2493
|
+
reserved: area.tickReserve,
|
|
2494
|
+
measuredLines: catPlan.maxLines,
|
|
2495
|
+
lineHeight: catPlan.font.size * 1.2,
|
|
2496
|
+
// Rotated rows reserve more than lines × line height; the receipt names it.
|
|
2497
|
+
extra: catPlan.rowHeight - catPlan.maxLines * catPlan.font.size * 1.2,
|
|
2498
|
+
dateNumeric: catPlan.dateNumeric,
|
|
2499
|
+
position: "below"
|
|
2500
|
+
}
|
|
2501
|
+
} : {},
|
|
2502
|
+
...points.length ? { integratedVariance: points } : {},
|
|
2503
|
+
...anomaly ? { anomaly: anomalyReceipt(anomaly) } : {}
|
|
2504
|
+
},
|
|
2505
|
+
a11y: {
|
|
2506
|
+
title: accessibleTitle(domain.options.title, chartString2(domain.options, "columnTitle", { v1: dataSeries.map((s) => s.label).join(", "), v2: cats.length })),
|
|
2507
|
+
counts: [...domain.anomaly?.counts ?? [], structureCount("categories", domain.cats.length, void 0, domain.options), structureCount("series", domain.dataSeries.length, void 0, domain.options), ...domain.refSeries.length ? [structureCount("reference-series", domain.refSeries.length, chartString2(domain.options, "referenceSeriesCount", { v1: domain.refSeries.length }))] : []],
|
|
2508
|
+
desc: columnA11yDesc(domain, area, scene.rangeMarks, points)
|
|
2509
|
+
},
|
|
2510
|
+
warnings,
|
|
2511
|
+
paintWarningRules,
|
|
2512
|
+
debug: {
|
|
2513
|
+
occupied: occupied.snapshot(),
|
|
2514
|
+
decisions: [...solved.decisions, ...annotated.decisions]
|
|
2515
|
+
}
|
|
2516
|
+
};
|
|
2517
|
+
}
|
|
2518
|
+
function layoutColumn(data, options = {}, keepEachValue = !1) {
|
|
2519
|
+
let resolved = withValueLabelDefaults(ribbonDefaults(withLocaleStrings(options)), "column", options.valueAxis?.percent ? "stacked100" : options.variant), geometry = withBandValueNotes(data, resolved, (next) => layoutColumnWithNotes(data, next, keepEachValue)), keyed = new Set(geometry.legend?.items.map((item) => item.id)), lost = geometry.labels.some((label) => label.hidden && label.id.startsWith("seriesEdge:") && !keyed.has(label.owner.seriesId)), keyAsked = resolved.legend !== void 0 && resolved.legend !== "none";
|
|
2520
|
+
if (!lost || !keyAsked || resolved[KEY_EDGE_SERIES]) return geometry;
|
|
2521
|
+
let again = { ...resolved, [KEY_EDGE_SERIES]: !0 };
|
|
2522
|
+
return withBandValueNotes(data, again, (next) => layoutColumnWithNotes(data, next, keepEachValue));
|
|
2523
|
+
}
|
|
2524
|
+
function ribbonDefaults(options) {
|
|
2525
|
+
return !(options.variant === "stacked" || options.variant === "stacked100" || !!options.valueAxis?.percent) || !options.ribbons || options.seriesLabels !== void 0 ? options : { ...options, seriesLabels: { at: "right-edge" } };
|
|
2526
|
+
}
|
|
2527
|
+
function layoutColumnWithNotes(data, options, keepEachValue) {
|
|
2528
|
+
let named = /* @__PURE__ */ new Map(), pass, minimumChrome = 1 / 0, run = (next) => {
|
|
2529
|
+
pass = layoutColumnPass(data, next, keepEachValue);
|
|
2530
|
+
let settled = settleStaircase(next, (o) => (pass = layoutColumnPass(data, o, keepEachValue)).staircase, pass.staircase);
|
|
2531
|
+
return minimumChrome = Math.min(minimumChrome, plotChromeFloor.get(pass.geometry.frame) ?? NaN), settled;
|
|
2532
|
+
}, settleBandHeadroom = (next) => {
|
|
2533
|
+
let bandPad = next[BAND_PAD] ?? 0;
|
|
2534
|
+
for (let round = 0; round < 2 && pass.bandNeed > 0; round++)
|
|
2535
|
+
bandPad += Math.ceil(pass.bandNeed), next = run({ ...next, [BAND_PAD]: bandPad });
|
|
2536
|
+
return next;
|
|
2537
|
+
};
|
|
2538
|
+
options = run(options);
|
|
2539
|
+
for (let round = 0, pad = 0; round < 3 && pass.legDeficit > 0.5; round++)
|
|
2540
|
+
pad += Math.ceil(pass.legDeficit) + 2, options = run({ ...options, [CAGR_PAD]: pad });
|
|
2541
|
+
if (pass.valueLineReserve > 0 && (options = run({ ...options, [VALUE_LINE_RESERVE]: pass.valueLineReserve })), pass.tickReserve > 0 && !(TICK_LABEL_RESERVE in options)) {
|
|
2542
|
+
let before = pass, hiddenTicks = (p) => p.geometry.labels.filter((label) => label.kind === "tick" && label.hidden !== void 0).length, reserved = run({ ...options, [TICK_LABEL_RESERVE]: pass.tickReserve });
|
|
2543
|
+
hiddenTicks(pass) < hiddenTicks(before) ? options = reserved : pass = before;
|
|
2544
|
+
}
|
|
2545
|
+
if (panelTypeClass(options) !== void 0)
|
|
2546
|
+
return settleBandHeadroom(options), pass.geometry;
|
|
2547
|
+
let current = options;
|
|
2548
|
+
pass.categoryNotes.length > 0 && (current = run({ ...options, [CATEGORY_NOTES]: pass.categoryNotes, [POINTED_NOTES]: pass.categoryNotes }));
|
|
2549
|
+
let owed = data.series.reduce((count, series) => count + series.values.length, 0), unnamed = () => [...pass.unprinted.keys()].some((id) => !named.has(id)), nameUnprinted = (next) => {
|
|
2550
|
+
for (let round = 0; round <= owed && unnamed(); round++) {
|
|
2551
|
+
let byData = dataOrder(data, pass.geometry.labels);
|
|
2552
|
+
named = new Map([...named, ...pass.unprinted].sort(([a], [b]) => byData(a, b))), next = run({ ...next, [SEGMENT_NOTE]: [...named.values()] });
|
|
2553
|
+
}
|
|
2554
|
+
return next;
|
|
2555
|
+
}, last = nameUnprinted(current);
|
|
2556
|
+
pass.categoryNotes.length > 0 && (last = run({ ...last, [CATEGORY_NOTES]: pass.categoryNotes, [POINTED_NOTES]: pass.categoryNotes }));
|
|
2557
|
+
let printed = last[CATEGORY_NOTES];
|
|
2558
|
+
if (printed && categoryNotesDiffer(pass.planNotes, printed)) {
|
|
2559
|
+
let keyed = pass.rankKey();
|
|
2560
|
+
last = run({ ...last, [CATEGORY_NOTES]: keyed, [POINTED_NOTES]: keyed, [FORCE_CATEGORY_RANKS]: !0 });
|
|
2561
|
+
}
|
|
2562
|
+
last = settleBandHeadroom(last), unnamed() && (last = settleBandHeadroom(nameUnprinted(last)));
|
|
2563
|
+
for (let label of pass.geometry.labels) named.has(label.id) && label.hidden && (label.noted = !0);
|
|
2564
|
+
let items = new Map(pass.geometry.labels.filter((label) => named.has(label.id) && label.hidden && label.printsFor?.length !== 0).map((label) => [`${label.owner.seriesId}|${label.owner.categoryId}`, named.get(label.id)]));
|
|
2565
|
+
return pass.geometry.scene = pass.geometry.scene.map((node) => {
|
|
2566
|
+
let item = (node.t === "rect" || node.t === "path") && node.separation ? items.get(`${node.owner.seriesId}|${node.owner.categoryId}`) : void 0;
|
|
2567
|
+
return item !== void 0 && (node.t === "rect" || node.t === "path") && node.separation ? { ...node, separation: { ...node.separation, notedAs: item } } : node;
|
|
2568
|
+
}), Number.isFinite(minimumChrome) ? plotChromeFloor.set(pass.geometry.frame, minimumChrome) : plotChromeFloor.delete(pass.geometry.frame), pass.geometry;
|
|
2569
|
+
}
|
|
2570
|
+
function layoutColumnPass(data, options, keepEachValue) {
|
|
2571
|
+
let warnings = [], domain = resolveColumnDomain(data, options, warnings), paints = columnPaints(domain, warnings), { size, theme } = domain, areaWarningsAt = 0, settled = settleEventLane({
|
|
2572
|
+
annotations: domain.annList,
|
|
2573
|
+
categories: domain.cats,
|
|
2574
|
+
events: options.events,
|
|
2575
|
+
language: options.locale?.language,
|
|
2576
|
+
colorblindSafe: options.colorblindSafe,
|
|
2577
|
+
inline: !1,
|
|
2578
|
+
footnotesOff: options.footnotesOff,
|
|
2579
|
+
theme,
|
|
2580
|
+
measure: domain.measure,
|
|
2581
|
+
size,
|
|
2582
|
+
compact: options.mode === "compact",
|
|
2583
|
+
solve: (key, w) => solveColumnFrame(domain, paints, w, key),
|
|
2584
|
+
area: (framed2, w) => (areaWarningsAt = w.length, columnPlotArea(domain, framed2.frame, w)),
|
|
2585
|
+
axis: (area2) => ({ x: (ci) => area2.band.center(ci), step: area2.band.step, plot: area2.plot }),
|
|
2586
|
+
warnings
|
|
2587
|
+
}), framed = settled.framed, occupied = framed.claims, area = settled.area;
|
|
2588
|
+
domain.activeBreak && domain.variant !== "grouped" && stackBreakReversesOrder(area.y, domain.stacks) && (domain.activeBreak = void 0, delete framed.frame.frame.plotMinHeight, plotChromeFloor.delete(framed.frame.frame), warnings.length = areaWarningsAt, area = columnPlotArea(domain, framed.frame, warnings), warnings.push(axisBreakHeightOrderWarning()));
|
|
2589
|
+
let scene = layoutColumnMarks(domain, paints, area);
|
|
2590
|
+
for (let c of scene.claims.snapshot()) occupied.claim(c.rect, c.kind, c.owner, c.part);
|
|
2591
|
+
scene.claims.tickColumns && (occupied.tickColumns = scene.claims.tickColumns);
|
|
2592
|
+
let requests = area.axisTitle && domain.va.show ? [valueAxisTitleRequest(area.axisTitle, { x: area.frame.plot.x, y: area.frame.plot.y + area.ruleH + 4 }, "start", "axis:y:title")] : [], tierState = area.tier ? addRatioTierRequests(area.tier, requests, {
|
|
2593
|
+
plot: area.plot,
|
|
2594
|
+
categoryBandHeight: area.catBandH,
|
|
2595
|
+
categoryCenter: (categoryId) => area.band.center(domain.cats.findIndex((cat) => cat.id === categoryId)),
|
|
2596
|
+
theme,
|
|
2597
|
+
measure: domain.measure
|
|
2598
|
+
}) : void 0, stair = area.stairTop === void 0 ? void 0 : seatStaircase({
|
|
2599
|
+
categories: domain.cats,
|
|
2600
|
+
band: area.band,
|
|
2601
|
+
top: area.stairTop,
|
|
2602
|
+
left: area.plot.x,
|
|
2603
|
+
right: area.plot.x + area.plot.w,
|
|
2604
|
+
floor: area.y0,
|
|
2605
|
+
above: options.labels !== !1 ? area.gtH + 4 : 0,
|
|
2606
|
+
font: area.tickFont,
|
|
2607
|
+
measure: domain.measure,
|
|
2608
|
+
tops: domain.posTopP,
|
|
2609
|
+
options,
|
|
2610
|
+
cap: STAIRCASE_MAX_PAD * area.frame.plot.h,
|
|
2611
|
+
occupied,
|
|
2612
|
+
requests
|
|
2613
|
+
}), noted = { items: /* @__PURE__ */ new Map(), slivers: /* @__PURE__ */ new Set() }, digits = { requests: [], slivers: [], warningAt: 0 }, pointFont = planColumnValueLabels(domain, paints, area, scene, requests, warnings, noted, digits), paintWarningRules = [];
|
|
2614
|
+
pushAll(warnings, rectSeriesAdjacentWarnings(scene.nodes, paints.css, "vertical", domain.highlights, theme, { rules: paintWarningRules, before: warnings.filter((warning) => !["pie-ramp-crowded", "likert-ramp-invisible", "band-lightness-insufficient", "series-adjacent-similar", "highlight-reads-as-loss"].includes(warning.code)).length }));
|
|
2615
|
+
let growthPoints = planColumnLabels(domain, area, scene, requests, warnings), solveCtx = labelCtx(theme, size, options, {
|
|
2616
|
+
density: domain.density,
|
|
2617
|
+
measure: domain.measure,
|
|
2618
|
+
plot: area.plot,
|
|
2619
|
+
labelPad: 2,
|
|
2620
|
+
// A histogram keeps each fitting count, even when other bins need a note.
|
|
2621
|
+
// values valueLabels picks are no scatter; each one that cannot sit goes to the note alone.
|
|
2622
|
+
seriesUniform: keepEachValue || pickedValues(domain.options) ? void 0 : bandValueLabelUniformity()
|
|
2623
|
+
}), solved = solveLabels(keepValuesWithoutAxis(requests, domain.density, domain.va.show === !0), occupied, solveCtx), toDate = toDateOnValues(domain);
|
|
2624
|
+
if (toDate.size > 0 && (!toDateFits(domain.options.strings?.toDate ?? chartString2(domain.options, "toDate"), theme, domain.measure, toDateRoom(area.band.bandwidth)) || solved.placed.some((l) => (l.kind === "grandTotal" || l.kind === "point") && l.hidden !== void 0 && toDate.has(l.owner.categoryId ?? ""))))
|
|
2625
|
+
return layoutColumnPass(data, { ...options, [PARTIAL_KEY]: !0 }, keepEachValue);
|
|
2626
|
+
let staircase = runStaircase(theme, options.categoryLabels, options, stair, solved.placed, occupied, scene.nodes, warnings);
|
|
2627
|
+
applyValueAxisTitleInk(solved.placed);
|
|
2628
|
+
let crossed = haloOverRules(solved.placed, occupied, /* @__PURE__ */ new Set(["referenceLine", "valueLine"]));
|
|
2629
|
+
pushAll(warnings, solved.warnings);
|
|
2630
|
+
for (let point of growthPoints) {
|
|
2631
|
+
let growthLabel = solved.placed.find((label) => label.id === point.growthLabelId);
|
|
2632
|
+
growthLabel && !growthLabel.hidden && (growthLabel.ink = point.tone === "neutral" ? { token: "inkMuted" } : options.colorblindSafe ? colorblindPaint(point.tone) : { token: point.tone });
|
|
2633
|
+
}
|
|
2634
|
+
for (let label of solved.placed) label.id.startsWith("tick:") && !label.hidden && (label.ink = { token: "inkMuted" });
|
|
2635
|
+
for (let label of solved.placed) label.id.startsWith("seriesEdge:") && (label.font = edgeNameFont(label.font ?? area.labelFont, domain));
|
|
2636
|
+
let ratioTierResult = tierState ? finalizeRatioTier(tierState, solved.placed, occupied, theme, domain.measure) : void 0;
|
|
2637
|
+
ratioTierResult && pushAll(scene.nodes, ratioTierResult.nodes), pushAll(warnings, ratioTierSpacingWarnings(area.tier, solved.placed));
|
|
2638
|
+
let annotated = annotateColumn(domain, area, scene, occupied, solveCtx, solved.placed);
|
|
2639
|
+
pushAll(warnings, annotated.warnings);
|
|
2640
|
+
let lane = settled.lane ? emitEventLane(theme, {
|
|
2641
|
+
...settled.lane,
|
|
2642
|
+
axis: { x: (ci) => area.band.center(ci), step: area.band.step, plot: area.plot },
|
|
2643
|
+
mode: "stop",
|
|
2644
|
+
baseline: area.plot.y + area.plot.h,
|
|
2645
|
+
occupied,
|
|
2646
|
+
solveCtx
|
|
2647
|
+
}) : void 0;
|
|
2648
|
+
lane && pushAll(warnings, lane.warnings);
|
|
2649
|
+
let pointedAt = new Set((options.annotations ?? []).flatMap((a) => (a.kind === "callout" || a.kind === "note") && typeof a.at == "object" && "categoryId" in a.at && a.at.seriesId ? [`segment:${a.at.seriesId}:${a.at.categoryId}`] : [])), inPanel = panelTypeClass(options) !== void 0;
|
|
2650
|
+
seatDigits(
|
|
2651
|
+
digits,
|
|
2652
|
+
solved,
|
|
2653
|
+
occupied,
|
|
2654
|
+
solveCtx,
|
|
2655
|
+
warnings,
|
|
2656
|
+
paintWarningRules,
|
|
2657
|
+
(id) => !inPanel && !pointedAt.has(id),
|
|
2658
|
+
[...scene.nodes, ...annotated.nodes, ...lane?.nodes ?? []]
|
|
2659
|
+
);
|
|
2660
|
+
let unprinted = new Map([...noted.items].filter(([id]) => !pointedAt.has(id) && // The note names what is not drawn: a sliver a pin placed is drawn, and so is one whose total prints its value.
|
|
2661
|
+
solved.placed.some((label) => label.id === id && (label.hidden === "collision" || label.hidden !== void 0 && label.printedIn === void 0 && noted.slivers.has(id))))), geometry = assembleColumnGeometry(domain, area, scene, solved, annotated, tierState, pointFont, growthPoints, ratioTierResult, occupied, warnings, paintWarningRules, lane);
|
|
2662
|
+
geometry.scene = raiseOverRules(geometry.scene, crossed);
|
|
2663
|
+
let planNotes = area.showCatRow ? area.catPlan.step === "ranks" ? rankNotes(domain.cats.map((c) => c.label ?? c.id), domain.options) : area.catPlan.cutNotes : [], categoryNotes = options[CATEGORY_NOTES] ? [] : planNotes, valueLineReserve = hiddenValueLineReserve(geometry.labels, (text) => domain.measure(text, { ...area.labelFont, weight: emphasisWeight(domain.theme) }).width, size.width), lastCategory = domain.cats.at(-1), lastTick = domain.pyRef && lastCategory ? geometry.labels.find((label) => label.id === `tick:${domain.pyRef.id}:${lastCategory.id}` && (label.hidden === "collision" || label.hidden === "note")) : void 0, lastBar = lastTick && lastCategory ? area.band.position(domain.cats.length - 1) + area.band.bandwidth : 0, tickReserve = lastTick ? Math.max(0, Math.ceil(lastBar + PY_TICK_LEAD + domain.measure(lastTick.text, area.tickFont).width + 2 - size.width)) : 0;
|
|
2664
|
+
return { geometry, unprinted, categoryNotes, planNotes, rankKey: () => rankNotes(domain.cats.map((c) => c.label ?? c.id), domain.options), legDeficit: annotated.legDeficit, bandNeed: annotated.bandNeed, valueLineReserve, tickReserve: tickReserve <= size.width / 3 ? tickReserve : 0, ...staircase ? { staircase } : {} };
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
export {
|
|
2668
|
+
TILED_BANDS,
|
|
2669
|
+
layoutColumn
|
|
2670
|
+
};
|