Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c940c2b
Committing updated Blazor Charts getting started content for Web, Ser…
TrishaKumarasamy Jun 5, 2026
e4d7980
Committing Charts by updating getting started by simplifying run the …
TrishaKumarasamy Jun 5, 2026
2f50190
Merge branch 'development' into charts-getting-started
TrishaKumarasamy Jun 5, 2026
84c05a0
Merge branch 'development' into charts-getting-started
TrishaKumarasamy Jun 8, 2026
bd22e95
Merge branch 'development' into charts-getting-started
TrishaKumarasamy Jun 11, 2026
acb131f
Merge branch 'development' into charts-getting-started
kmkrish001 Jun 15, 2026
e359d18
Update getting-started-with-web-app.md
TrishaKumarasamy Jun 18, 2026
904d31c
Update getting-started.md
TrishaKumarasamy Jun 18, 2026
ebd8104
Update getting-started-wasm.md
TrishaKumarasamy Jun 18, 2026
9aecb5c
Merge branch 'development' into charts-getting-started
TrishaKumarasamy Jun 18, 2026
6c8a5fa
Update getting-started.md
TrishaKumarasamy Jun 18, 2026
e54610f
Update getting-started-with-web-app.md
TrishaKumarasamy Jun 18, 2026
80dc452
Update getting-started.md
TrishaKumarasamy Jun 18, 2026
2c30fc1
Update getting-started-wasm.md
TrishaKumarasamy Jun 18, 2026
c3958f6
Committing Blazor Charts component by updated getting started
TrishaKumarasamy Jun 25, 2026
a1b37ee
Merge branch 'development' into charts-getting-started
TrishaKumarasamy Jun 26, 2026
e1981b7
Committing Blazor Charts component by correcting getting started cont…
TrishaKumarasamy Jun 30, 2026
e4be557
Merge branch 'development' into charts-getting-started
TrishaKumarasamy Jun 30, 2026
be50406
Merge branch 'development' into charts-getting-started
TrishaKumarasamy Jul 1, 2026
5cf9f15
Merge branch 'development' into charts-getting-started
Sittiq3586 Jul 1, 2026
6f941a4
Merge branch 'development' into charts-getting-started
Keerthivasan-Ramamoorthy Jul 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 106 additions & 56 deletions blazor/chart/getting-started-wasm.md
Original file line number Diff line number Diff line change
@@ -1,105 +1,116 @@
---
layout: post
title: Getting Started with Blazor Chart Component | Syncfusion®
description: Checkout and learn about getting started with Blazor Charts in Blazor WebAssembly (WASM) App using Visual Studio and more.
title: Getting Started with Blazor Charts in Blazor WASM App | Syncfusion
description: Checkout and learn about getting started with Syncfusion Blazor Charts in Blazor WebAssembly (WASM) App using Visual Studio and more.
platform: Blazor
control: Chart
control: Charts
documentation: ug
---

<!-- markdownlint-disable MD040 -->

# Getting Started with Blazor Chart Component in Blazor WASM App
# Getting Started with Blazor Charts Component in Blazor WASM App

