Download
Since 0.1.0-alpha.22A download button
To let readers save a chart as an image, set Download. A button across from the title saves it as a PNG named after the title, here "Revenue by region, 2026.png".
Static
Preview
- Americas
- Europe
- Asia Pacific
| Quarter | Americas | Europe | Asia Pacific |
|---|---|---|---|
| Q1 | $412K | $268K | $154K |
| Q2 | $438K | $281K | $171K |
| Q3 | $425K | $297K | $189K |
| Q4 | $476K | $322K | $214K |
Code
@* Quarterly revenue by region, with a button by the title that saves the chart as a PNG. *@
<Chart Items="_quarters" Argument="q => q.Quarter" Title="Revenue by region, 2026" Download>
<ChartValueAxis Format="$#,##0,K" />
<ChartBarSeries Value="q => q.Americas" Name="Americas" />
<ChartBarSeries Value="q => q.Europe" Name="Europe" />
<ChartBarSeries Value="q => q.AsiaPacific" Name="Asia Pacific" />
</Chart>
{
private record QuarterRevenue(string Quarter, int Americas, int Europe, int AsiaPacific);
private readonly QuarterRevenue[] _quarters =
[
new("Q1", 412_000, 268_000, 154_000),
new("Q2", 438_000, 281_000, 171_000),
new("Q3", 425_000, 297_000, 189_000),
new("Q4", 476_000, 322_000, 214_000),
];
}The image is the chart as it shows: twice its size on screen for sharp text, in the light or dark scheme the page is in, with any series the legend hid left out. The buttons, the tooltip and Show data are left out.
Every chart type takes Download: PieChart, NestedDonutChart, FunnelChart, HeatmapChart, CalendarHeatmap, TreemapChart, SankeyChart and RadarChart too.
For a PDF, print the page and choose Save as PDF, or send the chart's picture in a form to a PDF your server builds, as the Downloads article shows.
Your own button
To save a chart from a button of your own, such as one in a card's header, give the chart an id and the button data-ib-chart-download set to that id.
Static
Preview
New signups, last 7 days
Trials and paid plans
- Trials
- Paid
| Day | Trials | Paid |
|---|---|---|
| Mon | 142 | 31 |
| Tue | 168 | 38 |
| Wed | 155 | 35 |
| Thu | 171 | 42 |
| Fri | 149 | 33 |
| Sat | 88 | 14 |
| Sun | 79 | 12 |
Code
@* A dashboard card whose own button saves its chart: the button names the chart by its id. *@
<Card Title="New signups, last 7 days" TitleId="week-signups-heading" Description="Trials and paid plans" Width="Length.Full" MaxWidth="32.Rem">
<CardActions>
<Button Variant="ButtonVariant.Ghost" Size="ControlSize.Sm" StartIcon="Lucide.Download" data-ib-chart-download="week-signups">Download</Button>
</CardActions>
<Chart id="week-signups" Items="_days" Argument="d => d.Day" TitledBy="week-signups-heading" Stacking="ChartStacking.Normal" Height="12.Rem">
<ChartBarSeries Value="d => d.Trials" Name="Trials" />
<ChartBarSeries Value="d => d.Paid" Name="Paid" />
</Chart>
</Card>
{
private record DaySignups(string Day, int Trials, int Paid);
private readonly DaySignups[] _days =
[
new("Mon", 142, 31), new("Tue", 168, 38), new("Wed", 155, 35), new("Thu", 171, 42),
new("Fri", 149, 33), new("Sat", 88, 14), new("Sun", 79, 12),
];
}A chart titled by a heading (TitledBy) or with HideTitle gets its title written above it in the image, so the picture says what it shows.
The button works on a static page with no circuit, as on an interactive one.