Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

Download

Since 0.1.0-alpha.22
Download puts a button by the title that saves the chart as a PNG named after it. A button of your own can save it too, on a static page as well.

A 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

Revenue by region, 2026
  • Americas
  • Europe
  • Asia Pacific
Arrow keys move between values; Escape hides the tooltip.

Code

Download.razor
@* 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>

@code {
    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
Arrow keys move between values; Escape hides the tooltip.

Code

DownloadButton.razor
@* 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>

@code {
    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.

Connection lost

Rejoining the server…