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,1109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
valueLineExtent
|
|
3
|
+
} from "./chunk-QPWRHDLZ.js";
|
|
4
|
+
import {
|
|
5
|
+
percentLevels,
|
|
6
|
+
runAnnotatePass
|
|
7
|
+
} from "./chunk-GQS46LC3.js";
|
|
8
|
+
import {
|
|
9
|
+
stepDownFont
|
|
10
|
+
} from "./chunk-EWVKBRLV.js";
|
|
11
|
+
import {
|
|
12
|
+
breakUnsupported,
|
|
13
|
+
chartTheme
|
|
14
|
+
} from "./chunk-SXGTRZFN.js";
|
|
15
|
+
import {
|
|
16
|
+
structureCount
|
|
17
|
+
} from "./chunk-B2EBEXIS.js";
|
|
18
|
+
import {
|
|
19
|
+
receivedDescription
|
|
20
|
+
} from "./chunk-RZNYW7UP.js";
|
|
21
|
+
import {
|
|
22
|
+
applyAxisBounds,
|
|
23
|
+
calendarCategories,
|
|
24
|
+
chartSizing,
|
|
25
|
+
linearScale,
|
|
26
|
+
niceDomain,
|
|
27
|
+
resolveSizing,
|
|
28
|
+
spread1DResult,
|
|
29
|
+
sweepHide,
|
|
30
|
+
warnSpreadOverflow
|
|
31
|
+
} from "./chunk-GQPESFAF.js";
|
|
32
|
+
import {
|
|
33
|
+
prepareFractionData
|
|
34
|
+
} from "./chunk-3EZRM4YM.js";
|
|
35
|
+
import {
|
|
36
|
+
PRIORITY,
|
|
37
|
+
authoredFootnoteCount,
|
|
38
|
+
authoredNotes,
|
|
39
|
+
clamp,
|
|
40
|
+
createOccupiedIndex,
|
|
41
|
+
cutWithTitle,
|
|
42
|
+
distinguishSeries,
|
|
43
|
+
fitText,
|
|
44
|
+
frameTextOptions,
|
|
45
|
+
labelCtx,
|
|
46
|
+
labelsToNodes,
|
|
47
|
+
lineBox,
|
|
48
|
+
markedLabel,
|
|
49
|
+
normalizeLegendOption,
|
|
50
|
+
plotHeightAfter,
|
|
51
|
+
round2,
|
|
52
|
+
solveFrame,
|
|
53
|
+
solveLabels
|
|
54
|
+
} from "./chunk-2JAWQ7VV.js";
|
|
55
|
+
import {
|
|
56
|
+
disclosureNote
|
|
57
|
+
} from "./chunk-YTSSXSZR.js";
|
|
58
|
+
import {
|
|
59
|
+
formatterFromExample,
|
|
60
|
+
seriesRasterFormatter
|
|
61
|
+
} from "./chunk-ASAON7G4.js";
|
|
62
|
+
import {
|
|
63
|
+
autoDecimals,
|
|
64
|
+
chartStrings,
|
|
65
|
+
chartWording,
|
|
66
|
+
formatAuthoredPercent,
|
|
67
|
+
formatAutomaticNumber,
|
|
68
|
+
formatAutomaticPercent,
|
|
69
|
+
numberRange,
|
|
70
|
+
seriesValueFormatter
|
|
71
|
+
} from "./chunk-YQ2B3YVF.js";
|
|
72
|
+
import {
|
|
73
|
+
cellMeta,
|
|
74
|
+
cellValue,
|
|
75
|
+
isPctCell
|
|
76
|
+
} from "./chunk-OAPCJO6W.js";
|
|
77
|
+
import {
|
|
78
|
+
canvasMargin,
|
|
79
|
+
colorblindPaint,
|
|
80
|
+
dashToken,
|
|
81
|
+
emphasisWeight,
|
|
82
|
+
labelsOffKeepsNames,
|
|
83
|
+
markRolePaint,
|
|
84
|
+
mutedMarkPaint,
|
|
85
|
+
panelTypeClass,
|
|
86
|
+
resolveSemanticPaletteTheme,
|
|
87
|
+
semanticPalettePaint,
|
|
88
|
+
seriesPaint,
|
|
89
|
+
strokeToken,
|
|
90
|
+
textScaleOf
|
|
91
|
+
} from "./chunk-II7652VA.js";
|
|
92
|
+
import {
|
|
93
|
+
MARK_CONTRAST_FLOOR
|
|
94
|
+
} from "./chunk-2MTWKMEG.js";
|
|
95
|
+
import {
|
|
96
|
+
NormalizeError,
|
|
97
|
+
TARGET_SIZE,
|
|
98
|
+
accessibleTitle,
|
|
99
|
+
normalizeCategory,
|
|
100
|
+
normalizeScenario,
|
|
101
|
+
normalizeSeriesValues,
|
|
102
|
+
resolveHighlight,
|
|
103
|
+
resolveSize
|
|
104
|
+
} from "./chunk-SGD3ZHID.js";
|
|
105
|
+
import {
|
|
106
|
+
maxOf,
|
|
107
|
+
minOf,
|
|
108
|
+
pushAll
|
|
109
|
+
} from "./chunk-WYJEOMNY.js";
|
|
110
|
+
import {
|
|
111
|
+
defaultMeasurer
|
|
112
|
+
} from "./chunk-TXINIAFL.js";
|
|
113
|
+
|
|
114
|
+
// src/core/charts/slope/slopeSizing.ts
|
|
115
|
+
var SLOPE_SIZING = { ...chartSizing("slope"), minWidth: 320 };
|
|
116
|
+
|
|
117
|
+
// src/core/strings/slope.ts
|
|
118
|
+
var EN = {
|
|
119
|
+
// reader-facing wording linked only by its consumers.
|
|
120
|
+
slopeDesc: "Slope chart, {v1} series from {v2} to {v3}. ",
|
|
121
|
+
seriesUnchanged: "All series unchanged.",
|
|
122
|
+
slopeTitle: "Slope chart: {v1} series, {v2} to {v3}",
|
|
123
|
+
slopeResponseRest: "{v1} and {v2} do not add to 100: the rest ({v3} per group and period) chose neither answer.",
|
|
124
|
+
slopeNetNote: "Net = {v1} \u2212 {v2} in {v3}; change vs {v4} in brackets.",
|
|
125
|
+
slopeBaseNote: "Hatched: base below {v1} respondents ({v2}); read with care.",
|
|
126
|
+
divergingSlopeDesc: "Diverging slope chart, {v1} series, one panel per group, {v2} above and {v3} below zero, from {v4} to {v5}. ",
|
|
127
|
+
slopeNetRiseDesc: "Net score rose in {v1} of them; highest in {v2}: {v3} {v4}.",
|
|
128
|
+
slopeLowBaseDesc: " Low base: {v1}.",
|
|
129
|
+
divergingSlopeTitle: "Diverging slope chart: {v1} groups, {v2} to {v3}",
|
|
130
|
+
steepestRiser: "Steepest riser: {v1}",
|
|
131
|
+
steepestFaller: "steepest faller: {v1}",
|
|
132
|
+
slopeFoldHead: "{v1}: the {v2} series below {v3} of the endpoint total at both ends ",
|
|
133
|
+
slopeFoldSum: "summed to {v1} at {v2} and ",
|
|
134
|
+
slopeFoldEnd: "{v1} at {v2}.",
|
|
135
|
+
slopeNetLabel: "Net {v1} ({v2})",
|
|
136
|
+
positiveName: "Positive",
|
|
137
|
+
negativeName: "Negative"
|
|
138
|
+
}, DE = {
|
|
139
|
+
// reader-facing wording linked only by its consumers.
|
|
140
|
+
slopeDesc: "Steigungsdiagramm, {v1} {v1|Reihe|Reihen} von {v2} bis {v3}. ",
|
|
141
|
+
seriesUnchanged: "Alle Reihen unver\xE4ndert.",
|
|
142
|
+
slopeTitle: "Steigungsdiagramm: {v1} {v1|Reihe|Reihen}, {v2} bis {v3}",
|
|
143
|
+
slopeResponseRest: "{v1} und {v2} ergeben nicht 100. Der Rest ({v3} je Gruppe und Periode) w\xE4hlte keine dieser Antworten.",
|
|
144
|
+
slopeNetNote: "Netto = {v1} \u2212 {v2} in {v3}; \xC4nderung vs {v4} in Klammern.",
|
|
145
|
+
slopeBaseNote: "Schraffiert: Basis unter {v1} {v1|Antwort|Antworten} ({v2}); vorsichtig lesen.",
|
|
146
|
+
divergingSlopeDesc: "Divergierendes Steigungsdiagramm, {v1} {v1|Reihe|Reihen}, ein Feld je Gruppe, {v2} \xFCber und {v3} unter null, von {v4} bis {v5}. ",
|
|
147
|
+
slopeNetRiseDesc: "Nettowert stieg in {v1} davon; h\xF6chster in {v2}: {v3} {v4}.",
|
|
148
|
+
slopeLowBaseDesc: " Niedrige Basis: {v1}.",
|
|
149
|
+
divergingSlopeTitle: "Divergierendes Steigungsdiagramm: {v1} {v1|Gruppe|Gruppen}, {v2} bis {v3}",
|
|
150
|
+
steepestRiser: "St\xE4rkster Anstieg: {v1}",
|
|
151
|
+
steepestFaller: "st\xE4rkster Abfall: {v1}",
|
|
152
|
+
slopeFoldHead: "{v1}: die {v2} {v2|Reihe|Reihen} unter {v3} der Endpunktsumme an beiden Enden ",
|
|
153
|
+
slopeFoldSum: "zusammen {v1} bei {v2} und ",
|
|
154
|
+
slopeFoldEnd: "{v1} bei {v2}.",
|
|
155
|
+
slopeNetLabel: "Netto {v1} ({v2})",
|
|
156
|
+
positiveName: "Positiv",
|
|
157
|
+
negativeName: "Negativ"
|
|
158
|
+
}, { chartString } = chartStrings(EN, DE);
|
|
159
|
+
|
|
160
|
+
// src/core/charts/slope/fold.ts
|
|
161
|
+
var FOLD_FIELD = ["options", "foldBelowShare"], FOLD_POINTER = "/options/foldBelowShare";
|
|
162
|
+
function round4(value) {
|
|
163
|
+
return Math.round(value * 1e4) / 1e4;
|
|
164
|
+
}
|
|
165
|
+
function sharePercentText(share, language) {
|
|
166
|
+
let percent = share * 100, close = (value) => Math.abs(value - percent) <= Math.abs(percent) * 1e-9, decimals = 0;
|
|
167
|
+
for (; decimals < 12 && !close(Number(percent.toFixed(decimals))); ) decimals++;
|
|
168
|
+
return formatAutomaticPercent(Number(percent.toFixed(decimals)), decimals, !1, language);
|
|
169
|
+
}
|
|
170
|
+
var RAISE_OR_SEPARATE = "Raise foldBelowShare so they stay apart, or give the folded series the same kind.", SMALLEST_STATED_PERCENT = 1e-12;
|
|
171
|
+
function foldShareRefusal(share) {
|
|
172
|
+
if (share === void 0) return null;
|
|
173
|
+
if (Number.isFinite(share) && share > 0 && share * 100 < SMALLEST_STATED_PERCENT)
|
|
174
|
+
return {
|
|
175
|
+
code: "fold-share-out-of-range",
|
|
176
|
+
severity: "error",
|
|
177
|
+
message: `foldBelowShare ${share} is too small to state as a percentage, so no footnote could name the cutoff`,
|
|
178
|
+
suggest: "Write a larger share, such as 0.05 for 5 percent.",
|
|
179
|
+
field: FOLD_FIELD,
|
|
180
|
+
expected: { types: ["number"], minimum: SMALLEST_STATED_PERCENT / 100, maximum: 1, inclusive: !1 },
|
|
181
|
+
received: { type: "number", value: share }
|
|
182
|
+
};
|
|
183
|
+
if (Number.isFinite(share) && share > 0 && share < 1) return null;
|
|
184
|
+
let divided = Number.isFinite(share) && share >= 1 && share < 100 ? Number((share / 100).toPrecision(12)) : null, asShare = divided !== null && divided > 0 && divided < 1 ? divided : null;
|
|
185
|
+
return {
|
|
186
|
+
code: "fold-share-out-of-range",
|
|
187
|
+
severity: "error",
|
|
188
|
+
// One reading, not two. Saying that 5 "reads as 500 percent" and then
|
|
189
|
+
// proposing 0.05 "for 5 percent" puts two numbers in front of the caller
|
|
190
|
+
// and leaves it to guess which one the engine means.
|
|
191
|
+
message: `foldBelowShare is a share of the endpoint total between 0 and 1, and ${share} is not one` + (asShare !== null ? `. Written as a percentage, ${share} percent is ${asShare}` : ""),
|
|
192
|
+
suggest: asShare !== null ? `Write ${asShare} for ${share} percent.` : "Write a number above 0 and below 1, such as 0.05 for 5 percent.",
|
|
193
|
+
field: FOLD_FIELD,
|
|
194
|
+
expected: {
|
|
195
|
+
types: ["number"],
|
|
196
|
+
minimum: 0,
|
|
197
|
+
maximum: 1,
|
|
198
|
+
inclusive: !1,
|
|
199
|
+
condition: "a share of the endpoint total, such as 0.05 for 5 percent"
|
|
200
|
+
},
|
|
201
|
+
received: receivedDescription(share),
|
|
202
|
+
...asShare !== null ? { fix: [{ op: "replace", path: FOLD_POINTER, value: asShare }] } : {}
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function endpointTotal(series, end) {
|
|
206
|
+
return series.reduce((sum, s) => sum + (s[end].v ?? 0), 0);
|
|
207
|
+
}
|
|
208
|
+
function negativeMember(series) {
|
|
209
|
+
return series.find((s) => (s.a.v ?? 0) < 0 || (s.b.v ?? 0) < 0);
|
|
210
|
+
}
|
|
211
|
+
function otherLineId(taken) {
|
|
212
|
+
let id = "other";
|
|
213
|
+
for (; taken.some((s) => s.id === id); ) id = `_${id}`;
|
|
214
|
+
return id;
|
|
215
|
+
}
|
|
216
|
+
function foldNote(members, values, pct, ctx, share) {
|
|
217
|
+
let percent = sharePercentText(share, ctx.language);
|
|
218
|
+
return disclosureNote(
|
|
219
|
+
chartString({ locale: { language: ctx.language } }, "slopeFoldHead", { v1: ctx.othersLabel, v2: members.length, v3: percent }) + // The note names what it folded, not only how many.
|
|
220
|
+
`(${members.map((member) => member.label).join(", ")}), ` + chartString({ locale: { language: ctx.language } }, "slopeFoldSum", { v1: ctx.format(values.from, pct.from), v2: ctx.categories.from }) + chartString({ locale: { language: ctx.language } }, "slopeFoldEnd", { v1: ctx.format(values.to, pct.to), v2: ctx.categories.to })
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
function planSlopeFold(plotted, listed, share, ctx) {
|
|
224
|
+
let negative = negativeMember(plotted), totals = { from: endpointTotal(plotted, "a"), to: endpointTotal(plotted, "b") };
|
|
225
|
+
if (negative || totals.from <= 0 || totals.to <= 0)
|
|
226
|
+
return ctx.warnings.push({
|
|
227
|
+
code: "fold-share-undefined",
|
|
228
|
+
severity: "warn",
|
|
229
|
+
message: negative ? `foldBelowShare needs values at or above zero at both ends, and series '${negative.id}' is negative \u2014 nothing folded` : `foldBelowShare needs a positive total at both ends, and the endpoints sum to ${round2(totals.from)} and ${round2(totals.to)} \u2014 nothing folded`,
|
|
230
|
+
suggest: "Drop foldBelowShare on data that crosses zero, or plot the levels the shares are taken of.",
|
|
231
|
+
field: FOLD_FIELD
|
|
232
|
+
}), null;
|
|
233
|
+
let candidates = plotted.filter(
|
|
234
|
+
(s) => (s.a.v ?? 0) / totals.from < share && (s.b.v ?? 0) / totals.to < share
|
|
235
|
+
), members = candidates.filter((s) => !ctx.highlights.has(s.id)), kept = candidates.length - members.length;
|
|
236
|
+
return kept > 0 && ctx.warnings.push({
|
|
237
|
+
code: "fold-keeps-highlight",
|
|
238
|
+
severity: "info",
|
|
239
|
+
message: `${kept} highlighted or annotated ${kept === 1 ? "series stays" : "series stay"} under their own name although they are below ${sharePercentText(share, ctx.language)} of the endpoint total`,
|
|
240
|
+
field: FOLD_FIELD
|
|
241
|
+
}), members.length < 2 ? (ctx.warnings.push({
|
|
242
|
+
code: "fold-below-two",
|
|
243
|
+
severity: "info",
|
|
244
|
+
message: members.length === 1 ? `one series is below ${sharePercentText(share, ctx.language)} of the endpoint total at both ends \u2014 nothing folded, because one line named '${ctx.othersLabel}' says less than the line it replaces` : `no series is below ${sharePercentText(share, ctx.language)} of the endpoint total at both ends \u2014 nothing folded`,
|
|
245
|
+
suggest: "Raise foldBelowShare, or leave it out and let every series keep its name.",
|
|
246
|
+
field: FOLD_FIELD
|
|
247
|
+
}), null) : buildFold(members, plotted, listed, totals, share, ctx);
|
|
248
|
+
}
|
|
249
|
+
function buildFold(members, plotted, listed, totals, share, ctx) {
|
|
250
|
+
let memberIds = new Set(members.map((s) => s.id)), values = {
|
|
251
|
+
from: members.reduce((sum, s) => sum + s.a.v, 0),
|
|
252
|
+
to: members.reduce((sum, s) => sum + s.b.v, 0)
|
|
253
|
+
}, scenario = members.every((s) => s.scenario === members[0].scenario) ? members[0].scenario : void 0;
|
|
254
|
+
scenario === void 0 && members.some((s) => s.scenario !== void 0) && ctx.warnings.push({
|
|
255
|
+
code: "fold-mixed-scenarios",
|
|
256
|
+
severity: "warn",
|
|
257
|
+
message: `${ctx.othersLabel} mixes scenarios (${[...new Set(members.map((s) => s.scenario ?? "none"))].sort().join(", ")}) and carries none.`,
|
|
258
|
+
suggest: RAISE_OR_SEPARATE
|
|
259
|
+
});
|
|
260
|
+
let units = [...new Set(members.map((s) => s.unit ?? ctx.chartUnit ?? ""))];
|
|
261
|
+
units.length > 1 && ctx.warnings.push({
|
|
262
|
+
code: "fold-mixed-units",
|
|
263
|
+
severity: "warn",
|
|
264
|
+
message: `${ctx.othersLabel} adds different units (${units.map((unit) => unit || "none").join(", ")}); the sum is in none.`,
|
|
265
|
+
suggest: RAISE_OR_SEPARATE
|
|
266
|
+
});
|
|
267
|
+
for (let end of ["a", "b"]) {
|
|
268
|
+
let pct = members.filter((s) => s[end].isPct).length;
|
|
269
|
+
pct > 0 && pct < members.length && ctx.warnings.push({
|
|
270
|
+
code: "fold-mixed-units",
|
|
271
|
+
severity: "warn",
|
|
272
|
+
message: `${ctx.othersLabel} sums ${pct} percentage and ${members.length - pct} plain endpoints at ${end === "a" ? ctx.categories.from : ctx.categories.to}; shown as a plain number.`,
|
|
273
|
+
suggest: RAISE_OR_SEPARATE
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
let other = {
|
|
277
|
+
id: otherLineId(listed),
|
|
278
|
+
label: ctx.othersLabel,
|
|
279
|
+
...scenario !== void 0 ? { scenario } : {},
|
|
280
|
+
a: { v: values.from, isPct: members.every((s) => s.a.isPct) },
|
|
281
|
+
b: { v: values.to, isPct: members.every((s) => s.b.isPct) }
|
|
282
|
+
}, note = foldNote(members, values, { from: other.a.isPct, to: other.b.isPct }, ctx, share);
|
|
283
|
+
return {
|
|
284
|
+
plotted: [...plotted.filter((s) => !memberIds.has(s.id)), other],
|
|
285
|
+
listed: [...listed.filter((s) => !memberIds.has(s.id)), other],
|
|
286
|
+
legendLabel: `${ctx.othersLabel} (${members.length} series below ${sharePercentText(share, ctx.language)})`,
|
|
287
|
+
record: {
|
|
288
|
+
share,
|
|
289
|
+
otherId: other.id,
|
|
290
|
+
memberIds: members.map((s) => s.id),
|
|
291
|
+
values: { from: round2(values.from), to: round2(values.to) },
|
|
292
|
+
shares: { from: round4(values.from / totals.from), to: round4(values.to / totals.to) },
|
|
293
|
+
totals: { from: round2(totals.from), to: round2(totals.to) },
|
|
294
|
+
note
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// src/core/charts/slope/diverging.ts
|
|
300
|
+
var MAX_GROUPS = 12, MAX_PER_ROW = 8, MIN_PANEL_W = 88, PANEL_GAP = 16, ROW_GAP = 14, MIN_BAND = 60, NATURAL_SCALE_WIDTH = 640, NATURAL_SCALE_MIN = 1.15, NATURAL_SCALE_MAX = 1.5, DOT_R = 3.5, KEY_GAP = 22, KEY_GAP_MIN = 12, KEY_RUN = 24, KEY_RUN_MIN = 14, HEAD_CLEAR = 6, DEFAULT_MIN_BASE = 30;
|
|
301
|
+
function layoutDivergingSlope(data, options = {}) {
|
|
302
|
+
let warnings = [], theme = resolveSemanticPaletteTheme(
|
|
303
|
+
chartTheme(options),
|
|
304
|
+
options.palette,
|
|
305
|
+
warnings
|
|
306
|
+
), size = resolveSize(options.size), measure = options.measure ?? defaultMeasurer, opt = options.diverging ?? {}, language = options.locale?.language, fmtVal = (v, isPct, example = options.format) => example ? formatterFromExample(example, options.locale?.language)(v) : isPct ? formatAuthoredPercent(v, language) : formatAutomaticNumber(v, { locale: language, decimals: autoDecimals(v) }), signed = (v) => formatAutomaticNumber(v, { locale: language, signed: !0, decimals: autoDecimals(v) });
|
|
307
|
+
if (!data || !Array.isArray(data.categories) || data.categories.length < 2)
|
|
308
|
+
throw new NormalizeError("empty-data", "categories", "slope variant 'diverging' requires two categories (periods)");
|
|
309
|
+
if (data.categories.length > 2)
|
|
310
|
+
throw new NormalizeError(
|
|
311
|
+
"slope-diverging-too-many-periods",
|
|
312
|
+
"categories",
|
|
313
|
+
`slope variant 'diverging' compares exactly two periods, got ${data.categories.length}: an area between three or more survey waves suggests a path between them`,
|
|
314
|
+
"keep the first and last period here; draw a trend over more waves with type 'line', or one wave's full answer scale with type 'likert'"
|
|
315
|
+
);
|
|
316
|
+
let cats = data.categories.map((c, i) => normalizeCategory(c, i)), [c0, c1] = [cats[0], cats[1]], p1 = c0.label ?? c0.id, p2 = c1.label ?? c1.id, minBase = opt.minBase ?? DEFAULT_MIN_BASE, groups = [];
|
|
317
|
+
if (data.series.forEach((s, si) => {
|
|
318
|
+
if (!s?.id) throw new NormalizeError("missing-id", `series[${si}]`, "series requires an id");
|
|
319
|
+
if (s.role === "reference") return;
|
|
320
|
+
if (!Array.isArray(s.negative))
|
|
321
|
+
throw new NormalizeError(
|
|
322
|
+
"slope-diverging-missing-negative",
|
|
323
|
+
`series[${s.id}].negative`,
|
|
324
|
+
`series '${s.id}' has no negative share: variant 'diverging' draws values as the positive share and negative as the negative share`,
|
|
325
|
+
`add "negative": [<period 1>, <period 2>] to series '${s.id}', as positive numbers`
|
|
326
|
+
);
|
|
327
|
+
let pos = normalizeSeriesValues(s, cats, si), neg = normalizeSeriesValues({ ...s, values: s.negative }, cats, si), pv = pos.map(cellValue), nv = neg.map(cellValue);
|
|
328
|
+
if ([...pv, ...nv].some((v) => v === null)) {
|
|
329
|
+
warnings.push({
|
|
330
|
+
code: "slope-missing-endpoint",
|
|
331
|
+
severity: "warn",
|
|
332
|
+
message: `series '${s.id}': a share is missing in one period \u2014 the group is not drawn`,
|
|
333
|
+
owner: { seriesId: s.id }
|
|
334
|
+
});
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
if ([...pv, ...nv].some((v) => v < 0))
|
|
338
|
+
throw new NormalizeError(
|
|
339
|
+
"slope-diverging-negative-value",
|
|
340
|
+
`series[${s.id}]`,
|
|
341
|
+
`series '${s.id}' has a share below zero: both shares are counts of respondents, so the negative share is drawn downward but given as a positive number`,
|
|
342
|
+
"give every share as a positive number, for example 12 rather than -12"
|
|
343
|
+
);
|
|
344
|
+
let positive = [pv[0], pv[1]], negative = [nv[0], nv[1]], net = [round2(positive[0] - negative[0]), round2(positive[1] - negative[1])], n = s.n === void 0 ? void 0 : typeof s.n == "number" ? [s.n, s.n] : [s.n[0], s.n[s.n.length - 1]];
|
|
345
|
+
groups.push({
|
|
346
|
+
s,
|
|
347
|
+
label: s.label ?? s.id,
|
|
348
|
+
isPct: isPctCell(pos[1]),
|
|
349
|
+
formats: { positive: pos.map((c) => cellMeta(c)?.format), negative: neg.map((c) => cellMeta(c)?.format) },
|
|
350
|
+
g: {
|
|
351
|
+
positive,
|
|
352
|
+
negative,
|
|
353
|
+
net,
|
|
354
|
+
netChange: round2(net[1] - net[0]),
|
|
355
|
+
neither: [round2(100 - positive[0] - negative[0]), round2(100 - positive[1] - negative[1])],
|
|
356
|
+
...n ? { n } : {},
|
|
357
|
+
lowBase: n !== void 0 && Math.min(...n) < minBase
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
}), groups.length === 0) throw new NormalizeError("empty-data", "series", "slope variant 'diverging' requires at least one group with both shares in both periods");
|
|
361
|
+
if (groups.length > MAX_GROUPS)
|
|
362
|
+
throw new NormalizeError(
|
|
363
|
+
"slope-diverging-too-many-groups",
|
|
364
|
+
"series",
|
|
365
|
+
`slope variant 'diverging' draws one panel per group and reads up to ${MAX_GROUPS} groups, got ${groups.length}`,
|
|
366
|
+
"group the series further, or draw the net score per group with type 'likert' (sortBy 'net')"
|
|
367
|
+
);
|
|
368
|
+
for (let { s, g } of groups)
|
|
369
|
+
g.neither.some((v) => v < -0.5) && warnings.push({
|
|
370
|
+
code: "slope-diverging-over-100",
|
|
371
|
+
severity: "warn",
|
|
372
|
+
message: `series '${s.id}': the positive and negative shares add to more than 100 in one period`,
|
|
373
|
+
suggest: "give both shares in percent of the same respondents",
|
|
374
|
+
owner: { seriesId: s.id }
|
|
375
|
+
});
|
|
376
|
+
let sort = opt.sort ?? "positive", order = groups.map((x, i) => ({ x, i }));
|
|
377
|
+
if (sort !== "data") {
|
|
378
|
+
let key = (x) => sort === "net" ? x.g.net[1] : x.g.positive[1];
|
|
379
|
+
order.sort((a, b) => key(b.x) - key(a.x) || a.i - b.i);
|
|
380
|
+
}
|
|
381
|
+
let panels = order.map((o) => o.x), posName = opt.labels?.positive ?? chartString(options, "positiveName"), negName = opt.labels?.negative ?? chartString(options, "negativeName"), showNet = opt.net ?? !0, notes = [...authoredNotes(options)];
|
|
382
|
+
showNet && notes.push(disclosureNote(chartString(options, "slopeNetNote", { v1: posName, v2: negName, v3: p2, v4: p1 })));
|
|
383
|
+
let neitherAll = panels.flatMap((p) => p.g.neither).map((v) => Math.max(0, v));
|
|
384
|
+
if ((opt.neutralNote ?? !0) && neitherAll.some((v) => v > 0.5)) {
|
|
385
|
+
let lo = minOf(neitherAll), hi = maxOf(neitherAll), restFmt = options.format ? (v) => fmtVal(v, !1) : seriesValueFormatter([lo, hi], language), span = lo === hi ? restFmt(lo) : numberRange(restFmt(lo), restFmt(hi));
|
|
386
|
+
notes.push(disclosureNote(chartString(options, "slopeResponseRest", { v1: posName, v2: negName, v3: span })));
|
|
387
|
+
}
|
|
388
|
+
let low = panels.filter((p) => p.g.lowBase);
|
|
389
|
+
low.length > 0 && notes.push(disclosureNote(chartString(options, "slopeBaseNote", { v1: minBase, v2: low.map((p) => `${p.label}: n = ${p.g.n[0]} / ${p.g.n[1]}`).join("; ") })));
|
|
390
|
+
let occupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), margin = { ...canvasMargin(theme, size.width), ...options.margin };
|
|
391
|
+
options.legend !== void 0 && warnings.push({ code: "slope-diverging-legend-ignored", severity: "info", message: "variant 'diverging' keys its areas and periods in its own key row; legend is ignored", suggest: "remove legend" }), (options.annotations ?? []).length > 0 && warnings.push({ code: "slope-diverging-annotations-ignored", severity: "warn", message: "variant 'diverging' draws no annotations; they are ignored", suggest: "remove annotations, or state the point in the title" });
|
|
392
|
+
let frameResult = solveFrame({ size, margin, ...frameTextOptions(options), footnotes: notes, theme, measure }, occupied), nodes = [...frameResult.nodes], labelFont = { family: theme.type.family, ...theme.type.label }, headFont = { ...labelFont, weight: emphasisWeight(theme) }, netFont = headFont, lineH = labelFont.size * (labelFont.lineHeight ?? 1.2), textH = measure("0", labelFont).height, posSolid = colorblindPaint("good", !0), posFill = { ...posSolid, tint: 0.62 }, negFill = { token: "badFill", tint: 0.62 }, posEdge = colorblindPaint("good"), negEdge = { token: "bad" }, keyInk = { token: "markInk" }, labelRequests = [], fontById = /* @__PURE__ */ new Map(), fixed = (id, kind, owner, lines, font, rects, priority, middle = !0, role) => {
|
|
393
|
+
fontById.set(id, font), labelRequests.push({
|
|
394
|
+
id,
|
|
395
|
+
kind,
|
|
396
|
+
owner,
|
|
397
|
+
text: lines.join(" "),
|
|
398
|
+
lines,
|
|
399
|
+
font,
|
|
400
|
+
priority,
|
|
401
|
+
...role ? { role } : {},
|
|
402
|
+
...middle ? { align: "middle" } : {},
|
|
403
|
+
candidates: rects.map((rect, k2) => ({ slot: `seat${k2}`, rect, penalty: k2 }))
|
|
404
|
+
});
|
|
405
|
+
}, plot0 = frameResult.plot, keyRowH = textH + 10, w1 = measure(p1, labelFont).width, w2 = measure(p2, labelFont).width, sw = 10, posW = measure(posName, labelFont).width, negW = measure(negName, labelFont).width, swatchesW = sw + 4 + posW + 12 + sw + 4 + negW, periodW = (run) => w1 + 6 + DOT_R * 2 + run + DOT_R * 2 + 6 + w2, tightRun = Math.min(KEY_RUN, plot0.w - swatchesW - KEY_GAP_MIN - periodW(0)), tight = swatchesW + KEY_GAP + periodW(KEY_RUN) > plot0.w && tightRun >= KEY_RUN_MIN, keyRun = tight ? tightRun : KEY_RUN, areasW = swatchesW + (tight ? KEY_GAP_MIN : KEY_GAP), keyW = periodW(keyRun), keyWraps = areasW + keyW > plot0.w + 1e-6, keyH = keyRowH * (keyWraps ? 2 : 1), keyCy = plot0.y + textH / 2;
|
|
406
|
+
{
|
|
407
|
+
let x = plot0.x;
|
|
408
|
+
for (let [name, fill, w] of [[posName, posFill, posW], [negName, negFill, negW]])
|
|
409
|
+
nodes.push({ t: "rect", id: `legend:area:${name}`, rect: { x, y: keyCy - sw / 2, w: sw, h: sw }, fill, owner: {}, part: "legendKey" }), fixed(`series:${name}`, "series", {}, [name], labelFont, [{ x: x + sw + 4, y: keyCy - textH / 2, w, h: textH }], PRIORITY.reference, !1), x += sw + 4 + w + 12;
|
|
410
|
+
}
|
|
411
|
+
let keyX = keyWraps ? plot0.x : plot0.x + areasW, periodCy = keyWraps ? keyCy + keyRowH : keyCy, k0 = keyX + w1 + 6 + DOT_R, k1 = k0 + DOT_R + keyRun + DOT_R;
|
|
412
|
+
fixed("legend:period:0", "category", { categoryId: c0.id }, [p1], labelFont, [{ x: keyX, y: periodCy - textH / 2, w: w1, h: textH }], PRIORITY.reference, !1), fixed("legend:period:1", "category", { categoryId: c1.id }, [p2], labelFont, [{ x: k1 + DOT_R + 6, y: periodCy - textH / 2, w: w2, h: textH }], PRIORITY.reference, !1), nodes.push(
|
|
413
|
+
{ t: "line", id: "legend:period:run", x1: k0, y1: periodCy, x2: k1, y2: periodCy, stroke: keyInk, width: strokeToken(theme, "data"), owner: {}, part: "legendKey" },
|
|
414
|
+
{ t: "circle", id: "legend:period:open", cx: k0, cy: periodCy, r: DOT_R, fill: { token: "background" }, stroke: keyInk, strokeWidth: strokeToken(theme, "mark"), owner: { categoryId: c0.id }, part: "legendKey" },
|
|
415
|
+
{ t: "circle", id: "legend:period:filled", cx: k1, cy: periodCy, r: DOT_R, fill: keyInk, owner: { categoryId: c1.id }, part: "legendKey" }
|
|
416
|
+
), occupied.claim({ x: k0 - DOT_R, y: periodCy - DOT_R, w: k1 - k0 + 2 * DOT_R, h: 2 * DOT_R }, "mark", {});
|
|
417
|
+
let gridY = plot0.y + keyH, gridH = plotHeightAfter(frameResult, size.height, plot0.h - keyH), count = panels.length, cols = Math.max(1, Math.min(count, MAX_PER_ROW, Math.floor((plot0.w + PANEL_GAP) / (MIN_PANEL_W + PANEL_GAP)))), rows = Math.ceil(count / cols);
|
|
418
|
+
cols = Math.ceil(count / rows);
|
|
419
|
+
let pw = (plot0.w - (cols - 1) * PANEL_GAP) / cols, groupFmts = /* @__PURE__ */ new Map(), valueText = (v, p, side, e) => {
|
|
420
|
+
let example = p.formats[side][e] ?? p.s.format ?? options.format;
|
|
421
|
+
if (example || p.isPct) return fmtVal(v, p.isPct, example);
|
|
422
|
+
let fmt = groupFmts.get(p);
|
|
423
|
+
return fmt || groupFmts.set(p, fmt = seriesValueFormatter([...p.g.positive, ...p.g.negative], language)), fmt(v);
|
|
424
|
+
}, valueW = maxOf(panels.flatMap((p) => ["positive", "negative"].flatMap((side) => p.g[side].map((v, e) => measure(valueText(v, p, side, e), labelFont).width)))), inset = Math.min(pw / 4, Math.max(6, valueW / 2 + 2)), heads = panels.map((p) => {
|
|
425
|
+
let suffix = markedLabel("", p.s.footnote, p.s.id, { count: authoredFootnoteCount(options), warnings }), fit = fitText(p.label, headFont, pw + PANEL_GAP - HEAD_CLEAR - measure(suffix, headFont).width, 3, measure);
|
|
426
|
+
if (!suffix) return fit;
|
|
427
|
+
let lines = [...fit.lines.slice(0, -1), `${fit.lines[fit.lines.length - 1]}${suffix}`];
|
|
428
|
+
return { ...fit, lines, w: Math.max(...lines.map((l) => measure(l, fit.font).width)) };
|
|
429
|
+
}), headH = maxOf(heads.map((h) => h.lines.length)) * headFont.size * (headFont.lineHeight ?? 1.2), hasN = panels.some((p) => p.g.n !== void 0), footerLines = (showNet ? 1 : 0) + (hasN ? 1 : 0), footerPitch = lineH + 2, footerH = footerLines * footerPitch + (footerLines > 0 ? 4 : 0), rowExt = Array.from({ length: rows }, (_, r) => {
|
|
430
|
+
let members = panels.slice(r * cols, (r + 1) * cols);
|
|
431
|
+
return { pos: maxOf(members.map((p) => Math.max(...p.g.positive))), neg: maxOf(members.map((p) => Math.max(...p.g.negative))) };
|
|
432
|
+
}), sumExt = Math.max(rowExt.reduce((a, e) => a + e.pos + e.neg, 0), 1e-9), bandOffset = headH + 4 + textH + 6, rowFixed = bandOffset + textH + 6 + footerH, k = Math.max((gridH - (rows - 1) * ROW_GAP - rows * rowFixed) / sumExt, 1e-9), maxPos = maxOf(panels.map((p) => Math.max(...p.g.positive))), maxNeg = maxOf(panels.map((p) => Math.max(...p.g.negative))), kMin = MIN_BAND / Math.max(maxPos + maxNeg, 1e-9), kNatural = Math.min(NATURAL_SCALE_MAX, Math.max(NATURAL_SCALE_MIN, size.width / NATURAL_SCALE_WIDTH)), minHeight = Math.ceil(size.height + (frameResult.deficit ?? 0) + (kMin - k) * sumExt - 1e-6), naturalHeight = Math.ceil(size.height + (frameResult.deficit ?? 0) + (kNatural - k) * sumExt - 1e-6);
|
|
433
|
+
k < kMin && (frameResult.frame.plotMinHeight = Math.max(frameResult.frame.plotMinHeight ?? 0, minHeight));
|
|
434
|
+
let rowTop = [], rowHs = [];
|
|
435
|
+
rowExt.reduce((y, e) => {
|
|
436
|
+
let h = rowFixed + k * (e.pos + e.neg);
|
|
437
|
+
return rowTop.push(y), rowHs.push(h), y + h + ROW_GAP;
|
|
438
|
+
}, gridY);
|
|
439
|
+
let marks = { series: [], panels: [] }, fmtN = (v) => Math.round(v * 100) / 100, poly = (pts) => pts.map(([x, y], i) => `${i === 0 ? "M" : "L"}${fmtN(x)} ${fmtN(y)}`).join("") + "Z", line = (pts) => pts.map(([x, y], i) => `${i === 0 ? "M" : "L"}${fmtN(x)} ${fmtN(y)}`).join("");
|
|
440
|
+
panels.forEach((p, i) => {
|
|
441
|
+
let row = Math.floor(i / cols), col = i % cols, px = plot0.x + col * (pw + PANEL_GAP), rowY = rowTop[row], rowH = rowHs[row], zeroY = rowY + bandOffset + rowExt[row].pos * k, x0 = px + inset, x1 = px + pw - inset, id = p.s.id, nid = `${id}:negative`, yP = [zeroY - p.g.positive[0] * k, zeroY - p.g.positive[1] * k], yN = [zeroY + p.g.negative[0] * k, zeroY + p.g.negative[1] * k], hatch = p.g.lowBase ? { pattern: "hatch45" } : {};
|
|
442
|
+
nodes.push(
|
|
443
|
+
{ t: "path", id: `area:${id}:positive`, d: poly([[x0, zeroY], [x0, yP[0]], [x1, yP[1]], [x1, zeroY]]), fill: p.g.lowBase ? posSolid : posFill, ...hatch, owner: { seriesId: id }, part: "area" },
|
|
444
|
+
{ t: "path", id: `area:${id}:negative`, d: poly([[x0, zeroY], [x0, yN[0]], [x1, yN[1]], [x1, zeroY]]), fill: p.g.lowBase ? { token: "badFill" } : negFill, ...hatch, owner: { seriesId: nid }, part: "area" },
|
|
445
|
+
{ t: "line", id: `zero:${id}`, x1: x0, y1: zeroY, x2: x1, y2: zeroY, stroke: { token: "axis" }, width: strokeToken(theme, "rule"), owner: { seriesId: id }, part: "zeroLine" },
|
|
446
|
+
{ t: "path", id: `mark:${id}`, d: line([[x0, yP[0]], [x1, yP[1]]]), stroke: posEdge, width: strokeToken(theme, "data"), owner: { seriesId: id }, part: "slope" },
|
|
447
|
+
{ t: "path", id: `mark:${id}:negative`, d: line([[x0, yN[0]], [x1, yN[1]]]), stroke: negEdge, width: strokeToken(theme, "data"), owner: { seriesId: nid }, part: "slope" }
|
|
448
|
+
);
|
|
449
|
+
let sides = [
|
|
450
|
+
{ side: "positive", ys: yP, vals: p.g.positive, edge: posEdge, sid: id },
|
|
451
|
+
{ side: "negative", ys: yN, vals: p.g.negative, edge: negEdge, sid: nid }
|
|
452
|
+
];
|
|
453
|
+
for (let { side, ys, vals, edge, sid } of sides)
|
|
454
|
+
[0, 1].forEach((e) => {
|
|
455
|
+
let cx = e === 0 ? x0 : x1, cy = ys[e], cat = e === 0 ? c0 : c1, text = valueText(vals[e], p, side, e);
|
|
456
|
+
nodes.push({
|
|
457
|
+
t: "circle",
|
|
458
|
+
id: `dot:${id}:${side}:${cat.id}`,
|
|
459
|
+
cx,
|
|
460
|
+
cy,
|
|
461
|
+
r: DOT_R,
|
|
462
|
+
fill: e === 0 ? { token: "background" } : edge,
|
|
463
|
+
...e === 0 ? { stroke: edge, strokeWidth: strokeToken(theme, "mark") } : {},
|
|
464
|
+
owner: { seriesId: sid, categoryId: cat.id },
|
|
465
|
+
part: "endpointDot",
|
|
466
|
+
display: { value: text }
|
|
467
|
+
}), occupied.claim({ x: cx - DOT_R, y: cy - DOT_R, w: 2 * DOT_R, h: 2 * DOT_R }, "mark", { seriesId: sid, categoryId: cat.id });
|
|
468
|
+
let w = measure(text, labelFont).width, above = { x: cx - w / 2, y: cy - DOT_R - 3 - textH, w, h: textH }, below = { x: cx - w / 2, y: cy + DOT_R + 3, w, h: textH }, beside = { x: e === 0 ? cx - DOT_R - 3 - w : cx + DOT_R + 3, y: cy - textH / 2, w, h: textH };
|
|
469
|
+
fixed(
|
|
470
|
+
`point:${id}:${side}:${cat.id}`,
|
|
471
|
+
"point",
|
|
472
|
+
{ seriesId: sid, categoryId: cat.id },
|
|
473
|
+
[text],
|
|
474
|
+
labelFont,
|
|
475
|
+
side === "positive" ? [above, beside] : [below, beside],
|
|
476
|
+
PRIORITY.endpoint
|
|
477
|
+
);
|
|
478
|
+
});
|
|
479
|
+
let head = heads[i], hh = head.lines.length * headFont.size * (headFont.lineHeight ?? 1.2);
|
|
480
|
+
fixed(`category:${id}`, "category", { seriesId: id }, head.lines, head.font, [{ x: px + pw / 2 - head.w / 2, y: rowY, w: head.w, h: hh }], PRIORITY.reference);
|
|
481
|
+
let fy = rowY + rowH - footerH + 4;
|
|
482
|
+
if (showNet) {
|
|
483
|
+
let text = chartString(options, "slopeNetLabel", { v1: signed(p.g.net[1]), v2: signed(p.g.netChange) }), w = measure(text, netFont).width;
|
|
484
|
+
fixed(`total:${id}:net`, "total", { seriesId: id }, [text], netFont, [{ x: px + pw / 2 - w / 2, y: fy, w, h: textH }], PRIORITY.total, !0, "note"), fy += footerPitch;
|
|
485
|
+
}
|
|
486
|
+
if (p.g.n) {
|
|
487
|
+
let text = `n = ${formatAutomaticNumber(p.g.n[1], { locale: language, decimals: 0 })}`, w = measure(text, labelFont).width;
|
|
488
|
+
fixed(`total:${id}:base`, "total", { seriesId: id }, [text], labelFont, [{ x: px + pw / 2 - w / 2, y: fy, w, h: textH }], PRIORITY.total, !0, "note");
|
|
489
|
+
}
|
|
490
|
+
marks.series.push({ seriesId: id, lineNodeId: `mark:${id}`, from: { x: x0, y: yP[0] }, to: { x: x1, y: yP[1] } }), marks.series.push({ seriesId: nid, lineNodeId: `mark:${id}:negative`, from: { x: x0, y: yN[0] }, to: { x: x1, y: yN[1] } }), marks.panels.push({ seriesId: id, rect: { x: px, y: rowY, w: pw, h: rowH }, zeroY, x0, x1, positiveY: yP, negativeY: yN });
|
|
491
|
+
});
|
|
492
|
+
let solveCtx = labelCtx(theme, size, options, {
|
|
493
|
+
focus: void 0,
|
|
494
|
+
measure,
|
|
495
|
+
plot: plot0,
|
|
496
|
+
labelPad: 1
|
|
497
|
+
}), solved = solveLabels(labelRequests, occupied, solveCtx);
|
|
498
|
+
pushAll(warnings, solved.warnings), pushAll(nodes, labelsToNodes(theme, solved.placed, (l) => fontById.get(l.id) ?? labelFont));
|
|
499
|
+
let changes = {};
|
|
500
|
+
for (let p of panels) {
|
|
501
|
+
let abs = p.g.positive[1] - p.g.positive[0];
|
|
502
|
+
changes[p.s.id] = { abs: round2(abs), pct: p.g.positive[0] !== 0 ? round2(abs / p.g.positive[0] * 100) : null };
|
|
503
|
+
}
|
|
504
|
+
let rising = panels.filter((p) => p.g.netChange > 0).length, best = [...panels].sort((a, b) => b.g.net[1] - a.g.net[1])[0], desc = chartString(options, "divergingSlopeDesc", { v1: panels.length, v2: posName, v3: negName, v4: p1, v5: p2 }) + chartString(options, "slopeNetRiseDesc", { v1: rising, v2: p2, v3: best.label, v4: signed(best.g.net[1]) }) + (low.length > 0 ? chartString(options, "slopeLowBaseDesc", { v1: low.map((p) => p.label).join(", ") }) : "");
|
|
505
|
+
return {
|
|
506
|
+
type: "slope",
|
|
507
|
+
size,
|
|
508
|
+
plot: plot0,
|
|
509
|
+
scene: nodes,
|
|
510
|
+
labels: solved.placed,
|
|
511
|
+
axes: [],
|
|
512
|
+
annotations: [],
|
|
513
|
+
legend: frameResult.legend,
|
|
514
|
+
frame: frameResult.frame,
|
|
515
|
+
marks,
|
|
516
|
+
derived: {
|
|
517
|
+
changes,
|
|
518
|
+
diverging: {
|
|
519
|
+
order: panels.map((p) => p.s.id),
|
|
520
|
+
groups: Object.fromEntries(panels.map((p) => [p.s.id, p.g]))
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
a11y: {
|
|
524
|
+
title: accessibleTitle(options.title, chartString(options, "divergingSlopeTitle", { v1: panels.length, v2: p1, v3: p2 })),
|
|
525
|
+
counts: [structureCount("series", panels.length, void 0, options)],
|
|
526
|
+
desc
|
|
527
|
+
},
|
|
528
|
+
warnings,
|
|
529
|
+
sizing: resolveSizing(SLOPE_SIZING, size, { minHeight, naturalHeight }),
|
|
530
|
+
debug: { occupied: occupied.snapshot(), decisions: solved.decisions }
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// src/core/charts/slope/layout.ts
|
|
535
|
+
var RAIL_GAP = 8, COMPACT_GAP = 120, NAME_RANK = 1e6, COMPACT_MIN_GAP = 64, WIDE_RAIL_MIN_WIDTH = 600, WIDE_RAIL_BASE = 70, WIDE_RAIL_SHARE = 0.29, MAX_GAP_RATIO = 1.6, RAIL_WASH = 0.75, SPREAD_GAP = 0, TOUCH_TOLERANCE = 1e-6, END_MIN_PITCH = 13, LINE_CLAIM_SEGMENTS = 8, CAGR_ENVELOPE_CLEARANCE = 26, BARE_ANCHOR_KEYS = /* @__PURE__ */ new Set(["at", "from", "to", "vs"]);
|
|
536
|
+
function layoutSlope(data, options = {}) {
|
|
537
|
+
if (options.variant === "diverging") return layoutDivergingSlope(data, options);
|
|
538
|
+
let warnings = [];
|
|
539
|
+
(options.diverging !== void 0 || data?.series?.some((s) => ["negative", "n", "footnote"].some((k) => k in s))) && warnings.push({ code: "slope-diverging-fields-ignored", severity: "warn", message: "diverging, series negative, n and footnote are read by variant 'diverging' only; the plain slope ignores them", suggest: "set options.variant to 'diverging', or remove them" }), breakUnsupported("slope", options, warnings);
|
|
540
|
+
let theme = resolveSemanticPaletteTheme(
|
|
541
|
+
chartTheme(options),
|
|
542
|
+
options.palette,
|
|
543
|
+
warnings
|
|
544
|
+
), size = resolveSize(options.size), measure = options.measure ?? defaultMeasurer, seriesKeys = /* @__PURE__ */ new Map(), seriesKey = (s) => seriesKeys.get(s) ?? seriesKeys.set(s, { unit: s.unit, values: [s.a, s.b].flatMap((end) => end.isPct || end.v === null ? [] : [end.v]) }).get(s), fmtVal = (v, isPct, example, s) => example ? formatterFromExample(example, options.locale?.language, s.unit ?? options.unit)(v) : isPct ? formatAuthoredPercent(v, options.locale?.language) : formats.forSeries(seriesKey(s))(v), highlights = new Set(resolveHighlight(options.highlight)), density = options.labelDensity ?? "smart";
|
|
545
|
+
if (!data || !Array.isArray(data.categories) || data.categories.length < 2)
|
|
546
|
+
throw new NormalizeError(
|
|
547
|
+
"empty-data",
|
|
548
|
+
"categories",
|
|
549
|
+
"slope requires exactly two categories (time points)"
|
|
550
|
+
);
|
|
551
|
+
if (!Array.isArray(data.series) || data.series.length === 0)
|
|
552
|
+
throw new NormalizeError("empty-data", "series", "slope requires at least one series");
|
|
553
|
+
let allCats = data.categories.map((c, i) => normalizeCategory(c, i));
|
|
554
|
+
allCats.length > 2 && warnings.push({
|
|
555
|
+
code: "slope-too-many-points",
|
|
556
|
+
severity: "error",
|
|
557
|
+
message: `slope requires exactly 2 categories, got ${allCats.length} \u2014 layout uses first and last only`,
|
|
558
|
+
suggest: "use chart type 'line' for more than two time points"
|
|
559
|
+
});
|
|
560
|
+
let i0 = 0, i1 = allCats.length - 1, c0 = allCats[i0], c1 = allCats[i1], toEnd = (cell) => {
|
|
561
|
+
let meta = cellMeta(cell);
|
|
562
|
+
return {
|
|
563
|
+
v: cellValue(cell),
|
|
564
|
+
isPct: isPctCell(cell),
|
|
565
|
+
labelOverride: meta?.label,
|
|
566
|
+
format: meta?.format,
|
|
567
|
+
priority: meta?.priority
|
|
568
|
+
};
|
|
569
|
+
}, seriesNorm = data.series.map((s, si) => {
|
|
570
|
+
if (!s?.id) throw new NormalizeError("missing-id", `series[${si}]`, "series requires an id");
|
|
571
|
+
let cells = normalizeSeriesValues(s, allCats, si);
|
|
572
|
+
return {
|
|
573
|
+
id: s.id,
|
|
574
|
+
label: s.label ?? s.id,
|
|
575
|
+
role: s.role ?? "data",
|
|
576
|
+
scenario: normalizeScenario(s.scenario, `series[${s.id}].scenario`),
|
|
577
|
+
colorRole: s.colorRole,
|
|
578
|
+
fill: s.fill,
|
|
579
|
+
format: s.format,
|
|
580
|
+
// Carried for the fold: a sum of euros and kilograms is not a quantity.
|
|
581
|
+
...typeof s.unit == "string" ? { unit: s.unit } : {},
|
|
582
|
+
a: toEnd(cells[i0]),
|
|
583
|
+
b: toEnd(cells[i1])
|
|
584
|
+
};
|
|
585
|
+
}).filter((s) => s.role !== "reference").map(({ role: _role, ...rest }) => rest), formats = seriesRasterFormatter(
|
|
586
|
+
options.format,
|
|
587
|
+
seriesNorm.flatMap((s) => [s.a, s.b].flatMap((end) => end.isPct ? [] : [end.v])),
|
|
588
|
+
options.locale?.language,
|
|
589
|
+
options.unit,
|
|
590
|
+
options.target
|
|
591
|
+
);
|
|
592
|
+
if (seriesNorm.length === 0)
|
|
593
|
+
throw new NormalizeError("empty-data", "series", "slope requires at least one data-role series");
|
|
594
|
+
let plottedSeries = seriesNorm.filter((s) => {
|
|
595
|
+
let ok = s.a.v !== null && s.b.v !== null;
|
|
596
|
+
return ok || warnings.push({
|
|
597
|
+
code: "slope-missing-endpoint",
|
|
598
|
+
severity: "warn",
|
|
599
|
+
message: `series '${s.id}': missing endpoint value \u2014 series not plotted`,
|
|
600
|
+
owner: { seriesId: s.id }
|
|
601
|
+
}), ok;
|
|
602
|
+
}), kept = new Set(highlights), collect = (value) => {
|
|
603
|
+
if (Array.isArray(value)) value.forEach(collect);
|
|
604
|
+
else if (value && typeof value == "object")
|
|
605
|
+
for (let [key, inner] of Object.entries(value))
|
|
606
|
+
key === "seriesId" && typeof inner == "string" ? kept.add(inner) : BARE_ANCHOR_KEYS.has(key) && typeof inner == "string" ? inner !== c0.id && inner !== c1.id && kept.add(inner) : collect(inner);
|
|
607
|
+
};
|
|
608
|
+
collect(options.annotations);
|
|
609
|
+
let foldRefusal = foldShareRefusal(options.foldBelowShare);
|
|
610
|
+
foldRefusal && warnings.push(foldRefusal);
|
|
611
|
+
let fold = foldRefusal || options.foldBelowShare === void 0 ? null : planSlopeFold(plottedSeries, seriesNorm, options.foldBelowShare, {
|
|
612
|
+
othersLabel: chartWording(options, "others", "Other"),
|
|
613
|
+
highlights: kept,
|
|
614
|
+
warnings,
|
|
615
|
+
format: (v, isPct) => options.format ? formatterFromExample(options.format, options.locale?.language, options.unit)(v) : isPct ? formatAuthoredPercent(v, options.locale?.language) : formats.fmt(v),
|
|
616
|
+
...typeof options.unit == "string" ? { chartUnit: options.unit } : {},
|
|
617
|
+
categories: { from: c0.label ?? c0.id, to: c1.label ?? c1.id },
|
|
618
|
+
...options.locale?.language !== void 0 ? { language: options.locale.language } : {}
|
|
619
|
+
});
|
|
620
|
+
fold && ({ plotted: plottedSeries, listed: seriesNorm } = fold);
|
|
621
|
+
let changes = {};
|
|
622
|
+
for (let s of plottedSeries) {
|
|
623
|
+
let abs = s.b.v - s.a.v;
|
|
624
|
+
changes[s.id] = {
|
|
625
|
+
abs: round2(abs),
|
|
626
|
+
pct: s.a.v !== 0 ? round2(abs / Math.abs(s.a.v) * 100) : null
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
let byChange = (dir) => {
|
|
630
|
+
let best, bestAbs = 0;
|
|
631
|
+
for (let s of plottedSeries) {
|
|
632
|
+
let c = changes[s.id].abs * dir;
|
|
633
|
+
(c > bestAbs || c === bestAbs && c > 0 && best !== void 0 && s.id < best) && (best = s.id, bestAbs = c);
|
|
634
|
+
}
|
|
635
|
+
return bestAbs > 0 ? best : void 0;
|
|
636
|
+
}, steepestUp = byChange(1), steepestDown = byChange(-1), kindSetting = (kind) => {
|
|
637
|
+
let l = options.labels;
|
|
638
|
+
if (l === !1) return kind === "category" && labelsOffKeepsNames(options);
|
|
639
|
+
let v = l?.[kind];
|
|
640
|
+
return v === void 0 ? !0 : v;
|
|
641
|
+
}, endContent = ((kind, dflt) => {
|
|
642
|
+
let s = kindSetting(kind);
|
|
643
|
+
return s === !1 ? null : Array.isArray(s) ? s : dflt;
|
|
644
|
+
})("series", ["series", "absolute"]), composeEndParts = (s, end, cat, side, compact2 = !1) => {
|
|
645
|
+
if (!endContent) return [];
|
|
646
|
+
let content = compact2 && side === "left" && s.b.labelOverride !== !1 ? endContent.filter((c) => c !== "series") : endContent, ordered = side === "left" || plottedSeries.length === 1 ? content : [...content].reverse(), parts = [];
|
|
647
|
+
for (let c of ordered)
|
|
648
|
+
if (c === "absolute" && end.v !== null) {
|
|
649
|
+
let value = fmtVal(end.v, end.isPct, end.format ?? s.format ?? options.format, s);
|
|
650
|
+
parts.push({ text: typeof end.labelOverride == "string" ? end.labelOverride.replace(/\$\{value\}/g, value) : value, isName: !1 });
|
|
651
|
+
} else c === "percent" && changes[s.id]?.pct != null ? parts.push({ text: formatAutomaticPercent(changes[s.id].pct, 1, !0, options.locale?.language), isName: !1 }) : c === "category" ? parts.push({ text: cat.label ?? cat.id, isName: !1 }) : c === "series" && parts.push({ text: s.label, isName: !0 });
|
|
652
|
+
return parts;
|
|
653
|
+
}, composeEnd = (s, end, cat, side, compact2 = !1) => composeEndParts(s, end, cat, side, compact2).map((p) => p.text).join(" "), labelFont = { family: theme.type.family, ...theme.type.label }, hlFont = { ...labelFont, weight: emphasisWeight(theme) }, catFont = { family: theme.type.family, ...theme.type.label }, endFontOf = (s) => highlights.has(s.id) ? hlFont : labelFont, endLineH = labelFont.size * (labelFont.lineHeight ?? 1.2), minPitch = Math.max(END_MIN_PITCH, endLineH), anyHighlight = highlights.size > 0 || seriesNorm.some((s) => !s.fill && s.colorRole === "highlight"), rawLinePaint = (s) => s.fill ? { css: s.fill } : s.colorRole ? markRolePaint(s.colorRole) : highlights.has(s.id) ? semanticPalettePaint(theme, options.palette, "focus") : anyHighlight && (options.palette === void 0 || theme.color.palettes?.[options.palette] === void 0) ? mutedMarkPaint() : semanticPalettePaint(
|
|
654
|
+
theme,
|
|
655
|
+
options.palette,
|
|
656
|
+
anyHighlight ? "neutralLight" : "neutralMark"
|
|
657
|
+
), keyedPaints = !anyHighlight && options.legend && options.legend !== "none" ? new Map(distinguishSeries(
|
|
658
|
+
seriesNorm.map((s) => ({
|
|
659
|
+
id: s.id,
|
|
660
|
+
label: s.label,
|
|
661
|
+
paint: rawLinePaint(s),
|
|
662
|
+
key: "line",
|
|
663
|
+
...s.scenario === "FC" ? { dash: dashToken(theme, "reference") } : {}
|
|
664
|
+
})),
|
|
665
|
+
new Set(seriesNorm.filter((s) => s.fill || s.colorRole || highlights.has(s.id)).map((s) => s.id)),
|
|
666
|
+
Array.from({ length: theme.color.series.length }, (_, i) => seriesPaint(i, options.palette)),
|
|
667
|
+
theme
|
|
668
|
+
).map((identity) => [identity.id, identity.paint])) : void 0, linePaint = (s) => keyedPaints?.get(s.id) ?? rawLinePaint(s), lineWidth = (s) => strokeToken(theme, highlights.has(s.id) ? "focus" : anyHighlight && !s.fill && !s.colorRole ? "mark" : "data"), occupied = createOccupiedIndex({ x: 0, y: 0, w: size.width, h: size.height }), margin = { ...canvasMargin(theme, size.width), ...options.margin }, legendInput;
|
|
669
|
+
if (options.legend && options.legend !== "none" && options.legend !== "auto") {
|
|
670
|
+
let legendOpts = normalizeLegendOption(options.legend), items = seriesNorm.filter((s) => !anyHighlight || highlights.has(s.id) || s.fill || s.colorRole || s.id === fold?.record.otherId).map((s) => ({
|
|
671
|
+
id: s.id,
|
|
672
|
+
label: s.id === fold?.record.otherId ? fold.legendLabel : s.label,
|
|
673
|
+
paint: linePaint(s),
|
|
674
|
+
// Every slope line draws a dot at both ends: its key carries one.
|
|
675
|
+
key: "line",
|
|
676
|
+
width: lineWidth(s),
|
|
677
|
+
marker: { shape: "circle" },
|
|
678
|
+
...s.scenario === "FC" ? { dash: dashToken(theme, "reference") } : {}
|
|
679
|
+
}));
|
|
680
|
+
if (legendOpts.order) {
|
|
681
|
+
let oi = (id) => {
|
|
682
|
+
let k = legendOpts.order.indexOf(id);
|
|
683
|
+
return k === -1 ? Number.MAX_SAFE_INTEGER : k;
|
|
684
|
+
};
|
|
685
|
+
items = [...items].sort((a, b) => oi(a.id) - oi(b.id));
|
|
686
|
+
}
|
|
687
|
+
legendInput = { options: legendOpts, items };
|
|
688
|
+
}
|
|
689
|
+
let frameResult = solveFrame(
|
|
690
|
+
{
|
|
691
|
+
size,
|
|
692
|
+
margin,
|
|
693
|
+
...frameTextOptions(options),
|
|
694
|
+
footnotes: [...authoredNotes(options), ...fold ? [fold.record.note] : []],
|
|
695
|
+
legend: legendInput,
|
|
696
|
+
theme,
|
|
697
|
+
measure
|
|
698
|
+
},
|
|
699
|
+
occupied
|
|
700
|
+
), sideCap = Math.max(40, frameResult.plot.w * 0.35), wrapRoom = plottedSeries.length * (2 * endLineH + SPREAD_GAP) <= frameResult.plot.h * 0.8, mkEndReq = (s, end, cat, side, compact2 = !1, maxSideW = sideCap) => {
|
|
701
|
+
let baseFont = endFontOf(s), text = composeEnd(s, end, cat, side, compact2), fit = typeof end.labelOverride == "string" ? void 0 : fitEndLabel(text, baseFont, { maxSideW, wrapRoom, shrink: stepDownFont(theme, baseFont, "label", options.target, textScaleOf(options)), target: options.target, measure }), font = fit?.font ?? baseFont, lines = fit?.lines ?? [text], tsize = fit?.size ?? measure(text || "0", font), title;
|
|
702
|
+
if (tsize.width > maxSideW && typeof end.labelOverride != "string") {
|
|
703
|
+
let parts = composeEndParts(s, end, cat, side, compact2), nameIdx = parts.findIndex((p) => p.isName);
|
|
704
|
+
if (nameIdx !== -1) {
|
|
705
|
+
let budget = maxSideW - parts.reduce(
|
|
706
|
+
(a, p, k) => k === nameIdx ? a : a + measure(p.text, font).width,
|
|
707
|
+
measure(" ", font).width * (parts.length - 1)
|
|
708
|
+
), name = parts[nameIdx].text;
|
|
709
|
+
if (measure(name, font).width > budget) {
|
|
710
|
+
let fitted = "", words = name.split(" ");
|
|
711
|
+
for (let k = words.length - 1; k >= 1; k--) {
|
|
712
|
+
let cand = `${words.slice(0, k).join(" ")}\u2026`;
|
|
713
|
+
if (measure(cand, font).width <= budget) {
|
|
714
|
+
fitted = cand;
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
fitted || (fitted = cutWithTitle(name, font, Math.max(budget, 0), measure).text), title = text, parts[nameIdx] = { text: fitted, isName: !0 }, text = parts.map((p) => p.text).join(" "), lines = [text], tsize = measure(text || "0", font);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
let change = changes[s.id]?.abs ?? 0, priority = end.priority ?? PRIORITY.endpoint + Math.min(99, Math.abs(change)) + (highlights.has(s.id) ? PRIORITY.highlightBonus : 0);
|
|
723
|
+
return {
|
|
724
|
+
s,
|
|
725
|
+
text,
|
|
726
|
+
w: tsize.width,
|
|
727
|
+
h: tsize.height,
|
|
728
|
+
priority,
|
|
729
|
+
suppressed: end.labelOverride === !1 || !text,
|
|
730
|
+
...title !== void 0 ? { title } : {},
|
|
731
|
+
...font !== baseFont ? { fontStep: font } : {},
|
|
732
|
+
lines
|
|
733
|
+
};
|
|
734
|
+
}, sideMax = (reqs) => reqs.reduce((m, r) => r.suppressed ? m : Math.max(m, r.w), 0), sideDemand = (side) => plottedSeries.reduce((max, s) => {
|
|
735
|
+
let end = side === "left" ? s.a : s.b;
|
|
736
|
+
if (end.labelOverride === !1) return max;
|
|
737
|
+
let text = composeEnd(s, end, side === "left" ? c0 : c1, side);
|
|
738
|
+
if (!text) return max;
|
|
739
|
+
let width = measure(text, endFontOf(s)).width;
|
|
740
|
+
return Math.max(max, typeof end.labelOverride == "string" ? width : Math.min(sideCap, width));
|
|
741
|
+
}, 0), fullLeftReqs = plottedSeries.map((s) => mkEndReq(s, s.a, c0, "left")), fullRightReqs = plottedSeries.map((s) => mkEndReq(s, s.b, c1, "right")), compactable = endContent !== null && options.labels !== !1 && !Array.isArray(options.labels?.series) && plottedSeries.length > 1 && endContent.includes("series") && endContent.length > 1, gapCompact = compactable && frameResult.plot.w - sideDemand("left") - sideDemand("right") - 2 * RAIL_GAP < COMPACT_GAP, cutCompact = compactable && !gapCompact && (fullLeftReqs.some((req) => req.title !== void 0) || fullRightReqs.some((req) => req.title !== void 0)), compactLeftReqs = gapCompact || cutCompact ? plottedSeries.map((s) => mkEndReq(s, s.a, c0, "left", !0)) : [], rightCap = gapCompact || cutCompact ? Math.max(sideCap, frameResult.plot.w - sideMax(compactLeftReqs) - 2 * RAIL_GAP - COMPACT_MIN_GAP) : sideCap, compactRightReqs = gapCompact || cutCompact ? plottedSeries.map((s) => mkEndReq(s, s.b, c1, "right", !0, rightCap)) : [], catH = measure("0", catFont).height, topPad = ((options.annotations ?? []).some((a) => a.kind === "cagr") ? measure("0", { ...labelFont, weight: emphasisWeight(theme) }).height + CAGR_ENVELOPE_CLEARANCE : 0) + catH + 10, plotY = frameResult.plot.y + topPad, plotH = plotHeightAfter(frameResult, size.height, frameResult.plot.h - topPad), wantPlotH = options[TARGET_SIZE]?.fixed.height === !1 && panelTypeClass(options) === void 0 && size.width >= WIDE_RAIL_MIN_WIDTH ? Math.round(WIDE_RAIL_BASE + WIDE_RAIL_SHARE * size.width) : 0;
|
|
742
|
+
wantPlotH > plotH && (frameResult.frame.plotMinHeight = Math.max(frameResult.frame.plotMinHeight ?? 0, Math.ceil(size.height + (frameResult.deficit ?? 0) + wantPlotH - plotH)));
|
|
743
|
+
let lo = valueLineExtent(options.annotations)?.lo ?? 1 / 0, hi = valueLineExtent(options.annotations)?.hi ?? -1 / 0;
|
|
744
|
+
for (let s of plottedSeries)
|
|
745
|
+
lo = Math.min(lo, s.a.v, s.b.v), hi = Math.max(hi, s.a.v, s.b.v);
|
|
746
|
+
Number.isFinite(lo) || (lo = 0, hi = 1);
|
|
747
|
+
let dLo, dHi;
|
|
748
|
+
if (lo === hi)
|
|
749
|
+
[dLo, dHi] = niceDomain(lo === 0 ? -1 : lo - Math.abs(lo) * 0.1, hi === 0 ? 1 : hi + Math.abs(hi) * 0.1, 4);
|
|
750
|
+
else {
|
|
751
|
+
let pad = (hi - lo) * 0.06;
|
|
752
|
+
[dLo, dHi] = niceDomain(lo - pad, hi + pad, 5, {
|
|
753
|
+
dataExtent: [lo, hi],
|
|
754
|
+
preserveDataSideOfZero: !0,
|
|
755
|
+
// Two-sided domain — waste SUM bounded by the 0.80 envelope floor.
|
|
756
|
+
maxWasteFraction: 0.15,
|
|
757
|
+
maxTotalWasteFraction: 0.2
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
let va = options.valueAxis ?? {};
|
|
761
|
+
[dLo, dHi] = applyAxisBounds([dLo, dHi], [lo, hi], va, warnings);
|
|
762
|
+
let y = linearScale([dLo, dHi], [plotY + plotH, plotY]), seatSide = (reqs, side, unnamed = /* @__PURE__ */ new Set()) => {
|
|
763
|
+
let rank = (r) => r.priority + (unnamed.size === 0 ? 0 : highlights.has(r.s.id) ? 2 * NAME_RANK : unnamed.has(r.s.id) ? NAME_RANK : 0), active = reqs.filter((r) => !r.suppressed), desiredOf = (r) => y(side === "left" ? r.s.a.v : r.s.b.v), pitch = minPitch, height = (rs, p) => rs.reduce((a, r) => a + Math.max(r.h, p), 0) + SPREAD_GAP * Math.max(0, rs.length - 1), step = stepDownFont(theme, labelFont, "label", options.target, textScaleOf(options));
|
|
764
|
+
if (step && height(active, pitch) > plotH) {
|
|
765
|
+
let small = active.map((r) => {
|
|
766
|
+
if (r.fontStep) return r;
|
|
767
|
+
let font = { ...endFontOf(r.s), size: step.size }, h = measure(r.lines[0] || "0", font).height + (r.lines.length - 1) * lineBox(font);
|
|
768
|
+
return { ...r, fontStep: font, w: Math.max(...r.lines.map((line) => measure(line || "0", font).width)), h };
|
|
769
|
+
}), smallPitch = Math.max(END_MIN_PITCH, step.size * (step.lineHeight ?? 1.2));
|
|
770
|
+
height(small, smallPitch) <= plotH && (active = small, pitch = smallPitch);
|
|
771
|
+
}
|
|
772
|
+
let effH = (r) => Math.max(r.h, pitch), kept2 = [...active], dropped = [];
|
|
773
|
+
if (kept2.length * pitch > plotH) {
|
|
774
|
+
let keepFlags = sweepHide(
|
|
775
|
+
kept2.map((r) => ({
|
|
776
|
+
start: desiredOf(r) - pitch / 2,
|
|
777
|
+
size: pitch,
|
|
778
|
+
priority: rank(r)
|
|
779
|
+
})),
|
|
780
|
+
0
|
|
781
|
+
);
|
|
782
|
+
pushAll(dropped, kept2.filter((_, i) => !keepFlags[i])), kept2 = kept2.filter((_, i) => keepFlags[i]);
|
|
783
|
+
}
|
|
784
|
+
let needed = () => kept2.reduce((a, r) => a + effH(r), 0) + SPREAD_GAP * Math.max(0, kept2.length - 1);
|
|
785
|
+
for (; kept2.length > 1 && needed() > plotH; ) {
|
|
786
|
+
let worst = 0;
|
|
787
|
+
for (let i = 1; i < kept2.length; i++) {
|
|
788
|
+
let a = kept2[i], b = kept2[worst];
|
|
789
|
+
(rank(a) < rank(b) || rank(a) === rank(b) && a.s.id > b.s.id) && (worst = i);
|
|
790
|
+
}
|
|
791
|
+
dropped.push(...kept2.splice(worst, 1));
|
|
792
|
+
}
|
|
793
|
+
return { kept: kept2, dropped, pitch };
|
|
794
|
+
}, compact = (gapCompact || cutCompact) && seatSide(compactRightReqs, "right").dropped.length === 0, leftReqs = compact ? compactLeftReqs : fullLeftReqs, rightReqs = compact ? compactRightReqs : fullRightReqs, leftMax = endContent ? sideMax(leftReqs) : 0, rightMax = endContent ? sideMax(rightReqs) : 0, railGapOf = (reqs, side) => {
|
|
795
|
+
let active = reqs.filter((r) => !r.suppressed);
|
|
796
|
+
if (!endContent || active.length === 0) return RAIL_GAP;
|
|
797
|
+
let desired = active.map((r) => y(side === "left" ? r.s.a.v : r.s.b.v)), spread = spread1DResult(active.map((r, i) => ({ desired: desired[i], size: Math.max(r.h, minPitch) })), [plotY, plotY + plotH], SPREAD_GAP), shift = Math.max(0, maxOf(spread.positions.map((position, i) => Math.abs(position - desired[i]))));
|
|
798
|
+
return Math.min(48, Math.max(RAIL_GAP, Math.ceil(shift + 0.4 * endLineH + 1)));
|
|
799
|
+
}, railGaps = { left: railGapOf(leftReqs, "left"), right: railGapOf(rightReqs, "right") }, railL = frameResult.plot.x + (leftMax > 0 ? leftMax + railGaps.left : 0), railR = frameResult.plot.x + frameResult.plot.w - (rightMax > 0 ? rightMax + railGaps.right : 0), maxGap = MAX_GAP_RATIO * plotH;
|
|
800
|
+
if (railR - railL > maxGap) {
|
|
801
|
+
let spare = railR - railL - maxGap;
|
|
802
|
+
railL += spare / 2, railR -= spare / 2;
|
|
803
|
+
}
|
|
804
|
+
let plot = { x: railL, y: plotY, w: Math.max(10, railR - railL), h: plotH }, nodes = [...frameResult.nodes], railXs = [plot.x, plot.x + plot.w], railCats = [c0, c1], railPaint = theme.color.reference !== void 0 ? { token: "reference" } : { token: "reference", theme: { kind: "visible-tint", base: { token: "reference" }, amount: RAIL_WASH, floor: MARK_CONTRAST_FLOOR } };
|
|
805
|
+
railCats.forEach((c, k) => {
|
|
806
|
+
let rx = railXs[k];
|
|
807
|
+
nodes.push({
|
|
808
|
+
t: "line",
|
|
809
|
+
id: `rail:${c.id}`,
|
|
810
|
+
x1: rx,
|
|
811
|
+
y1: plot.y,
|
|
812
|
+
x2: rx,
|
|
813
|
+
y2: plot.y + plot.h,
|
|
814
|
+
stroke: railPaint,
|
|
815
|
+
width: strokeToken(theme, "rule"),
|
|
816
|
+
owner: { categoryId: c.id },
|
|
817
|
+
part: "rail"
|
|
818
|
+
}), occupied.claim({ x: rx - 1, y: plot.y, w: 2, h: plot.h }, "axis", { categoryId: c.id });
|
|
819
|
+
});
|
|
820
|
+
let marks = { series: [] };
|
|
821
|
+
for (let s of plottedSeries) {
|
|
822
|
+
let yA = y(s.a.v), yB = y(s.b.v), lineNodeId = `mark:${s.id}`;
|
|
823
|
+
nodes.push({
|
|
824
|
+
t: "line",
|
|
825
|
+
id: lineNodeId,
|
|
826
|
+
x1: railXs[0],
|
|
827
|
+
y1: yA,
|
|
828
|
+
x2: railXs[1],
|
|
829
|
+
y2: yB,
|
|
830
|
+
stroke: linePaint(s),
|
|
831
|
+
width: lineWidth(s),
|
|
832
|
+
...s.scenario === "FC" ? { dash: dashToken(theme, "reference") } : {},
|
|
833
|
+
owner: { seriesId: s.id },
|
|
834
|
+
part: "slope"
|
|
835
|
+
});
|
|
836
|
+
let w = railXs[1] - railXs[0];
|
|
837
|
+
for (let k = 0; k < LINE_CLAIM_SEGMENTS; k++) {
|
|
838
|
+
let fx0 = k / LINE_CLAIM_SEGMENTS, fx1 = (k + 1) / LINE_CLAIM_SEGMENTS, sy0 = yA + (yB - yA) * fx0, sy1 = yA + (yB - yA) * fx1;
|
|
839
|
+
occupied.claim(
|
|
840
|
+
{
|
|
841
|
+
x: railXs[0] + w * fx0,
|
|
842
|
+
y: Math.min(sy0, sy1) - 1.5,
|
|
843
|
+
w: w * (fx1 - fx0),
|
|
844
|
+
h: Math.abs(sy1 - sy0) + 3
|
|
845
|
+
},
|
|
846
|
+
"mark",
|
|
847
|
+
{ seriesId: s.id }
|
|
848
|
+
);
|
|
849
|
+
}
|
|
850
|
+
[[railXs[0], yA, c0], [railXs[1], yB, c1]].forEach(([dx, dy, dc]) => {
|
|
851
|
+
let end = dc.id === c0.id ? s.a : s.b;
|
|
852
|
+
nodes.push({
|
|
853
|
+
t: "circle",
|
|
854
|
+
id: `dot:${s.id}:${dc.id}`,
|
|
855
|
+
cx: dx,
|
|
856
|
+
cy: dy,
|
|
857
|
+
r: 2.5,
|
|
858
|
+
fill: linePaint(s),
|
|
859
|
+
owner: { seriesId: s.id, categoryId: dc.id },
|
|
860
|
+
part: "endpointDot",
|
|
861
|
+
display: { value: fmtVal(end.v, end.isPct, end.format ?? s.format ?? options.format, s) }
|
|
862
|
+
}), occupied.claim({ x: dx - 2.5, y: dy - 2.5, w: 5, h: 5 }, "mark", {
|
|
863
|
+
seriesId: s.id,
|
|
864
|
+
categoryId: dc.id
|
|
865
|
+
});
|
|
866
|
+
}), marks.series.push({
|
|
867
|
+
seriesId: s.id,
|
|
868
|
+
lineNodeId,
|
|
869
|
+
from: { x: railXs[0], y: yA },
|
|
870
|
+
to: { x: railXs[1], y: yB }
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
let labelRequests = [], planSide = (reqs, side, unnamed) => {
|
|
874
|
+
if (!endContent) return [];
|
|
875
|
+
let railX = side === "left" ? railXs[0] : railXs[1], cat = side === "left" ? c0 : c1, desiredOf = (r) => y(side === "left" ? r.s.a.v : r.s.b.v), { kept: kept2, dropped, pitch } = seatSide(reqs, side, unnamed), effH = (r) => Math.max(r.h, pitch), spread = spread1DResult(
|
|
876
|
+
kept2.map((r) => ({ desired: desiredOf(r), size: effH(r) })),
|
|
877
|
+
[plot.y, plot.y + plot.h],
|
|
878
|
+
SPREAD_GAP
|
|
879
|
+
);
|
|
880
|
+
warnSpreadOverflow(warnings, spread.fits, `${side} endpoint labels exceed the plot height even after spreading \u2014 labels stay bounded but overlap; reduce series or enlarge the canvas`);
|
|
881
|
+
let centers = spread.positions, slot = side === "left" ? "railLeft" : "railRight", rectFor = (r, centerY) => ({
|
|
882
|
+
x: side === "left" ? railX - railGaps.left - r.w : railX + railGaps.right,
|
|
883
|
+
y: centerY - r.h / 2,
|
|
884
|
+
w: r.w,
|
|
885
|
+
h: r.h
|
|
886
|
+
});
|
|
887
|
+
kept2.forEach((r, i) => {
|
|
888
|
+
labelRequests.push({
|
|
889
|
+
id: `series:${r.s.id}:${cat.id}`,
|
|
890
|
+
kind: "series",
|
|
891
|
+
owner: { seriesId: r.s.id, categoryId: cat.id },
|
|
892
|
+
text: r.text,
|
|
893
|
+
lines: r.lines,
|
|
894
|
+
...r.title !== void 0 ? { title: r.title } : {},
|
|
895
|
+
...r.fontStep ? { fontStep: r.fontStep } : {},
|
|
896
|
+
font: endFontOf(r.s),
|
|
897
|
+
priority: r.priority,
|
|
898
|
+
// Spread boxes may touch (SPREAD_GAP), so the solver pads them by 0.
|
|
899
|
+
pad: -TOUCH_TOLERANCE,
|
|
900
|
+
candidates: [{
|
|
901
|
+
slot,
|
|
902
|
+
rect: rectFor(r, centers[i]),
|
|
903
|
+
penalty: 0,
|
|
904
|
+
// Moved off its point: a leader from the rail point to the label.
|
|
905
|
+
...Math.abs(centers[i] - desiredOf(r)) > 0.5 ? { leaderFrom: { x: railX, y: desiredOf(r) } } : {}
|
|
906
|
+
}]
|
|
907
|
+
});
|
|
908
|
+
});
|
|
909
|
+
for (let r of [...dropped, ...reqs.filter((x) => x.suppressed)]) {
|
|
910
|
+
let desired = desiredOf(r);
|
|
911
|
+
labelRequests.push({
|
|
912
|
+
id: `series:${r.s.id}:${cat.id}`,
|
|
913
|
+
kind: "series",
|
|
914
|
+
owner: { seriesId: r.s.id, categoryId: cat.id },
|
|
915
|
+
text: r.text,
|
|
916
|
+
lines: [r.text],
|
|
917
|
+
font: endFontOf(r.s),
|
|
918
|
+
priority: r.priority,
|
|
919
|
+
redundant: !0,
|
|
920
|
+
// Dropped because the side could not give every end label readable
|
|
921
|
+
// pitch — NOT because the name appears elsewhere. Publishing this as
|
|
922
|
+
// 'redundant' told a reader the omission was free when it was not.
|
|
923
|
+
suppressedAs: "density",
|
|
924
|
+
candidates: [{ slot, rect: rectFor(r, desired), penalty: 0 }]
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
return kept2;
|
|
928
|
+
}, leftKept = planSide(leftReqs, "left"), leftNamed = new Set(compact || !endContent?.includes("series") ? [] : leftKept.map((r) => r.s.id));
|
|
929
|
+
planSide(rightReqs, "right", compact || !endContent?.includes("series") ? void 0 : new Set(plottedSeries.filter((s) => !leftNamed.has(s.id)).map((s) => s.id)));
|
|
930
|
+
let catLabelsShown = !1;
|
|
931
|
+
kindSetting("category") !== !1 && (catLabelsShown = !0, railCats.forEach((c, k) => {
|
|
932
|
+
let rx = railXs[k], text = markedLabel(c.label ?? c.id, c.footnote, c.id, { count: authoredFootnoteCount(options), warnings }), tsize = measure(text, catFont), cy = plot.y - catH - 6, centeredX = clamp(rx - tsize.width / 2, 2, size.width - tsize.width - 2), inwardX = k === 0 ? rx + 4 : rx - tsize.width - 4;
|
|
933
|
+
labelRequests.push({
|
|
934
|
+
id: `category:${c.id}`,
|
|
935
|
+
kind: "category",
|
|
936
|
+
owner: { categoryId: c.id },
|
|
937
|
+
text,
|
|
938
|
+
lines: [text],
|
|
939
|
+
font: catFont,
|
|
940
|
+
priority: PRIORITY.endpoint,
|
|
941
|
+
candidates: [
|
|
942
|
+
{ slot: "aboveRail", rect: { x: centeredX, y: cy, w: tsize.width, h: catH }, penalty: 0 },
|
|
943
|
+
{ slot: "aboveRailInward", rect: { x: inwardX, y: cy, w: tsize.width, h: catH }, penalty: 1 }
|
|
944
|
+
]
|
|
945
|
+
});
|
|
946
|
+
}));
|
|
947
|
+
let solveCtx = labelCtx(theme, size, options, {
|
|
948
|
+
density,
|
|
949
|
+
measure,
|
|
950
|
+
plot,
|
|
951
|
+
labelPad: 2
|
|
952
|
+
}), solved = solveLabels(labelRequests, occupied, solveCtx);
|
|
953
|
+
pushAll(warnings, solved.warnings);
|
|
954
|
+
let plottedById = new Map(plottedSeries.map((s) => [s.id, s])), endpointOf = (sid, cid) => {
|
|
955
|
+
let s = plottedById.get(sid);
|
|
956
|
+
if (!s) return null;
|
|
957
|
+
let k = cid === c0.id ? 0 : cid === c1.id ? 1 : -1;
|
|
958
|
+
if (k === -1) return null;
|
|
959
|
+
let v = k === 0 ? s.a.v : s.b.v, cat = k === 0 ? c0 : c1;
|
|
960
|
+
return {
|
|
961
|
+
x: railXs[k],
|
|
962
|
+
y: y(v),
|
|
963
|
+
value: v,
|
|
964
|
+
format: s.format,
|
|
965
|
+
date: cat.date,
|
|
966
|
+
owner: { seriesId: sid, categoryId: cat.id }
|
|
967
|
+
};
|
|
968
|
+
}, resolveAnchor = (ref) => {
|
|
969
|
+
if (typeof ref == "string") {
|
|
970
|
+
if (ref === c0.id || ref === c1.id) {
|
|
971
|
+
let sid = plottedSeries[0]?.id;
|
|
972
|
+
return sid ? endpointOf(sid, ref) : null;
|
|
973
|
+
}
|
|
974
|
+
return endpointOf(ref, c1.id);
|
|
975
|
+
}
|
|
976
|
+
if ("categoryId" in ref && ref.seriesId) return endpointOf(ref.seriesId, ref.categoryId);
|
|
977
|
+
if ("categoryId" in ref) {
|
|
978
|
+
let sid = plottedSeries[0]?.id;
|
|
979
|
+
return sid ? endpointOf(sid, ref.categoryId) : null;
|
|
980
|
+
}
|
|
981
|
+
return null;
|
|
982
|
+
}, annResult = runAnnotatePass({
|
|
983
|
+
annotations: options.annotations ?? [],
|
|
984
|
+
resolve: resolveAnchor,
|
|
985
|
+
defaultSpan: plottedSeries.length === 1 ? {
|
|
986
|
+
from: { categoryId: c0.id, seriesId: plottedSeries[0].id },
|
|
987
|
+
to: { categoryId: c1.id, seriesId: plottedSeries[0].id }
|
|
988
|
+
} : void 0,
|
|
989
|
+
occupied,
|
|
990
|
+
plot,
|
|
991
|
+
theme,
|
|
992
|
+
measure,
|
|
993
|
+
format: options.format,
|
|
994
|
+
locale: options.locale?.language,
|
|
995
|
+
strings: options.strings,
|
|
996
|
+
valueLinePercentLevels: options.unit === "%" || percentLevels(plottedSeries.map((series) => ({ vals: [series.a, series.b] }))),
|
|
997
|
+
solveCtx,
|
|
998
|
+
yScale: y
|
|
999
|
+
});
|
|
1000
|
+
pushAll(warnings, annResult.warnings);
|
|
1001
|
+
let allLabels = [...solved.placed, ...annResult.labels], legendNames = legendInput !== void 0 && frameResult.legend !== void 0 ? legendInput.items.map((item) => item.id) : [];
|
|
1002
|
+
pushAll(warnings, unnamedSeriesWarnings(seriesNorm, allLabels, legendNames)), pushAll(nodes, annResult.nodes), pushAll(
|
|
1003
|
+
nodes,
|
|
1004
|
+
labelsToNodes(
|
|
1005
|
+
theme,
|
|
1006
|
+
allLabels,
|
|
1007
|
+
(l) => l.kind === "category" ? catFont : l.kind === "annotation" || l.kind === "valueLine" ? { ...labelFont, weight: emphasisWeight(theme) } : highlights.has(l.owner.seriesId ?? "") ? hlFont : labelFont
|
|
1008
|
+
)
|
|
1009
|
+
// Every leader keeps the thin neutral leader paint; a leader in the
|
|
1010
|
+
// highlight colour reads as a hook in its line.
|
|
1011
|
+
);
|
|
1012
|
+
let axes = [
|
|
1013
|
+
{
|
|
1014
|
+
axis: "x",
|
|
1015
|
+
ticks: railCats.map((c, k) => ({
|
|
1016
|
+
at: c.id,
|
|
1017
|
+
pos: railXs[k],
|
|
1018
|
+
labelId: catLabelsShown ? `category:${c.id}` : void 0
|
|
1019
|
+
}))
|
|
1020
|
+
}
|
|
1021
|
+
], changeText = (sid) => {
|
|
1022
|
+
let s = plottedById.get(sid), ch = changes[sid], pctPart = ch.pct !== null ? ` (${formatAutomaticPercent(ch.pct, 1, !0, options.locale?.language)})` : "";
|
|
1023
|
+
return `${s.label} ${formatAutomaticNumber(ch.abs, { locale: options.locale?.language, signed: !0, decimals: autoDecimals(ch.abs) })}${pctPart}`;
|
|
1024
|
+
}, steepParts = [];
|
|
1025
|
+
steepestUp && steepParts.push(chartString(options, "steepestRiser", { v1: changeText(steepestUp) })), steepestDown && steepParts.push(chartString(options, "steepestFaller", { v1: changeText(steepestDown) }));
|
|
1026
|
+
let a11yDesc = chartString(options, "slopeDesc", { v1: plottedSeries.length, v2: c0.label ?? c0.id, v3: c1.label ?? c1.id }) + (steepParts.length ? `${steepParts.join("; ")}.` : chartString(options, "seriesUnchanged")) + (fold ? ` ${fold.record.note}` : ""), derived = {
|
|
1027
|
+
changes,
|
|
1028
|
+
...steepestUp !== void 0 ? { steepestUp } : {},
|
|
1029
|
+
...steepestDown !== void 0 ? { steepestDown } : {},
|
|
1030
|
+
...fold ? { folded: fold.record } : {}
|
|
1031
|
+
};
|
|
1032
|
+
return {
|
|
1033
|
+
type: "slope",
|
|
1034
|
+
size,
|
|
1035
|
+
plot,
|
|
1036
|
+
scene: nodes,
|
|
1037
|
+
labels: allLabels,
|
|
1038
|
+
axes,
|
|
1039
|
+
annotations: annResult.placed,
|
|
1040
|
+
legend: frameResult.legend,
|
|
1041
|
+
frame: frameResult.frame,
|
|
1042
|
+
marks,
|
|
1043
|
+
derived,
|
|
1044
|
+
a11y: {
|
|
1045
|
+
title: accessibleTitle(options.title, chartString(options, "slopeTitle", { v1: plottedSeries.length, v2: c0.label ?? c0.id, v3: c1.label ?? c1.id })),
|
|
1046
|
+
counts: [structureCount("series", plottedSeries.length, void 0, options), ...fold ? [structureCount("series", fold.record.memberIds.length, void 0, options)] : []],
|
|
1047
|
+
desc: a11yDesc
|
|
1048
|
+
},
|
|
1049
|
+
warnings,
|
|
1050
|
+
debug: {
|
|
1051
|
+
occupied: occupied.snapshot(),
|
|
1052
|
+
decisions: [...solved.decisions, ...annResult.decisions]
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
function unnamedSeriesWarnings(series, labels, legendNames) {
|
|
1057
|
+
let named = new Set(legendNames);
|
|
1058
|
+
for (let label of labels)
|
|
1059
|
+
label.hidden || label.owner.seriesId !== void 0 && named.add(label.owner.seriesId);
|
|
1060
|
+
let anonymous = series.filter((s) => !named.has(s.id));
|
|
1061
|
+
return anonymous.length === 0 ? [] : [{
|
|
1062
|
+
code: "series-unnamed",
|
|
1063
|
+
severity: "warn",
|
|
1064
|
+
message: `${anonymous.length} of ${series.length} series are named nowhere on the canvas (${anonymous.map((s) => s.label).join(", ")}): both endpoint labels were suppressed and there is no legend`,
|
|
1065
|
+
suggest: "add `legend` so every line keeps an identity, increase the chart height, or reduce the number of series"
|
|
1066
|
+
}];
|
|
1067
|
+
}
|
|
1068
|
+
function fitEndLabel(text, font, opts) {
|
|
1069
|
+
let { measure } = opts, one = measure(text || "0", font);
|
|
1070
|
+
if (one.width <= opts.maxSideW) return { font, lines: [text], size: one };
|
|
1071
|
+
let fonts = opts.shrink && opts.shrink.size < font.size ? [font, opts.shrink] : [font];
|
|
1072
|
+
for (let candidate of fonts) {
|
|
1073
|
+
let single = measure(text || "0", candidate);
|
|
1074
|
+
if (single.width <= opts.maxSideW) return { font: candidate, lines: [text], size: single };
|
|
1075
|
+
if (!opts.wrapRoom) continue;
|
|
1076
|
+
let wrapped = fitText(text, candidate, opts.maxSideW, 2, measure, { target: opts.target, typeRole: "label" });
|
|
1077
|
+
if (wrapped.title === void 0) {
|
|
1078
|
+
let height = measure(wrapped.lines[0] ?? "0", candidate).height + (wrapped.lines.length - 1) * lineBox(candidate);
|
|
1079
|
+
return { font: candidate, lines: wrapped.lines, size: { width: wrapped.w, height } };
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
let cutFont = fonts[fonts.length - 1];
|
|
1083
|
+
return { font: cutFont, lines: [text], size: cutFont === font ? one : measure(text || "0", cutFont) };
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
// src/core/charts/slope/core.ts
|
|
1087
|
+
var slopeCore = {
|
|
1088
|
+
type: "slope",
|
|
1089
|
+
sizing: SLOPE_SIZING,
|
|
1090
|
+
title: "Slope",
|
|
1091
|
+
summary: "Two-point slope lines with collision-spread end labels and highlight emphasis. Each end label names its series and prints its value, so the line chart's seriesLabels and valueLabels are refused; labels.series sets the parts",
|
|
1092
|
+
layout: (data, options) => layoutSlope(prepareFractionData(data), options),
|
|
1093
|
+
categoryLabels: calendarCategories,
|
|
1094
|
+
prepare: prepareFractionData,
|
|
1095
|
+
defaults: {},
|
|
1096
|
+
annotationKinds: ["cagr", "diff", "delta", "abs", "note", "callout", "valueLine"],
|
|
1097
|
+
lint: (data) => Array.isArray(data?.categories) && data.categories.length > 2 ? [
|
|
1098
|
+
{
|
|
1099
|
+
code: "slope-too-many-points",
|
|
1100
|
+
severity: "error",
|
|
1101
|
+
message: `slope requires exactly 2 categories, got ${data.categories.length} \u2014 layout uses first and last only`,
|
|
1102
|
+
suggest: "use chart type 'line' for more than two time points"
|
|
1103
|
+
}
|
|
1104
|
+
] : []
|
|
1105
|
+
};
|
|
1106
|
+
|
|
1107
|
+
export {
|
|
1108
|
+
slopeCore
|
|
1109
|
+
};
|