@tangle-network/charts 0.1.5 → 0.1.7

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 (2) hide show
  1. package/dist/index.js +10 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -729,7 +729,7 @@ function logDomain(lo, hi, minFactor = 3, pad = 1.25) {
729
729
  /**
730
730
  * `comparisonIntervals`: is each step in an order real.
731
731
  *
732
- * One row per comparison, "{favored} over {other}", with the pair count. x is
732
+ * One row per comparison, "{favored} − {other}", with the pair count. x is
733
733
  * the difference in points with a muted zero line. The clustered interval is a
734
734
  * 6 px accent bar, the exact interval a 2 px muted bar under it, and a dashed
735
735
  * ink tick marks the row's registered minimum effect. There is no point
@@ -756,7 +756,7 @@ function gaps(row) {
756
756
  function comparisonIntervals(rows, setups, o) {
757
757
  const id = o.id ?? "comparison-intervals";
758
758
  const name = (setupId) => setups.find((s) => s.id === setupId)?.label ?? setupId;
759
- const title = (row) => `${name(row.favored)} over ${name(row.other)}`;
759
+ const title = (row) => `${name(row.favored)} − ${name(row.other)}`;
760
760
  if (rows.length === 0) return {
761
761
  id,
762
762
  refused: "No comparison was registered."
@@ -853,13 +853,11 @@ function draw(drawn, domain, width, plotX, labelW) {
853
853
  } else {
854
854
  const label = wrap(title, width, 14);
855
855
  marks += textBlock(label.lines, 0, y + 14, 18, `class="tgc-ink" font-size="14"`);
856
- marks += text(width, y + 14, `${row.pairs} pairs`, {
857
- cls: "tgc-ink-muted tgc-num",
858
- anchor: "end"
859
- });
860
- barY = y + label.lines.length * 18 + 4;
856
+ marks += text(0, y + 14 + label.lines.length * 18, `${row.pairs} pairs`, { cls: "tgc-ink-muted tgc-num" });
857
+ barY = y + label.lines.length * 18 + 22;
861
858
  y = barY + 24;
862
859
  }
860
+ if (labelW === 0) marks += line(x(0), barY - 8, x(0), barY + 20, "tgc-zero");
863
861
  const lo = x(row.interval.lower);
864
862
  const hi = x(row.interval.upper);
865
863
  marks += rect(lo, barY, Math.max(hi - lo, 2), 6, "tgc-ci");
@@ -873,7 +871,7 @@ function draw(drawn, domain, width, plotX, labelW) {
873
871
  body += titled(`${title} · ${row.pairs} pairs · ${intervalName(row.interval)} interval ${pts(row.interval.lower)} to ${pts(row.interval.upper)}${rateExactTitle(row)} · minimum effect ${pts(row.minimumEffect)}`, marks);
874
872
  }
875
873
  const zero = x(0);
876
- let axis = line(zero, rowsTop, zero, y, "tgc-zero");
874
+ let axis = labelW > 0 ? line(zero, rowsTop, zero, y, "tgc-zero") : "";
877
875
  for (const t of linearTicks(domain[0], domain[1], width > 400 ? 6 : 3)) axis += text(x(t), y + 16, pts(t), {
878
876
  cls: "tgc-ink-muted tgc-num",
879
877
  anchor: "middle"
@@ -999,7 +997,7 @@ function costFrontier(rows, o) {
999
997
  row.label,
1000
998
  drawable(row.estimate) ? pct(row.rate) : estimateNote(row.estimate, row.attempts),
1001
999
  kn(row.solved, row.attempts),
1002
- rateIntervalGap(row) === null ? `${pct(row.interval.lower)}–${pct(row.interval.upper)} (${intervalName(row.interval)}, n=${row.attempts})` : `not drawn (${rateIntervalGap(row)})`,
1000
+ rateIntervalGap(row) === null ? `${pct(row.interval.lower)}–${pct(row.interval.upper)} (${intervalName(row.interval)}, ${row.attempts} attempts)` : `not drawn (${rateIntervalGap(row)})`,
1003
1001
  costText(row.cost, row.solved),
1004
1002
  row.cost.basis,
1005
1003
  row.onFront === null ? "not computed" : row.onFront ? "yes" : "no"
@@ -1065,7 +1063,7 @@ function narrowList(rows) {
1065
1063
  const fact = placed ? `${count} · ${costText(row.cost, row.solved)} per pass${row.onFront ? " · on the frontier" : ""}` : `${count} · ${reason}not plotted`;
1066
1064
  const facts = fitLines(fact.split(" · "), 358, 12, "mono");
1067
1065
  marks += textBlock(facts, 0, cy + 12, 16, `class="tgc-ink-muted tgc-num" font-size="12"`);
1068
- const interval = rateIntervalGap(row) === null ? ` · ${intervalName(row.interval)} interval ${pct(row.interval.lower)}–${pct(row.interval.upper)}, n=${row.attempts}` : "";
1066
+ const interval = rateIntervalGap(row) === null ? ` · ${intervalName(row.interval)} interval ${pct(row.interval.lower)}–${pct(row.interval.upper)}, ${row.attempts} attempts` : "";
1069
1067
  out += titled(`${row.label} · ${fact}${interval}`, marks);
1070
1068
  y = cy + 4 + facts.length * 16;
1071
1069
  if (i < rows.length - 1) out += line(0, y + 2, 358, y + 2, "tgc-rule");
@@ -1228,7 +1226,7 @@ function plot(costed, unplaced, drawLine, o) {
1228
1226
  }
1229
1227
  for (const p of placed) {
1230
1228
  const cls = p.row.onFront ? p.estimated ? "tgc-pt-est" : "tgc-pt-front" : "tgc-pt";
1231
- out += titled(`${p.row.label} · ${pct(p.row.rate)} ${o.measure} · ${kn(p.row.solved, p.row.attempts)} passed · ${costText(p.row.cost, p.row.solved)} per pass${rateIntervalGap(p.row) === null ? ` · ${intervalName(p.row.interval)} interval ${pct(p.row.interval.lower)}–${pct(p.row.interval.upper)}, n=${p.row.attempts}` : ""}${p.row.onFront ? " · on the frontier" : ""}`, circle(p.x, p.y, 4, cls));
1229
+ out += titled(`${p.row.label} · ${pct(p.row.rate)} ${o.measure} · ${kn(p.row.solved, p.row.attempts)} passed · ${costText(p.row.cost, p.row.solved)} per pass${rateIntervalGap(p.row) === null ? ` · ${intervalName(p.row.interval)} interval ${pct(p.row.interval.lower)}–${pct(p.row.interval.upper)}, ${p.row.attempts} attempts` : ""}${p.row.onFront ? " · on the frontier" : ""}`, circle(p.x, p.y, 4, cls));
1232
1230
  }
1233
1231
  out += labels.join("");
1234
1232
  let h = 320;
@@ -1388,7 +1386,7 @@ function rankedRates(input, o) {
1388
1386
  String(row.solved),
1389
1387
  String(row.attempts),
1390
1388
  drawable(row.estimate) ? pct(row.rate) : estimateNote(row.estimate, row.attempts),
1391
- rateIntervalGap(row) === null ? `${pct(row.interval.lower)}–${pct(row.interval.upper)} (${intervalName(row.interval)}, n=${row.attempts})` : `not drawn (${rateIntervalGap(row)})`,
1389
+ rateIntervalGap(row) === null ? `${pct(row.interval.lower)}–${pct(row.interval.upper)} (${intervalName(row.interval)}, ${row.attempts} attempts)` : `not drawn (${rateIntervalGap(row)})`,
1392
1390
  ...tiered ? [row.tiers ? [tierSummary(row.tiers), offLadder ? `${offLadder} off the ladder` : ""].filter(Boolean).join(" · ") || "none" : "not graded"] : [],
1393
1391
  ...layout.cost ? [costText(row.cost, row.solved), row.cost.basis + (row.cost.receipts !== null ? `, ${row.cost.receipts} receipts` : "")] : [],
1394
1392
  ...layout.median ? [row.medianWallMs === null ? "unknown" : duration(row.medianWallMs)] : []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/charts",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
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",