Initialize sparklines to start at zero

Bump version to 0.2.6
This commit is contained in:
GitHub Copilot
2026-01-24 12:55:18 +00:00
parent cc2ab79859
commit b5b144dcd0
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "textual-webterm" name = "textual-webterm"
version = "0.2.5" version = "0.2.6"
description = "Serve terminal sessions over the web" description = "Serve terminal sessions over the web"
authors = ["Will McGugan <will@textualize.io>"] authors = ["Will McGugan <will@textualize.io>"]
license = "MIT" license = "MIT"
+3
View File
@@ -325,6 +325,9 @@ def render_sparkline_svg(
# Empty placeholder # Empty placeholder
return f'<svg width="{width}" height="{height}" xmlns="http://www.w3.org/2000/svg"></svg>' return f'<svg width="{width}" height="{height}" xmlns="http://www.w3.org/2000/svg"></svg>'
# Prepend zero to start sparkline from baseline
values = [0.0, *values]
# Normalize values to 0-1 range # Normalize values to 0-1 range
max_val = max(values) if max(values) > 0 else 1 max_val = max(values) if max(values) > 0 else 1
normalized = [v / max_val for v in values] normalized = [v / max_val for v in values]