prographs 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +6 -4
  3. package/dist/AutoGraph-PDPEAIXL.cjs +145 -0
  4. package/dist/GraphType.js +19 -0
  5. package/dist/autograph/chartIndex.js +521 -0
  6. package/dist/autograph/chartModules.js +2 -1
  7. package/dist/autograph/index.cjs +98 -93
  8. package/dist/catalog-DI4XZ46L.cjs +142 -0
  9. package/dist/catalog.js +2 -1
  10. package/dist/charts/biologycharts/BiologySamples.js +59 -0
  11. package/dist/charts/biologycharts/PunnettSquare.js +342 -0
  12. package/dist/charts/biologycharts/biologyEnums.js +22 -1
  13. package/dist/charts/biologycharts/index.js +5 -3
  14. package/dist/charts/doecharts/DoeSamples.js +78 -0
  15. package/dist/charts/doecharts/SipocDiagram.js +453 -0
  16. package/dist/charts/doecharts/index.js +4 -2
  17. package/dist/charts/fieldcharts/SpeciesAccumulationCurve.js +350 -0
  18. package/dist/charts/fieldcharts/fieldEnums.js +8 -1
  19. package/dist/charts/fieldcharts/index.js +5 -3
  20. package/dist/charts/signals/AntennaPatternChart.js +492 -0
  21. package/dist/charts/signals/SignalSamples.js +17 -0
  22. package/dist/charts/signals/index.js +5 -3
  23. package/dist/charts/softwarediagrams/ComponentDiagram.js +504 -0
  24. package/dist/charts/softwarediagrams/DeploymentDiagram.js +419 -0
  25. package/dist/charts/softwarediagrams/SoftwareSamples.js +283 -1
  26. package/dist/charts/softwarediagrams/index.js +7 -3
  27. package/dist/charts/softwarediagrams/softwareEnums.js +45 -1
  28. package/dist/charts/sportscharts/PowerDurationCurve.js +301 -0
  29. package/dist/charts/sportscharts/SportsSamples.js +102 -0
  30. package/dist/charts/sportscharts/TrainingLoadChart.js +325 -0
  31. package/dist/charts/sportscharts/index.js +6 -2
  32. package/dist/charts/strategycharts/BassDiffusionChart.js +362 -0
  33. package/dist/charts/strategycharts/BassModel.js +96 -0
  34. package/dist/charts/strategycharts/BurnRunwayChart.js +284 -0
  35. package/dist/charts/strategycharts/CapTableChart.js +366 -0
  36. package/dist/charts/strategycharts/KanbanBoard.js +324 -0
  37. package/dist/charts/strategycharts/OkrTree.js +339 -0
  38. package/dist/charts/strategycharts/StrategyPane.js +27 -0
  39. package/dist/charts/strategycharts/StrategySamples.js +251 -0
  40. package/dist/charts/strategycharts/index.js +15 -3
  41. package/dist/charts/threefields/BsfcMap3DChart.js +231 -0
  42. package/dist/charts/threefields/CompressorMap3DChart.js +217 -0
  43. package/dist/charts/threefields/FieldGrid.js +50 -0
  44. package/dist/charts/threefields/LossLandscape3DChart.js +201 -0
  45. package/dist/charts/threefields/MapSheet.js +77 -0
  46. package/dist/charts/threefields/TerrainRoute3DChart.js +201 -0
  47. package/dist/charts/threefields/TerrainRouteMath.js +40 -0
  48. package/dist/charts/threefields/ThreeFieldBase.js +117 -0
  49. package/dist/charts/threefields/ThreeFieldsSamples.js +80 -0
  50. package/dist/charts/threefields/WaferMap3DChart.js +218 -0
  51. package/dist/charts/threefields/index.js +19 -0
  52. package/dist/charts/threesurfaces/index.js +2 -2
  53. package/dist/charts/tradingcharts/KeltnerChannelChart.js +171 -0
  54. package/dist/charts/tradingcharts/TradingMath.js +20 -0
  55. package/dist/charts/tradingcharts/index.js +4 -2
  56. package/dist/{chunk-ZL6XDXMK.cjs → chunk-26PSLEP4.cjs} +8 -8
  57. package/dist/{chunk-W3US6EFP.cjs → chunk-2BO5DZUP.cjs} +12 -12
  58. package/dist/{chunk-5DP7OUSE.cjs → chunk-2GG5YYSC.cjs} +6 -6
  59. package/dist/{chunk-7FG4JSVO.cjs → chunk-2GL2VNJU.cjs} +253 -33
  60. package/dist/{chunk-LCWMRCLF.cjs → chunk-2PYOI7OY.cjs} +21 -21
  61. package/dist/{chunk-JFWJAEBD.cjs → chunk-3U4MCSKI.cjs} +4 -4
  62. package/dist/{chunk-CUPLHZRR.cjs → chunk-3ZMM3FSK.cjs} +4 -4
  63. package/dist/{chunk-L2AV62DP.cjs → chunk-4767WQJ7.cjs} +6 -6
  64. package/dist/{chunk-DA2EYIIP.cjs → chunk-4E7FSSBF.cjs} +1210 -168
  65. package/dist/{chunk-VS5LQEZB.cjs → chunk-526STI2S.cjs} +5 -5
  66. package/dist/{chunk-RXIMEK6C.cjs → chunk-55767YPI.cjs} +20 -20
  67. package/dist/{chunk-JXLSKIUV.cjs → chunk-5FBQOMMT.cjs} +26 -26
  68. package/dist/{chunk-27PZV5BR.cjs → chunk-5N4Z7MTS.cjs} +4 -4
  69. package/dist/{chunk-KEWCUIQA.cjs → chunk-5WEV6YWA.cjs} +22 -22
  70. package/dist/chunk-5XOVVC5X.cjs +3281 -0
  71. package/dist/{chunk-HK5J7Q2W.cjs → chunk-6HLXVWXU.cjs} +9 -9
  72. package/dist/{chunk-7JG47RW4.cjs → chunk-6LQT4WJ5.cjs} +25 -25
  73. package/dist/{chunk-OCVTI6X4.cjs → chunk-6YTWOUFD.cjs} +329 -36
  74. package/dist/{chunk-W7IQCAVN.cjs → chunk-7F6W6HKL.cjs} +11 -11
  75. package/dist/{chunk-F2DCJXDM.cjs → chunk-7L6KYU5A.cjs} +21 -21
  76. package/dist/{chunk-GTGR6LPR.cjs → chunk-A4GIN4FE.cjs} +17 -17
  77. package/dist/{chunk-B2CETSR6.cjs → chunk-A4US7SA7.cjs} +5 -5
  78. package/dist/{chunk-3DIF2YYW.cjs → chunk-AOXPBLPW.cjs} +10 -10
  79. package/dist/{chunk-7TTR4UF5.cjs → chunk-ATI45Z4M.cjs} +2 -2
  80. package/dist/{chunk-5BFCIX2V.cjs → chunk-CPPMO4IQ.cjs} +434 -148
  81. package/dist/{chunk-AYZZQ6AC.cjs → chunk-CZ5KGF6Q.cjs} +9 -9
  82. package/dist/{chunk-7THJ3ZBK.cjs → chunk-D4I35MCE.cjs} +2 -2
  83. package/dist/{chunk-MCPPFRLN.cjs → chunk-DCGAAN3Z.cjs} +2 -2
  84. package/dist/{chunk-VABL6CVX.cjs → chunk-DEY36N37.cjs} +21 -21
  85. package/dist/{chunk-RNCKGJCC.cjs → chunk-DXHXD3DK.cjs} +3 -3
  86. package/dist/{chunk-A56ZGMVZ.cjs → chunk-E7B45DBZ.cjs} +11 -11
  87. package/dist/{chunk-DOR6L4MT.cjs → chunk-EJC6EAC5.cjs} +18 -18
  88. package/dist/{chunk-UPGNM7MA.cjs → chunk-EULJOOMA.cjs} +11 -11
  89. package/dist/{chunk-G4AZL4GO.cjs → chunk-EYM6LEIF.cjs} +474 -70
  90. package/dist/{chunk-NJ4X6XGV.cjs → chunk-EZTYX2GH.cjs} +5 -5
  91. package/dist/chunk-FDD4UP73.cjs +521 -0
  92. package/dist/{chunk-WJ3VH2Q4.cjs → chunk-GEAIGM3J.cjs} +110 -615
  93. package/dist/{chunk-P3SBHF43.cjs → chunk-GRUYVXTS.cjs} +2 -2
  94. package/dist/{chunk-NX4Z5LMS.cjs → chunk-H3SZXND5.cjs} +5 -5
  95. package/dist/{chunk-EE4S4TOE.cjs → chunk-HS45TOFJ.cjs} +21 -21
  96. package/dist/chunk-INGOG6OV.cjs +899 -0
  97. package/dist/{chunk-UDKA6DGT.cjs → chunk-J3CDXZHF.cjs} +4 -4
  98. package/dist/{chunk-YO6G7TKI.cjs → chunk-JAU5ADEU.cjs} +11 -11
  99. package/dist/{chunk-22LBK4GA.cjs → chunk-JQEBSHX3.cjs} +4 -4
  100. package/dist/{chunk-RXX3U7VQ.cjs → chunk-KLXGLMFU.cjs} +10 -10
  101. package/dist/chunk-KVOX36J3.cjs +327 -0
  102. package/dist/chunk-L6BGNHFL.cjs +139 -0
  103. package/dist/{chunk-GMER35L3.cjs → chunk-L7TB7PU5.cjs} +20 -20
  104. package/dist/{chunk-AFXYNBL2.cjs → chunk-LBTRYEM2.cjs} +4 -4
  105. package/dist/{chunk-WYYCKIOD.cjs → chunk-LLULNJSP.cjs} +11 -11
  106. package/dist/{chunk-J27XOSLP.cjs → chunk-LSO46AFV.cjs} +8 -8
  107. package/dist/{chunk-5XJO45ES.cjs → chunk-LZ2KJ7ZX.cjs} +11 -11
  108. package/dist/chunk-M4IQ5LIZ.cjs +422 -0
  109. package/dist/{chunk-Y2KIUKJF.cjs → chunk-MPDHDKYZ.cjs} +11 -11
  110. package/dist/{chunk-4EMPKRZU.cjs → chunk-MRQ42ZJE.cjs} +3 -3
  111. package/dist/{chunk-EU5D2MF4.cjs → chunk-MYV4KZWP.cjs} +9 -9
  112. package/dist/{chunk-XD7KN4UN.cjs → chunk-MZXVLC24.cjs} +6 -6
  113. package/dist/{chunk-PPSONARU.cjs → chunk-NLBVDFIR.cjs} +41 -2
  114. package/dist/{chunk-L3PEGMGM.cjs → chunk-NY3TBZY4.cjs} +33 -33
  115. package/dist/{chunk-6YNYXXB6.cjs → chunk-OGVVSFAR.cjs} +3 -3
  116. package/dist/{chunk-MLV7QLB6.cjs → chunk-OMTQIQMN.cjs} +6 -6
  117. package/dist/{chunk-BEEOSNK7.cjs → chunk-PEJJ6TXJ.cjs} +15 -144
  118. package/dist/{chunk-SOKOWUF5.cjs → chunk-PPGWHIU7.cjs} +2 -2
  119. package/dist/{chunk-IELWOM2J.cjs → chunk-PPO6SDAN.cjs} +6 -6
  120. package/dist/{chunk-6JTZZCSL.cjs → chunk-PUMKX5F2.cjs} +3 -3
  121. package/dist/{chunk-RFOXFY2U.cjs → chunk-PXBYWCNB.cjs} +190 -799
  122. package/dist/{chunk-3BYXOISI.cjs → chunk-Q3HB3IX6.cjs} +4 -4
  123. package/dist/{chunk-RXCOVONX.cjs → chunk-RBMUOIXE.cjs} +289 -34
  124. package/dist/{chunk-MSBNHCSE.cjs → chunk-RJHGCUUD.cjs} +6 -6
  125. package/dist/{chunk-I6VG7F6Z.cjs → chunk-RSONDMYW.cjs} +708 -141
  126. package/dist/{chunk-GZDNPHMT.cjs → chunk-SHMPFCUE.cjs} +19 -19
  127. package/dist/{chunk-ZIBVCOW6.cjs → chunk-SN4FCXFC.cjs} +19 -19
  128. package/dist/{chunk-7KM52NMN.cjs → chunk-SN5T7WYO.cjs} +2 -2
  129. package/dist/{chunk-7MSZR65Z.cjs → chunk-SQJZGVDR.cjs} +7 -7
  130. package/dist/chunk-SYABFMD7.cjs +633 -0
  131. package/dist/{chunk-2RRFEYFH.cjs → chunk-TICB3MAC.cjs} +16 -16
  132. package/dist/{chunk-AOOKHUV5.cjs → chunk-U7Z7XYR2.cjs} +5 -5
  133. package/dist/{chunk-JEWQAXVG.cjs → chunk-UA2THQFV.cjs} +6 -6
  134. package/dist/{chunk-LHZPAHU3.cjs → chunk-VIK4L2YF.cjs} +112 -521
  135. package/dist/{chunk-4YWMAQ4J.cjs → chunk-VM2Y6BDY.cjs} +4 -4
  136. package/dist/{chunk-IRRKE2ZE.cjs → chunk-VMS3KWYI.cjs} +21 -21
  137. package/dist/{chunk-4SLARW6F.cjs → chunk-VU5NUD46.cjs} +17 -17
  138. package/dist/{chunk-XHY6TVYG.cjs → chunk-VV5CVOF7.cjs} +13 -13
  139. package/dist/{chunk-CCIBPGPZ.cjs → chunk-VYSAWPSS.cjs} +57 -57
  140. package/dist/{chunk-TTNEMQ2A.cjs → chunk-W7YRWEWQ.cjs} +22 -22
  141. package/dist/{chunk-C7MUOGEW.cjs → chunk-X7R5SY62.cjs} +6 -6
  142. package/dist/{chunk-ILR5KBMB.cjs → chunk-XOK3KTSS.cjs} +6 -6
  143. package/dist/{chunk-2CZM2I3T.cjs → chunk-XUIX45VU.cjs} +19 -19
  144. package/dist/{chunk-TGRMPS3A.cjs → chunk-XWH46PVJ.cjs} +165 -43
  145. package/dist/{chunk-WQYXXECR.cjs → chunk-Y5XVMK3K.cjs} +6 -6
  146. package/dist/{chunk-AK4TX2WG.cjs → chunk-YCNKEDTG.cjs} +13 -13
  147. package/dist/{chunk-PJJB24DU.cjs → chunk-YEF7SE3X.cjs} +20 -20
  148. package/dist/{chunk-RVLV4XW6.cjs → chunk-YMTVPMU3.cjs} +22 -22
  149. package/dist/data/index.cjs +2 -2
  150. package/dist/entries/autograph-lazy.cjs +2 -2
  151. package/dist/entries/charts/acoustictransport.cjs +3 -3
  152. package/dist/entries/charts/analysischarts.cjs +3 -3
  153. package/dist/entries/charts/astrocharts.cjs +3 -3
  154. package/dist/entries/charts/bars.cjs +3 -3
  155. package/dist/entries/charts/bayesiancharts.cjs +3 -3
  156. package/dist/entries/charts/biocharts.cjs +3 -3
  157. package/dist/entries/charts/biologycharts.cjs +11 -3
  158. package/dist/entries/charts/biologycharts.d.ts +1 -1
  159. package/dist/entries/charts/biologycharts.js +3 -2
  160. package/dist/entries/charts/business.cjs +3 -3
  161. package/dist/entries/charts/carecharts.cjs +3 -3
  162. package/dist/entries/charts/chemistrycharts.cjs +3 -3
  163. package/dist/entries/charts/civicscharts.cjs +3 -3
  164. package/dist/entries/charts/clinicalcharts.cjs +3 -3
  165. package/dist/entries/charts/comparison.cjs +3 -3
  166. package/dist/entries/charts/demography.cjs +3 -3
  167. package/dist/entries/charts/density.cjs +3 -3
  168. package/dist/entries/charts/diagrams.cjs +3 -3
  169. package/dist/entries/charts/distribution.cjs +3 -3
  170. package/dist/entries/charts/doecharts.cjs +13 -3
  171. package/dist/entries/charts/doecharts.d.ts +1 -1
  172. package/dist/entries/charts/doecharts.js +2 -1
  173. package/dist/entries/charts/earthscience.cjs +3 -3
  174. package/dist/entries/charts/economicscharts.cjs +3 -3
  175. package/dist/entries/charts/energycharts.cjs +3 -3
  176. package/dist/entries/charts/engineering.cjs +3 -3
  177. package/dist/entries/charts/fieldcharts.cjs +7 -3
  178. package/dist/entries/charts/fieldcharts.d.ts +1 -1
  179. package/dist/entries/charts/fieldcharts.js +3 -2
  180. package/dist/entries/charts/financial.cjs +3 -3
  181. package/dist/entries/charts/flow.cjs +3 -3
  182. package/dist/entries/charts/frameworks.cjs +3 -3
  183. package/dist/entries/charts/genomics.cjs +3 -3
  184. package/dist/entries/charts/geoflows.cjs +3 -3
  185. package/dist/entries/charts/geomaps.cjs +3 -3
  186. package/dist/entries/charts/geosciencecharts.cjs +3 -3
  187. package/dist/entries/charts/hierarchy.cjs +3 -3
  188. package/dist/entries/charts/indicators.cjs +3 -3
  189. package/dist/entries/charts/inferencecharts.cjs +3 -3
  190. package/dist/entries/charts/layoutcharts.cjs +3 -3
  191. package/dist/entries/charts/lifescience.cjs +4 -4
  192. package/dist/entries/charts/linesareas.cjs +3 -3
  193. package/dist/entries/charts/logisticscharts.cjs +3 -3
  194. package/dist/entries/charts/machinecharts.cjs +7 -3
  195. package/dist/entries/charts/machinecharts.d.ts +1 -1
  196. package/dist/entries/charts/machinecharts.js +2 -1
  197. package/dist/entries/charts/massive.cjs +3 -3
  198. package/dist/entries/charts/mathematical.cjs +3 -3
  199. package/dist/entries/charts/matrix.cjs +3 -3
  200. package/dist/entries/charts/medicalcharts.cjs +4 -4
  201. package/dist/entries/charts/mlcharts.cjs +4 -4
  202. package/dist/entries/charts/modelcharts.cjs +6 -5
  203. package/dist/entries/charts/multivariate.cjs +3 -3
  204. package/dist/entries/charts/musiccharts.cjs +3 -3
  205. package/dist/entries/charts/network.cjs +3 -3
  206. package/dist/entries/charts/physicscharts.cjs +3 -3
  207. package/dist/entries/charts/pictorial.cjs +4 -4
  208. package/dist/entries/charts/portfoliocharts.cjs +3 -3
  209. package/dist/entries/charts/productcharts.cjs +3 -3
  210. package/dist/entries/charts/proportion.cjs +3 -3
  211. package/dist/entries/charts/qualitycharts.cjs +3 -3
  212. package/dist/entries/charts/radial.cjs +3 -3
  213. package/dist/entries/charts/reliabilitycharts.cjs +5 -3
  214. package/dist/entries/charts/scatter.cjs +3 -3
  215. package/dist/entries/charts/scientific.cjs +3 -3
  216. package/dist/entries/charts/seriescharts.cjs +3 -3
  217. package/dist/entries/charts/signals.cjs +7 -3
  218. package/dist/entries/charts/signals.d.ts +1 -1
  219. package/dist/entries/charts/signals.js +2 -1
  220. package/dist/entries/charts/softwarediagrams.cjs +21 -3
  221. package/dist/entries/charts/softwarediagrams.d.ts +1 -1
  222. package/dist/entries/charts/softwarediagrams.js +4 -2
  223. package/dist/entries/charts/sportscharts.cjs +13 -3
  224. package/dist/entries/charts/sportscharts.d.ts +1 -1
  225. package/dist/entries/charts/sportscharts.js +3 -1
  226. package/dist/entries/charts/statistics.cjs +6 -6
  227. package/dist/entries/charts/strategycharts.cjs +30 -3
  228. package/dist/entries/charts/strategycharts.d.ts +1 -1
  229. package/dist/entries/charts/strategycharts.js +6 -1
  230. package/dist/entries/charts/structure.cjs +3 -3
  231. package/dist/entries/charts/surveycharts.cjs +3 -3
  232. package/dist/entries/charts/systemscharts.cjs +3 -3
  233. package/dist/entries/charts/textcharts.cjs +5 -5
  234. package/dist/entries/charts/thematicmaps.cjs +4 -4
  235. package/dist/entries/charts/threebars.cjs +3 -3
  236. package/dist/entries/charts/threefields.cjs +53 -0
  237. package/dist/entries/charts/threefields.d.ts +1 -0
  238. package/dist/entries/charts/threefields.js +6 -0
  239. package/dist/entries/charts/threeglobe.cjs +3 -3
  240. package/dist/entries/charts/threenetwork.cjs +3 -3
  241. package/dist/entries/charts/threestrata.cjs +3 -3
  242. package/dist/entries/charts/threesurfaces.cjs +7 -3
  243. package/dist/entries/charts/threesurfaces.d.ts +1 -1
  244. package/dist/entries/charts/threesurfaces.js +2 -1
  245. package/dist/entries/charts/threevolume.cjs +4 -4
  246. package/dist/entries/charts/timeline.cjs +3 -3
  247. package/dist/entries/charts/tracecharts.cjs +3 -3
  248. package/dist/entries/charts/trackscharts.cjs +3 -3
  249. package/dist/entries/charts/tradingcharts.cjs +6 -4
  250. package/dist/entries/charts/tradingcharts.d.ts +1 -1
  251. package/dist/entries/charts/tradingcharts.js +2 -1
  252. package/dist/entries/three.cjs +60 -20
  253. package/dist/entries/three.d.ts +1 -1
  254. package/dist/entries/three.js +7 -1
  255. package/dist/index.cjs +258 -97
  256. package/dist/index.d.cts +1953 -10
  257. package/dist/index.d.ts +1953 -10
  258. package/dist/index.js +26 -5
  259. package/dist/page/index.cjs +2 -2
  260. package/dist/react/components.js +58 -1
  261. package/dist/react/index.cjs +135 -92
  262. package/dist/react/index.d.ts +1 -1
  263. package/dist/react/index.js +2 -2
  264. package/package.json +1 -1
  265. package/dist/AutoGraph-XLBJQDRB.cjs +0 -140
  266. package/dist/catalog-O7XGDD2H.cjs +0 -137
  267. package/dist/chunk-77K2HTRC.cjs +0 -3220
  268. package/dist/chunk-XEK47TVD.cjs +0 -323
  269. /package/dist/{chunk-UMEKIIHJ.cjs → chunk-LNWTC72Y.cjs} +0 -0
