Renders a horizontal-bar distribution chart for any
(source_table, column) pair. Designed to be used both standalone
(via its own URL) and embedded inside other reports.
Distribution — set as ReportType in def_report.
def Render(self, Param1="", Param2="", Param3="") -> str:
Param1 — source table (e.g. bloom_sim_hc_col_bl_v1).Param2 — column to group by (e.g. Outcome).Param3 — optional WHERE clause body (no leading WHERE).The standalone URL is
/report/distribution/<source_table>/<column>[/<where>].
import ObjReportDistribution
dist = ObjReportDistribution.Report(self.DB)
html = dist.render_fragment(
source_table="bloom_sim_hc_col_bl_v1",
column="Outcome",
empty_label="(unmatched)",
highlight_empty=True,
limit=20,
)
render_fragment() returns the bar list with its own scoped styles —
caller wraps it in a panel + heading.
source_table (required) — must be [A-Za-z0-9_]+.column (required) — same regex.where — extra SQL filter, no leading WHERE.empty_label — label for NULL / empty values. Default (empty).highlight_empty — colours the empty bucket as warn. Default True.limit — keep only the top-N rows; remainder shown as a "+ N more"0 = unlimited.The bars use .ax-bar / .ax-bar-fill from ObjCss. Layout-only
styles (multi-column grid, compact row) are scoped under .dist
classes in the companion YAML and use var(--ax-*) exclusively.