Vizor.ECharts 0.9.7

dotnet add package Vizor.ECharts --version 0.9.7
                    
NuGet\Install-Package Vizor.ECharts -Version 0.9.7
                    
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="Vizor.ECharts" Version="0.9.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Vizor.ECharts" Version="0.9.7" />
                    
Directory.Packages.props
<PackageReference Include="Vizor.ECharts" />
                    
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 Vizor.ECharts --version 0.9.7
                    
#r "nuget: Vizor.ECharts, 0.9.7"
                    
#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 Vizor.ECharts@0.9.7
                    
#: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=Vizor.ECharts&version=0.9.7
                    
Install as a Cake Addin
#tool nuget:?package=Vizor.ECharts&version=0.9.7
                    
Install as a Cake Tool

Vizor.ECharts

Blazor wrapper for Apache ECharts.

  • Supports .NET >= 8.0
  • Ships with echarts 6.0.0
  • Apache-2.0 Licensed (same as echarts)
  • Lots of examples in the Vizor.ECharts.Demo project
  • Refer to the official echarts cheat sheet for a quick introduction

Supported Chart Types:

  • Line
  • Bar
  • Pie
  • Scatter
  • Geo/Map
  • Candlestick
  • Radar
  • Boxplot
  • Heatmap
  • Graph
  • Tree
  • Treemap
  • Sunburst
  • Parallel
  • Sankey
  • Funnel
  • Gauge
  • Pictorial Bar
  • Theme River
  • Custom

How to include

  1. Add a package reference to Vizor.ECharts
  2. Add vizor-echarts-bundle-min.js OR vizor-echarts-min.js to your _Host.cshtml or _Layout.cshtml file
    • vizor-echarts-bundle-min.js includes apache echarts and echarts-stat.
    • vizor-echarts-min.js ONLY contains the binding code and requires you to manually include apache-echarts and plugins.
<script src="_content/Vizor.ECharts/js/vizor-echarts-bundle-min.js"></script>

See the example from the demo application.

How to use

The bindings are nearly identical to the javascript/typescript version. This makes it very easy to translate the examples from the official documentation to C#.

For example: a simple pie chart.

Add a using statement:

@using Vizor.ECharts;

Chart component in your .razor file:

<Vizor.ECharts.EChart Options="@options" Width="auto" Height="400px" />

Chart options in the code section of your razor file:

private ChartOptions options = new()
{
	Title = new()
	{
		Text = "Referer of a Website",
		Subtext = "Fake Data",
		Left = "center"
	},
	Tooltip = new()
	{
		Trigger = ECharts.TooltipTrigger.Item
	},
	Legend = new()
	{
		Orient = Orient.Vertical,
		Left = "left"
	},
	Series = new()
	{
		new PieSeries()
		{
			Name = "Access From",
			Radius = new CircleRadius("50%"),
			Data = new List<PieSeriesData>()
			{
				new() { Value = 1048, Name = "Search Engine" },
				new() { Value = 735, Name = "Direct" },
				new() { Value = 580, Name = "Email" },
				new() { Value = 484, Name = "Union Ads" },
				new() { Value = 300, Name = "Video Ads" },
			},
			Emphasis = new()
			{
				ItemStyle = new()
				{
					ShadowBlur = 10,
					ShadowOffsetX = 0,
					ShadowColor = Color.FromRGBA(0, 0, 0, 0.5)
				}
			}
		}
	}
};

See the full C# code.

Data loading

Most examples that you will find online have very basic datasets. However, in real life, data sets are often huge and come from various different sources.

Vizor.ECharts allows you to define data in 3 different ways:

  1. Inside the ChartOptions, as demonstrated in most examples.
  2. Using async data loaders in C#, allowing you to fetch data directly from the database.
  3. Using external data sources (e.g.: REST API) fetched by the browser.

Async data loading

Specify the DataLoader parameter, this can be a sync or async function.

<Vizor.ECharts.EChart Options="@options" DataLoader="@LoadChartData" Width="800px" Height="400px" />

Typically in the data loader function you update the Series property. However, you can update any chart option.

private async Task LoadChartData()
{
	options.Series = ... ;
}

See full example.

External Data Sources (fetch)

The short version: ExternalDataSource is provided as an EChart parameter, ExternalDataSourceRef is used in the ChartOptions to refer to a specific ExternalDataSource.

