0👍
Solved this scenario by adding multiple dataset for pie chart
Code:
var chartData = {
labels: [],
datasets: [{
label: ["Fail", "Pass"],
data: [24, 76],
backgroundColor: [
"#FF0000",
"#90EE90"
],
}, {
label: ["C1", "C2", "C3", "C4", "C5", "C6", "C7", "Total"],
data: [0.5, 0.12, 0.25, 0.40, 0.22, 0.36,5.6],
backgroundColor: [
"#766757",
"#FCB441",
"#E0400A",
"#056492",
"#BFBFBF",
"#1A3B69",
"#90EE90"
],
}]
};
var options = {
legend: false,
}
var pieChart = new Chart(ctx, {
type: 'pie',
data: chartData,
options: options
});
- Chartjs-Chart js: generate dynamic labels according to the data
- Chartjs-Is it possible to have tick stepSize for each dataset in Chart.js?
Source:stackexchange.com