<script>
$(function (){
//- DONUT CHART -
// Get context with jQuery - using jQuery's .get() method.
var donutChartCanvas = $('#donutChart').get(0).getContext('2d')
var donutData = {
labels: [
'TLI',
'MEL',
'NSRE',
],
datasets: [
{
data: [${countTLI} ,${countMEL} , ${countNSRE}],
backgroundColor : ['#f56954', '#00a65a', '#f39c12'],
}
]
}
var donutOptions = {
maintainAspectRatio : false,
responsive : true,
}
//Create pie or douhnut chart
// You can switch between pie and douhnut using the method below.
new Chart(donutChartCanvas, {
type: 'doughnut',
data: donutData,
options: donutOptions
})
//- PIE CHART -
// Get context with jQuery - using jQuery's .get() method.
var pieChartCanvas = $('#pieChart').get(0).getContext('2d')
var pieData = donutData;
var pieOptions = {
maintainAspectRatio : false,
responsive : true,
}
//Create pie or douhnut chart
// You can switch between pie and douhnut using the method below.
new Chart(pieChartCanvas, {
type: 'pie',
data: pieData,
options: pieOptions
})
})
</script>