Enhances user experience with dark‑mode detection, responsive layout, and streamlined role selection workflow
40 lines
1.9 KiB
HTML
40 lines
1.9 KiB
HTML
<div id="user-statistics-chart" class="rounded-xl bg-white dark:bg-gray-950 shadow-sm ring-1 ring-gray-950/5 dark:ring-white/10">
|
|
<div class="flex items-center gap-3 px-6 py-4 border-b border-gray-100 dark:border-gray-600">
|
|
<div>
|
|
<h3 class="text-base font-semibold text-gray-900 dark:text-white">User Statistics Chart</h3>
|
|
<p class="text-sm text-gray-500 dark:text-gray-400 mt-0.5">Individual contribution breakdown</p>
|
|
</div>
|
|
</div>
|
|
<div class="p-6">
|
|
<canvas id="userStatsChart" height="250"></canvas>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
(function() {
|
|
const ctx = document.getElementById('userStatsChart');
|
|
if (!ctx) return;
|
|
fetch('/dashboard/charts/user-statistics-data/')
|
|
.then(r => r.json())
|
|
.then(data => {
|
|
new Chart(ctx, {
|
|
type: 'bar',
|
|
data: {
|
|
labels: data.labels,
|
|
datasets: [
|
|
{ label: 'Total Projects', data: data.projects, backgroundColor: '#3B82F6', borderColor: '#3B82F6', borderWidth: 1 },
|
|
{ label: 'Total Assigned Tickets', data: data.assigned, backgroundColor: '#10B981', borderColor: '#10B981', borderWidth: 1 }
|
|
]
|
|
},
|
|
options: {
|
|
responsive: true, maintainAspectRatio: false,
|
|
color: document.documentElement.classList.contains('dark') ? '#9ca3af' : '#6b7280',
|
|
plugins: { legend: { display: true, position: 'top', labels: { color: document.documentElement.classList.contains('dark') ? '#d1d5db' : '#374151' } } },
|
|
scales: {
|
|
y: { beginAtZero: true, ticks: { stepSize: 1, color: document.documentElement.classList.contains('dark') ? '#9ca3af' : '#6b7280' }, grid: { color: document.documentElement.classList.contains('dark') ? '#374151' : '#e5e7eb' } },
|
|
x: { ticks: { color: document.documentElement.classList.contains('dark') ? '#9ca3af' : '#6b7280' }, grid: { display: false } }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
})();
|
|
</script> |