Bubble Chart in C#
Plot three variables at once in C# with AddBubble and BubblePoint — X, Y, and size. Self-contained SVG output, zero third-party dependencies.
Bubble Chart
AddBubble() — scatter with a third dimension (Z).
When to use a bubble chart
Reach for it when
- Three numeric measures per item where the third is a magnitude — revenue, population, spend.
- {"Portfolio and quadrant views"=>"two axes of position, one of weight."}
- Twenty to sixty items. Enough for a pattern, few enough that the bubbles do not merge.
Use something else when
- A third variable that is not a magnitude. Area reads as "how much", so encoding a rate or an index misleads.
- Precise comparison of the third value — area is judged poorly, so pair it with labels or a table.
- Dense data. Overlapping bubbles hide each other far faster than scatter markers do.
Bubble Chart in C#
Lifted verbatim from the chart types reference, so it compiles against the shipped API. See the API reference for every overload and the exact data types each series method accepts.
using TerraFluent.Chart.Reporting.Models;
string svg = ChartBuilder.Create()
.Title("Market Share vs. Growth — Bubble Size = Revenue")
.Size(700, 400)
.XAxis(x => { x.Title = "Market Share (%)"; x.Min = 0; x.Max = 40; })
.YAxis(y => { y.Title = "YoY Growth (%)"; y.Min = -10; y.Max = 50; })
.AsAnimated()
.Legend(l => l.TopRight())
.Series(s => s
.AddBubble("Product A", new[]
{
new BubblePoint(12, 28, 85), // (X=market share, Y=growth, Z=revenue $M)
new BubblePoint(22, 15, 120),
new BubblePoint( 8, 42, 60),
})
.AddBubble("Product B", new[]
{
new BubblePoint(30, 5, 200),
new BubblePoint(18, 22, 95),
new BubblePoint(35, -5, 140),
}))
.RenderToSvg();Install
dotnet add package TerraFluent.Chart.Reporting
- MIT licensed — free for commercial use, no chart limits, no watermarks.
- Zero dependencies — nothing but the .NET base class library.
- netstandard2.0 through net10.0 — .NET Framework 4.6.1+, .NET Core 2.0+, and every modern release.
- Output is one SVG string — embed it in HTML, a PDF, or a Word document.