ChartsKit.Blazor 1.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package ChartsKit.Blazor --version 1.0.5
                    
NuGet\Install-Package ChartsKit.Blazor -Version 1.0.5
                    
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="ChartsKit.Blazor" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ChartsKit.Blazor" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="ChartsKit.Blazor" />
                    
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 ChartsKit.Blazor --version 1.0.5
                    
#r "nuget: ChartsKit.Blazor, 1.0.5"
                    
#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 ChartsKit.Blazor@1.0.5
                    
#: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=ChartsKit.Blazor&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=ChartsKit.Blazor&version=1.0.5
                    
Install as a Cake Tool

ChartsKit.Blazor

Version: 1.0.5
Author: Shimon Hirari


ChartsKit is a reusable .NET 9 charting library designed to simplify the creation of beautiful, data-driven charts in Blazor applications. It provides a set of strongly-typed C# "Builders" that abstract away the complexity of ECharts JSON configuration, allowing developers to generate a wide variety of charts quickly and safely using familiar C# models.

This library is designed to be extensible, themeable, and easy to integrate into any Blazor Server project.


Features

  • 20+ Chart Types: Includes Bar, Line, Pie, Scatter, Gauge, Funnel, Radar, BoxPlot, Treemap, Candlestick, Heatmap, and many more.
  • Fluent Builder API: A simple, intuitive C# API for configuring charts without writing complex JSON.
  • Theming Support: Easily switch between "light" and "dark" modes.
  • Image Export: Export any chart to PNG or SVG with a single method call.
  • Strongly-Typed Models: Reduce errors with C# data models for all chart types, enabling compile-time safety.
  • Offline First: All required JavaScript assets are bundled with the library, requiring no external CDN links for core functionality.

Installation and Setup

1. Install NuGet Package

dotnet add package ChartsKit.Blazor

2. Register Services

// In Program.cs
builder.Services.AddChartsKit();

3. Include JavaScript Assets

Add these <script> tags at the end of the <body> section in your _Layout.cshtml or App.razor:

<script src="_content/ChartsKit.Blazor/js/echarts.min.js"></script>
<script src="_content/ChartsKit.Blazor/js/world.js"></script>
<script src="_content/ChartsKit.Blazor/js/interop.js"></script>

Quick Start: Your First Chart

@page "/my-first-chart"
@rendermode InteractiveServer

@using ChartsKit.Blazor
@using ChartsKit.Core.Builders
@using ChartsKit.Core.Models

<h3>My First Bar Chart</h3>

<div style="height: 400px; width: 100%;">
    <ChartView Options="@_chartOptions" />
</div>

@code {
    private object? _chartOptions;

    protected override void OnInitialized()
    {
        var barChartBuilder = new BarChartBuilder();

        var myData = new CategoryData[]
        {
            new("Apples", 50),
            new("Oranges", 75),
            new("Bananas", 120)
        };

        _chartOptions = barChartBuilder.Build(myData, seriesName: "Fruit Sales");
    }
}

Advanced Usage

Theming

<ChartView @ref="_chartView" Options="@_chartOptions" Theme="dark" />

Exporting to Image

@page "/advanced-example"
@rendermode InteractiveServer

@using ChartsKit.Blazor
@inject IJSRuntime JSRuntime

<h3>Advanced Chart</h3>

<div style="height: 500px; width: 100%;">
    <ChartView @ref="_chartView" Options="@_chartOptions" />
</div>

<button class="btn btn-primary mt-2" @onclick="ExportChart">Export as PNG</button>

@code {
    private ChartView? _chartView;
    private object? _chartOptions;

    private async Task ExportChart()
    {
        if (_chartView != null)
        {
            var dataUrl = await _chartView.ExportAsync("png");
            if (!string.IsNullOrEmpty(dataUrl))
            {
                await JSRuntime.InvokeVoidAsync("eval", $"let a = document.createElement('a'); a.href = '{dataUrl}'; a.download = 'chart.png'; a.click();");
            }
        }
    }
}

Chart Reference and Examples

Each chart type has a dedicated builder and data model.

Use builders like:

new BarChartBuilder().Build(myData);
new PieChartBuilder().Build(myData, isDoughnut: true);
new RadarChartBuilder().Build(indicators, seriesData);

And data models like:

new CategoryData("Label", value);
new BoxPlotData("Label", new List<double> { ... });
new GaugeData("Metric", value);
new HeatmapData(xLabels, yLabels, dataMatrix);

To generate chartOptions objects passed to <ChartView />.

Builders include:

  • BarChartBuilder, LineChartBuilder, AreaChartBuilder
  • PieChartBuilder, RadarChartBuilder, BoxPlotChartBuilder
  • CalendarHeatBuilder, FunnelChartBuilder, GanttChartBuilder
  • GaugeChartBuilder, CandlestickChartBuilder, TreeChartBuilder
  • SunburstChartBuilder, TreemapChartBuilder, MapChartBuilder
  • ParallelChartBuilder, MultiLineChartBuilder, SankeyChartBuilder
  • HeatmapChartBuilder, ScatterChartBuilder

Models include:

  • CategoryData, BoxPlotData, CalendarHeatData
  • CandlestickData, FunnelData, GanttTask
  • GaugeData, MapData, RadarIndicator, RadarSeriesData
  • ScatterData, SunburstNode, TreeNode, TreemapNode
  • SankeyData, ParallelData, MultiLineData, HeatmapData

Contributing

Contributions are welcome! If you have a suggestion or find a bug, please open an issue on the GitHub repository.


License

This project is licensed under the MIT License.
� 2025 Shimon Hirari

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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
1.0.8 291 7/2/2025
1.0.7 240 7/1/2025
1.0.6 229 7/1/2025
1.0.5 233 7/1/2025
1.0.4 250 7/1/2025
1.0.3 241 6/30/2025
1.0.2 227 6/30/2025
1.0.1 223 6/30/2025
1.0.0 223 6/30/2025