Skip to content

Commit 5cf4440

Browse files
committed
chart
Signed-off-by: yaacov <yzamir@redhat.com>
1 parent a281c71 commit 5cf4440

3 files changed

Lines changed: 57 additions & 2 deletions

File tree

‎docs/architecture/ref-baseline/dashboard.html‎

Lines changed: 23 additions & 1 deletion
Large diffs are not rendered by default.

‎tests/scenarios/lib/chart.umd.min.js‎

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tests/scenarios/lib/generate-run-dashboard.py‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424
from pathlib import Path
2525
from typing import Any
2626

27+
CHART_JS_PATH = Path(__file__).resolve().parent / "chart.umd.min.js"
28+
29+
30+
def load_chart_js() -> str:
31+
if not CHART_JS_PATH.is_file():
32+
raise FileNotFoundError(
33+
f"missing {CHART_JS_PATH} (Chart.js bundle for dashboards)"
34+
)
35+
return CHART_JS_PATH.read_text()
36+
2737

2838
def load_csv(path: Path) -> list[dict[str, Any]]:
2939
if not path.is_file():
@@ -467,13 +477,13 @@ def meta_cell(conv: str, key: str) -> str:
467477
{chr(10).join(chart_calls)}
468478
"""
469479

480+
chart_js = load_chart_js()
470481
return f"""<!DOCTYPE html>
471482
<html lang="en">
472483
<head>
473484
<meta charset="utf-8">
474485
<meta name="viewport" content="width=device-width, initial-scale=1">
475486
<title>{title}</title>
476-
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.min.js"></script>
477487
<style>
478488
*,*::before,*::after{{box-sizing:border-box}}
479489
body{{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
@@ -520,6 +530,9 @@ def meta_cell(conv: str, key: str) -> str:
520530
521531
</div>
522532
<script>
533+
{chart_js}
534+
</script>
535+
<script>
523536
{app_js}
524537
</script>
525538
</body>

0 commit comments

Comments
 (0)