Plotly.Blazor 7.0.0

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

Plotly.Blazor

Build Status Examples Status NuGet Status Forks Stars License

This library packages the well-known charting library plotly.js into a Razor component that can be used in a Blazor project. The advantage of this wrapper is that the plotly scheme itself is used to generate the classes. So you can automatically update to the latest plotly.js version with the help of the generator.

Getting Started

Prerequisites

To create Blazor Server Apps, install the latest version of Visual Studio 2019 with the ASP.NET and web development workload. For Blazor WebAssembly you need at least Visual Studio 2019 16.6+. Another alternative would be to use Visual Studio code. Click here for more information.

Plotly.Blazor with version >= 2.0.0 requires .NET 6 or higher.

Installing

After you have created your Blazor project, you need to do the following steps:

Install the latest NuGet Package

Using Package Manager

Install-Package Plotly.Blazor

Using .NET CLI

dotnet add package Plotly.Blazor

If you are using 4.1.0 or lower, then add the following lines to your _Layout.cshtml above the _/framework/blazor.webassembly.js or _/framework/blazor.server.js

<script src="_content/Plotly.Blazor/plotly-latest.min.js" type="text/javascript"></script>
<script src="_content/Plotly.Blazor/plotly-interop.js" type="text/javascript"></script>

Add the following lines to your _Imports.razor

@using Plotly.Blazor
@using Plotly.Blazor.Traces

Now we're ready to go! 🎉

Usage

Create the Razor component

Info: The chart reference is important so that we can update the chart later.

<PlotlyChart @bind-Config="config" @bind-Layout="layout" @bind-Data="data" @ref="chart"/>

Generate some initial data for your plot.

@code {
    PlotlyChart chart;
    Config config = new Config();
    Layout layout = new Layout();
    // Using of the interface IList is important for the event callback!
    IList<ITrace> data = new List<ITrace>
    {
        new Scatter
        {
            Name = "ScatterTrace",
            Mode = ModeFlag.Lines | ModeFlag.Markers,
            X = new List<object>{1,2,3},
            Y = new List<object>{1,2,3}
        }
    };
}

Generate some additional data for your plot.

private async Task AddData(int count = 100)
{
    if (!(chart.Data.FirstOrDefault() is Scatter scatter)) return;
    var (x, y) = Helper.GenerateData(scatter.X.Count + 1, scatter.X.Count + 1 + count);

    await chart.ExtendTrace(x, y, data.IndexOf(scatter));
}

Examples

Here you can find a running instance of the examples. This is always up-to-date with the current state of the develop branch.

What it might look like!

Image of Example

Missing Implementations

  • Events
  • Add multiple traces with one call
  • Delete multiple traces with one call
  • plotly.animate
  • plotly.addFrames
  • plotly.moveTraces

Versioning

We implement SemVer using GitVersion

License

This project is licensed under the MIT License - see the LICENSE file for details

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 Plotly.Blazor:

Package Downloads
Blazorized.AdminLte.Plugins

ADMINLTE plugins for Blazor is a collection of reusable components, with which you can easily develop digital services as a designer or developer. This project gathers a set of curated UI components that have been tested against the Blazorized AdminLTE project.

NEXCODE.Caffeine.UI

Shared Blazor UI Components — Blazor Blueprint, Plotly Charts, Localization

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.0.0 8,100 1/28/2026
6.0.2 103,185 5/6/2025
6.0.1 31,730 2/4/2025
5.4.1 10,220 1/16/2025
5.4.0 17,927 12/16/2024
5.3.0 20,173 10/21/2024
5.2.0 9,246 10/1/2024
5.1.2 8,217 9/17/2024
5.1.1 18,531 6/25/2024
5.1.0 2,369 6/17/2024
5.0.0 964 6/17/2024
4.3.0 34,648 4/8/2024
4.2.0 8,467 3/4/2024
4.1.0 56,878 11/22/2023
4.0.0 6,750 10/21/2023
3.0.0 3,128 10/12/2023
2.25.1 27,825 8/10/2023
2.18.2 67,561 2/24/2023
Loading failed