@tangle-network/charts 0.13.0 → 0.14.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.
- package/dist/react/index.d.ts +13 -0
- package/dist/react/index.js +65 -1
- package/package.json +1 -1
package/dist/react/index.d.ts
CHANGED
|
@@ -231,6 +231,19 @@ export declare function Spark({ points, max, color, label, format, time }: {
|
|
|
231
231
|
format?: (v: number) => string;
|
|
232
232
|
time?: (t: number) => string;
|
|
233
233
|
}): import("react").JSX.Element;
|
|
234
|
+
/** Recorded instants on one time axis, such as process restarts or deploys: a tick per event in `[from, to]`, with
|
|
235
|
+
* `ticks` evenly spaced axis labels under it. Hovering a tick names its time through `time`. The strip keeps its type
|
|
236
|
+
* size at any width, and `label` names it for assistive tech. */
|
|
237
|
+
export declare function Events({ at, from, to, label, color, ticks, axis, time }: {
|
|
238
|
+
at: number[];
|
|
239
|
+
from: number;
|
|
240
|
+
to: number;
|
|
241
|
+
label: string;
|
|
242
|
+
color?: string;
|
|
243
|
+
ticks?: number;
|
|
244
|
+
axis?: (t: number) => string;
|
|
245
|
+
time?: (t: number) => string;
|
|
246
|
+
}): import("react").JSX.Element;
|
|
234
247
|
/** One bar per row on a shared time axis (who worked when): each row's bar spans its start to its end, coloured by its
|
|
235
248
|
* state; hovering a span names it, its state and its span. Times are epoch ms; `axis` labels the time axis.
|
|
236
249
|
* `lanes` give a row several spans (the same shape as the static `timeline`); a span with `end: null` is open and runs
|
package/dist/react/index.js
CHANGED
|
@@ -1501,6 +1501,70 @@ function Spark({ points, max = 1, color = LIVE_SERIES[0], label, format = format
|
|
|
1501
1501
|
]
|
|
1502
1502
|
});
|
|
1503
1503
|
}
|
|
1504
|
+
/** Recorded instants on one time axis, such as process restarts or deploys: a tick per event in `[from, to]`, with
|
|
1505
|
+
* `ticks` evenly spaced axis labels under it. Hovering a tick names its time through `time`. The strip keeps its type
|
|
1506
|
+
* size at any width, and `label` names it for assistive tech. */
|
|
1507
|
+
function Events({ at, from, to, label, color = LIVE_SERIES[0], ticks = 7, axis = (t) => new Date(t).toLocaleDateString(void 0, { weekday: "short" }), time = (t) => new Date(t).toLocaleString() }) {
|
|
1508
|
+
const [ref, width, em] = useWidth();
|
|
1509
|
+
if (!Number.isFinite(from) || !Number.isFinite(to) || to <= from) throw new RangeError("Events needs a window with to after from.");
|
|
1510
|
+
const shown = at.filter((t) => Number.isFinite(t) && t >= from && t <= to).sort((a, b) => a - b);
|
|
1511
|
+
const strip = Math.round(2.2 * em);
|
|
1512
|
+
const height = strip + Math.round(1.5 * em);
|
|
1513
|
+
const pad = 6;
|
|
1514
|
+
const x = (t) => pad + (t - from) / (to - from) * Math.max(0, width - 12);
|
|
1515
|
+
const steps = Math.max(1, Math.round(ticks));
|
|
1516
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1517
|
+
ref,
|
|
1518
|
+
className: "ov-plot",
|
|
1519
|
+
children: width > 0 && /* @__PURE__ */ jsxs("svg", {
|
|
1520
|
+
width,
|
|
1521
|
+
height,
|
|
1522
|
+
role: "img",
|
|
1523
|
+
"aria-label": `${label}: ${shown.length} in the window`,
|
|
1524
|
+
children: [
|
|
1525
|
+
/* @__PURE__ */ jsx("line", {
|
|
1526
|
+
x1: pad,
|
|
1527
|
+
x2: width - pad,
|
|
1528
|
+
y1: strip / 2,
|
|
1529
|
+
y2: strip / 2,
|
|
1530
|
+
className: "ov-gridline"
|
|
1531
|
+
}),
|
|
1532
|
+
shown.map((t, i) => /* @__PURE__ */ jsxs("g", {
|
|
1533
|
+
"data-event": t,
|
|
1534
|
+
children: [
|
|
1535
|
+
/* @__PURE__ */ jsx("title", { children: time(t) }),
|
|
1536
|
+
/* @__PURE__ */ jsx("rect", {
|
|
1537
|
+
x: x(t) - 6,
|
|
1538
|
+
y: 0,
|
|
1539
|
+
width: 12,
|
|
1540
|
+
height: strip,
|
|
1541
|
+
fill: "transparent"
|
|
1542
|
+
}),
|
|
1543
|
+
/* @__PURE__ */ jsx("line", {
|
|
1544
|
+
x1: x(t),
|
|
1545
|
+
x2: x(t),
|
|
1546
|
+
y1: 4,
|
|
1547
|
+
y2: strip - 4,
|
|
1548
|
+
stroke: color,
|
|
1549
|
+
strokeWidth: 2,
|
|
1550
|
+
strokeLinecap: "round"
|
|
1551
|
+
})
|
|
1552
|
+
]
|
|
1553
|
+
}, `${t}-${i}`)),
|
|
1554
|
+
Array.from({ length: steps + 1 }, (_, i) => {
|
|
1555
|
+
const t = from + i / steps * (to - from);
|
|
1556
|
+
return /* @__PURE__ */ jsx("text", {
|
|
1557
|
+
x: x(t),
|
|
1558
|
+
y: height - em * .35,
|
|
1559
|
+
className: "ov-axis",
|
|
1560
|
+
textAnchor: i === 0 ? "start" : i === steps ? "end" : "middle",
|
|
1561
|
+
children: axis(t)
|
|
1562
|
+
}, i);
|
|
1563
|
+
})
|
|
1564
|
+
]
|
|
1565
|
+
})
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1504
1568
|
/** One bar per row on a shared time axis (who worked when): each row's bar spans its start to its end, coloured by its
|
|
1505
1569
|
* state; hovering a span names it, its state and its span. Times are epoch ms; `axis` labels the time axis.
|
|
1506
1570
|
* `lanes` give a row several spans (the same shape as the static `timeline`); a span with `end: null` is open and runs
|
|
@@ -2228,4 +2292,4 @@ function DotMap({ positions, radii, colors, palette, extent, rects, labels, dimm
|
|
|
2228
2292
|
});
|
|
2229
2293
|
}
|
|
2230
2294
|
//#endregion
|
|
2231
|
-
export { DEFAULT_SPARKLINE_EMPTY_LABEL, DEFAULT_SPARKLINE_HEIGHT, DEFAULT_SPARKLINE_LABEL, DEFAULT_SPARKLINE_UNAVAILABLE_LABEL, DEFAULT_SPARKLINE_WIDTH, DOT_MAP_CATEGORIES, DayBars, DotMap, FigureView, Gantt, HBars, Histogram, LIVE_SERIES, Lines, Meter, Spark, Sparkline, StackedBarChart, TimelineView, WaterfallBar, WaterfallHeader, WaterfallRow, WaterfallTimeAxis, formatCompact, formatSparklineValue, formatWaterfallDuration, sparklineGeometry, sparklineLabel, sparklinePointsAttribute, sparklineReadings, waterfallSpanGeometry, waterfallTicks };
|
|
2295
|
+
export { DEFAULT_SPARKLINE_EMPTY_LABEL, DEFAULT_SPARKLINE_HEIGHT, DEFAULT_SPARKLINE_LABEL, DEFAULT_SPARKLINE_UNAVAILABLE_LABEL, DEFAULT_SPARKLINE_WIDTH, DOT_MAP_CATEGORIES, DayBars, DotMap, Events, FigureView, Gantt, HBars, Histogram, LIVE_SERIES, Lines, Meter, Spark, Sparkline, StackedBarChart, TimelineView, WaterfallBar, WaterfallHeader, WaterfallRow, WaterfallTimeAxis, formatCompact, formatSparklineValue, formatWaterfallDuration, sparklineGeometry, sparklineLabel, sparklinePointsAttribute, sparklineReadings, waterfallSpanGeometry, waterfallTicks };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/charts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.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",
|