DanielRegaladoCardoso commited on
Commit
9b0542e
·
verified ·
1 Parent(s): ba39c81

SVG: standalone download (XML prolog, white bg, fixed dims) + Plotly first

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -581,9 +581,11 @@ def _download_links_html(sql: str, results: list[dict], svg: str) -> str:
581
  f'<span class="icon">↓</span> CSV ({len(results):,} rows)</a>'
582
  )
583
 
584
- # SVG download
585
  if svg and "<svg" in svg.lower():
586
- svg_b64 = base64.b64encode(svg.encode("utf-8")).decode("ascii")
 
 
587
  parts.append(
588
  f'<a class="download-link" '
589
  f'href="data:image/svg+xml;base64,{svg_b64}" '
 
581
  f'<span class="icon">↓</span> CSV ({len(results):,} rows)</a>'
582
  )
583
 
584
+ # SVG download (standalone version: explicit dims, white bg, XML prolog)
585
  if svg and "<svg" in svg.lower():
586
+ from src.visualization.svg_theme import to_standalone_svg
587
+ standalone = to_standalone_svg(svg)
588
+ svg_b64 = base64.b64encode(standalone.encode("utf-8")).decode("ascii")
589
  parts.append(
590
  f'<a class="download-link" '
591
  f'href="data:image/svg+xml;base64,{svg_b64}" '