Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

Bubble chart

Since 0.1.0-alpha.22
Shows how two measures relate, with a third as each item's size.

Use a bubble chart when a third measure adds to a scatter chart, such as revenue on top of growth and margin. People judge size far less exactly than position, so put the most important measures on the axes. Say what the size means in the title or the legend.

Named bubbles for a third measure

A bubble chart is a scatter whose circles are sized by a third measure. Use ChartBubbleSeries and give it a Size, here each product's revenue.

Static

Preview

Product portfolio: growth, margin and revenue, 2026
Arrow keys move between values; Escape hides the tooltip.

Code

Usage.razor
@* A product portfolio: each product's revenue growth against its margin, sized by its revenue and
   named on the chart, so the big earners and the fast growers stand out at once. *@
<Chart Items="_products" Argument="p => p.Growth" Title="Product portfolio: growth, margin and revenue, 2026">
    <ChartValueAxis Format="P0" Title="Gross margin" />
    <ChartArgumentAxis Format="+0%;−0%;0%" Title="Revenue growth" />
    <ChartBubbleSeries Value="p => p.Margin" Size="p => p.Revenue" SizeFormat="$#,##0,,M" LabelText="p => p.Name" Name="Products" />
    <ChartTooltip>
        <div class="ib-chart-tooltip-title">@context.Item.Name</div>
        <div>Revenue @context.Item.Revenue.ToString("$#,##0,,M"), growth @context.Argument</div>
        <div>Gross margin @context.Item.Margin.ToString("P0")</div>
    </ChartTooltip>
</Chart>

@code {
    private record Product(string Name, double Growth, double Margin, decimal Revenue);

    private readonly Product[] _products =
    [
        new("Analytics", 0.34, 0.71, 18_000_000),
        new("Payments", 0.22, 0.38, 46_000_000),
        new("Mobile SDK", 0.41, 0.62, 6_000_000),
        new("Data export", 0.08, 0.66, 9_000_000),
        new("Support plans", 0.04, 0.29, 22_000_000),
        new("Hosting", 0.15, 0.24, 31_000_000),
        new("Integrations", 0.27, 0.55, 11_000_000),
        new("Training", -0.06, 0.41, 4_000_000),
        new("Legacy CRM", -0.14, 0.52, 14_000_000),
    ];
}

Add this example to a page with the izzy CLI:

bash
izzy add component ChartBubbleSeries --at <file>:<line>

Circles are sized by area, on one scale across every series: revenue twice as large is a circle twice the area. The largest is capped to the plot. Larger bubbles are drawn first, so none hides a smaller one.

SizeFormat sets how sizes read in the tooltip and in Show data. With few bubbles, name each one with LabelText; names that would collide are left out at the widths where they would.

Many bubbles, by group, on a log scale

To spread out values that span a hundredfold, such as income, set Logarithmic on ChartArgumentAxis: each step of ten is an equal distance apart. Here each country's income is plotted against how long its people live, sized by population and colored by region with SeriesBy.

Static

Preview

Income and life expectancy by country, around 2023
  • Asia
  • Americas
  • Africa
  • Europe
  • Oceania
  • Population 1,000M300M
Arrow keys move between values; Escape hides the tooltip.

Code

BubbleWorld.razor
@* Income per person against life expectancy for 32 countries, each sized by its population and
   colored by its region, income on a log scale: each step of ten in income counts alike.
   Figures are rounded, around 2023. *@
<Chart Items="_countries" Argument="c => c.Income" Title="Income and life expectancy by country, around 2023" Height="Length.Rem(24)" Legend="ChartLegend.End">
    <ChartValueAxis Format="0" Title="Life expectancy (years)" />
    <ChartArgumentAxis Format="$#,##0" Title="GDP per person (US$, log scale)" Logarithmic />
    <ChartBubbleSeries Value="c => c.LifeExpectancy" Size="c => c.Population" SizeFormat="#,##0,,M" SeriesBy="c => c.Region" LabelText="c => c.Name" ShowSizeKey />
    <ChartTooltip>
        <div class="ib-chart-tooltip-title">@context.Item.Name</div>
        <div>@context.Item.Income.ToString("$#,##0") per person</div>
        <div>Lives to @context.Item.LifeExpectancy.ToString("0.0") years</div>
        <div>@context.Item.Population.ToString("#,##0,,") million people</div>
    </ChartTooltip>
</Chart>

