I'm not very comfortable with java. I'm trying to make pie charts by setting the color based on the labels.
I use chartist.min.js
What do I need to change in my code to do this? Thanks
Mon code :
<!DOCTYPE html>
<html>
<head>
<title>Chartist.js Pie Chart avec des Libellés Personnalisés</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/chartist.js/latest/chartist.min.css">
<script src="https://cdn.jsdelivr.net/chartist.js/latest/chartist.min.js"></script>
</head>
<body>
<div class="ct-chart ct-perfect-fourth" id="pie-chart"></div>
<script>
// Données avec libellés et valeurs
var data = {
labels: ['Label 1', 'Label 2', 'Label 3'],
series: [20, 30, 50]
};
// Configuration du graphique
var options = {
width: 300,
height: 300
};
// Création du graphique en secteurs
new Chartist.Pie('#pie-chart', data, options);
</script>
</body>
</html>