"""Area chart template — fetch-and-adapt from d3-graph-gallery.com. Adapted from d3-graph-gallery.com (Yan Holtz) — https://d3-graph-gallery.com/graph/area_basic.html """ from __future__ import annotations from pydantic import BaseModel from app.agents.d3.registry import D3Template, register class Point(BaseModel): x: float y: float class AreaData(BaseModel): title: str = "" x_label: str = "" y_label: str = "" data: list[Point] _HTML = """
""" golden_sample = AreaData( title="Demo", x_label="Time", y_label="Value", data=[Point(x=0, y=1), Point(x=1, y=3), Point(x=2, y=2)], ) register( D3Template( id="area", family="chart", title="Area chart", when_to_use="Show a single numeric value's magnitude changing over an ordered/continuous axis, emphasizing volume under the curve.", data_requirements="A sequence of (x, y) points, ordered along x.", schema=AreaData, html_template=_HTML, golden_sample=golden_sample, ) )