Spaces:
Sleeping
Sleeping
TOTEM Studio commited on
Commit ·
a59aacf
1
Parent(s): b773732
fix gauge arc dasharray: use circ-seg_filled as gap, not full circ
Browse files
app.py
CHANGED
|
@@ -1331,12 +1331,14 @@ def render_signal_gauge(value: int) -> str:
|
|
| 1331 |
if filled <= seg_start:
|
| 1332 |
break
|
| 1333 |
seg_filled = min(filled - seg_start, seg)
|
| 1334 |
-
#
|
|
|
|
| 1335 |
rotate_deg = -90 + (seg_start / circ) * 360
|
| 1336 |
arc_elements.append(
|
| 1337 |
f'<circle cx="80" cy="80" r="68" fill="none" stroke="{color}" '
|
| 1338 |
f'stroke-width="7" stroke-linecap="round" '
|
| 1339 |
-
f'stroke-dasharray="{seg_filled:.2f} {circ:.2f}" '
|
|
|
|
| 1340 |
f'transform="rotate({rotate_deg:.1f} 80 80)" />'
|
| 1341 |
)
|
| 1342 |
arcs_html = "\n ".join(arc_elements)
|
|
|
|
| 1331 |
if filled <= seg_start:
|
| 1332 |
break
|
| 1333 |
seg_filled = min(filled - seg_start, seg)
|
| 1334 |
+
# Each arc: dasharray shows seg_filled px, hides the rest
|
| 1335 |
+
# rotate so this segment starts at top (-90deg) + offset for prior segments
|
| 1336 |
rotate_deg = -90 + (seg_start / circ) * 360
|
| 1337 |
arc_elements.append(
|
| 1338 |
f'<circle cx="80" cy="80" r="68" fill="none" stroke="{color}" '
|
| 1339 |
f'stroke-width="7" stroke-linecap="round" '
|
| 1340 |
+
f'stroke-dasharray="{seg_filled:.2f} {(circ - seg_filled):.2f}" '
|
| 1341 |
+
f'stroke-dashoffset="0" '
|
| 1342 |
f'transform="rotate({rotate_deg:.1f} 80 80)" />'
|
| 1343 |
)
|
| 1344 |
arcs_html = "\n ".join(arc_elements)
|