@code {
    private record Country(string Name, string Region, double Income, double LifeExpectancy, double Population);

    // Largest first, so the most populous countries are named when names crowd.
    private readonly Country[] _countries =
    [
        new("India", "Asia", 2_500, 72.0, 1_430_000_000),
        new("China", "Asia", 12_600, 78.0, 1_410_000_000),
        new("United States", "Americas", 81_700, 78.4, 335_000_000),
        new("Indonesia", "Asia", 4_900, 71.0, 278_000_000),
        new("Pakistan", "Asia", 1_400, 67.0, 240_000_000),
        new("Nigeria", "Africa", 1_600, 54.5, 224_000_000),
        new("Brazil", "Americas", 10_000, 75.8, 216_000_000),
        new("Bangladesh", "Asia", 2_600, 73.5, 173_000_000),
        new("Russia", "Europe", 13_800, 73.2, 144_000_000),
        new("Mexico", "Americas", 13_800, 75.1, 129_000_000),
        new("Ethiopia", "Africa", 1_300, 65.6, 127_000_000),
        new("Japan", "Asia", 33_800, 84.5, 124_000_000),
        new("Philippines", "Asia", 3_700, 69.8, 117_000_000),
        new("Egypt", "Africa", 3_500, 70.2, 113_000_000),
        new("DR Congo", "Africa", 650, 61.6, 102_000_000),
        new("Vietnam", "Asia", 4_300, 74.6, 99_000_000),
        new("Germany", "Europe", 52_700, 81.4, 84_000_000),
        new("Thailand", "Asia", 7_200, 76.4, 72_000_000),
        new("United Kingdom", "Europe", 48_900, 81.3, 68_000_000),
        new("France", "Europe", 44_500, 83.3, 68_000_000),
        new("South Africa", "Africa", 6_000, 61.5, 62_000_000),
        new("Italy", "Europe", 38_400, 83.7, 59_000_000),
        new("Kenya", "Africa", 2_000, 62.7, 55_000_000),
        new("Colombia", "Americas", 6_900, 77.7, 52_000_000),
        new("South Korea", "Asia", 33_100, 83.5, 52_000_000),
        new("Spain", "Europe", 33_500, 83.7, 48_000_000),
        new("Argentina", "Americas", 13_700, 77.4, 46_000_000),
        new("Canada", "Americas", 53_400, 81.7, 40_000_000),
        new("Poland", "Europe", 22_100, 78.5, 37_000_000),
        new("Peru", "Americas", 7_800, 77.7, 34_000_000),
        new("Australia", "Oceania", 64_700, 83.6, 27_000_000),
        new("Singapore", "Asia", 84_700, 83.7, 6_000_000),
    ];
}

With this many bubbles, not every name fits. List the items largest first, and LabelText names the biggest, leaving out those that would collide.

ShowSizeKey adds a key to the legend, with circles for a round size near the largest and a quarter of it, so a size can be read and not only compared. SizeFormat sets how sizes read there. Here the legend is beside the chart, with Legend="ChartLegend.End".

Details

Each circle's area is in proportion to its Size.

Mode support

What works in each mode, Bubble chart
FeatureStaticInteractive
Circles sized by area, on one scale across seriesYesYes
An optional size key of reference circlesYesYes
Each bubble named on the chartYesYes
Drawn on the server, as wide as its container, with labels that thin out as it narrowsYesYes
A table of the values behind a "Show data" buttonYesYes
Tooltips on hover and from the keyboardYesYes
Legend items that hide and show a seriesYesYes

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 on hover and from the keyboard: waits for the script
  • Legend items that hide and show a series: waits for the script

Parameters

ChartBubbleSeries parameters
PropTypeDefault
SizeEach bubble's size, such as d => d.Customers: its area is in proportion to it, on one scale across the chart's bubble series, the largest capped to the plot.Expression<Func<TItem, object?>>Required
SizeFormatA .NET format string for the sizes, such as C0 or $#,##0,,.#M, in the tooltip, the data table and the size key.string?computed
ShowSizeKeyShows a size key: reference circles at the far end of the legend row, for a round size near the largest and a quarter of it, so a bubble's size can be read, not only compared.boolfalse
ValueThe value to draw, such as m => m.Revenue: any number, or null for none.Expression<Func<TItem, object?>>Required
AggregateWith ChartDrillLevel<T>s, how each level adds up its items' values: DataAggregate.Sum (the default), DataAggregate.Avg, DataAggregate.Min, DataAggregate.Max or DataAggregate.Count (the items with a value).DataAggregateDataAggregate.Sum
NameThe series' name, in the legend, the data table and each value's description.string?computed
SeriesBySplits the series into one per value of this, such as p => p.Device: each draws only its own items' values, is named by its value, and takes the next color and marker, in the order the values first appear.Expression<Func<TItem, object?>>?
ColorA CSS color, such as var(--ib-color-danger) or #0f766e.string?computed
LabelsWrites each value beside its bar or point.ChartLabelsChartLabels.None
LabelFormatA .NET format string for this series' labels, such as C0.string?computed
LabelTextWhat each label says in place of its value, such as r => r.Region to name each bubble or point.Expression<Func<TItem, object?>>?
LabelOverlapWhat labels do when they'd overlap others: left out at those widths (ChartLabelOverlap.Hide, the default), or shown anyway (ChartLabelOverlap.Show).ChartLabelOverlapChartLabelOverlap.Hide
TrendDraws a trend through the values: a dashed line in the series' color, named "Revenue trend" (a moving average "Revenue, 7-day average") in the legend, tooltips and data table.ChartTrendChartTrend.None
TrendOrderA polynomial trend's order, 2 (a parabola) to 6.int2
TrendPeriodHow many values a moving average takes in, 2 or more.int3
TrendColorThe trend's CSS color, such as var(--ib-color-danger), used as given.string?computed
ValueAxisThe Name of the value axis the series is read off, for a measure in other units on a second axis at the end side, such as "margin".string?computed
HiddenStarts with the series hidden: the chart is drawn as if it weren't there, and it keeps its place in the legend, to show it again, and in the data table.boolfalse

Connection lost

Rejoining the server…