Chart
Since 0.1.0-alpha.22Choose the series by the question. For change over time, use lines or areas. To compare amounts, use bars. To show how two measures relate, use a scatter or bubble chart. To show how values spread, use a histogram, box plot or violin. To explain how a total was reached, use a waterfall. Parts of a whole, flows and targets have components of their own, such as PieChart, SankeyChart and BulletChart.
Bar and line series
Give Chart the Items, what each is plotted at as Argument, and a Title. Each series draws one Value per item: ChartBarSeries as bars, and ChartLineSeries as a line, here the plan each month's revenue is measured against.
Static
Preview
- Revenue
- Plan
| Month | Revenue | Plan |
|---|---|---|
| January | $42,100 | $45,000 |
| February | $45,800 | $46,000 |
| March | $51,300 | $48,000 |
| April | $48,700 | $50,000 |
| May | $55,200 | $52,000 |
| June | $58,900 | $54,000 |
| July | $54,400 | $56,000 |
| August | $61,700 | $58,000 |
| September | $66,300 | $60,000 |
| October | $63,800 | $62,000 |
| November | $70,200 | $65,000 |
| December | $78,600 | $70,000 |
Code
@* Revenue each month as columns, against the revenue plan as a line. *@
<Chart Items="_months" Argument="m => m.Month" Title="Revenue against plan, 2026">
<ChartValueAxis Format="C0" />
<ChartBarSeries Value="m => m.Revenue" Color="var(--ib-color-primary)" />
<ChartLineSeries Value="m => m.Plan" Color="var(--ib-color-on-surface)" LineStyle="ChartLineStyle.Dashed" />
</Chart>
{
private record MonthRevenue(string Month, decimal Revenue, decimal Plan);
private readonly MonthRevenue[] _months =
[
new("January", 42_100, 45_000),
new("February", 45_800, 46_000),
new("March", 51_300, 48_000),
new("April", 48_700, 50_000),
new("May", 55_200, 52_000),
new("June", 58_900, 54_000),
new("July", 54_400, 56_000),
new("August", 61_700, 58_000),
new("September", 66_300, 60_000),
new("October", 63_800, 62_000),
new("November", 70_200, 65_000),
new("December", 78_600, 70_000),
];
}Add this example to a page with the izzy CLI:
izzy add component Chart --at <file>:<line>Color sets a series' color in place of the palette's next one. Here the revenue is in the theme's primary color and the plan in its text color, and LineStyle dashes the plan's line.
A ChartValueAxis with a Format formats the values on the axis and in the Show data table. Leave the axes out and they take their defaults.
The chart is rendered on the server with the page, so it shows with JavaScript off.
Topics
- Titles: A chart's title, or a heading on the page that titles it, such as a card's, so the title isn't written twice, and the title's size and alignment.
- Value labels: Each value written beside its bar or point, on any series, past a bar's end or in the middle of a stacked segment, with labels that would overlap left out.
- Reference lines: Lines at a target or an average, and shaded ranges of values or arguments such as a season, each labeled in text and said in the chart's description.
- Annotations: Short notes at a point, and lines at an argument such as a launch day, which move with the chart when the legend rescales it.
- Trends: A dashed line through any series' values: the straight line or curve that fits them best, or a moving average that smooths out the ups and downs.
- A second axis: A second value axis across the plot from the first, for a measure in other units read against the same arguments, with ticks on the first axis's grid lines.
- Axes: Titles beside the axes, a set gap between ticks, a log scale, grid lines, values on either side, and names that turn or wrap when they crowd.
- Colors: Series take the theme's colors, one series in color and the rest gray, shades of one color for ordered series, two colors either side of a middle, or your own.
- Tooltips: Each series' value for the item under the pointer or keyboard focus, said to screen readers, from a template of your own if you like.
- Crosshair: Lines at the item under the pointer and at its nearest value, with both in badges on the axes, to read values off the axes exactly.
- Legend: A legend above, below or beside the chart whose items hide and show their series, with series that can start hidden.
- Zoom: Zooming shows part of the arguments up close, such as a month of a year of days, from a drag, the wheel, a pinch or the keys, with no round trip.
- Synchronized charts: Charts that share a Sync name zoom together and show the same date, number or name when one is pointed at, with no round trip.
- Live data: A chart that reads its data again every few seconds, on a static page with no circuit too, with a Pause button and the item shown kept as data comes and goes.
- Drill-down: Bars, slices and tiles that open the level below them, such as a year's months, with the level in the page's address.
- Download: 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.
Details
The chart is drawn on the server, in the page's HTML, so it shows with no script and no circuit, prints, and fills its container's width.
Argument is what each item is plotted at: names and enums sit in bands, one per item; numbers and dates, on a line or area chart, sit on a scale (any chart with bars uses bands). Each series draws one value per item, as bars, a line, an area, points or bubbles; ChartValueAxis and ChartArgumentAxis set up the axes. Stacking stacks bars and areas; Orientation.Horizontal lays bars across, the arguments down the side.
The text is HTML beside the plot, so it keeps its size at any width; at narrow widths every other label (or every fourth) hides so they don't crowd. --ib-chart-tick-color and --ib-chart-tick-size set the axis labels' color and size (the theme's muted text at --ib-text-xs by default); labels fit by Inter at 12px until the script measures them. --ib-chart-title-size and --ib-chart-title-weight set the title's size and weight (--ib-text-lg, semibold, by default) on every chart: Chart, PieChart, the heatmaps and the rest.
Parts
Written inside Chart. The API page lists their parameters.
ChartValueAxis: a chart's value axis: its range, ticks, format, title and side.ChartArgumentAxis: a chart's argument axis, where each item is plotted: its format, title, grid lines and how crowded names fit:<ChartArgumentAxis Title="Month" LabelFit="ChartLabelFit.Rotate" />.ChartTooltip<TItem>: a chart's tooltip content, in place of the item's argument and each series' value:<ChartTooltip Context="t">@t.Argument: @t.Points[0].Text</ChartTooltip>.ChartReferenceLine: a line across a chart at a value, such as a target, or at an argument, such as a launch date, labeled in text beside it:<ChartReferenceLine Value="150_000" Label="Target" />.ChartReferenceBand: a shaded range across a chart, labeled in text inside it: between two values withFromandTo, such as<ChartReferenceBand From="120_000" To="150_000" Label="Target range" />, or between two arguments withArgumentFromandArgumentTo, such as<ChartReferenceBand ArgumentFrom="@("Nov")" ArgumentTo="@("Dec")" Label="Holiday season" />.ChartAnnotation: a short note at a point on a chart, with a line down to it:<ChartAnnotation Argument="@("Jun")" Value="98_000" Text="Price change" />.ChartDrillLevel<TItem>: one level of a chart's drill-down, such as years, then months, then days: in aChart<T>, in order from the top.ChartDownload: saves a chart as a PNG, from outside the chart: a tile's or card's header.ChartResetZoom: resets a zoomed chart, from outside the chart.ChartZoom: zooms a chart out and in, from outside the chart: two buttons.ChartPause: pauses and resumes a live chart's updates, from outside the chart.
Mode support
| Feature | Static | Interactive |
|---|---|---|
| Drawn on the server, as wide as its container, with labels that thin out as it narrows | Yes | Yes |
| Axis titles, set steps, log scales, grid lines and a second axis | Yes | Yes |
| Value labels, reference lines and bands, notes and trends | Yes | Yes |
| A table of the values behind a "Show data" button | Yes | Yes |
| Tooltips from a template, on hover and from the keyboard | Yes | Yes |
| Legend items that hide and show a series | Yes | Yes |
| Zoom and pan by dragging, Ctrl+wheel, a pinch or the keys, with no round trip | Yes | Yes |
| Opening zoomed into part of the arguments, such as the last quarter | No | Yes |
| The part in view reported to C# as each zoom ends | No | Yes |
| Synchronized charts: a shared `Sync` name zooms them together and shows the same item in each | Yes | Yes |
| Live data read again on an interval, on a static page too, with a Pause button | Yes | Yes |
| Drill-down by levels, with a breadcrumb back up, from links in the address that work with no script | Yes | Yes |
| A button that saves the chart as a PNG, or a button of your own | Yes | Yes |
| On a right-to-left page, the plot keeps its direction while the legend, title and tooltip follow the page; `Reverse` on `ChartArgumentAxis` runs the arguments right to left | Yes | Yes |
Static: static server-side rendering, with no circuit and no WebAssembly. Interactive: Server, WebAssembly or Auto.
Without JavaScript
Every page starts as plain HTML: before IzzyBlazor's script loads on a static page, while an interactive page prerenders, and with JavaScript off.
- Tooltips from a template, on hover and from the keyboard: waits for the script
- Legend items that hide and show a series: waits for the script
- Zoom and pan by dragging, Ctrl+wheel, a pinch or the keys, with no round trip: waits for the script
- Synchronized charts: a shared `Sync` name zooms them together and shows the same item in each: waits for the script
- Live data read again on an interval, on a static page too, with a Pause button: waits for the script
- A button that saves the chart as a PNG, or a button of your own: waits for the script
Accessibility
- The chart is a figure captioned by
Title, or named by a heading on the page withTitledBy. - The plot and its axes are one image named by the caption, so a screen reader hears the chart, not each tick.
- "Show data" under the chart opens a table of every value (
DataTable), with no script. - Lines differ by dash and marker shape as well as color; bars keep the legend's order.
- The palette's colors are 3:1 against the surface in dark mode; in light mode pink, yellow, aqua and orange are lighter than that, which the legend, tooltips and table make up for. Palette's shades and diverging ramps keep their lightest step at about 2:1, so the data table matters more with them.
- Reference lines and bands are read in the chart's description, such as "Target $150K: $150,000". Value labels are hidden from screen readers, since "Show data" has every value.
- With script, the plot is one Tab stop that keeps the arrow keys, with a screen reader too: each move shows that item's tooltip and says its values.
Keyboard navigation
On the plot
| Press this key | To do this |
|---|---|
| Right or Down | Show the next item's values in the order shown, so Right moves right on a reversed axis too (on a scatter chart, the next point to the right) |
| Left or Up | Show the item before |
| Page Down or Page Up | Move a tenth of the items forward or back |
| Home or End | Go to the first or last item |
| Enter | Open the item's level below (with ChartDrillLevels) |
| Escape | Hide the tooltip |
| Plus or Equals | Zoom in around the item shown (with ChartArgumentAxis Zoom); zoomed in, an arrow key to an item out of view pans to it |
| Minus or Underscore | Zoom out |
| 0 | Zoom all the way out |
| Left or Right or Up or Down | Zoomed in, on a chart with no tooltips, pan a tenth of the view (at least an item) |
Parameters
| Prop | Type | Default |
|---|---|---|
ItemsThe items to chart, one point or bar per series for each. | IEnumerable<TItem>? | Required |
ArgumentWhat each item is plotted at, such as m => m.Month: text, an enum, a number or a date. | Expression<Func<TItem, object?>>? | |
TitleThe chart's title, such as "Revenue by month", shown above it as its caption. | string? | |
HideTitleHides the title, which still names the chart for screen readers. | bool | false |
TitleAlignWhere the title sits: at the start, over the chart's first label, by default (the left, in a left-to-right page); ChartAlign.Center or ChartAlign.End. | ChartAlign | ChartAlign.Start |
TitledByThe id of a heading already on the page that titles the chart, such as a card's, in place of Title: the chart takes its name from it and shows no title of its own. | string? | |
StackingWhether bar and area series stack: ChartStacking.Normal puts each on top of the one before, so the stack's height is the total; ChartStacking.Percent draws each stack to 100%, so the parts show as shares of the whole. | ChartStacking | ChartStacking.None |
OrientationOrientation.Vertical, the default, draws upright columns with the arguments along the bottom; Orientation.Horizontal draws bars across, the arguments down the side, which suits long names. | Orientation | Orientation.Vertical |
HeightThe plot's height. | Length? | computed |
BarWidthHow thick the bars are: the share of its band a bar takes, above 0 and up to 1, such as 0.5 for slim bars with as much room between them. | double? | 0.72 |
TooltipShows a tooltip with every series' value for the item under the pointer, or under keyboard focus on the chart, with script. | bool? | |
PaletteThe colors in order: Colors (the theme's eight, the default), Shades of one color for series in an order, Diverging for series either side of a middle, or your own with Of. | ChartPalette? | |
LegendThe legend and where it goes: above the chart, under the title, when there are two series or more, by default, so its keys are read before the data; ChartLegend.Top, ChartLegend.Bottom, ChartLegend.Start or ChartLegend.End to always show it there, or ChartLegend.None. | ChartLegend | ChartLegend.Auto |
LegendAlignWhere the legend sits along its edge: at the start, by default (the left above or below the chart, the top beside it); ChartAlign.Center or ChartAlign.End. | ChartAlign | ChartAlign.Start |
DataTableThe values as a table: by default behind a "Show data" button that opens it over the chart; ChartDataTable.Collapsed puts it in a disclosure under the chart. | ChartDataTable | ChartDataTable.Popover |
@bind-ViewThe part of the arguments in view, such as the last 30 days: the chart opens zoomed into it. | ChartView? | |
SyncA name the charts it links share, such as Sync="sales": zooming one zooms the others to the same arguments, and pointing at an item shows the item at the same argument (date, number or name) in each, with its tooltip. | string? | |
CrosshairDraws a crosshair at the item under the pointer or keyboard focus: a line across the plot at the item, and one at the value nearest the pointer (snapped to it), with the item's argument and that value in badges on their axes. | bool | false |
SyncViewWith Sync, the chart zooms with the others (and, without its own Zoom, only follows them). | bool | true |
SyncHoverWith Sync, the item pointed at (or chosen by the keys) in another chart shows here too. | bool | true |
RefreshHow often the chart reads its data again, at least a second, such as Refresh="TimeSpan.FromSeconds(5)". | TimeSpan? | |
RefreshFromOn a static page with Refresh: a lighter page to fetch than this one, which renders the same chart with the same id. | string? | |
LiveThe data updates on its own, such as from a timer or SignalR on an interactive page: the chart gets a Pause button, keeps the item shown and the zoom by argument as items come and go, and a view at the latest item follows new data. | bool | false |
@bind-PausedA live chart's updates are paused: it keeps the drawing it has (@bind-Paused). | bool | false |
HidePauseLeaves out a live chart's Pause button, for a page that pauses its updates from its own control (bind Paused). | bool | false |
DownloadShows a button across from the title that saves the chart as a PNG, named after its title, in the color scheme on screen. | bool | false |
DrillWith ChartDrillLevel<T>s: the name of the page address's query value that holds the level drilled into, such as ?drill=2025&drill=Mar. | string? | |
HideBreadcrumbLeaves out a drilled chart's breadcrumb, for a page that shows the level its own way (read it from the address). | bool | false |
ChildContentThe series (ChartBarSeries<T>, ChartLineSeries<T>, ChartAreaSeries<T>, ChartScatterSeries<T>, ChartBubbleSeries<T>, ChartWaterfallSeries<T>), the axes (ChartValueAxis, ChartArgumentAxis), reference marks and a ChartTooltip<T>. | RenderFragment? | |
OnRefreshOn an interactive page with Refresh: raised at each interval while not paused, to load new Items. | EventCallback |
Plus 17 item props and 4 common props.
Full APISee also
- Stat: shows a figure with its trend, read as words.
- Table: displays rows of data users can sort, filter, page and select, with the state in the URL.