# 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](https://demos.telerik.com/aspnet-core/chartwizard/remote-data-binding).

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 HtmlHelper
       @(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);
           })
       )
   ```

   ```Razor TagHelper
       @addTagHelper *, Kendo.Mvc

       <kendo-chartwizard name="chartwizard">
           <datasource type="DataSourceTagHelperType.Ajax">
               <schema data="Data" total="Total" errors="Errors">
                   <model>
                       <fields>
                           <field name="ProductName" type="string"></field>
                           <field name="Quantity" type="number"></field>
                       </fields>
                   </model>
               </schema>
               <transport>
                   <read url="@Url.Action("Read", "Home")"/>
               </transport>
           </datasource>
           <data-columns>
               <data-column field="ProductName" title="Product Name"/>
               <data-column field="Quantity" />
           </data-columns>
       </kendo-chartwizard>
   ```

## See Also

* [Binding the Chart Wizard to Local Data](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/chartwizard/binding/local-binding)

* [Binding the Chart Wizard for ASP.NET Core to Remote Data (Demo)](https://demos.telerik.com/aspnet-core/chartwizard/remote-data-binding)

* [Server-Side API of the Chart Wizard HtmlHelper](https://www.telerik.com/aspnet-core-ui/documentation/api/chartwizard)

* [Server-Side API of the Chart Wizard TagHelper](https://www.telerik.com/aspnet-core-ui/documentation/api/taghelpers/chartwizard)
