New to Telerik UI for ASP.NET CoreStart a free 30-day trial

Bind Chart to Dynamic Series

Environment

ProductTelerik UI for ASP.NET Core Chart
Product VersionCreated with version 2024.4.1112

Description

How can I bind the Chart to dynamic series?

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(def.Stack);
              }
          })
          .CategoryAxis(axis => axis
             .Categories(new string[] { "A", "B", "C" })
          )
    )

To see the complete example, refer to the ASP.NET MVC application in the UI for ASP.NET MVC Examples repository. You can use this as a starting point to configure the same setup in an ASP.NET Core project.

More ASP.NET Core Chart Resources

See Also