BlazorGraphs 2.1.1

dotnet add package BlazorGraphs --version 2.1.1
                    
NuGet\Install-Package BlazorGraphs -Version 2.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BlazorGraphs" Version="2.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BlazorGraphs" Version="2.1.1" />
                    
Directory.Packages.props
<PackageReference Include="BlazorGraphs" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BlazorGraphs --version 2.1.1
                    
#r "nuget: BlazorGraphs, 2.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BlazorGraphs@2.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BlazorGraphs&version=2.1.1
                    
Install as a Cake Addin
#tool nuget:?package=BlazorGraphs&version=2.1.1
                    
Install as a Cake Tool

BlazorGraphs is a lightweight SVG chart library for Blazor with no Javascript dependency. Build fast, interactive charts and gauges using pure Blazor rendering:

  • Pure Blazor rendering (no JS interop)
  • Lightweight SVG output
  • Zero external dependencies
  • Simple API, fast integration

Charts

  • Histogram
  • Line chart
  • Bar chart
  • Pie chart
  • Donut chart
  • Polar chart
  • Radar chart

Gauges

  • Linear gauge
  • Semicircle gauge

Namespaces

  • BlazorGraphs.Enums
  • BlazorGraphs.Gauges
  • BlazorGraphs.Charts
  • BlazorGraphs.Models
  • BlazorGraphs.Legends
  • BlazorGraphs.Structures

How to use

Each chart or gauge have a dedicated data model as parameter, the data model contains all the data needed to draw the chart.

Each data model has two methods:

  • Add: to add new data to the model
  • Clear: to remove all the existing data from the model

Use the data structures you find in BlazorGraphs.Structures to fill the data model.

Legends

The legend component is separated from the charts, and has a dedicated namespace BlazorGraphs.Legends, which contains:

  • the component LegendBar
  • the struct LegendItem

The LegendBar component accepts the same data models of charts as parameter, since this is separated from the chart, you can place everywhere you want and if horizontally or vertically oriented.

Histogram example

This renders a fully interactive SVG histogram.

<HistChart Model="@histogram"></HistChart>

@{
    histogram = new Histogram("asseX", "asseY", KnownColor.CadetBlue);

    for (int i = 0; i < 10; i++)
    {
        histogram.Add(new Bin()
        {
            Min = i, //bin left side
            Max = i + 1, //bin right side
            Value = 10 + i //bin height
        });
    }
}
Barchart example

This renders a fully interactive SVG bar chart.

<BarChart Model="@bargram"  
          Direction="@Positioning.Vertical">
</BarChart>

@{
    bargram = new Bargram("asseY", KnownColor.RoyalBlue);

    for (int i = 0; i < 10; i++)
    {
        bargram.Add(new Bar()
        {
            Label = $"Bar-{i}", //bar label
            Value = 10 + i //bar height
        });
    }
}
Linechart example

This renders a fully interactive SVG linechart, with the legend at the bottom of the chart.

<LineChart Model="@linegram"></LineChart>
<LegendBar Model="@linegram" 
           Direction="Positioning.Horizontal">
</LegendBar>

@{
    linegram = new Linegram("X1", "Y1");

    List<PointF> points1 = new();
    List<PointF> points2 = new();
    List<PointF> points3 = new();
    List<PointF> points4 = new();

    for (int i=0; i<10; i++)
    {
        points1.Add(new PointF(i, i));
        points2.Add(new PointF(i, i + 2));
        points3.Add(new PointF(i, i + 3));
        points4.Add(new PointF(i, i + 4));
    }

    linegram.Add(new Line("F1", KnownColor.LimeGreen, points1));
    linegram.Add(new Line("F2", KnownColor.OrangeRed, points2, DrawMode.Drawline));
    linegram.Add(new Line("F3", KnownColor.CadetBlue, points3, DrawMode.Drawpoints));
    linegram.Add(new Line("F4", KnownColor.DodgerBlue, points4, DrawMode.Drawpoints | DrawMode.Drawline));
}
Gauge example

This renders a fully interactive SVG linear gauge, the breakpoints are optional.

<LinearGauge Model="@gaugegram"></LinearGauge>

@{
    gaugegram = new Gaugegram(0, 500, "G1", KnownColor.Navy);
    gaugegram.Value = 175;
    gaugegram.AddBreakpoint(new Breakpoint()
    {
        Value = 150,
        Color = KnownColor.Green,
        Label = "LV-1"
    });
    gaugegram.AddBreakpoint(new Breakpoint()
    {
        Value = 250,
        Color = KnownColor.Gold,
        Label = "LV-2"
    });
    gaugegram.AddBreakpoint(new Breakpoint()
    {
        Value = 500,
        Color = KnownColor.Red,
        Label = "LV-3"
    });
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.1 57 5/31/2026
2.1.0 100 5/23/2026
2.0.0 116 4/27/2026
1.4.0 130 4/3/2026 1.4.0 is deprecated because it is no longer maintained.

- fix linear gauge
   - fix color string