@tangle-network/charts 0.1.3 → 0.1.4

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/README.md CHANGED
@@ -18,9 +18,11 @@ A figure function returns a `Refusal` in place of a figure it cannot draw honest
18
18
  The producer's `estimate` controls rate marks: `descriptive` draws a rate bar and may show a named Wilson score interval when that estimate meets the producer's unit threshold.
19
19
  Task-clustered bootstrap intervals require a `bootstrap` estimate.
20
20
  Intervals without support are marked as not drawn in the data table and note.
21
- A missing, zero, or unproven cost prints `unknown`; zero passes print `no pass`.
21
+ Cost-per-pass figures print `unknown` for missing, zero, or unproven cost; zero passes print `no pass`.
22
+ A matrix preserves an observed zero cost as $0 and omits a null cost.
22
23
  Rank numbers require every row to carry both a rank and a `bootstrap` estimate.
23
24
  Malformed rates, intervals, matrix counts, and breakdown counts return a refusal instead of a misleading mark.
25
+ Unmeasured and flagged matrix attempts keep distinct marks and table counts, even without tier grades.
24
26
  An interval whisker is omitted when its bounds exclude the row's rate.
25
27
 
26
28
  It has no runtime dependencies and uses no DOM, so it runs in a Worker, a build step or a browser.
package/dist/index.js CHANGED
@@ -1596,8 +1596,17 @@ function tilesOf(cell) {
1596
1596
  while (out.length < attempts) out.push("ungraded");
1597
1597
  return out;
1598
1598
  }
1599
- if (cell.solved !== null) return [...Array(cell.solved).fill("solved"), ...Array(attempts - cell.solved).fill("open")];
1600
- return Array(attempts).fill("ungraded");
1599
+ if (cell.solved !== null) return [
1600
+ ...Array(cell.solved).fill("solved"),
1601
+ ...Array(attempts - cell.solved - (cell.flagged ?? 0) - (cell.unmeasured ?? 0)).fill("open"),
1602
+ ...Array(cell.flagged ?? 0).fill("flagged"),
1603
+ ...Array(cell.unmeasured ?? 0).fill("unmeasured")
1604
+ ];
1605
+ return [
1606
+ ...Array(attempts - (cell.flagged ?? 0) - (cell.unmeasured ?? 0)).fill("ungraded"),
1607
+ ...Array(cell.flagged ?? 0).fill("flagged"),
1608
+ ...Array(cell.unmeasured ?? 0).fill("unmeasured")
1609
+ ];
1601
1610
  }
