Repository navigation
Sections and charts
Gil Cleber Barboza edited this page Nov 12, 2026
·
1 revision
Pass sections instead of data + layout for free-form documents:
payload = {
"meta": {"title": "Board Pack", "locale": "en-US"},
"sections": [
{"type": "text", "title": "Intro", "paragraphs": ["Hello.", "World."]},
{"type": "table", "title": "Sales", "layout": {...}, "data": [...]},
{"type": "kpi", "title": "Totals", "items": [{"label": "Orders", "value": 42, "format_mask": "int"}]},
{"type": "chart", "title": "Trend", "chart": {"kind": "bar", "labels": ["Jan", "Feb"], "values": [10, 20]}},
],
}
generate_pdf(payload) # sections.jinja is picked automaticallySection types: table (full tabular engine: layout + data + aggregates + summary), text (paragraphs or single body), kpi (items with label/value/format_mask), chart (see below).
Inline SVG, rendered by Chromium into the PDF:
{"type": "chart", "title": "Trend", "chart": {
"kind": "bar", # bar | line | pie | donut
"labels": ["Q3", "Q4", "Q1"],
"values": [15000, 18000, 20000],
"color": "#0A2F46", # bar/line
"orientation": "vertical",# bar only: vertical | horizontal
"width": 600, "height": 300,
}}Labels are XML-escaped; mismatched/empty/non-numeric series raise ValueError; pie needs a positive total. Python API: build_chart(spec) (not exported at top level — import from isis_report_lib.charts).
XLSX/CSV flatten each section: tables → sheets/sections, text → notes, KPI → label/value, chart → its series data.