This section briefly explains how to include [Blazor Charts](https://www.syncfusion.com/blazor-components/blazor-charts) component in a Blazor WebAssembly App using [Visual Studio](https://visualstudio.microsoft.com/vs/), [Visual Studio Code](https://code.visualstudio.com/), and the [.NET CLI](https://learn.microsoft.com/en-us/dotnet/core/tools/).

> **Ready to streamline your Blazor development?** <br/>Discover the full potential of Blazor components with AI Coding Assistants. Effortlessly integrate, configure, and enhance your projects with intelligent, context-aware code suggestions, streamlined setups, and real-time insights—all seamlessly integrated into your preferred AI-powered IDEs like VS Code, Cursor, CodeStudio and more. [Explore AI Coding Assistants](https://blazor.syncfusion.com/documentation/ai-coding-assistant/overview)

## Create a new Blazor WebAssembly (Standalone) App

{% tabcontents %}

{% tabcontent Visual Studio %}

## Prerequisites
Create a **Blazor WebAssembly App** using Visual Studio via [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-10.0&pivots=vs) or the [Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-integration/template-studio).

* [System requirements for Blazor components](https://blazor.syncfusion.com/documentation/system-requirements)
{% endtabcontent %}

## Create a new Blazor App in Visual Studio
{% tabcontent Visual Studio Code %}

Create a **Blazor WebAssembly App** using Visual Studio via [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-10.0&pivots=vs) or the [Syncfusion® Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-integration/template-studio). For detailed instructions, refer to the [Blazor WASM App Getting Started](https://blazor.syncfusion.com/documentation/getting-started/blazor-webassembly-app) documentation.
Run the following command to create a new Blazor WebAssembly App.

{% endtabcontent %}
{% tabs %}
{% highlight razor tabtitle="Terminal" %}

{% tabcontent Visual Studio Code %}
dotnet new blazorwasm -o BlazorApp
cd BlazorApp

## Prerequisites
{% endhighlight %}
{% endtabs %}

* [System requirements for Blazor components](https://blazor.syncfusion.com/documentation/system-requirements)
Alternatively, create a **Blazor WebAssembly App** using Visual Studio Code via [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-10.0&pivots=vsc) or the [Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-code-integration/create-project), or the [C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit) extension.

## Create a new Blazor App in Visual Studio Code
{% endtabcontent %}

Create a **Blazor WebAssembly App** using Visual Studio Code via [Microsoft Templates](https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-10.0&pivots=vsc) or the [Syncfusion® Blazor Extension](https://blazor.syncfusion.com/documentation/visual-studio-code-integration/create-project). For detailed instructions, refer to the [Blazor WASM App Getting Started](https://blazor.syncfusion.com/documentation/getting-started/blazor-webassembly-app?tabcontent=visual-studio-code) documentation.
{% tabcontent .NET CLI %}

Alternatively, create a WebAssembly application by using the following command in the integrated terminal (<kbd>Ctrl</kbd>+<kbd>`</kbd>).
Run the following command to create a new Blazor WebAssembly App.

{% tabs %}

{% highlight c# tabtitle="Blazor WASM App" %}
{% highlight razor tabtitle="Command Prompt" %}

dotnet new blazorwasm -o BlazorApp
cd BlazorApp

{% endhighlight %}

{% endtabs %}

{% endtabcontent %}

{% tabcontent .NET CLI %}
{% endtabcontents %}

## Install the required Blazor package

Install the [Syncfusion.Blazor.Charts](https://www.nuget.org/packages/Syncfusion.Blazor.Charts/) NuGet package. All Syncfusion Blazor packages are available on [nuget.org](https://www.nuget.org/packages?q=syncfusion.blazor). See the [NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages) topic for details.

## Prerequisites
{% tabcontents %}

{% tabcontent Visual Studio %}

Install the latest version of [.NET SDK](https://dotnet.microsoft.com/en-us/download). If the .NET SDK is already installed, determine the installed version by running the following command in a command prompt (Windows), terminal (macOS), or command shell (Linux).
1. Go to *Tools → NuGet Package Manager → Manage NuGet Packages for Solution*.
2. Search the required NuGet package (`Syncfusion.Blazor.Charts`) and install it.

Alternatively, you can install the same package using the Package Manager Console with the following commands.

{% tabs %}
{% highlight c# tabtitle=".NET CLI" %}
{% highlight razor tabtitle="Package Manager Console" %}

dotnet --version
Install-Package Syncfusion.Blazor.Charts -Version {{ site.releaseversion }}

{% endhighlight %}
{% endtabs %}

## Create a Blazor WebAssembly App using .NET CLI
{% endtabcontent %}

{% tabcontent Visual Studio Code %}

Run the following command to create a new Blazor WebAssembly App in a command prompt (Windows) or terminal (macOS) or command shell (Linux). For detailed instructions, refer to the [Blazor WASM App Getting Started](https://blazor.syncfusion.com/documentation/getting-started/blazor-webassembly-app?tabcontent=.net-cli) documentation.
Open the terminal and run the following commands.

{% tabs %}
{% highlight c# tabtitle=".NET CLI" %}
{% highlight razor tabtitle="Terminal" %}

dotnet new blazorwasm -o BlazorApp
cd BlazorApp
dotnet add package Syncfusion.Blazor.Charts -v {{ site.releaseversion }}

{% endhighlight %}
{% endtabs %}

{% endtabcontent %}

{% endtabcontents %}

## Install required Blazor packages

Install the [Syncfusion.Blazor.Charts](https://www.nuget.org/packages/Syncfusion.Blazor.Charts/) NuGet package in your project using the NuGet Package Manager in Visual Studio (*Tools → NuGet Package Manager → Manage NuGet Packages for Solution*), or the integrated terminal in Visual Studio Code (dotnet add package Syncfusion.Blazor.Charts --version {{ site.releaseversion }}), or the .NET CLI.
{% tabcontent .NET CLI %}

Alternatively, run the following commands in the Package Manager Console to achieve the same.
Open the command prompt and run the following commands.

{% tabs %}
{% highlight C# tabtitle="Package Manager" %}
{% highlight razor tabtitle="Command Prompt" %}

Install-Package Syncfusion.Blazor.Charts -Version {{ site.releaseversion }}
dotnet add package Syncfusion.Blazor.Charts -v {{ site.releaseversion }}

{% endhighlight %}
{% endtabs %}

N> All Syncfusion Blazor packages are available on [nuget.org](https://www.nuget.org/packages?q=syncfusion.blazor). See the [NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages) topic for details.
{% endtabcontent %}

{% endtabcontents %}

## Add import namespaces

Expand All @@ -116,9 +127,9 @@ N> The `~/` notation represents the root directory of your project. This file is
{% endhighlight %}
{% endtabs %}

## Register Blazor service
## Register the Blazor service

Register the Blazor service in the **Program.cs** file of your Blazor WebAssembly App. This step enables the Blazor components to work in your application.
Open the **Program.cs** file in Blazor WebAssembly App and register the Blazor service.

{% tabs %}
{% highlight C# tabtitle="Program.cs" %}
Expand All @@ -133,20 +144,20 @@ builder.Services.AddSyncfusionBlazor();
{% endtabs %}

## Add script resources

The script can be accessed from NuGet through [Static Web Assets](https://blazor.syncfusion.com/documentation/appearance/themes#static-web-assets). Include the [script references](https://blazor.syncfusion.com/documentation/common/adding-script-references) in the **~wwwroot/index.html** file.

The JavaScript library needs to be included in your application. The script can be accessed from NuGet through [Static Web Assets](https://blazor.syncfusion.com/documentation/common/adding-script-references#static-web-assets). Include the script reference in the **~/index.html** file (this is the main HTML entry point of your WebAssembly application).

```html
{% tabs %}
{% highlight html tabtitle="index.html" %}

<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>

```

N> Check out the [Adding Script Reference](https://blazor.syncfusion.com/documentation/common/adding-script-references) topic to learn different approaches for adding script references in the Blazor application.
{% endhighlight %}
{% endtabs %}

## Add Blazor Chart component
## Add Blazor Charts component

Add the Blazor Chart component in the **~/Pages/Home.razor** file.
Open a Razor file located in the **~/Pages/*.razor** (for example, **Home.razor**) and add the [Blazor Charts](https://www.syncfusion.com/blazor-components/blazor-charts) component inside the razor file.

{% tabs %}
{% highlight razor tabtitle="Home.razor" %}
Expand All @@ -159,13 +170,51 @@ Add the Blazor Chart component in the **~/Pages/Home.razor** file.
{% endhighlight %}
{% endtabs %}

* Press <kbd>Ctrl</kbd>+<kbd>F5</kbd> (Windows) or <kbd>⌘</kbd>+<kbd>F5</kbd> (macOS) to launch the application. This will render the Blazor Chart component in the default web browser.
**Run the application**

{% tabcontents %}

{% tabcontent Visual Studio %}

Press <kbd>Ctrl</kbd>+<kbd>F5</kbd> (Windows) or <kbd>⌘</kbd>+<kbd>F5</kbd> (macOS) to launch the application. The Blazor Charts component will render in your default web browser.

{% endtabcontent %}

{% tabcontent Visual Studio Code %}

Open the terminal and run the following command.

{% tabs %}
{% highlight razor tabtitle="Terminal" %}

dotnet run

{% endhighlight %}
{% endtabs %}

{% endtabcontent %}

{% tabcontent .NET CLI %}

Open the command prompt and run the following command.

{% tabs %}
{% highlight razor tabtitle="Command Prompt" %}

dotnet run

{% endhighlight %}
{% endtabs %}

{% endtabcontent %}

{% endtabcontents %}

{% previewsample "https://blazorplayground.syncfusion.com/embed/rZLzNsLepwXKBvNw?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" backgroundimage "[Blazor Chart Component](images/getting-started/blazor-chart.webp)" %}

## Populate Blazor chart with data
## Populate Blazor Charts with data

To bind data for the chart component, you can assign an IEnumerable object to the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Charts.ChartSeries.html#Syncfusion_Blazor_Charts_ChartSeries_DataSource) property. It can also be provided as an instance of the [DataManager](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataManager.html).
To bind data for the Blazor charts component, you can assign an IEnumerable object to the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Charts.ChartSeries.html#Syncfusion_Blazor_Charts_ChartSeries_DataSource) property. It can also be provided as an instance of the [DataManager](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DataManager.html).

Map the data fields `Month` and `SalesValue` to the series [XName](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Charts.ChartSeries.html#Syncfusion_Blazor_Charts_ChartSeries_XName) and [YName](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Charts.ChartSeries.html#Syncfusion_Blazor_Charts_ChartSeries_YName) properties, then set the data to the [DataSource](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Charts.ChartSeries.html#Syncfusion_Blazor_Charts_ChartSeries_DataSource) property, and the [chart type](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Charts.ChartSeries.html#Syncfusion_Blazor_Charts_ChartSeries_Type) to **Column** because we will be viewing the data in a column chart.

Expand All @@ -185,7 +234,8 @@ Map the data fields `Month` and `SalesValue` to the series [XName](https://help.
</ChartSeriesCollection>
</SfChart>

@code {
@code
{
public class SalesInfo
{
public string Month { get; set;}
Expand All @@ -207,12 +257,12 @@ Map the data fields `Month` and `SalesValue` to the series [XName](https://help.
{% endhighlight %}
{% endtabs %}

{% previewsample "https://blazorplayground.syncfusion.com/embed/rtBTNiLezckHqsGf?appbar=false&editor=false&result=true&errorlist=false&theme=bootstrap5" backgroundimage "[Blazor Column Chart](images/getting-started/blazor-chart-column.webp)" %}
{% previewsample "https://blazorplayground.syncfusion.com/embed/BjrRZdMVgPGhfPSi?appbar=false&editor=false&result=true&errorlist=false&theme=fluent2" backgroundimage "[Blazor Charts](images/getting-started/blazor-chart-column.webp)" %}

N> [View Sample in GitHub](https://github.com/SyncfusionExamples/Blazor-Getting-Started-Examples/tree/main/Chart)
N> [View Sample in GitHub](https://github.com/SyncfusionExamples/Blazor-Getting-Started-Examples/tree/main/Chart).

## See also

* [Getting Started with Blazor for Client-Side in .NET Core CLI](https://blazor.syncfusion.com/documentation/getting-started/blazor-webassembly-app)
* [Getting Started with Blazor for Server-Side in Visual Studio](https://blazor.syncfusion.com/documentation/getting-started/blazor-web-app)
* [Getting Started with Blazor for Server-Side in .NET Core CLI](https://blazor.syncfusion.com/documentation/getting-started/blazor-web-app)
1. [Getting Started with Blazor for Client-Side in .NET Core CLI](https://blazor.syncfusion.com/documentation/getting-started/blazor-webassembly-app)
2. [Getting Started with Blazor for Server-Side in Visual Studio](https://blazor.syncfusion.com/documentation/getting-started/blazor-web-app)
3. [Getting Started with Blazor for Server-Side in .NET Core CLI](https://blazor.syncfusion.com/documentation/getting-started/blazor-web-app)
Loading