Chart
Since 0.1.0-alpha.22IzzyBlazor.Chart<TItem> in the IzzyBlazor.Core package, generated from the 0.1.0-alpha.31 assembly
and its doc comments.
Properties (29)
ItemsIEnumerable<TItem>? requiredThe items to chart, one point or bar per series for each.
ArgumentExpression<Func<TItem, object?>>?What each item is plotted at, such as m => m.Month: text, an enum, a number or a date. Text and enums are bands in item order; numbers and dates are a scale on a line or area chart. Required, unless ChartDrillLevel<T>s give each level's.
Titlestring?The chart's title, such as "Revenue by month", shown above it as its caption. It also names the chart for screen readers. A chart needs a Title or TitledBy.
HideTitlebool = falseHides the title, which still names the chart for screen readers.
TitleAlignChartAlign = ChartAlign.StartWhere 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.
TitledBystring?The 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.
StackingChartStacking = ChartStacking.NoneWhether 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. Lines never stack.
OrientationOrientation = Orientation.VerticalOrientation.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.
HeightLength? (computed)The plot's height. Defaults to 18rem. The chart is always as wide as its container.
BarWidthdouble? = 0.72How 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. A stack counts as one bar, and bars side by side share it. Defaults to 0.72. The plot's size and the number of bars set the band; this sets how much of it is bar. Not a histogram's, whose bars fill their bins.
Tooltipbool?Shows a tooltip with every series' value for the item under the pointer, or under keyboard focus on the chart, with script. By default it's on unless every series writes its values as Labels, which the tooltip would repeat; true or false decides. Off, the tooltips are left out of the page.
PaletteChartPalette?LegendChartLegend = ChartLegend.AutoThe 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. Beside the chart, it moves above or below under 30rem.
LegendAlignChartAlign = ChartAlign.StartWhere 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.
DataTableChartDataTable = ChartDataTable.PopoverThe 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.
@bind-ViewChartView?The part of the arguments in view, such as the last 30 days: the chart opens zoomed into it. Null (the default) shows every item. With Zoom the reader zooms from there, and ViewChanged says where to (@bind-View).
Syncstring?A 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. A RangeSelector<T> with the name zooms them all. The charts match by argument, so they can cover different spans.
Crosshairbool = falseDraws 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. On a scatter or bubble chart both lines run through the nearest point. It goes with the tooltip, so with tooltips off there's none.
SyncViewbool = trueSyncHoverbool = trueWith Sync, the item pointed at (or chosen by the keys) in another chart shows here too. On by default.
RefreshTimeSpan?How often the chart reads its data again, at least a second, such as Refresh="TimeSpan.FromSeconds(5)". On a static page the page is fetched again and the chart drawn from it (set an id, which finds it there); on an interactive page OnRefresh is raised, for you to load new Items. Not while the tab is hidden or the chart is off-screen (static), nor while paused. Makes the chart Live.
RefreshFromstring?On a static page with Refresh: a lighter page to fetch than this one, which renders the same chart with the same id.
Livebool = falseThe 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. Refresh sets it.
@bind-Pausedbool = falseA live chart's updates are paused: it keeps the drawing it has (@bind-Paused).
HidePausebool = falseLeaves out a live chart's Pause button, for a page that pauses its updates from its own control (bind Paused).
Downloadbool = falseShows a button across from the title that saves the chart as a PNG, named after its title, in the color scheme on screen. With JavaScript off there's no button.
Drillstring?With ChartDrillLevel<T>s: the name of the page address's query value that holds the level drilled into, such as ?drill=2025&drill=Mar. "drill" by default; give each chart that drills on a page its own.
HideBreadcrumbbool = falseLeaves out a drilled chart's breadcrumb, for a page that shows the level its own way (read it from the address).
ChildContentRenderFragment?The series (ChartBarSeries<T>, ChartLineSeries<T>, ChartAreaSeries<T>, ChartScatterSeries<T>, ChartBubbleSeries<T>, ChartWaterfallSeries<T>), the axes (ChartValueAxis, ChartArgumentAxis), reference marks and a ChartTooltip<T>.
Plus 17 item props and 4 common props.
Show them hereEvents (1)
Parts (11)
Components written inside Chart, documented here with it.
ChartValueAxis
A chart's value axis: its range, ticks, format, title and side. A second ChartValueAxis with a Name is drawn at the other side, for series in other units that name it as their ValueAxis: <ChartValueAxis Name="margin" Format="P0" Title="Margin" />.
Namestring?Formatstring?A .NET format string for the values, such as C0, N1 or P0: on the axis, in tooltips and in the data table.
FormatterFunc<double, string>?Writes each value's text yourself, such as v => $"${v / 1e6:0.#}M", in place of Format: on the axis, in tooltips and in the data table. (A percent stack's axis still reads in percent.) Hiding a series from the legend then keeps the axis as it is rather than rescaling it, since its text comes from the server. First axis only.
Mindouble? (computed)Where the axis starts. Defaults to a round number at or below the lowest value (0 with bars and areas); on a second axis, one its ticks line up with the first axis's grid at.
Maxdouble? (computed)Where the axis ends. Defaults to a round number at or above the highest value.
Stepdouble? (computed)The gap between ticks, such as 25_000. The axis's ends round to it unless Min and Max are set. Defaults to a round step for the chart's size; ticks that would crowd still thin out. A step that would make more than 500 ticks is ignored. First axis only: a second axis's ticks fall on the first's grid lines.
Logarithmicbool = falseDraws the axis on a log scale (base 10), for values that span several powers of ten, such as company sizes. Values at or under zero have no place on it and aren't drawn; bars and areas start at the axis's bottom. First axis only.
GridLinesbool = trueDraws a grid line across the plot at each tick. On by default for the first value axis; a second axis's ticks fall on the first's lines, so it has none of its own.
PositionChartAxisPosition = ChartAxisPosition.AutoThe side the axis is drawn at: ChartAxisPosition.Left (the default) or ChartAxisPosition.Right on an upright chart, ChartAxisPosition.Bottom (the default) or ChartAxisPosition.Top on a horizontal one. Sides are physical: a right-to-left page doesn't move the axis. A second axis takes the other side. First axis only.
LabelWidthLength?The least room for the axis's labels beside the plot, such as LabelWidth="Length.Rem(4)", on an upright chart. Give charts stacked over each other the same, such as synced ones (Sync), so their plots line up whatever their values' widths. Wider labels still fit.
Titlestring?A title beside the axis, such as "Revenue (USD)" or "Month".
HideLabelsbool = falseLeaves out the axis's labels, for a small chart or one whose values are labeled on the marks. The scale stays. Not on a second value axis.
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" />.
Formatstring?A .NET format string for the arguments, such as MMM or N0.
FormatterFunc<object?, string>?Writes each argument's text yourself, in place of Format. It gets the item's argument, or a tick on a number or date scale: a double, or a date of the argument's own type. Dates then have no second line for the month or year.
LabelFitChartLabelFit = ChartLabelFit.SkipHow names along the bottom fit when they crowd: skipped (the default), turned 45° first, or all shown, wrapped. Applies to names in bands on an upright chart; ticks on a number or date scale are always chosen to fit.
GridLinesbool = falseDraws grid lines between the arguments (at each tick on a number or date scale). Off by default.
Logarithmicbool = falseDraws the arguments on a log scale (base 10), for numbers that span several powers of ten, such as income per person, where each step of ten counts alike. Arguments at or under zero have no place on it and aren't drawn. Numbers only: a chart of names or dates throws.
Reversebool = falseRuns the arguments backward: the first at the right, or at the bottom on a horizontal chart. For an app whose readers take time right to left. A right-to-left page alone doesn't reverse a chart.
SkipGapsbool = falseSpaces dates by item, not by time: each item takes the same room and a date with no item (a weekend, a holiday, a closed night) takes none, as on a stock chart. The labels still mark where a day, month or year begins. The items need to be in date order. A chart with bars or candles already spaces its dates by item.
Zoombool = falseLets the reader zoom into part of the arguments and pan along them: a drag across the plot, Ctrl (⌘ on a Mac) and the wheel, a pinch, + and − on the focused chart, or the Zoom in and Zoom out buttons by the title. The page still scrolls under the plain wheel and one finger. A ChartRangeSelector in the chart turns it on by itself. The chart's View and ViewChanged say what's in view.
MinZoomSpanint = 2The fewest items a zoom can come down to. 2 by default.
Titlestring?A title beside the axis, such as "Revenue (USD)" or "Month".
HideLabelsbool = falseLeaves out the axis's labels, for a small chart or one whose values are labeled on the marks. The scale stays. Not on a second value axis.
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>. It's drawn on the server for each item, so keep it to text and inline content (no buttons or links). The chart's Tooltip turns tooltips on or off.
ChildContentRenderFragment<ChartTooltipContext<TItem>>? requiredThe tooltip's content for one item.
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" />. With Statistic and Series, the value is the series' average or median. The line is dashed, so it reads apart from the series.
Valuedouble?The value the line is drawn at, on the value axis.
Argumentobject?The argument the line is drawn at, across the argument axis: a name, number or date, such as a launch day.
ValueAxisstring? (computed)Labelstring? (computed)The line's label, such as "Target". Defaults to its value (or the statistic's name).
LabelAlignChartAlign?Where the label sits along the line. On a line across it sits just above the line, at the left by default; on an upright line it sits on the line, at the top by default. ChartAlign.Start is the left or the top, ChartAlign.Center the middle, ChartAlign.End the right or the bottom.
ChartReferenceBand
A shaded range across a chart, labeled in text inside it: between two values with From and To, such as <ChartReferenceBand From="120_000" To="150_000" Label="Target range" />, or between two arguments with ArgumentFrom and ArgumentTo, such as <ChartReferenceBand ArgumentFrom="@("Nov")" ArgumentTo="@("Dec")" Label="Holiday season" />. Its edges are drawn, so it reads apart from the grid.
Fromdouble?Where a band of values starts, on the value axis.
Todouble?Where a band of values ends.
ArgumentFromobject?Where a band of arguments starts: a name, number or date.
ArgumentToobject?Where a band of arguments ends. On names, the band covers both ends' bands.
ValueAxisstring? (computed)Labelstring?The band's label, such as "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 a Chart<T>, in order from the top. The chart groups its items by the level's Argument, adds up each series by its Aggregate, and links each bar or point to the next level down; a breadcrumb above the plot goes back up. The level is in the page's address (Drill), so it works with no script, the browser's Back goes up a level, and a level can be bookmarked.
<ChartDrillLevel Argument="s => s.Date.Year" Name="Year" />
ChartDownload
Saves a chart as a PNG, from outside the chart: a tile's or card's header.
Forstring?The id of the chart it acts on. Leave it out in a tile or card with one chart: it acts on that one.
Plus 4 common props.
ChartResetZoom
Resets a zoomed chart, from outside the chart. It shows only while the chart is zoomed in; the chart needs zooming on.
Forstring?The id of the chart it acts on. Leave it out in a tile or card with one chart: it acts on that one.
Plus 4 common props.
ChartZoom
Zooms a chart out and in, from outside the chart: two buttons. The chart needs zooming on.
Forstring?The id of the chart it acts on. Leave it out in a tile or card with one chart: it acts on that one.
Plus 4 common props.
ChartPause
Pauses and resumes a live chart's updates, from outside the chart. Pressed, the chart keeps what it shows. The chart needs Refresh (or updates on an interactive page).
Forstring?The id of the chart it acts on. Leave it out in a tile or card with one chart: it acts on that one.
Plus 4 common props.
Types (12)
ChartAlign
enumWhere a chart's title or legend sits along its edge: for a title or a legend above or below, left, center or right (in a left-to-right page); for a legend beside the chart, top, middle or bottom.
| Value | Description |
|---|---|
Start | At the start: the left (in a left-to-right page), or the top beside the chart. |
Center | Centered. |
End | At the end: the right (in a left-to-right page), or the bottom beside the chart. |
ChartAxisPosition
enumThe side of the plot a value axis is drawn at.
| Value | Description |
|---|---|
Auto | At the left on an upright chart, along the bottom on a horizontal one. |
Left | At the left of an upright chart. |
Right | At the right of an upright chart, as in a chart that reads right to left, with the values beside its first argument. |
Bottom | Along the bottom of a horizontal chart. |
Top | Along the top of a horizontal chart, so the values read before a long list of bars. |
ChartDataTable
enumHow a chart offers its values as a table.
| Value | Description |
|---|---|
Popover | A "Show data" button under the chart that opens the table in a popover over it, so nothing on the page moves (the default). It works with JavaScript off. |
Collapsed | A "Show data" disclosure under the chart, closed until opened, that pushes what's below down: for a report read top to bottom, with the chart and table seen together. |
Visible | The table shows under the chart. |
None | No table, for a page that lists the values elsewhere. |
ChartLabelFit
enumHow a ChartArgumentAxis fits the names along the bottom when they don't all fit side by side.
| Value | Description |
|---|---|
Skip | Names that don't fit are skipped: every other one, then every fourth, and so on. |
Rotate | Names are turned 45° before any are skipped, so more of them show. |
Wrap | Every name shows, wrapped onto more lines in its band. Suits a few long names. |
ChartLegend
enumWhether a chart has a legend, and where it goes.
| Value | Description |
|---|---|
Auto | A Chart's legend above it, under the title, when there are two series or more (a single series is named by the chart's title); a PieChart's beside the circle when there's room, and below it otherwise. |
Top | Above the chart, even for one series. |
Bottom | Below the chart, even for one series. |
Start | Beside the chart on the start side (the left, in a left-to-right page), in a column; below 30rem wide, above it instead. |
End | Beside the chart on the end side (the right, in a left-to-right page), in a column; below 30rem wide, below it instead. |
None | No legend. |
ChartPalette
classThe colors a Chart<T> or PieChart<T> gives its series or slices, or a Gauge its bands, in order: Colors (the default: the theme's palette, set with ChartPalette), one palette whatever the theme's (Contrast, OkabeIto, Calm), one series picked out with Emphasis, Shades of one color, Diverging between two, or your own with Of. Shades and diverging ramps are sampled for the number of series, so three get three even steps, and they turn round in dark mode, where the strongest color is the lightest.
| Member | Description |
|---|---|
Colors | Distinct colors, for series that aren't in an order, such as regions or products. The default. A chart of exactly two, three or four series gets a set picked for that count, so every pair stays apart for color-blind readers ( |
Contrast | The Contrast palette whatever the theme's: eight colors of one lightness, each 3:1 or more on the surface, with sets picked for two, three or four series. The same in every app: it doesn't follow the brand. |
OkabeIto | The Okabe-Ito palette whatever the theme's: the widely used color-blind-safe set, seven colors and then gray. |
Calm | The Calm palette whatever the theme's: muted colors, for dashboards read all day. |
Emphasis(int index, Color? color) | One series in color and every other one in gray, for a chart that makes a point about one series, such as this year against earlier years or one store against the rest. The gray is the text color mixed into the surface, so it keeps 3:1 on the surface in both schemes and the other series stay readable as context. The grays are alike, so give the series names: the legend and tooltips tell them apart. On a line chart, define the picked series last so it's drawn on top. |
Shades(Color color) | Light to dark shades of one color, for series in an order, such as age bands or plan tiers: the first series is the lightest. Past about six, shades are hard to tell apart. |
Tints(Color color) | Light tints of one color up to the color itself, for ranges drawn as large areas, such as a |
Diverging(Color low, Color high) | Two colors that meet at a neutral middle, for series on either side of one, such as answers from "Strongly disagree" to "Strongly agree": the first series is the strongest |
Of(Color[] colors) | Your own colors, one per series in order; they repeat past the last, up to eight. |
ChartStacking
enumWhether a chart's bars and areas sit side by side or on top of each other.
| Value | Description |
|---|---|
None | Bars side by side, areas over each other. |
Normal | Each series on top of the one before, so the stack's height is the total. |
Percent | Stacked, with each stack drawn to 100%, so the parts show as shares of the whole. |
ChartStatistic
enumA value worked out from a series, for a ChartReferenceLine.
| Value | Description |
|---|---|
Average | The mean of the series' values. |
Median | The middle value of the series' values. |
ChartTooltipContext
classWhat a ChartTooltip<T> draws from: the item under the pointer (or keyboard focus) and each series' value for it.
| Member | Description |
|---|---|
Item TItem | The item. |
Index int | The item's place in the chart's |
Argument string | The item's argument as the chart shows it, formatted as on the argument axis. |
Points IReadOnlyList<ChartTooltipPoint> | Each series' value for the item, in the chart's order. |
ChartView
recordThe part of a chart's argument axis in view: from one argument to another, such as two dates, two numbers or two names (both included). A null end is the data's own end. A Chart's View opens it zoomed in, and its ViewChanged says where the reader zoomed to.
| Member | Description |
|---|---|
From object? | The first argument in view, or null for the first item's. |
To object? | The last argument in view, or null for the last item's. |
Length
structA width, height or flex basis: a size token, a keyword, or a CSS length built with a factory such as Rem.
| Member | Description |
|---|---|
Sm | 640px (matches the |
Md | 768px (matches the |
Lg | 1024px (matches the |
Xl | 1280px (matches the |
Prose | A comfortable reading width, 68 characters. |
Full | 100% of the containing block. |
Auto |
|
FitContent |
|
MinContent |
|
MaxContent |
|
Px(double value) | Pixels. |
Rem(double value) | Root ems (16px each by default). |
Percent(double value) | Percent of the containing block. |
Ch(double value) | Character widths, for text measures. |
Vw(double value) | Percent of the viewport width. |
Dvh(double value) | Percent of the dynamic viewport height (accounts for mobile browser bars). |
Of(string css) | Any CSS length, such as |
Css string | The CSS value this length renders as. |
Orientation
enumWhether items run across or down.
| Value | Description |
|---|---|
Vertical | Top to bottom. |
Horizontal | Side by side, wrapping when space runs out. |