1602
1611
  function tile(kind, x, y) {
1603
1612
  switch (kind) {
@@ -1619,7 +1628,7 @@ function cellText(cell, means) {
1619
1628
  if (cell.attempts === 0) return "none counted";
1620
1629
  if (cell.solved !== null) return kn(cell.solved, cell.attempts);
1621
1630
  if (cell.tiers) return tierSummary(cell.tiers, cell.unmeasured, cell.flagged);
1622
- return `${cell.attempts}`;
1631
+ return tierSummary(null, cell.unmeasured, cell.flagged) ? `${cell.attempts} · ${tierSummary(null, cell.unmeasured, cell.flagged)}` : `${cell.attempts}`;
1623
1632
  }
1624
1633
  function describe(task, setup, cell, means) {
1625
1634
  if (!cell || (means ? cell.mean === null : cell.attempts === null)) return `${task} · ${setup.label}: not run`;
@@ -1684,7 +1693,7 @@ function taskMatrix(tasks, setupsIn, cells, o = {}) {
1684
1693
  refused: `${cell.task} × ${cell.setup}: cost is invalid.`
1685
1694
  };
1686
1695
  if (!means && cell.attempts !== null) {
1687
- if (tierTotal(cell.tiers) + (cell.flagged ?? 0) + (cell.unmeasured ?? 0) > cell.attempts || cell.solved !== null && cell.solved > cell.attempts) return {
1696
+ if (tierTotal(cell.tiers) + (cell.flagged ?? 0) + (cell.unmeasured ?? 0) > cell.attempts || cell.solved !== null && cell.solved + (cell.flagged ?? 0) + (cell.unmeasured ?? 0) > cell.attempts) return {
1688
1697
  id,
1689
1698
  refused: `${cell.task} × ${cell.setup}: grades or passes exceed its ${cell.attempts} attempts.`
1690
1699
  };
@@ -1761,7 +1770,7 @@ function taskMatrix(tasks, setupsIn, cells, o = {}) {
1761
1770
  const kinds = /* @__PURE__ */ new Set();
1762
1771
  if (!means) for (const cell of cells) for (const k of tilesOf(cell)) kinds.add(k);
1763
1772
  const tiered = cells.some((c) => c.tiers !== null);
1764
- const read = means ? `Each cell is one ${noun.setup}'s mean on one ${noun.task}, printed and drawn as a bar on a shared scale; · marks a pair never scored.` : tiered ? `One tile per ${noun.attempt}, best first: tiles fill by App Grade tier and an outline is F${o.passTier ? `; ${o.passTier} or better passes` : ""}. Tile order is not run order.` : `One tile per ${noun.attempt}: a filled tile passed and an outline did not. Tile order is not run order.`;
1773
+ const read = means ? `Each cell is one ${noun.setup}'s mean on one ${noun.task}, printed and drawn as a bar on a shared scale; · marks a pair never scored.` : tiered ? `One tile per ${noun.attempt}, best first: tiles fill by App Grade tier and an outline is F${o.passTier ? `; ${o.passTier} or better passes` : ""}. Tile order is not run order.` : `One tile per ${noun.attempt}: a filled tile passed and a plain outline did not. Dashed, dotted, and struck tiles keep their separate observation states. Tile order is not run order.`;
1765
1774
  const method = means ? `Each cell is the producer's mean score for one ${noun.setup} on one ${noun.task}.` : [
1766
1775
  tiered ? `Tiles show the App Grade tier of each ${noun.attempt}${o.passTier ? `, and ${o.passTier} or better counts as a pass` : ""}.` : `Filled tiles are the ${plural(2, noun.attempt)} the producer marks solved.`,
1767
1776
  kinds.has("unmeasured") ? `U marks ${noun.attempt === "attempt" ? "an attempt" : `a ${noun.attempt}`} the grader could not measure.` : "",
@@ -1774,8 +1783,8 @@ function taskMatrix(tasks, setupsIn, cells, o = {}) {
1774
1783
  }))], tasks.map((task) => [task, ...setups.map((s) => {
1775
1784
  const cell = at(task, s);
1776
1785
  const main = cellText(cell, means);
1777
- const extra = !means && cell && cell.solved !== null && cell.tiers ? ` · ${tierSummary(cell.tiers, cell.unmeasured, cell.flagged)}` : "";
1778
- const cost = cell && cell.costUsd !== null ? ` · ${cell.costUsd > 0 ? usd(cell.costUsd) : "cost unknown"}` : "";
1786
+ const extra = !means && cell && cell.solved !== null && (cell.tiers || cell.unmeasured || cell.flagged) ? ` · ${tierSummary(cell.tiers, cell.unmeasured, cell.flagged)}` : "";
1787
+ const cost = cell && cell.costUsd !== null ? ` · ${usd(cell.costUsd)}` : "";
1779
1788
  return main === "·" ? "not run" : `${main}${extra}${cost}`;
1780
1789
  })]));
1781
1790
  const scaleMax = Math.max(1, ...cells.map((c) => c.mean ?? 0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/charts",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Benchmark figures as static SVG and HTML tables: ranked rates, cost frontier, comparison intervals, task matrix and breakdown. Draws from producer data and refuses what it cannot draw honestly.",
5
5
  "type": "module",
6
6
  "license": "MIT",