(0527) 61002 pa.amuntai@gmail.com Portal Resmi (.go.id)
Kembali ke Pengumuman
Pengumuman

Realisasi Anggaran Bulan Februari

Senin, 3 Februari 2025 | Humas PA Amuntai | 990 kali dilihat

{source}

<!DOCTYPE html>
<html lang="id">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Chart dan Pie Chart</title>
    <!-- Bootstrap CSS -->
    <link href="/https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Chart.js -->
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            background-color: #f8f9fa;
            padding: 20px;
        }

        .chart-container {
            width: 90%;
            margin: 30px auto;
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
            border-radius: 20px;
            padding: 25px;
            background: white;
            transition: transform 0.3s ease;
        }

        .chart-container:hover {
            transform: translateY(-5px);
        }

        h2 {
            text-align: center;
            margin: 40px 0 20px;
            color: #2c3e50;
            font-size: 28px;
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 1px;
            position: relative;
            padding-bottom: 10px;
        }

        h2::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 100px;
            height: 3px;
            background: linear-gradient(90deg, #4CAF50, #2196F3);
            border-radius: 2px;
        }

        .dashboard-header {
            text-align: center;
            padding: 20px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 15px;
            margin-bottom: 30px;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="dashboard-header">
            <h1>Dashboard Keuangan</h1>
            <p class="lead">Periode: Februari 2025</p>
        </div>

        <!-- Chart (Bar Chart) -->
        <h2>Grafik Pagu dan Realisasi</h2>
        <div class="chart-container">
            <canvas id="myChart"></canvas>
        </div>

        <!-- Pie Chart -->
        <h2>Proporsi Pagu</h2>
        <div class="text-center mb-3">
            <h4>Total Pagu: <span id="totalPagu">Rp 0</span></h4>
        </div>
        <div class="chart-container">
            <canvas id="myPieChart"></canvas>
        </div>
    </div>

    <script>
        // Fungsi untuk membuat gradien
        function createGradient(ctx, startColor, endColor) {
            const gradient = ctx.createLinearGradient(0, 0, 0, 400);
            gradient.addColorStop(0, startColor);
            gradient.addColorStop(1, endColor);
            return gradient;
        }

        // Data untuk Bar Chart
        const barData = {
            labels: ['Belanja Pegawai', 'Belanja Barang', 'Belanja Modal'],
            datasets: [{
                label: 'Pagu (Rp)',
                data: [2760471000, 811077000, 0],
                backgroundColor: function (context) {
                    const chart = context.chart;
                    const { ctx } = chart;
                    return createGradient(ctx, 'rgba(103, 126, 234, 0.8)', 'rgba(103, 126, 234, 0.2)');
                },
                borderColor: 'rgba(103, 126, 234, 1)',
                borderWidth: 2
            }, {
                label: 'Realisasi (Rp)',
                data: [218339233, 64280768, 0],
                backgroundColor: function (context) {
                    const chart = context.chart;
                    const { ctx } = chart;
                    return createGradient(ctx, 'rgba(118, 75, 162, 0.8)', 'rgba(118, 75, 162, 0.2)');
                },
                borderColor: 'rgba(118, 75, 162, 1)',
                borderWidth: 2
            }]
        };

        // Konfigurasi Bar Chart
        const barConfig = {
            type: 'bar',
            data: barData,
            options: {
                responsive: true,
                animation: {
                    duration: 2000,
                    easing: 'easeInOutQuart'
                },
                scales: {
                    y: {
                        beginAtZero: true,
                        ticks: {
                            callback: function (value) {
                                return new Intl.NumberFormat('id-ID').format(value);
                            },
                            font: {
                                size: 12
                            }
                        },
                        grid: {
                            color: 'rgba(0, 0, 0, 0.05)'
                        }
                    },
                    x: {
                        grid: {
                            display: false
                        }
                    }
                },
                plugins: {
                    tooltip: {
                        backgroundColor: 'rgba(0, 0, 0, 0.8)',
                        padding: 12,
                        callbacks: {
                            label: function (context) {
                                let label = context.dataset.label || '';
                                if (label) {
                                    label += ': Rp ';
                                }
                                if (context.parsed.y !== null) {
                                    label += new Intl.NumberFormat('id-ID').format(context.parsed.y);
                                }
                                return label;
                            }
                        }
                    },
                    legend: {
                        position: 'top',
                        labels: {
                            padding: 20,
                            font: {
                                size: 14,
                                weight: 'bold'
                            }
                        }
                    }
                }
            }
        };

        // Data untuk Pie Chart
        const pieData = {
            labels: ['Belanja Pegawai', 'Belanja Barang', 'Belanja Modal'],
            datasets: [{
                data: [2760471000, 811077000, 0],
                backgroundColor: [
                    'rgba(75, 192, 192, 0.8)',
                    'rgba(255, 159, 64, 0.8)',
                    'rgba(153, 102, 255, 0.8)'
                ],
                borderColor: [
                    'rgba(75, 192, 192, 1)',
                    'rgba(255, 159, 64, 1)',
                    'rgba(153, 102, 255, 1)'
                ],
                borderWidth: 1
            }]
        };

        // Konfigurasi Pie Chart
        const pieConfig = {
            type: 'pie',
            data: pieData,
            options: {
                responsive: true,
                plugins: {
                    tooltip: {
                        callbacks: {
                            label: function (context) {
                                let label = context.label || '';
                                if (label) {
                                    label += ': Rp ';
                                }
                                if (context.parsed !== null) {
                                    label += new Intl.NumberFormat('id-ID').format(context.parsed);
                                }
                                return label;
                            }
                        }
                    },
                    legend: {
                        position: 'bottom',
                        labels: {
                            font: {
                                size: 14
                            }
                        }
                    }
                }
            }
        };

        // Render Charts
        window.addEventListener('load', function () {
            const barCtx = document.getElementById('myChart');
            const pieCtx = document.getElementById('myPieChart');

            new Chart(barCtx, barConfig);
            new Chart(pieCtx, pieConfig);
        });
        // Menghitung dan menampilkan total pagu
        window.addEventListener('load', function () {
            const totalPagu = pieData.datasets[0].data.reduce((a, b) => a + b, 0);
            document.getElementById('totalPagu').textContent =
                'Rp ' + new Intl.NumberFormat('id-ID').format(totalPagu);
        });
    </script>

    <!-- Bootstrap JS -->
</body>

</html>

{/source}
Sarana Disabilitas

Blok (sorot) teks untuk mendengarkannya.

Pratinjau

Tidak tampil? Sebagian situs menolak ditampilkan di situs lain — gunakan “Buka di tab baru”.

Pencarian Informasi Website