Any Data property inside the ChartOptions of type object? accepts a ExternalDataSourceRef allowing you to specify a reference to an external data source.

... = new ExternalDataSourceRef(dataSource);

An array of ExternalDataSource instances must be supplied to the the EChart ExternalDataSources parameter.

<Vizor.ECharts.EChart ExternalDataSources="@(new[] { extData })" ... />

An example on how to construct an ExternalDataSource instance:

... = new ExternalDataSource("https://example.com/api/data/sunburst_simple.json")

See full example.

It is also possible to provide a simple path expression to retrieve only a part of the external data:

... = new ExternalDataSource("https://example.com/api/data/sankey_simple.json", path: "nodes")

See full example.

Or you can execute a function after load to manipulate the loaded data:

... = new ExternalDataSource("/data/les-miserables.json", ExternalDataFetchAs.Json)
{
	AfterLoad = new JavascriptFunction(@"function (graph) {
		graph.nodes.forEach(function (node) { node.symbolSize = 5; });
		return graph;
	}")
};

See full example.

See Javascript functions chapter in the readme for more details about JS functions.

An ExternalDataSourceRef also supports a path expression to select a child object.

... = new ExternalDataSourceRef(graph, "nodes")
... = new ExternalDataSourceRef(graph, "links")
... = new ExternalDataSourceRef(graph, "categories")
}

See example.

Additional credentials, headers, policies, ... can also be supplied. See ExternalDataSource and FetchOptions for more details.

Remark 1: Never make an ExternalDataSource static, you need 1 instance per chart.

Remark 2: You will get a InvalidOperationException if you try to use ExternalDataSource in the chart options.

Datasets

ECharts supports dataset transformations. This allows for simplified data retrieval, without the need to have a separate dataset for different charts or chart types.

See example # and example 2 .

See also the echarts dataset documentation and tutorial .

Javascript functions

ECharts sometimes allows you to assign custom functions instead of values. This can be achieved with the JavascriptFunction class. The class accepts a string literal containing the Javascript function. The function is evaluated inside the brower. Be carefull: syntax errors in the JS function will break the chart serialization.

For example:

Formatter = new JavascriptFunction("function (param) { return param.name + ' (' + param.percent * 2 + '%)'; }")

See full example.

Updating charts

Chart options and/or data can be updated. For example: to show a never ending line chart, a temperature gauge, ... .

First store a reference to your chart.

<Vizor.ECharts.EChart @ref="chart" Options="@options" Width="800px" Height="400px" />
...
private Vizor.ECharts.EChart? chart;

Next modify the chart options. Modified options have full support for Javascript functions and external data sources.

private async Task UpdateChartAsync()
{
	if (chart == null)
		return;

	// modify chart options
	
	await chart.UpdateAsync();
}

See full example.

Filing Bugs / Future Development

See Issues for a list of open tasks/bugs.

Please provide a runnable sample using the ECharts Online Editor and a description of what is wrong with the C# mapping.

Project Lineage & Branching

  • Upstream: This repository began as a fork of the original Vizor.ECharts project (now inactive). That upstream state is retained for reference only.
  • Active branch: dev contains the maintained code. Plan: promote dev to the primary main branch after detaching from the fork (no upstream updates expected).
  • Releases: Build and pack from the active branch (currently dev; will move to main after the promotion step).
  • Contributions: Open pull requests against the active branch; avoid reviving the upstream fork since it is unmaintained.
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 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 is compatible.  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 (2)

Showing the top 2 NuGet packages that depend on Vizor.ECharts:

Package Downloads
Stomme.Server

CMS and Application Framework for Blazor and .NET MAUI

ChartsKit.Core

Core library for ChartsKit, providing chart builders and models.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.9.7 10,960 5/18/2026
0.9.6 1,075 5/15/2026
0.9.5 182 5/12/2026
0.9.4 155 5/12/2026
0.9.3 98,267 2/10/2025
0.9.2 490 1/21/2025
0.9.0 9,310 3/12/2024
0.8.9 641 8/9/2023
0.8.8 336 8/5/2023
0.8.7 330 8/3/2023
0.8.6 332 8/2/2023
0.8.5 331 8/1/2023
0.8.4 318 8/1/2023
0.8.3 340 8/1/2023
0.8.2 333 7/31/2023
0.8.1 307 7/31/2023
0.8.0 424 7/31/2023