Currently, I am utilizing Chart.js to visualize my data as shown in the following image:
https://i.sstatic.net/5sEHW.png
My goal is to incorporate an image in the center of the chart.
https://i.sstatic.net/YDlOd.png
Is there a way to insert an image in the middle of the Donut Chart?
Here is the JavaScript code I have been working with:$.ajax({
type: "POST",
url: "/Plant/SunChart",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (jsonData) {
var items = jsonData[0];
var countOfItems = jsonData[1];
var ctx = document.getElementById("sunPieChart");
var myPieChart = new Chart(ctx, {
type: 'doughnut',
data: {
labels: items,
datasets: [{
data: countOfItems,
backgroundColor: ['#ffff00', '#ffffa4', '#ced5df'],
hoverBackgroundColor: ['#ffff00', '#ffffa4', '#ced5df'],
hoverBorderColor: "rgba(234, 236, 244, 1)",
}],
},
options: {
maintainAspectRatio: false,
tooltips: {
backgroundColor: "rgb(255,255,255)",
bodyFontColor: "#858796",
borderColor: '#dddfeb',
borderWidth: 1,
xPadding: 15,
yPadding: 15,
displayColors: false,
caretPadding: 10,
},
legend: {
display: false
},
cutoutPercentage: 80,
},
});
}
});