"""Bar chart template — fetch-and-adapt reference for all D3 templates. Adapted from d3-graph-gallery.com (Yan Holtz) — https://d3-graph-gallery.com/graph/barplot_basic.html """ from __future__ import annotations from pydantic import BaseModel from app.agents.d3.registry import D3Template, register class BarDatum(BaseModel): name: str value: float class BarChartData(BaseModel): title: str = "" x_label: str = "" y_label: str = "" data: list[BarDatum] _HTML = """
""" golden_sample = BarChartData( title="Demo", x_label="Category", y_label="Value", data=[BarDatum(name="A", value=12), BarDatum(name="B", value=7)], ) register( D3Template( id="bar_chart", family="chart", title="Bar chart", when_to_use="Compare one numeric value across named categories.", data_requirements="Named categories each with a single numeric value.", schema=BarChartData, html_template=_HTML, golden_sample=golden_sample, ) )