Skip to content

Commit c1e017d

Browse files
committed
improve on svg style
1 parent c35560f commit c1e017d

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

scripts/ci-generate-dashboard.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424
compilers = sorted(compilers)
2525

2626
# SVG layout parameters
27-
cell_w, cell_h = 60, 40
27+
gap = 5 # space between cells
28+
cell_w, cell_h = 25, 25
2829
header_h = 100
29-
row_label_w = 150
30-
svg_w = row_label_w + len(compilers) * cell_w + 50
30+
row_label_w = 120
31+
svg_w = row_label_w + len(compilers) * cell_w + 80
3132
svg_h = header_h + len(oses) * cell_h + 50
3233

3334
def status_color_symbol(status):
@@ -43,29 +44,31 @@ def status_color_symbol(status):
4344
f'<svg xmlns="http://www.w3.org/2000/svg" width="{svg_w}" height="{svg_h}" font-family="monospace">'
4445
]
4546

46-
# Column headers (rotated -45° for readability)
47+
# Column headers (rotated -45° for readability, aligned with gap)
4748
for j, comp in enumerate(compilers):
48-
x = row_label_w + j * cell_w + cell_w // 2
49-
y = header_h - 30
49+
x = row_label_w + j * (cell_w + gap) + cell_w // 2
50+
y = header_h - 10
5051
svg.append(
5152
f'<text x="{x}" y="{y}" transform="rotate(-45,{x},{y})" font-size="12">{comp}</text>'
5253
)
5354

54-
# Row headers
55+
# Row headers (align OS labels right before the grid)
5556
for i, os in enumerate(oses):
56-
y = header_h + i * cell_h + cell_h // 2 + 5
57-
svg.append(f'<text x="10" y="{y}" font-size="14">{os}</text>')
57+
y = header_h + i * (cell_h + gap) + cell_h // 2 + 5
58+
svg.append(
59+
f'<text x="{row_label_w - gap}" y="{y}" font-size="14" text-anchor="end">{os}</text>'
60+
)
5861

5962
# Grid cells
6063
for i, os in enumerate(oses):
6164
for j, comp in enumerate(compilers):
6265
status = matrix.get((os, comp), "skipped")
6366
color, symbol = status_color_symbol(status)
64-
x = row_label_w + j * cell_w
65-
y = header_h + i * cell_h
67+
x = row_label_w + j * (cell_w + gap)
68+
y = header_h + i * (cell_h + gap)
6669
svg.append(
6770
f'<rect x="{x}" y="{y}" width="{cell_w}" height="{cell_h}" '
68-
f'fill="{color}" fill-opacity="0.3" stroke="black"/>'
71+
f'rx="6" ry="6" fill="{color}" fill-opacity="0.3" stroke="black"/>'
6972
)
7073
svg.append(
7174
f'<text x="{x + cell_w/2}" y="{y + cell_h/2 + 5}" '

0 commit comments

Comments
 (0)