New to Telerik UI for ASP.NET MVC? Start a free 30-day trial
Bind Chart to Dynamic Series
Updated on Oct 28, 2026
Environment
| Product | Telerik UI for ASP.NET MVC Chart |
| Product Version | Created with version 2024.4.1112 |
Description
How can I bind the Chart to dynamic series?
Model
Define the series data and category values in the view model. The Stack property in this example stores the stack group, while the Stack100 mode is configured in the Chart.
C#
using System.Collections.Generic;
public class MySeriesData
{
public string Name { get; set; }
public string Stack { get; set; }
public decimal[] Data { get; set; }
}
public class MyViewModel
{
public List<string> Categories { get; set; } = new List<string>();
public List<MySeriesData> Series { get; set; } = new List<MySeriesData>();
}
Example
Razor
@model TelerikAspNetCoreApp4.Models.MyViewModel
@(Html.Kendo().Chart()
.Name("Chart")
.Series(series => {
foreach (var def in Model.Series) {
series.Column(def.Data)
.Name(def.Name)
.Stack(ChartStackType.Stack100, def.Stack);
}
})
.CategoryAxis(axis => axis
.Categories(Model.Categories.ToArray())
)
)To see the complete example, refer to the ASP.NET MVC application in the UI for ASP.NET MVC Examples repository.