Compact charts and sparklines

Sparklines for Blazor: Compact="true" turns any chart into one, with no axes, grid, legend or title; the series fill the box and the y range fits the data. Give it a small Height and put it in a table, a card or a sentence.

Sparkline

The y range fits the data tightly, so small changes show (bars keep zero). Highlight marks the last, first, lowest or highest value with a dot; it works on normal charts too. The tooltip still works, and screen readers get a short summary such as "Web: 28 to 252 sessions, last 193, falling" instead of a tab stop.

Web sessions, last 48 h
Web: 28 sessions to 252 sessions, last 193 sessions, stable.
193
Code
Razor
<RioChart Items="web" Compact="true" Height="40">
    <LineSeries Name="Web" XValue="r => r.Time" YValue="r => r.Value" Format="#,0 'sessions'"
                Highlight="PointHighlight.Last | PointHighlight.Min | PointHighlight.Max" />
</RioChart>

In a table

Every interactive chart loads the JS module, measures its container and sends its points to the browser. With dozens of charts on a page, Interactive="false" draws plain SVG instead: no JS, no tooltip, no round trips. Give it a Width so it is drawn at its real size (without one it is laid out 160 px wide and scaled to fit). Here the water bottle keeps selling more, and the tent shows a gap while it was sold out.

ProductSold per hour, 48 hLast hour
Trail shoe · Ridge 2
Trail shoe · Ridge 2. Sold: 3 per hour to 24 per hour, last 20 per hour, stable.
20
Rain jacket · Storm
Rain jacket · Storm. Sold: 1 per hour to 15 per hour, last 13 per hour, rising.
13
Headlamp · Beam 400
Headlamp · Beam 400. Sold: 5 per hour to 13 per hour, last 6 per hour, rising.
6
Water bottle · 1 l
Water bottle · 1 l. Sold: 3 per hour to 19 per hour, last 19 per hour, rising.
19
Tent · Dome 2p
Tent · Dome 2p. Sold: 1 per hour to 5 per hour, last 5 per hour, rising.
5
Code
Razor
@foreach (var product in products)
{
    <tr>
        <td>@product.Name</td>
        <td>
            <RioChart Items="product.Readings" Compact="true" Interactive="false" Width="140" Height="28" Title="@product.Name">
                <LineSeries Name="Sold" XValue="r => r.Time" YValue="r => r.Value" Format="0 'per hour'" Highlight="PointHighlight.Last" />
            </RioChart>
        </td>
        <td>@product.LastHour</td>
    </tr>
}

Areas and bars

Area and bar series work the same way. Areas fill down to the bottom of the box; bars start at zero, so their lengths compare.

Revenue, € per 15 min
Revenue: 42 € to 1,709 €, last 1,289 €, stable.
Orders per day, 35 days
Orders: 159 orders to 290 orders, last 273 orders, falling.
Code
Razor
<RioChart Items="revenue" Compact="true" Height="48">
    <AreaSeries Name="Revenue" XValue="r => r.Time" YValue="r => r.Value" Format="#,0 €" Curve="CurveType.Monotone" />
</RioChart>

<RioChart Items="orders" Compact="true" Height="48">
    <BarSeries Name="Orders" XValue="r => r.Time" YValue="r => r.Value" Format="#,0 'orders'" />
</RioChart>

Target range

Annotations still draw, without their text: a ReferenceBand shows the target range at a glance. Bands do not widen the y range, so the line keeps its detail, and a gap (here, while tracking was down) stays a gap.

Conversion vs 2–3 % target
Conversion: 1.73 % to 3.56 %, last 2.94 %, rising. 2 – 3
Code
Razor
<RioChart Items="conversion" Compact="true" Height="40">
    <LineSeries Name="Conversion" XValue="r => r.Time" YValue="r => r.Value" Format="0.00 '%'" Highlight="PointHighlight.Last" />
    <ReferenceBand From="2" To="3" />
</RioChart>

Pies, donuts and radial bars

Round charts work too. Compact, they drop their labels, legend and the donut's center total and fill the box, so give them a square size and put the number next to them. A single radial bar with EndAngle="360" is a progress ring. Hover a slice or bar for its name and value.

Revenue per category. Donut chart with 6 items: Shoes 412, Clothing 236, Camping 148, Accessories 97, Bags 31, Other 15.
Shoes, of revenue44 %
Orders per channel. Pie chart with 2 items: Web 1,840, App 1,160.
Orders in the app39 %
Revenue goal. Radial bar chart with 1 item: Revenue 87.
Revenue goal87 %
This month's goals. Radial bar chart with 4 items: Revenue 87, Orders 74, New customers 41, Reviews 92.
Goals reached2 of 4
Code
Razor
<RioChart Items="categories" Compact="true" Width="48" Height="48" Title="Revenue per category">
    <PieSeries Name="Revenue" XValue="s => s.Name" YValue="s => s.Value" Format="0 k€" InnerRadius="0.55" />