@@ -0,0 +1,350 @@
1
+ import { CartesianChart } from "../../core/CartesianChart.js";
2
+ import { ChartFamily, DataShape, Dimension } from "../../core/enums.js";
3
+ import { SampleData } from "../../data/SampleData.js";
4
+ import { AccumulationOrder, RarefactionBasis } from "./fieldEnums.js";
5
+ import { FieldKit } from "./FieldKit.js";
6
+ import { RarefactionCurve } from "./RarefactionCurve.js";
7
+ import { area, line, scaleLinear, symbol, symbolDiamond } from "d3";
8
+ // src/charts/fieldcharts/SpeciesAccumulationCurve.ts
9
+ var STEPS = 48;
10
+ var AHEAD = 24;
11
+ var Z = 1.96;
12
+ var diamond = symbol(symbolDiamond, 64)();
13
+ /** Habitats of an invented pitfall-trap survey: species pool and traps set. Most species are rare, so sampling stops short of the pool. */
14
+ var HABITATS = [
15
+ [
16
+ "Riparian forest",
17
+ 58,
18
+ 12
19
+ ],
20
+ [
21
+ "Upland forest",
22
+ 40,
23
+ 10
24
+ ],
25
+ [
26
+ "Pasture",
27
+ 20,
28
+ 8
29
+ ]
30
+ ];
31
+ /**
32
+ * Judge whether sampling has found most of the species at a site: species found against effort, as the collector's
33
+ * curve in the order sampled and as the mean over random orders, carried on towards the estimated total richness.
34
+ */
35
+ var SpeciesAccumulationCurve = class SpeciesAccumulationCurve extends CartesianChart {
36
+ static meta = {
37
+ id: "species-accumulation-curve",
38
+ name: "Species accumulation curve",
39
+ family: ChartFamily.Statistical,
40
+ dimension: Dimension.Two,
41
+ shape: DataShape.Table,
42
+ description: "Plots species found against sampling effort per site, as sampled and as the randomised mean with its band, extrapolated towards a Chao richness estimate.",
43
+ tags: [
44
+ "ecology",
45
+ "biodiversity",
46
+ "species richness",
47
+ "collector curve",
48
+ "sampling effort",
49
+ "extrapolation",
50
+ "chao",
51
+ "asymptote"
52
+ ],
53
+ sample: (seed) => {
54
+ const { u, n } = SampleData.rng(seed);
55
+ const poisson = (mean) => {
56
+ let k = 0;
57
+ for (let p = u(); p > Math.exp(-mean); p *= u()) k++;
58
+ return k;
59
+ };
60
+ return HABITATS.flatMap(([site, pool, traps]) => {
61
+ const rates = Array.from({ length: pool }, () => Math.exp(n() * 1.5 - 1.7));
62
+ return Array.from({ length: traps }, (_, j) => rates.flatMap((rate, s) => {
63
+ const count = poisson(rate);
64
+ return count > 0 ? [{
65
+ site,
66
+ sample: `Trap ${j + 1}`,
67
+ species: `sp${s + 1}`,
68
+ count
69
+ }] : [];
70
+ })).flat();
71
+ });
72
+ },
73
+ variants: {
74
+ order: [
75
+ AccumulationOrder.Both,
76
+ AccumulationOrder.Collector,
77
+ AccumulationOrder.Randomised
78
+ ],
79
+ effort: [RarefactionBasis.Samples, RarefactionBasis.Individuals],
80
+ extrapolate: [true, false]
81
+ }
82
+ };
83
+ defaults() {
84
+ return {
85
+ site: "site",
86
+ sample: "sample",
87
+ species: "species",
88
+ count: "count",
89
+ order: AccumulationOrder.Both,
90
+ effort: RarefactionBasis.Samples,
91
+ extrapolate: true,
92
+ reach: 2,
93
+ yLabel: "Species"
94
+ };
95
+ }
96
+ /** Species found so far after each sample, in the order given. Each sample maps a species to the individuals counted. */
97
+ static collector(samples) {
98
+ const seen = /* @__PURE__ */ new Set();
99
+ let individuals = 0;
100
+ return samples.map((found) => {
101
+ const before = seen.size;
102
+ for (const [name, count] of found) {
103
+ if (count <= 0) continue;
104
+ seen.add(name);
105
+ individuals += count;
106
+ }
107
+ return {
108
+ species: seen.size,
109
+ added: seen.size - before,
110
+ individuals
111
+ };
112
+ });
113
+ }
114
+ /** Chao's bias-corrected count of species present but not found, from those found once and twice. `scale` is (T - 1) / T for T samples and 1 for individuals. */
115
+ static unseen(ones, twos, scale = 1) {
116
+ return ones > 1 ? scale * ones * (ones - 1) / (2 * (twos + 1)) : 0;
117
+ }
118
+ /**
119
+ * Expected species `extra` units of effort past the `effort` observed, after Colwell et al. (2012): the curve closes
120
+ * on the Chao estimate at a rate set by the species found once. The variance treats the frequency counts as
121
+ * multinomial, so it meets the interpolated band at `extra = 0` and grows to that of the estimate itself.
122
+ */
123
+ static extrapolated(observed, ones, twos, effort, extra, scale = 1) {
124
+ const gain = (q1, q2) => {
125
+ const missing = SpeciesAccumulationCurve.unseen(q1, q2, scale);
126
+ return missing > 0 ? missing * (1 - (1 - q1 / (effort * missing + q1)) ** extra) : 0;
127
+ };
128
+ const missing = SpeciesAccumulationCurve.unseen(ones, twos, scale), total = observed + missing;
129
+ if (!(total > 0)) return {
130
+ s: 0,
131
+ variance: 0
132
+ };
133
+ const h = 1e-4;
134
+ const d1 = (gain(ones + h, twos) - gain(ones - h, twos)) / (2 * h), d2 = (gain(ones, twos + h) - gain(ones, twos - h)) / (2 * h);
135
+ const variance = missing * (1 - missing / total) + 2 * missing * (d1 * ones + d2 * twos) / total + d1 * d1 * ones * (1 - ones / total) + d2 * d2 * twos * (1 - twos / total) - 2 * d1 * d2 * ones * twos / total;
136
+ return {
137
+ s: observed + gain(ones, twos),
138
+ variance: Math.max(0, variance)
139
+ };
140
+ }
141
+ get #bySamples() {
142
+ return this.options.effort !== RarefactionBasis.Individuals;
143
+ }
144
+ get #chao() {
145
+ return this.#bySamples ? "Chao2" : "Chao1";
146
+ }
147
+ #curves() {
148
+ const { data, site, sample, species, count, extrapolate, reach } = this.options;
149
+ const sites = /* @__PURE__ */ new Map();
150
+ for (const row of Array.isArray(data) ? data : []) {
151
+ const value = FieldKit.number(row?.[count]);
152
+ if (value === null || value < 0) continue;
153
+ const key = FieldKit.text(row[site]) || "All", unit = FieldKit.text(row[sample]) || "All", name = FieldKit.text(row[species]);
154
+ const units = sites.get(key) ?? sites.set(key, /* @__PURE__ */ new Map()).get(key);
155
+ const found = units.get(unit) ?? units.set(unit, /* @__PURE__ */ new Map()).get(unit);
156
+ if (name && value > 0) found.set(name, (found.get(name) ?? 0) + value);
157
+ }
158
+ const bySamples = this.#bySamples, far = extrapolate ? Math.max(1, Number(reach) || 2) : 1;
159
+ const point = (n, { s, variance }) => {
160
+ const half = Z * Math.sqrt(variance);
161
+ return {
162
+ n,
163
+ s,
164
+ low: Math.max(0, s - half),
165
+ high: s + half
166
+ };
167
+ };
168
+ return [...sites].map(([key, units]) => {
169
+ const names = [...units.keys()], samples = [...units.values()];
170
+ const tally = /* @__PURE__ */ new Map();
171
+ for (const found of samples) for (const [name, value] of found) {
172
+ const entry = tally.get(name) ?? tally.set(name, {
173
+ total: 0,
174
+ units: 0
175
+ }).get(name);
176
+ entry.total += value;
177
+ entry.units++;
178
+ }
179
+ const counts = [...tally.values()].map((entry) => bySamples ? entry.units : Math.round(entry.total)).filter((k) => k > 0);
180
+ const effort = bySamples ? samples.length : counts.reduce((sum, k) => sum + k, 0), observed = counts.length;
181
+ const ones = counts.filter((k) => k === 1).length, twos = counts.filter((k) => k === 2).length;
182
+ const scale = bySamples && effort ? (effort - 1) / effort : 1;
183
+ const estimate = observed + SpeciesAccumulationCurve.unseen(ones, twos, scale);
184
+ const ahead = (extra) => SpeciesAccumulationCurve.extrapolated(observed, ones, twos, effort, extra, scale);
185
+ const drawn = [...new Set(Array.from({ length: 49 }, (_, i) => Math.max(1, Math.round(i / STEPS * effort))))];
186
+ const half = Z * Math.sqrt(ahead(Infinity).variance);
187
+ return {
188
+ site: key,
189
+ observed,
190
+ estimate,
191
+ effort,
192
+ ceiling: [Math.max(observed, estimate - half), estimate + half],
193
+ steps: SpeciesAccumulationCurve.collector(samples).map((step, i) => ({
194
+ ...step,
195
+ key: `${key}\u0000${i}`,
196
+ site: key,
197
+ sample: names[i],
198
+ effort: bySamples ? i + 1 : step.individuals
199
+ })),
200
+ mean: effort > 0 ? drawn.map((n) => point(n, RarefactionCurve.samples(counts, effort, n, estimate))) : [],
201
+ beyond: far > 1 ? Array.from({ length: 25 }, (_, i) => point(effort * (1 + i / AHEAD * (far - 1)), ahead(i / AHEAD * (far - 1) * effort))) : []
202
+ };
203
+ }).filter((curve) => curve.effort > 0);
204
+ }
205
+ get #collected() {
206
+ return this.options.order !== AccumulationOrder.Randomised;
207
+ }
208
+ get #averaged() {
209
+ return this.options.order !== AccumulationOrder.Collector;
210
+ }
211
+ #label(curve) {
212
+ return `${this.#chao} ${curve.estimate.toFixed(1)}`;
213
+ }
214
+ /** Room on the right for the richness estimates the extrapolation is marked with. */
215
+ plotMargin() {
216
+ const margin = super.plotMargin(), marked = this.#curves().filter((curve) => curve.beyond.length);
217
+ return marked.length ? {
218
+ ...margin,
219
+ right: 16 + Math.max(...marked.map((curve) => FieldKit.width(this.#label(curve), 10)))
220
+ } : margin;
221
+ }
222
+ scales(ctx) {
223
+ const curves = this.#curves();
224
+ const far = Math.max(1, ...curves.map((curve) => curve.beyond.at(-1)?.n ?? curve.effort));
225
+ const top = Math.max(1, ...curves.flatMap((curve) => [
226
+ curve.observed,
227
+ ...this.#averaged ? curve.mean.map((p) => p.high) : [],
228
+ ...curve.beyond.map((p) => p.high),
229
+ ...curve.beyond.length ? [curve.estimate] : []
230
+ ]));
231
+ return {
232
+ x: scaleLinear([0, far], [0, ctx.plot.width]).nice(),
233
+ y: scaleLinear([0, top * 1.05], [ctx.plot.height, 0]).nice()
234
+ };
235
+ }
236
+ plotMarks(ctx, { x, y }) {
237
+ const curves = this.#curves(), { width, height } = ctx.plot;
238
+ const sx = (n) => x(n) ?? 0, sy = (s) => y(s) ?? 0;
239
+ const tone = (d) => ctx.palette.color(d.site);
240
+ const unit = this.#bySamples ? "Samples" : "Individuals", chao = this.#chao;
241
+ const averaged = this.#averaged ? curves : [], ahead = curves.filter((curve) => curve.beyond.length);
242
+ const summary = (d) => [
243
+ ["Observed species", d.observed],
244
+ [unit, d.effort],
245
+ [`${chao} estimate`, d.estimate.toFixed(1)]
246
+ ];
247
+ const band = area().x((p) => sx(p.n)).y0((p) => sy(p.low)).y1((p) => sy(p.high));
248
+ const bands = ctx.marks("intervals", "path", averaged, (d) => d.site).attr("fill", tone).attr("fill-opacity", .16).attr("stroke", "none").attr("pointer-events", "none");
249
+ ctx.set(bands, { d: (d) => band(d.mean) ?? "" });
250
+ const cones = ctx.marks("extrapolated-intervals", "path", ahead, (d) => d.site).attr("fill", tone).attr("fill-opacity", .1).attr("stroke", "none").attr("pointer-events", "none");
251
+ ctx.set(cones, { d: (d) => band(d.beyond) ?? "" });
252
+ const trace = line().x((p) => sx(p.n)).y((p) => sy(p.s));
253
+ const dashed = ctx.marks("extrapolated", "path", ahead, (d) => d.site).attr("fill", "none").attr("stroke", tone).attr("stroke-width", 2).attr("stroke-dasharray", "6 4");
254
+ ctx.set(dashed, { d: (d) => trace(d.beyond) ?? "" });
255
+ ctx.hover(dashed, (d) => {
256
+ const end = d.beyond.at(-1);
257
+ return {
258
+ title: `${d.site}, extrapolated`,
259
+ color: tone(d),
260
+ rows: [
261
+ [`Expected at ${Math.round(end.n)} ${unit.toLowerCase()}`, end.s.toFixed(1)],
262
+ ["95% interval", `${end.low.toFixed(1)} to ${end.high.toFixed(1)}`],
263
+ ...summary(d)
264
+ ]
265
+ };
266
+ });
267
+ const means = ctx.marks("curves", "path", averaged, (d) => d.site).attr("fill", "none").attr("stroke", tone).attr("stroke-width", 2).attr("stroke-linejoin", "round");
268
+ ctx.set(means, { d: (d) => trace(d.mean) ?? "" });
269
+ ctx.drawOn(means);
270
+ ctx.hover(means, (d) => ({
271
+ title: `${d.site}, randomised mean`,
272
+ color: tone(d),
273
+ rows: summary(d)
274
+ }));
275
+ const collected = this.#collected ? curves : [];
276
+ const walk = line().x((step) => sx(step.effort)).y((step) => sy(step.species));
277
+ const walks = ctx.marks("collector", "path", collected, (d) => d.site).attr("fill", "none").attr("stroke", tone).attr("stroke-width", this.#averaged ? 1.5 : 2).attr("stroke-linejoin", "round");
278
+ ctx.set(walks, { d: (d) => walk(d.steps) ?? "" });
279
+ ctx.hover(walks, (d) => ({
280
+ title: `${d.site}, as sampled`,
281
+ color: tone(d),
282
+ rows: summary(d)
283
+ }));
284
+ const roomy = collected.every((curve) => (sx(curve.steps.at(-1).effort) - sx(curve.steps[0].effort)) / curve.steps.length >= 12);
285
+ const dots = ctx.marks("samples", "circle", roomy ? collected.flatMap((curve) => curve.steps.slice(0, -1)) : [], (step) => step.key).attr("fill", tone).attr("stroke", ctx.theme.surface).attr("stroke-width", 1.5);
286
+ ctx.set(dots, {
287
+ cx: (step) => sx(step.effort),
288
+ cy: (step) => sy(step.species),
289
+ r: 4
290
+ }, { r: 0 });
291
+ ctx.hover(dots, (step) => ({
292
+ title: `${step.site}, ${step.sample}`,
293
+ color: tone(step),
294
+ rows: [
295
+ ["Species so far", step.species],
296
+ ["New in this sample", step.added],
297
+ [unit, this.#bySamples ? step.effort : Math.round(step.effort)]
298
+ ]
299
+ }));
300
+ const ends = ctx.marks("observed", "circle", curves, (d) => d.site).attr("fill", tone).attr("stroke", ctx.theme.surface).attr("stroke-width", 2);
301
+ ctx.set(ends, {
302
+ cx: (d) => sx(d.effort),
303
+ cy: (d) => sy(d.observed),
304
+ r: 5
305
+ }, { r: 0 });
306
+ ctx.hover(ends, (d) => ({
307
+ title: d.site,
308
+ color: tone(d),
309
+ rows: summary(d)
310
+ }));
311
+ const place = (d) => `translate(${width},${sy(d.estimate)})`;
312
+ const marks = ctx.marks("estimates", "path", ahead, (d) => d.site).attr("d", diamond).attr("fill", tone).attr("stroke", ctx.theme.surface).attr("stroke-width", 2).attr("paint-order", "stroke");
313
+ ctx.set(marks, { transform: place }, { transform: place });
314
+ ctx.hover(marks, (d) => ({
315
+ title: d.site,
316
+ color: tone(d),
317
+ rows: [
318
+ [`${chao} estimate`, d.estimate.toFixed(1)],
319
+ ["95% interval", `${d.ceiling[0].toFixed(1)} to ${d.ceiling[1].toFixed(1)}`],
320
+ ["Observed species", d.observed],
321
+ ["Share found", `${Math.round(100 * d.observed / Math.max(d.estimate, 1e-9))}%`]
322
+ ]
323
+ }));
324
+ const stacked = [...ahead].sort((a, b) => a.estimate - b.estimate).map((curve) => ({
325
+ curve,
326
+ at: sy(curve.estimate) + 3.5
327
+ }));
328
+ stacked.forEach((label, i) => {
329
+ if (i) label.at = Math.min(label.at, stacked[i - 1].at - 11);
330
+ });
331
+ const lift = Math.max(0, 9 - (stacked.at(-1)?.at ?? height));
332
+ const names = ctx.text(ctx.marks("estimate-labels", "text", stacked, (d) => d.curve.site), 10).attr("pointer-events", "none").text((d) => this.#label(d.curve));
333
+ ctx.set(names, {
334
+ x: width + 9,
335
+ y: (d) => d.at + lift
336
+ }, {
337
+ x: width + 9,
338
+ y: (d) => d.at + lift
339
+ });
340
+ }
341
+ /** The x title names the effort unless the caller set their own. */
342
+ paint() {
343
+ const title = this.#bySamples ? "Samples taken" : "Individuals counted";
344
+ if (this.options.xLabel === void 0 || this.options.xLabel === this.#title) this.options.xLabel = title;
345
+ this.#title = title;
346
+ super.paint();
347
+ }
348
+ #title = "";
349
+ };
350
+ export { SpeciesAccumulationCurve };
@@ -48,6 +48,13 @@ var RarefactionBasis = /* @__PURE__ */ function(RarefactionBasis) {
48
48
  RarefactionBasis["Samples"] = "samples";
49
49
  return RarefactionBasis;
50
50
  }({});
51
+ /** Samples added in the order they were taken (the collector's curve), averaged over every order, or both. */
52
+ var AccumulationOrder = /* @__PURE__ */ function(AccumulationOrder) {
53
+ AccumulationOrder["Collector"] = "collector";
54
+ AccumulationOrder["Randomised"] = "randomised";
55
+ AccumulationOrder["Both"] = "collector-and-randomised";
56
+ return AccumulationOrder;
57
+ }({});
51
58
  /** One abundance scale for every species, or each species scaled to its own peak. */
52
59
  var KiteScaling = /* @__PURE__ */ function(KiteScaling) {
53
60
  KiteScaling["Shared"] = "shared";
@@ -71,4 +78,4 @@ var KobePath = /* @__PURE__ */ function(KobePath) {
71
78
  KobePath["Terminal"] = "terminal";
72
79
  return KobePath;
73
80
  }({});
74
- export { ConcordiaMarks, ConcordiaProjection, FieldSamples, FieldStyle, KiteScaling, KobePath, PollenStyle, PollenWidth, QapfRocks, RarefactionBasis, SpiderDisplay, SpiderNormaliser };
81
+ export { AccumulationOrder, ConcordiaMarks, ConcordiaProjection, FieldSamples, FieldStyle, KiteScaling, KobePath, PollenStyle, PollenWidth, QapfRocks, RarefactionBasis, SpiderDisplay, SpiderNormaliser };
@@ -1,4 +1,4 @@
1
- import { ConcordiaMarks, ConcordiaProjection, FieldSamples, FieldStyle, KiteScaling, KobePath, PollenStyle, PollenWidth, QapfRocks, RarefactionBasis, SpiderDisplay, SpiderNormaliser } from "./fieldEnums.js";
1
+ import { AccumulationOrder, ConcordiaMarks, ConcordiaProjection, FieldSamples, FieldStyle, KiteScaling, KobePath, PollenStyle, PollenWidth, QapfRocks, RarefactionBasis, SpiderDisplay, SpiderNormaliser } from "./fieldEnums.js";
2
2
  import { FieldKit } from "./FieldKit.js";
3
3
  import { ConcordiaDiagram } from "./ConcordiaDiagram.js";
4
4
  import { KiteDiagram } from "./KiteDiagram.js";
@@ -6,6 +6,7 @@ import { KobePlot } from "./KobePlot.js";
6
6
  import { PollenDiagram } from "./PollenDiagram.js";
7
7
  import { QapfDiagram } from "./QapfDiagram.js";
8
8
  import { RarefactionCurve } from "./RarefactionCurve.js";
9
+ import { SpeciesAccumulationCurve } from "./SpeciesAccumulationCurve.js";
9
10
  import { SpiderDiagram } from "./SpiderDiagram.js";
10
11
  import { FieldDiagram } from "./FieldDiagram.js";
11
12
  import { TasDiagram } from "./TasDiagram.js";
@@ -20,6 +21,7 @@ var fieldchartsCatalog = [
20
21
  KiteDiagram,
21
22
  PollenDiagram,
22
23
  WhittakerBiomeDiagram,
23
- KobePlot
24
+ KobePlot,
25
+ SpeciesAccumulationCurve
24
26
  ];
25
- export { ConcordiaDiagram, ConcordiaMarks, ConcordiaProjection, FieldDiagram, FieldKit, FieldSamples, FieldStyle, KiteDiagram, KiteScaling, KobePath, KobePlot, PollenDiagram, PollenStyle, PollenWidth, QapfDiagram, QapfRocks, RarefactionBasis, RarefactionCurve, SpiderDiagram, SpiderDisplay, SpiderNormaliser, TasDiagram, WhittakerBiomeDiagram, fieldchartsCatalog };
27
+ export { AccumulationOrder, ConcordiaDiagram, ConcordiaMarks, ConcordiaProjection, FieldDiagram, FieldKit, FieldSamples, FieldStyle, KiteDiagram, KiteScaling, KobePath, KobePlot, PollenDiagram, PollenStyle, PollenWidth, QapfDiagram, QapfRocks, RarefactionBasis, RarefactionCurve, SpeciesAccumulationCurve, SpiderDiagram, SpiderDisplay, SpiderNormaliser, TasDiagram, WhittakerBiomeDiagram, fieldchartsCatalog };