fix: move reference line labels off the bars in the scaling plots
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-16
@@ -198,7 +198,7 @@ class Svg:
|
|||||||
cy - 3,
|
cy - 3,
|
||||||
color=color,
|
color=color,
|
||||||
width=2,
|
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)
|
self.text(cx + 22, cy + 1, label, color=INK_2)
|
||||||
cx += item_w
|
cx += item_w
|
||||||
@@ -388,12 +388,12 @@ def plot_p95(label: dict[str, Any], title: str) -> str:
|
|||||||
width=1.5,
|
width=1.5,
|
||||||
dash="6 4",
|
dash="6 4",
|
||||||
)
|
)
|
||||||
|
# подпись SLO слева: справа линии конфигураций пересекают порог
|
||||||
svg.text(
|
svg.text(
|
||||||
left + plot_w - 4,
|
left + 6,
|
||||||
sy(slo) - 6,
|
sy(slo) - 6,
|
||||||
f"SLO p95 {slo:g} мс",
|
f"SLO p95 {slo:g} мс",
|
||||||
color=INK_2,
|
color=INK_2,
|
||||||
anchor="end",
|
|
||||||
)
|
)
|
||||||
svg.text(
|
svg.text(
|
||||||
left + plot_w / 2,
|
left + plot_w / 2,
|
||||||
@@ -506,13 +506,6 @@ def plot_cpu(labels: list[dict[str, Any]], title: str) -> str:
|
|||||||
width=1.5,
|
width=1.5,
|
||||||
dash="2 4",
|
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))
|
slot = plot_w / max(1, len(bars))
|
||||||
bar_w = min(24.0, slot * 0.6)
|
bar_w = min(24.0, slot * 0.6)
|
||||||
for index, (name, values, c) in enumerate(bars):
|
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",
|
anchor="middle",
|
||||||
rotate=True,
|
rotate=True,
|
||||||
)
|
)
|
||||||
svg.legend(
|
# подпись линии ядер хоста — в легенде: на линии её закрывают столбики
|
||||||
[(SERIES[i], text, "box") for i, (_, text) in enumerate(COMPONENTS)],
|
items = [
|
||||||
left,
|
(SERIES[i], text, "box") for i, (_, text) in enumerate(COMPONENTS)
|
||||||
98,
|
]
|
||||||
plot_w,
|
if perf:
|
||||||
)
|
items.append((MUTED, f"{perf} производительных ядер хоста", "dots"))
|
||||||
|
svg.legend(items, left, 98, plot_w)
|
||||||
return svg.render()
|
return svg.render()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user