"""Histogram template — fetch-and-adapt from d3-graph-gallery.com. Adapted from d3-graph-gallery.com (Yan Holtz) — https://d3-graph-gallery.com/graph/histogram_basic.html """ from __future__ import annotations from pydantic import BaseModel from app.agents.d3.registry import D3Template, register class HistogramData(BaseModel): title: str = "" x_label: str = "" values: list[float] bins: int = 20 _HTML = """
""" golden_sample = HistogramData( title="Demo", x_label="Value", values=[2, 4, 4, 6, 7, 7, 7, 8, 9, 12], bins=8, ) register( D3Template( id="histogram", family="chart", title="Histogram", when_to_use="Show the distribution of a single numeric variable across many observations.", data_requirements="A list of numeric values (no pre-binning needed).", schema=HistogramData, html_template=_HTML, golden_sample=golden_sample, ) )