ASP.NET MVC [C#]:
// Controller
List<ChartData> list = new List<ChartData>();
list.Add(new ChartData(1, "Due More Than 10", 0));
list.Add(new ChartData(2, "Due Today", 11));
list.Add(new ChartData(3, "Due Tomorrow", 7));
list.Add(new ChartData(4, "Due Within 10", 48));
list.Add(new ChartData(5, "Overdue", 0));
//Binding dataSource to ViewBag
ViewBag.datasource = list;
// View
@(Html.EJ().Chart("chartContainer")
.Series(sr =>
{
//Binding dataSource to chart
sr.DataSource(ViewBag.datasource);
sr.XName("period");
sr.YName("count");
sr.Type(SeriesType.Pie).Add();
})
)
@(Html.EJ().Grid<OrdersView>("FlatGrid")
//Binding dataSource to grid
.Datasource((IEnumerable<object>)ViewBag.datasource)
.Columns(col =>
{
col.Field("period").HeaderText("Period").Width(80).Add();
col.Field("count").HeaderText("Count").Width(75).Add();
})
) |