describe("chart bar sizing", () => {
it("bar width ratio and max are reasonable", () => {
expect(CHART_BAR_WIDTH_RATIO).toBeGreaterThan(0);
expect(CHART_BAR_WIDTH_RATIO).toBeLessThan(1);
expect(CHART_MAX_BAR_WIDTH).toBeGreaterThan(0);
});
it("bars fit within chart width for typical point counts", () => { const chartWidth = 366; // typical: 400 - padding.left(30) - padding.right(4) // For reasonable point counts (up to ~300), bars should fit for (const n of [1, 2, 10, 50, 100, 200]) { const slotWidth = chartWidth / n; const barWidth = Math.min(
CHART_MAX_BAR_WIDTH,
Math.max(1, slotWidth * CHART_BAR_WIDTH_RATIO),
); const barGap = slotWidth - barWidth; // Slot-based sizing guarantees total = n * slotWidth = chartWidth
expect(n * slotWidth).toBeCloseTo(chartWidth); // Bar gap is non-negative when slotWidth >= 1 / CHART_BAR_WIDTH_RATIO if (slotWidth >= 1 / CHART_BAR_WIDTH_RATIO) {
expect(barGap).toBeGreaterThanOrEqual(0);
}
}
});
});
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-06-07)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.