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

Remote Binding

The Chart Wizard supports remote data binding that enables you to load the chart data through a remote endpoint.

For a runnable example, refer to the demo on binding the Chart Wizard to remote data.

To configure the Chart Wizard to bind to data received from a remote endpoint, follow the next steps:

  1. Define a Model with the respective properties that must be accessible in the chart (for the axes and series).

    C#
        public class Product
        {
            public int ProductID { get; set; }
            public string ProductName { get; set; }
            public int Quantity { get; set; }
            public decimal Price { get; set; }
            public decimal Tax { get; set; }
            public decimal Total { get; set; }
            public decimal TotalTax { get; set; }
        }
  2. Create an Action method and pass data collection to the ToDataSourceResult() extension method to convert the collection to a DataSourceResult object.

    C#
        public JsonResult Read([DataSourceRequest] DataSourceRequest request)
        {
            return Json(ProductsData().ToDataSourceResult(request));
        }
    
        private static List<Product> ProductsData()
        {
            return new List<Product>()
            {
                new Product { ProductID = 216321, ProductName = "Calzone", Quantity = 1 },
                new Product { ProductID = 546897, ProductName = "Margarita", Quantity = 2 },
                new Product { ProductID = 456231, ProductName = "Pollo Formaggio", Quantity = 1 }
            };
        }
  3. Within the Index.cshtml View, configure the Chart Wizard to use DataSource and specify the name of the Action that returns the data in the Read() option. Also, you must define the Model properties in the DataColumns() configuration to make them accessible through the chart configurator.

    Razor
        @(Html.Kendo().ChartWizard<Product>()
            .Name("chartwizard")
            .DataSource(dataSource => dataSource
                .Read(read => read.Action("Read", "Home"))
            )
            .DataColumns(columns =>
            {
                columns.Add().Field(f => f.ProductName).Title("Product Name");
                columns.Add().Field(f => f.Quantity);
            })
        )

See Also

In this article
See Also
Not finding the help you need?
Contact Support