Struggling to display the data from the Model into the Kendo Bar chart. I want bar chart to display the results as shown in the following figure
The controller returns valid data but chart fails to display the data properly.
Model is
public class FeeCollectionViewModel
{
[Key]
public int FeeCollectionID { get; set; }
public int StudentID { get; set; }
public int FeeModeID { get; set; }
public int FeeTypeID { get; set; }
public string FeeTypeName { get; set; }
public double Amount { get; set; }
public DateTime CollectionDate { get; set; }
}
Here is the View
@using Kendo.Mvc.UI
@using Kendo.Mvc.Extensions
@{
ViewBag.Title = "Fee Statistics";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Fee Statistics</h2>
@(Html.Kendo().Chart<SMS.ViewModels.FeeCollectionViewModel>()
.Name("chart")
.Title("Today's Collection")
.Legend(legend => legend
.Position(ChartLegendPosition.Top)
)
.DataSource(ds => ds
.Read(read => read.Action("TodaysCollection_Read", "FeeCollections"))
.Group(group => group.Add(model => model.FeeTypeName))
)
.Series(series =>
{
series.Column(model => model.Amount).Name("Amount Collected");
})
.CategoryAxis(axis => axis
.Categories(model => model.FeeTypeName)
.Labels(labels => labels.Rotation(-90))
.MajorGridLines(lines => lines.Visible(false))
)
.ValueAxis(axis => axis.Numeric()
.Labels(labels => labels.Format("{0:N0}"))
.MajorUnit(10000)
.Line(line => line.Visible(false))
)
.Tooltip(tooltip => tooltip
.Visible(true)
.Format("{0:N0}")
)
)