-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_report.py
More file actions
66 lines (54 loc) · 1.71 KB
/
Copy pathbasic_report.py
File metadata and controls
66 lines (54 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
"""Basic HolySheet report example.
Creates a simple report with a few KPI cards and a line chart,
then exports it to HTML and JSON.
"""
from __future__ import annotations
from holysheet import KPI, LineChart, Markdown, Report
def main() -> None:
"""Build and export a basic report."""
# Sample data
monthly_data = [
{"month": "Jan", "users": 1_200},
{"month": "Feb", "users": 1_450},
{"month": "Mar", "users": 1_830},
{"month": "Apr", "users": 2_100},
{"month": "May", "users": 2_540},
{"month": "Jun", "users": 2_890},
]
# Build the report
report = Report(
title="Basic Report",
subtitle="A quick overview of key metrics",
theme="light",
)
# Add a markdown intro
report.add(
Markdown(
content=(
"## Welcome\n\n"
"This is a basic HolySheet report demonstrating KPI cards "
"and a simple line chart."
)
)
)
# Add KPI cards
report.add(KPI(label="Total Users", value="2,890", delta="+13.8%", status="positive"))
report.add(KPI(label="Active Rate", value=78, delta="+2.1%", status="positive", unit="%"))
report.add(KPI(label="Churn Rate", value="4.2%", delta="-0.5%", status="positive"))
# Add a line chart
report.add(
LineChart(
title="User Growth",
data=monthly_data,
x="month",
y="users",
height=400,
)
)
# Export
report.export_html("basic_report.html")
report.export_json("basic_report.json")
print("✓ Exported: basic_report.html, basic_report.json")
if __name__ == "__main__":
main()