chart
Selasa, 24 Desember 2024 | Humas PA Amuntai
{source}
<head>
<!-- ...existing code... -->
<script src="/https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
.chart-container {
display: flex;
flex-direction: column;
align-items: center;
border: 2px solid #ccc;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
background-color: #f9f9f9;
}
.chart-item {
margin: 20px;
}
</style>
<!-- ...existing code... -->
</head>
<body>
<!-- ...existing code... -->
<div class="chart-container">
<div class="chart-item">
<canvas id="dipaPieChart" width="400" height="400"></canvas>
</div>
<div class="chart-item">
<canvas id="dipaBarChart1" width="400" height="400"></canvas>
</div>
<div class="chart-item">
<canvas id="dipaBarChart2" width="400" height="400"></canvas>
</div>
</div>
<!-- ...existing code... -->
<script>
var ctx = document.getElementById('dipaPieChart').getContext('2d');
var dipaPieChart = new Chart(ctx, {
type: 'pie',
data: {
labels: ['DIPA 01 (Manajemen Operasional)', 'DIPA 04 (Penegakan dan Pelayanan Hukum)'],
datasets: [{
label: 'Pagu vs Realisasi',
data: [3761945000, 142450000],
backgroundColor: ['#FF6384', '#36A2EB'],
hoverBackgroundColor: ['#FF6384', '#36A2EB'],
borderColor: '#fff',
borderWidth: 2
}]
},
options: {
responsive: true,
plugins: {
legend: {
position: 'top',
},
tooltip: {
callbacks: {
label: function(tooltipItem) {
var label = tooltipItem.label || '';
if (label) {
label += ': ';
}
label += new Intl.NumberFormat('id-ID', { style: 'currency', currency: 'IDR' }).format(tooltipItem.raw);
return label;
}
}
},
title: {
display: true,
text: 'DIPA Pagu vs Realisasi'
}
},
animation: {
animateScale: true,
animateRotate: true
}
}
});
var ctx1 = document.getElementById('dipaBarChart1').getContext('2d');
var dipaBarChart1 = new Chart(ctx1, {
type: 'bar',
data: {
labels: ['Pagu', 'Realisasi', 'Sisa'],
datasets: [{
label: 'DIPA 01 (Manajemen Operasional)',
data: [3761945000, 3545303256, 3761945000 - 3545303256],
backgroundColor: ['#FF6384', '#36A2EB', '#FFCE56'],
hoverBackgroundColor: ['#FF6384', '#36A2EB', '#FFCE56'],
borderColor: '#fff',
borderWidth: 2
}]
},
options: {
responsive: true,
plugins: {
legend: {
position: 'top',
},
tooltip: {
callbacks: {
label: function(tooltipItem) {
var label = tooltipItem.label || '';
if (label) {
label += ': ';
}
label += new Intl.NumberFormat('id-ID', { style: 'currency', currency: 'IDR' }).format(tooltipItem.raw);
return label;
}
}
},
title: {
display: true,
text: 'DIPA 01 (Manajemen Operasional) Pagu vs Realisasi'
}
},
animation: {
duration: 2000,
easing: 'easeInOutBounce'
}
}
});
var ctx2 = document.getElementById('dipaBarChart2').getContext('2d');
var dipaBarChart2 = new Chart(ctx2, {
type: 'bar',
data: {
labels: ['Pagu', 'Realisasi', 'Sisa'],
datasets: [{
label: 'DIPA 04 (Penegakan dan Pelayanan Hukum)',
data: [142450000, 135783330, 142450000 - 135783330],
backgroundColor: ['#FF6384', '#36A2EB', '#FFCE56'],
hoverBackgroundColor: ['#FF6384', '#36A2EB', '#FFCE56'],
borderColor: '#fff',
borderWidth: 2
}]
},
options: {
responsive: true,
plugins: {
legend: {
position: 'top',
},
tooltip: {
callbacks: {
label: function(tooltipItem) {
var label = tooltipItem.label || '';
if (label) {
label += ': ';
}
label += new Intl.NumberFormat('id-ID', { style: 'currency', currency: 'IDR' }).format(tooltipItem.raw);
return label;
}
}
},
title: {
display: true,
text: 'DIPA 04 (Penegakan dan Pelayanan Hukum) Pagu vs Realisasi'
}
},
animation: {
duration: 2000,
easing: 'easeInOutBounce'
}
}
});
</script>
<!-- ...existing code... -->
</body>
{/source}