TerraFluent.Chart.Reporting

Donut Chart in C#

Build donut charts in C# with DonutHole and DonutCenter — a total in the middle, labelled slices around it, rendered as self-contained SVG.

Donut Chart

Pie chart with DonutHolePercent = 0.55 creating a donut hole.

Revenue by Region — Donut — DonutHolePercent = 0.55 · DonutCenter shows auto total Revenue by Region — Donut — DonutHolePercent = 0.55 · DonutCenter shows auto total — Series: Revenue %. Categories: North America, Europe, Asia-Pacific, Rest of World. Values range from 8 to 42. Revenue by Region — Donut DonutHolePercent = 0.55 · DonutCenter shows auto total Total 100 42% 28% 22% 8% North America: 42 Europe: 28 Asia-Pacific: 22 Rest of World: 8 North America Europe Asia-Pacific Rest of World terrafluent.dev terrafluent.dev

Donut — Center Label

DonutCenter: auto total · title caption · font size.

Donut — Center Label Showcase — DonutCenter: auto total · title caption · FontSize Donut — Center Label Showcase — DonutCenter: auto total · title caption · FontSize — Series: Deployment Mix. Categories: Cloud, On-Premise, Hybrid, Managed Service. Values range from 10 to 45. Donut — Center Label Showcase DonutCenter: auto total · title caption · FontSize Total % 100 45% 25% 20% 10% Cloud: 45% On-Premise: 25% Hybrid: 20% Managed Service: 10% Cloud On-Premise Hybrid Managed Service terrafluent.dev terrafluent.dev

Monthly Sales — USD Donut

Donut chart with USD data labels and DonutCenter total.

Monthly Sales by Product Line — April 2025 — Total sales in center Monthly Sales by Product Line — April 2025 — Total sales in center — Series: Sales. Categories: Software to Training. Values range from 75 to 485. Monthly Sales by Product Line April 2025 — Total sales in center Total Sales $1.3M $37.31k $24.62k $21.15k $11.15k $5.77k Software: $485k Hardware: $320k Services: $275k Support: $145k Training: $75k Software Hardware Services Support Training terrafluent.dev terrafluent.dev

When to use a donut chart

Reach for it when

  • A part-of-whole breakdown where the total itself is worth stating — put it in the hole with DonutCenter.
  • Dashboard tiles, where the ring reads as a compact shape at small sizes.
  • The same cases as a pie chart, when the centre space is useful rather than empty.

Use something else when

  • The comparisons a pie chart is already bad at. Removing the centre makes angle judgement slightly harder, not easier.
  • Many slices — the ring is thinner than a pie, so small slices disappear sooner.
  • A single percentage. Use a data ring or a gauge, which are built for one value.

Donut 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.

// Donut with center label
string svg = ChartBuilder.Create()
    .AsPie()
    .Title("Revenue by Region")
    .Size(620, 460)
    .Labels("North America","Europe","Asia-Pacific","Rest of World")
    .Legend(l => l.AtBottom())
    .AsAnimated()
    .Series(s => s
        .Add("Revenue %", new double[] { 42, 28, 22, 8 },
            cfg =>
            {
                cfg.DonutHole(0.55);                // 55 % hole radius
                cfg.DataLabel.Show().Radius(1.0).Format("{value}%");
                cfg.DonutCenter.Show().Title("Total");
            }))
    .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.