@tangle-network/charts 0.6.0 → 0.7.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.
@@ -66,6 +66,12 @@ interface StackedBarBucket {
66
66
  readonly total: number | null;
67
67
  /** Stack order is input order. Charts neither groups nor sorts. */
68
68
  readonly segments: readonly StackedBarSegment[];
69
+ /**
70
+ * Caller-owned text about this bucket that the chart cannot derive, such as
71
+ * request counts. Appended to the bar's name, the live readout and the
72
+ * pointer tooltip; never parsed.
73
+ */
74
+ readonly description?: string;
69
75
  }
70
76
  interface StackedBarChartProps {
71
77
  label: string;
@@ -247,7 +247,7 @@ function StackedBarChart(props) {
247
247
  validate(props);
248
248
  const bySeries = new Map(series.map((entry) => [entry.id, entry]));
249
249
  const formatted = (value) => isValue(value) ? formatValue(value) : unavailableLabel;
250
- const summary = (bucket) => `${bucket.label}: total ${formatted(bucket.total)}` + (hasGap(bucket) ? ` — ${unavailableLabel}` : "") + (bucket.segments.length ? ` — ${bucket.segments.map((segment) => `${bySeries.get(segment.seriesId).label} ${formatted(segment.value)}`).join(", ")}` : "");
250
+ const summary = (bucket) => `${bucket.label}: total ${formatted(bucket.total)}` + (hasGap(bucket) ? ` — ${unavailableLabel}` : "") + (bucket.segments.length ? ` — ${bucket.segments.map((segment) => `${bySeries.get(segment.seriesId).label} ${formatted(segment.value)}`).join(", ")}` : "") + (bucket.description ? ` — ${bucket.description}` : "");
251
251
  const activeIndex = selectedBucketId === null ? -1 : buckets.findIndex(({ id }) => id === selectedBucketId);
252
252
  const activeBucket = activeIndex >= 0 ? buckets[activeIndex] : null, marginTop = 12, marginRight = 16, marginLeft = 56;
253
253
  const chartHeight = 220;
@@ -490,7 +490,8 @@ function StackedBarChart(props) {
490
490
  bySeries.get(segment.seriesId).label,
491
491
  ": ",
492
492
  formatted(segment.value)
493
- ] }, segment.seriesId))
493
+ ] }, segment.seriesId)),
494
+ activeBucket.description && /* @__PURE__ */ jsx("div", { children: activeBucket.description })
494
495
  ]
495
496
  }),
496
497
  /* @__PURE__ */ jsx("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/charts",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Static SVG and HTML figures for benchmarks and operational timing. Draws from producer data and refuses what it cannot draw honestly.",
5
5
  "type": "module",
6
6
  "license": "MIT",