chart() renders responsive browser charts (lazy-loaded so pages without charts pay zero JS cost) supporting line, bar, barh, area, pie, scatter, histogram, heatmap, sparkline, and small-multiple facet grids.
chart()
line
bar
barh
area
pie
scatter
histogram
heatmap
sparkline
facet
<ComponentPreview title="Interactive Bar & Line Charts">
[
{
"type": "chart",
"title": "Weekly Agent Runs",
"chart_type": "bar",
"x": "day",
"y": ["runs"],
"height": 220,
"data": [
{"day": "Mon", "runs": 120},
{"day": "Tue", "runs": 185},
{"day": "Wed", "runs": 240},
{"day": "Thu", "runs": 210},
{"day": "Fri", "runs": 295}
]
},
"title": "Success Rate Trend",
"chart_type": "area",
"y": ["rate"],
"height": 180,
{"day": "Mon", "rate": 98.4},
{"day": "Tue", "rate": 99.1},
{"day": "Wed", "rate": 99.5},
{"day": "Thu", "rate": 99.3},
{"day": "Fri", "rate": 99.8}
}
</ComponentPreview>
<Tabs>
<Tab title="Python">
</Tab>
<Tab title="YAML">
</Tabs>
aiui.chart(..., data=df) accepts pandas and Polars DataFrames directly (duck-typed without importing them). If you already build Plotly figures, aiui.plotly_chart(fig) converts standard Plotly traces (bar, barh, scatter/scattergl line/area/scatter, pie/donut, histogram, heatmap) into native Recharts chart blocks without bundling plotly.js:
aiui.chart(..., data=df)
aiui.plotly_chart(fig)
scattergl
donut
chart
plotly.js
Both work on @aiui.page and inline in chat via await aiui.send_block(...).
@aiui.page
await aiui.send_block(...)
| Parameter | Type | Description |
|---|---|---|
| title, data | str, list[dict] / DataFrame | Chart heading and row-oriented data records (or pandas/Polars DataFrame). |
title
data
str
list[dict]
| chart_type | str | bar, barh, line, area, pie, donut, scatter, histogram, heatmap, or sparkline. |
chart_type
| x, y, y2, stacked | str / list / bool | Axis keys, secondary axis, and stacked bar/area mode. |
x
y
y2
stacked
list
bool
| x_domain, y_domain, x_scale, y_scale, facet | options | Custom domains, log scales, reference lines, and faceted small multiples. |
x_domain
y_domain
x_scale
y_scale
log