File "burndown_001.php"

Full Path: /home/analogde/www/samples/Dev tableau/Improve/burndown_001.php
File size: 3.3 KB
MIME-type: text/html
Charset: utf-8

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Burn Down Chart</title>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <style>
        .chart-container {
            width: 100%; /* Largeur du conteneur */
            height: 100vh; /* Hauteur du conteneur */
            border: 1px solid #ccc; /* Bordure pour une meilleure visibilité */
            position: relative; /* Assure que le conteneur est positionné correctement */
        }
        #burnDownChart {
            width: 100%; /* Largeur du canvas */
            height: 100%; /* Hauteur du canvas */
        }
    </style>
</head>
<body>
    <div class="chart-container">
        <canvas id="burnDownChart"></canvas>
    </div>
    <script>
        // Données simulées pour le Burn Down Chart
        const totalDays = 120;
        const totalTasks = 20;

        // Générer des données de progression aléatoires pour remainingTasks
        const remainingTasks = [];
        let tasksLeft = totalTasks;
        for (let i = 0; i < totalDays; i++) {
            remainingTasks.push(tasksLeft);
            // Simuler la complétion des tâches
            if (tasksLeft > 0 && Math.random() < 0.05) {
                tasksLeft -= 1;
            }
        }

        // Générer des données de progression aléatoires pour pipoTasks
        const pipoTasks = [];
        let pipoTasksLeft = totalTasks;
        for (let i = 0; i < totalDays; i++) {
            pipoTasks.push(pipoTasksLeft);
            // Simuler la complétion des tâches
            if (pipoTasksLeft > 0 && Math.random() < 0.05) {
                pipoTasksLeft -= 1;
            }
        }

        // Configuration du graphique
        const ctx = document.getElementById('burnDownChart').getContext('2d');
        const burnDownChart = new Chart(ctx, {
            type: 'line',
            data: {
                labels: Array.from({ length: totalDays }, (_, i) => i + 1),
                datasets: [{
                    label: 'Tâches restantes',
                    data: remainingTasks,
                    borderColor: 'rgba(75, 192, 192, 1)',
                    borderWidth: 1,
                    fill: false,
                    tension: 0.1
                }, {
                    label: 'Pipo',
                    data: pipoTasks,
                    borderColor: 'rgba(255, 99, 132, 1)',
                    borderWidth: 1,
                    fill: false,
                    tension: 0.1
                }]
            },
            options: {
                scales: {
                    x: {
                        title: {
                            display: true,
                            text: 'Jours'
                        }
                    },
                    y: {
                        title: {
                            display: true,
                            text: 'Tâches restantes'
                        },
                        min: 0,
                        max: totalTasks
                    }
                },
                responsive: true,
                maintainAspectRatio: false
            }
        });
    </script>
</body>
</html>