</RioChart>

@* A progress ring: one radial bar all the way round *@
<RioChart Items="revenueGoal" Compact="true" Width="48" Height="48" Title="Revenue goal">
    <RadialBarSeries XValue="s => s.Name" YValue="s => s.Value" Max="100" EndAngle="360" InnerRadius="0.6" Format="0'%'" />
</RioChart>

More chart types

Every chart type has a compact form: candlesticks, heatmaps, box plots, horizontal bars, treemaps and radar charts lose their axes, labels and legend the same way, and keep their tooltip.

Electricity price, €/MWh, 30 days
Price: 27.2 € to 87.7 €, last 49.7 €, falling.
Sessions per weekday and hour
Chart with 7 series. Lowest 4 at Mon 01, highest 278 at Sun 13.
Response time per endpoint
Response time: 34 ms to 215 ms.
Revenue per category, k€
Revenue: 6 k€ to 412 k€.
Disk usage
Treemap with 3 items: Home 58%, Work 29%, System 13%.
Laptop vs class average
Radar chart with 6 items: Laptop: Performance 82, Battery 64, Display 71, Keyboard 90, Weight 55, Price 77; Class average: Performance 75, Battery 75, Display 75, Keyboard 75, Weight 75, Price 75.
Code
Razor
<RioChart Items="prices" Compact="true" Height="48">
    <CandlestickSeries Name="Price" XValue="p => p.Date" OpenValue="p => p.First" HighValue="p => p.Highest"
                       LowValue="p => p.Lowest" CloseValue="p => p.Last" Format="0.0 €" DirectionColors="true" />
</RioChart>

<RioChart TItem="HourCount" Compact="true" Height="48">
    @foreach (var (day, hours) in week)
    {
        <HeatmapSeries Items="hours" Name="@day" XValue="h => h.Hour" YValue="h => h.Sessions" Format="#,0" />
    }
</RioChart>

<RioChart Items="categories" Compact="true" Horizontal="true" Height="48">
    <BarSeries Name="Revenue" XValue="s => s.Name" YValue="s => s.Value" Format="0 k€" />
</RioChart>

<RioChart Items="folders" Compact="true" Height="48">
    <TreemapSeries Name="Disk usage" XValue="f => f.Name" ParentValue="f => f.Parent" YValue="f => f.Gigabytes" Format="0 GB" />
</RioChart>

Auto-compact

Normal charts make room for the plot as they get small: first the axis titles go, then the legend (the tooltip still names the series), the title and the axis labels. A right legend moves to the top on narrow charts. Below 120 × 60 px the chart is drawn as a compact chart. It is on by default; AutoCompact="false" keeps everything at any size. Pick a size:

Chart "Store traffic" with 2 series. Web: 192 values, lowest 28 at 11/17/2026 7:45 AM, highest 252 at 11/16/2026 8:00 PM, trend stable. App: 192 values, lowest 13 at 11/16/2026 7:45 AM, highest 165 at 11/17/2026 7:45 PM, trend rising. Store traffic0200400Nov 1612:00 PMNov 1712:00 PMSessions per 15 minWebAppUse Left and Right to move between points, Up and Down to change series. Press Escape to leave.
Code
Razor
<RioChart Items="web" Height="130" Title="Store traffic"
          XAxis="@(new AxisOptions { Title = "Time" })" YAxis="@(new AxisOptions { Title = "Sessions per 15 min" })">
    <LineSeries Name="Web" XValue="r => r.Time" YValue="r => r.Value" Format="#,0" />
    <LineSeries Items="app" Name="App" XValue="r => r.Time" YValue="r => r.Value" Format="#,0" />
</RioChart>

Options

OptionDefaultMeaning
CompactfalseNo axes, grid, legend or title; a tight y range. Also "compact": true in JSON definitions.
Height300Set it small, e.g. 24–48 px.
Highlight (line, area)nonePointHighlight.Last, First, Min, Max, combined with |.
InteractivetrueFalse: plain SVG without JS (no tooltip). For many charts on a page.
Widththe containerNeeded for exact geometry when Interactive="false".
AutoCompacttrueLeave out axis titles, legend, title and axis labels as a normal chart gets small. Also "autoCompact" in JSON definitions.
KeyboardNavigationoff when compactSet true to make a compact chart a tab stop with arrow-key navigation.
An unhandled error has occurred. Reload 🗙