TerraFluent.Chart.Reporting

Heatmap in C#

Generate heatmaps in C# with AddHeatmap and HeatmapPoint — colour-scaled grids for matrices and correlations, rendered as self-contained SVG.

Heatmap

AddHeatmap() — colour-coded matrix.

Heatmap — Weekly Sales by Region & Day — AddHeatmap() — cell colour interpolates cold→hot by value. Heatmap — Weekly Sales by Region & Day — AddHeatmap() — cell colour interpolates cold→hot by value. — Series: Sales. Categories: Mon to Fri. Heatmap — Weekly Sales by Region & Day AddHeatmap() — cell colour interpolates cold→hot by value. North South East Mon Tue Wed Thu Fri 42 58 73 61 88 31 45 52 78 65 67 83 91 55 48 Sales 31 61 91 terrafluent.dev terrafluent.dev

When to use a heatmap

Reach for it when

  • A value across two categorical dimensions — hour by weekday, region by product.
  • Correlation matrices and confusion matrices, where the pattern matters more than each cell.
  • Spotting hot spots and gaps in a dense grid that a table of numbers would bury.

Use something else when

  • Precise comparison. Colour is the weakest quantitative encoding; add cell labels when the numbers matter.
  • Diverging data on a sequential palette — a scale that does not mark the midpoint hides the sign of the value.
  • Grids so large the cells fall below a few pixels, where nothing is distinguishable.

Heatmap 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("Weekly Sales by Region & Day")
    .Size(700, 380)
    .XAxis("Day", "Mon","Tue","Wed","Thu","Fri")   // column labels
    .Series(s => s
        .AddHeatmap("Sales",
            new[]
            {
                // HeatmapPoint(col, row, value)
                new HeatmapPoint(0,0,42), new HeatmapPoint(1,0,58), new HeatmapPoint(2,0,73),
                new HeatmapPoint(3,0,61), new HeatmapPoint(4,0,88),
                new HeatmapPoint(0,1,31), new HeatmapPoint(1,1,45), new HeatmapPoint(2,1,52),
                new HeatmapPoint(3,1,78), new HeatmapPoint(4,1,65),
                new HeatmapPoint(0,2,67), new HeatmapPoint(1,2,83), new HeatmapPoint(2,2,91),
                new HeatmapPoint(3,2,55), new HeatmapPoint(4,2,48),
            },
            cfg =>
            {
                cfg.DataLabel.Show().Format("{value}");     // show value in each cell
                cfg.HeatmapRowLabels.AddRange(new[] { "North","South","East" });
            }))
    .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.