I have this query.
SELECT p.courseCategory, COUNT(c.courseField) AS courseCount
from ProgramCategories p left outer join CourseCategory c
on(c.courseField = p.courseCategory)
group by p.courseCategory;
I want to dispaly courseCategory and its count in a bar Chart.
- X axis- for courseCategory
- Y axis- for courseCount
This is the barchart what want in View. This is demo chart working nicely.
<canvas id="income" width="600" height="400"></canvas>
<script>
var barData = {
labels: ["January", "February", "March", "April", "May", "June"],
datasets: [
{
fillColor: "#48A497",
strokeColor: "#48A4D1",
data: [456, 479, 324, 569, 702, 600]
}]
}
var income = document.getElementById("income").getContext("2d");
new Chart(income).Bar(barData);
</script>
To labels I want to set CourseCategories and for data I want to set courseCount. I don't know how to set these records to my View. How the method in controller should be and How I call that in my razor view.