File size: 1,391 Bytes
aef7e33 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
var data = data;
var backgroundColor = backgroundColor;
var borderColor = backgroundColor;
var labels = labels;
(function($) {
'use strict';
$(function() {
var bestSellersData = {
datasets: [{
data: data,
backgroundColor:
backgroundColor
,
borderColor: backgroundColor,
}],
// These labels appear in the legend and in the tooltips when hovering different arcs
labels: labels
};
var bestSellersOptions = {
responsive: true,
cutoutPercentage: 80,
legend: {
display: false,
},
animation: {
animateScale: true,
animateRotate: true
},
plugins: {
datalabels: {
display: false,
align: 'center',
anchor: 'center'
}
}
};
// Loop through each canvas element with the class 'bestSellers'
document.querySelectorAll('.bestSellers').forEach(function(canvas, index) {
var pieChart = new Chart(canvas, {
type: 'doughnut',
data: bestSellersData,
options: bestSellersOptions
});
});
});
})(jQuery);
|