0
모델에서 검도 막대 차트로 데이터를 표시하는 데 어려움이 있습니다. 나는 다음 그림검도 막대 차트에 데이터가 표시되지 않음
컨트롤러는 유효한 데이터를 반환하지만 차트가 제대로 데이터를 표시하는 데 실패 같이 막대 그래프 결과를 표시합니다.
모델은 여기에
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; }
}
이다보기 GROUPBY 합을 수행하지 않습니다
@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}")
)
)
'.AutoBind (true) '를 추가하면 작동합니까? 또한 콘솔에서 관련된 자바 스크립트 오류가 있는지 확인하고 다른 컨트롤의보기 또는 레이아웃에 ID 'chart'가 있는지 확인하십시오. – zgood