CourseWork_SchoolStudyAgain/SchoolAgainStudy/StudentWebClient/Views/Home/TopInterests.cshtml

33 lines
892 B
Plaintext

@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: "theme2",
animationEnabled: true,
title: {
text: "Общее развитие интересов"
},
data: [
{
// change type to bar, line, area, pie, etc.
type: "pie",
dataPoints: dataPoints
}
]
});
chart.render();
};
</script>
<body>
<div id="chartContainer">
</div>
</body>