NTComponents.Charts 2.0.0-preview.2

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

NTComponents.Charts

Interactive Blazor charts powered by SkiaSharp for .NET 9, 10, and 11. The library uses NTComponents 2.0.0-preview.76 and its current Material 3 icon buttons and theme runtime.

Install NTComponents.Charts, register NTComponents services with builder.Services.AddNTServices(), and include NTHeadDependencies in your application's head. For a WebAssembly host, include the NTComponents and Charts scoped stylesheets in wwwroot/index.html.

@using NTComponents.Charts
@using NTComponents.Charts.Core
@using NTComponents.Charts.Core.Axes

<div style="height: 320px">
    <NTChart TData="SalesPoint">
        <NTXAxisOptions ValueSelector="@(point => point.Month)" />
        <NTYAxisOptions ValueSelector="@(point => point.Total)" />
        <NTLineSeries Data="_sales" XValue="@(point => point.Month)" YValueSelector="@(point => point.Total)" />
    </NTChart>
</div>

@code {
    private readonly SalesPoint[] _sales = [new("January", 120m), new("February", 180m)];
    private sealed record SalesPoint(string Month, decimal Total);
}

Chart colors use NTColor, the Material 3 color-role enum in NTComponents. Leave a color null to use the chart default or palette; TnTColor.None has no NTColor equivalent. Charts refresh their palette after the theme runtime's nt-theme-changed event, including light/dark and contrast changes. Export and reset use named NTIconButton actions; AllowExport and series interaction flags control their visibility. Unmatched attributes such as aria-label and data-* are forwarded to the chart root.

Canvas drawings and PNG exports use embedded Roboto Bold (700), Medium (500), and Regular (400) font files, without synthetic bolding. Titles, axes, legends, and data labels use Bold; tooltip labels, annotations, and hierarchy navigation use Medium; debug text uses Regular. These drawings do not depend on installed system fonts or browser font downloads. The redistributed Roboto fonts include their SIL Open Font License in the package.

Series use NTMotionDuration and NTMotionEasing from NTComponents for drawing and visibility transitions. The defaults are AnimationDuration="NTMotionDuration.Ms500" and AnimationEasing="NTMotionEasing.Emphasized". Chart hover effects, including pie explosions and treemap highlighting, use HoverAnimationDuration="NTMotionDuration.Ms250" and HoverAnimationEasing="NTMotionEasing.Standard". Canvas easing matches the NTComponents web curves; AnimationEnabled="false" completes transitions immediately. Bubble radius growth uses the series timing; its physical movement still follows the configured physics settings.

Charts paint on demand and run continuous frames only while a transition or bubble simulation is active. Settled bubble physics sleeps until data, layout, or interactions change. Charts suspend animation frames while hidden or outside the viewport, and redraw after becoming visible, resizing, or changing display density. Axes, titles, legend measurements, and series geometry reuse cached resources between changes. After changing items inside an existing Data collection, call chart.Invalidate() to refresh cached values and redraw. Theme changes redraw the current state without restarting data animations.

The duration parameters now accept enum tokens instead of TimeSpan: replace AnimationDuration="TimeSpan.FromMilliseconds(400)" with AnimationDuration="NTMotionDuration.Ms400", and migrate HoverAnimationDuration in the same way. Custom series should use the protected EaseAnimation(progress) helper in place of the former BackEase(progress) overshoot helper.

When checked out under the NTComponents repository, Charts automatically references the sibling NTComponents project. Use -p:UseLocalNTComponentsProject=false to validate the published NuGet dependency instead.

From this repository's root, run:

npm ci
npm run build:ts
dotnet build NTComponents.Charts.slnx -c Release -m:1 -p:UseLocalNTComponentsProject=false
dotnet test --project "$PWD/Tests/NTComponents.Charts.Tests/NTComponents.Charts.Tests.csproj" -c Release --no-build -p:UseLocalNTComponentsProject=false
npm test
dotnet pack NTComponents.Charts/NTComponents.Charts.csproj -c Release -o artifacts/nuget -p:UseLocalNTComponentsProject=false

The chart module is authored in NTComponents.Charts/wwwroot/ntcomponents-charts.ts with strict TypeScript checking. Run npm ci once, then npm run build:ts before .NET build, pack, or publish so static asset discovery sees the generated module. npm test regenerates the module before running Node's built-in tests. Node 22 or later is required. Generated JavaScript is ignored by Git but included in the NuGet package and consuming application publishes; TypeScript source and declarations are excluded from both.

SkiaSharp's native WebAssembly assets support native linking with the .NET 10 toolchain. The .NET 11 compatibility host validates compilation and trimming only: browser rendering requires native linking, which SkiaSharp 4.153.1 cannot perform with .NET 11 RC's Emscripten 6 toolchain (saveSetjmp/testSetjmp are unresolved). .NET 11 browser support requires compatible upstream native assets.

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 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.  net11.0 is compatible. 
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.0.0-preview.4 65 10/29/2026
2.0.0-preview.3 56 10/28/2026
2.0.0-preview.2 60 10/27/2026
2.0.0-preview.1 161 10/21/2026
1.6.0 387 3/12/2026
1.0.0 148 2/20/2026