@tangle-network/charts 0.1.8 → 0.1.9

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 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -776,7 +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 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.`;
779
+ const minimum = drawn[0].row.minimumEffect;
780
+ const sameMinimum = drawn.every(({ row }) => row.minimumEffect === minimum);
781
+ const pluralSubject = clears.length > 1 && clears.length < drawn.length;
782
+ const difference = drawn.every(({ row }) => row.minimumEffect >= 0) ? "improvement" : "difference";
783
+ const requirement = sameMinimum ? `the required ${difference} of more than ${new Intl.NumberFormat("en-US", { maximumFractionDigits: 12 }).format(minimum * 100)} percentage points in ${o.measure}` : `${pluralSubject ? "their" : "its"} required ${difference}${pluralSubject ? "s" : ""}`;
784
+ const finding = `${clears.length === drawn.length ? drawn.length === 1 ? "The comparison" : "Every comparison" : clears.length === 0 ? "No comparison" : `${clears.length} of ${drawn.length} comparisons`} ${pluralSubject ? "support" : "supports"} ${requirement}.`;
780
785
  const pairs = drawn.reduce((s, d) => s + d.row.pairs, 0);
781
786
  const lede = `${drawn.length} ${plural(drawn.length, "comparison")} over ${pairs} paired ${plural(pairs, "attempt")}${refused.length ? `; ${refused.length} not drawn` : ""}.`;
782
787
  const names = [...new Set(drawn.map((d) => intervalName(d.row.interval)))];
@@ -966,12 +971,14 @@ function costFrontier(rows, o) {
966
971
  const cheapest = [...costed].sort((a, b) => cost(a) - cost(b))[0];
967
972
  finding = `${cheapest.label} has the lowest cost per pass, ${usd(cost(cheapest))}${est(cheapest)}.`;
968
973
  }
969
- const lede = `${costed.length} of ${rows.length} setups are plotted; ` + (drawLine ? `${front.length} sit on the producer's frontier.` : front.length === 1 ? "1 sits on the producer's frontier." : "the producer computed no frontier.");
974
+ const lowest = Math.min(...costed.map(cost));
975
+ const highest = Math.max(...costed.map(cost));
976
+ const lede = (lowest === highest ? `Cost per pass is ${usd(lowest)}.` : `Cost per pass ranges from ${usd(lowest)} to ${usd(highest)}.`) + (costed.some((row) => row.cost.basis === "estimated") ? " Costs include estimates." : "");
970
977
  const read = `Higher ${o.measure} and lower cost per pass are better; on the wide plot, better is up and right.` + (drawLine ? " Filled points sit on the frontier; the line joins them." : "") + (costed.some((r) => r.onFront && r.cost.basis !== "receipts") ? " A hollow accent ring is a frontier point with an estimated cost." : "");
971
978
  const intervals = [...new Set(costed.filter((r) => rateIntervalGap(r) === null).map((r) => intervalName(r.interval)))];
972
979
  const method = [
973
980
  `Cost per pass is model spend over passed attempts, ${[...new Set(costed.map((r) => r.cost.basis))].map((b) => b === "receipts" ? "from router receipts" : b === "estimated" ? "estimated, not billed" : "from an unrecorded source").join(" or ")}.`,
974
- front.length ? "The frontier is the producer's: no setup off it is both cheaper and higher." : "The producer did not compute a frontier.",
981
+ front.length ? `A frontier setup has no alternative with both lower cost and higher ${o.measure}.` : "",
975
982
  intervals.length ? `Vertical lines: ${intervals.join(", ")} on the ${o.measure}.` : ""
976
983
  ].filter(Boolean).join(" ");
977
984
  const columns = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/charts",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
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",