How can I help you?
Getting Started with ASP.NET MVC Chart Control
18 May 20264 minutes to read
This section briefly explains how to add the ASP.NET MVC Chart control to your ASP.NET MVC application using Visual Studio.
Ready to streamline your Syncfusion® ASP.NET MVC development? Discover the full potential of Syncfusion® ASP.NET MVC controls with Syncfusion® AI Coding Assistant. 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 Visual Studio, Visual Studio Code, Cursor, Syncfusion® CodeStudio and more. Explore Syncfusion® AI Coding Assistant
Prerequisites
Refer to the System requirements for ASP.NET MVC controls before creating the application.
Create an ASP.NET MVC Application with HTML Helper
You can create an ASP.NET MVC application using either of the following options:
Install the ASP.NET MVC NuGet Package
To add Syncfusion® ASP.NET MVC controls to the application, open the NuGet Package Manager in Visual Studio by selecting Tools > NuGet Package Manager > Manage NuGet Packages for Solution. Search for Syncfusion.EJ2.MVC5, and then install it.
Install-Package Syncfusion.EJ2.MVC5 -Version 33.2.3NOTE
Syncfusion® ASP.NET MVC controls are available in nuget.org. Refer to the NuGet packages topic to learn more about installing NuGet packages in various operating system environments. The Syncfusion.EJ2.MVC5 NuGet package depends on Newtonsoft.Json for JSON serialization and Syncfusion.Licensing for validating the Syncfusion® license key.
Add the Namespace
Add the Syncfusion.EJ2 namespace reference in the Web.config file available in the Views folder.
<namespaces>
<add namespace="Syncfusion.EJ2" />
</namespaces>Add Script Resources
Add the script reference inside the <head> element of the ~/Views/Shared/_Layout.cshtml file as follows.
<head>
...
<!-- Syncfusion ASP.NET MVC controls scripts -->
<script src="https://cdn.syncfusion.com/ej2/33.2.3/dist/ej2.min.js"></script>
</head>NOTE
Refer to the Adding Script Reference topic to learn different approaches for adding script references in your ASP.NET MVC application.
Register the Syncfusion® Script Manager
Register the script manager EJS().ScriptManager() at the end of the <body> element in the ~/Views/Shared/_Layout.cshtml file as follows.
<body>
...
<!-- Syncfusion ASP.NET MVC Script Manager -->
@Html.EJS().ScriptManager()
</body>Add the ASP.NET MVC Chart Control
Add the Syncfusion® ASP.NET MVC Chart control to the ~/Home/Index.cshtml page.
@Html.EJS().Chart("container").Render()Press Ctrl+F5 on Windows or ⌘+F5 on macOS to run the application. The Syncfusion® ASP.NET MVC Chart control will be rendered in the default web browser.

Render a Chart with Data
To render a column chart with data, define a data source and bind it to the chart series using the DataSource, XName, and YName properties.
@{
var chartData = new List<object>
{
new { Month = "Jan", Sales = 35 },
new { Month = "Feb", Sales = 28 },
new { Month = "Mar", Sales = 34 },
new { Month = "Apr", Sales = 32 },
new { Month = "May", Sales = 40 }
};
}
@Html.EJS().Chart("container").Title("Monthly Sales").PrimaryXAxis(px => px
.ValueType(Syncfusion.EJ2.Charts.ValueType.Category)
).Series(series =>
{
series.DataSource(chartData)
.XName("Month")
.YName("Sales")
.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Column)
.Add();
}).Render()
NOTE
Explore the sample on GitHub to understand how this getting started example works.