<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
npm install --save chart.js
var xValues = ["HTML", "CSS", "JavaScript", "PHP", "Python"];
var yValues = [55, 49, 44, 24, 15];
var barColors = [
"#b91d47",
"#00aba9",
"#2b5797",
"#e8c3b9",
"#1e7145"
];
new Chart("pieChart", {
type: "doughnut",
data: {
labels: xValues,
datasets: [{
backgroundColor: barColors,
data: yValues
}]
},
options: {
title: {
display: true,
text: "Programming Languages"
}
}
});
npm install --save ng2-charts
pnpm add react-chartjs-2 chart.js
# or
yarn add react-chartjs-2 chart.js
# or
npm i react-chartjs-2 chart.js