From b7e787a658a51c0352046053ed67169e8ec6f946 Mon Sep 17 00:00:00 2001 From: roman Date: Sun, 11 Oct 2026 06:26:03 +0300 Subject: [PATCH] fix: move reference line labels off the bars in the scaling plots Co-Authored-By: Claude Opus 5.5 --- bench/plots.py | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/bench/plots.py b/bench/plots.py index c727074d..aa6b9106 100644 --- a/bench/plots.py +++ b/bench/plots.py @@ -198,7 +198,7 @@ class Svg: cy - 3, color=color, width=2, - dash="5 4" if kind == "dash" else "", + dash={"dash": "5 4", "dots": "2 4"}.get(kind, ""), ) self.text(cx + 22, cy + 1, label, color=INK_2) cx += item_w @@ -388,12 +388,12 @@ def plot_p95(label: dict[str, Any], title: str) -> str: width=1.5, dash="6 4", ) + # подпись SLO слева: справа линии конфигураций пересекают порог svg.text( - left + plot_w - 4, + left + 6, sy(slo) - 6, f"SLO p95 {slo:g} мс", color=INK_2, - anchor="end", ) svg.text( left + plot_w / 2, @@ -506,13 +506,6 @@ def plot_cpu(labels: list[dict[str, Any]], title: str) -> str: width=1.5, dash="2 4", ) - svg.text( - left + plot_w - 4, - sy(perf) - 6, - f"{perf} производительных ядер хоста", - color=INK_2, - anchor="end", - ) slot = plot_w / max(1, len(bars)) bar_w = min(24.0, slot * 0.6) for index, (name, values, c) in enumerate(bars): @@ -565,12 +558,13 @@ def plot_cpu(labels: list[dict[str, Any]], title: str) -> str: anchor="middle", rotate=True, ) - svg.legend( - [(SERIES[i], text, "box") for i, (_, text) in enumerate(COMPONENTS)], - left, - 98, - plot_w, - ) + # подпись линии ядер хоста — в легенде: на линии её закрывают столбики + items = [ + (SERIES[i], text, "box") for i, (_, text) in enumerate(COMPONENTS) + ] + if perf: + items.append((MUTED, f"{perf} производительных ядер хоста", "dots")) + svg.legend(items, left, 98, plot_w) return svg.render()