CourseWork_SchoolStudyAgain/SchoolAgainStudy/TeacherWebClient/Views/Home/TopStudents.cshtml

33 lines
874 B
Plaintext
Raw Normal View History

2023-05-19 18:30:49 +04:00
@using SchoolAgainStudyContracts.ViewModel;
@model List<TopersViewModel>
<script type="text/javascript">
var result = @Html.Raw(ViewBag.DataPoints);
var dataPoints = [];
for (var i = 0; i < result.length; i++) {
dataPoints.push({ label: result[i].Name, y: result[i].Count });
}
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
theme: "theme1",
animationEnabled: true,
title: {
text: "Топ студентов"
},
data: [
{
// change type to bar, line, area, pie, etc.
type: "column",
dataPoints: dataPoints
}
]
});
chart.render();
};
</script>
<body>
<div id="chartContainer">
</div>
</body>