ChartsKit.Blazor
1.0.5
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
<PackageReference Include="ChartsKit.Blazor" Version="1.0.5" />
<PackageVersion Include="ChartsKit.Blazor" Version="1.0.5" />
<PackageReference Include="ChartsKit.Blazor" />
paket add ChartsKit.Blazor --version 1.0.5
#r "nuget: ChartsKit.Blazor, 1.0.5"
#:package ChartsKit.Blazor@1.0.5
#addin nuget:?package=ChartsKit.Blazor&version=1.0.5
#tool nuget:?package=ChartsKit.Blazor&version=1.0.5
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,AreaChartBuilderPieChartBuilder,RadarChartBuilder,BoxPlotChartBuilderCalendarHeatBuilder,FunnelChartBuilder,GanttChartBuilderGaugeChartBuilder,CandlestickChartBuilder,TreeChartBuilderSunburstChartBuilder,TreemapChartBuilder,MapChartBuilderParallelChartBuilder,MultiLineChartBuilder,SankeyChartBuilderHeatmapChartBuilder,ScatterChartBuilder
Models include:
CategoryData,BoxPlotData,CalendarHeatDataCandlestickData,FunnelData,GanttTaskGaugeData,MapData,RadarIndicator,RadarSeriesDataScatterData,SunburstNode,TreeNode,TreemapNodeSankeyData,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 | Versions 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. |
-
net9.0
- ChartsKit.Core (>= 1.0.3)
- Microsoft.AspNetCore.Components.Web (>= 9.0.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.