@tangle-network/charts 0.1.6 → 0.1.8

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 +9 -11
  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."
@@ -776,12 +776,12 @@ function comparisonIntervals(rows, setups, o) {
776
776
  refused: rows.every((r) => r.interval === null) ? `${rows.length} ${plural(rows.length, "comparison")} listed; none carries an interval.` : `No comparison can be drawn. ${refused.join("; ")}.`
777
777
  };
778
778
  const clears = drawn.filter(({ row }) => row.interval.lower > row.minimumEffect && (intervalGap(row.exactInterval) !== null || row.exactInterval.lower > row.minimumEffect));
779
- const finding = clears.length === drawn.length ? drawn.length === 1 ? "The step clears its registered minimum effect." : `Each of the ${drawn.length} steps clears its registered minimum effect.` : clears.length === 0 ? `No step clears its registered minimum effect.` : `${clears.length} of ${drawn.length} steps clear their registered minimum effect.`;
779
+ const finding = clears.length === drawn.length ? drawn.length === 1 ? "The comparison clears its registered minimum effect." : `Each of the ${drawn.length} comparisons clears its registered minimum effect.` : clears.length === 0 ? `No comparison clears its registered minimum effect.` : `${clears.length} of ${drawn.length} comparisons clear their registered minimum effect.`;
780
780
  const pairs = drawn.reduce((s, d) => s + d.row.pairs, 0);
781
781
  const lede = `${drawn.length} ${plural(drawn.length, "comparison")} over ${pairs} paired ${plural(pairs, "attempt")}${refused.length ? `; ${refused.length} not drawn` : ""}.`;
782
782
  const names = [...new Set(drawn.map((d) => intervalName(d.row.interval)))];
783
783
  const exactNames = [...new Set(drawn.filter((d) => intervalGap(d.row.exactInterval) === null).map((d) => intervalName(d.row.exactInterval)))];
784
- const read = `Each bar is the ${names.join(" or ")} interval on the difference in ${o.measure}` + (exactNames.length ? `; the thin bar under it is the ${exactNames.join(" or ")} interval` : "") + ". A step is backed when every bar lies wholly right of the dashed minimum effect.";
784
+ const read = `Each bar is the ${names.join(" or ")} interval on the difference in ${o.measure}` + (exactNames.length ? `; the thin bar under it is the ${exactNames.join(" or ")} interval` : "") + ". A comparison is supported when every bar lies wholly right of the dashed minimum effect.";
785
785
  const columns = [
786
786
  { label: "Comparison" },
787
787
  {
@@ -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"
@@ -1746,7 +1744,7 @@ function taskMatrix(tasks, setupsIn, cells, o = {}) {
1746
1744
  const most = Math.max(...perSetup.map((x) => x.k));
1747
1745
  const leaders = perSetup.filter((x) => x.k === most).map((x) => x.s.label);
1748
1746
  const rest = perSetup.filter((x) => x.k !== most);
1749
- if (setups.length > 1 && everywhere > 0) finding = `${everywhere} of ${tasksN} passed at least once for every ${noun.setup}.`;
1747
+ if (setups.length > 1 && everywhere > 0) finding = `Every ${noun.setup} passed at least once on ${everywhere} shared ${plural(everywhere, noun.task)} out of ${tasks.length}.`;
1750
1748
  else if (most === 0) finding = `No ${noun.task} passed for any ${noun.setup}.`;
1751
1749
  else {
1752
1750
  const tail = rest.length && rest.every((x) => x.k === 0) ? `; ${rest.length === 1 ? rest[0].s.label : `every other ${noun.setup}`} on none` : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/charts",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
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",