idaGarfield's picture
Jag vill att du hjälper mig att ta fram en tydlig graf utifrån denna data:Självdriven inlärning – 46 %
cdc8d07 verified
Raw History Blame Contribute Delete
11.2 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Learning Statistics Visualization</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: {
50: '#f0f9ff',
100: '#e0f2fe',
200: '#bae6fd',
300: '#7dd3fc',
400: '#38bdf8',
500: '#0ea5e9',
600: '#0284c7',
700: '#0369a1',
800: '#075985',
900: '#0c4a6e',
},
secondary: {
50: '#f5f3ff',
100: '#ede9fe',
200: '#ddd6fe',
300: '#c4b5fd',
400: '#a78bfa',
500: '#8b5cf6',
600: '#7c3aed',
700: '#6d28d9',
800: '#5b21b6',
900: '#4c1d95',
}
}
}
}
}
</script>
</head>
<body class="bg-gray-50 min-h-screen">
<div class="container mx-auto px-4 py-12">
<div class="text-center mb-12">
<h1 class="text-4xl font-bold text-primary-800 mb-4">Learning Methods Distribution</h1>
<p class="text-lg text-gray-600 max-w-2xl mx-auto">Visual representation of how employees acquire new skills and knowledge</p>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div class="bg-white rounded-xl shadow-lg p-6 h-full">
<h2 class="text-xl font-semibold text-primary-700 mb-4">Bar Chart</h2>
<div class="h-96">
<canvas id="barChart"></canvas>
</div>
</div>
<div class="bg-white rounded-xl shadow-lg p-6 h-full">
<h2 class="text-xl font-semibold text-primary-700 mb-4">Pie Chart</h2>
<div class="h-96">
<canvas id="pieChart"></canvas>
</div>
</div>
<div class="bg-white rounded-xl shadow-lg p-6 h-full lg:col-span-2">
<h2 class="text-xl font-semibold text-primary-700 mb-4">Detailed Statistics</h2>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Learning Method</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Percentage</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Visual</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Self-driven learning</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">46%</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="w-full bg-gray-200 rounded-full h-2.5">
<div class="bg-primary-500 h-2.5 rounded-full" style="width: 46%"></div>
</div>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">External courses</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">28%</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="w-full bg-gray-200 rounded-full h-2.5">
<div class="bg-primary-400 h-2.5 rounded-full" style="width: 28%"></div>
</div>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Internal knowledge sharing</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">15%</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="w-full bg-gray-200 rounded-full h-2.5">
<div class="bg-primary-300 h-2.5 rounded-full" style="width: 15%"></div>
</div>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Formal education</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">7%</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="w-full bg-gray-200 rounded-full h-2.5">
<div class="bg-primary-200 h-2.5 rounded-full" style="width: 7%"></div>
</div>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">No learning opportunities</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">4%</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="w-full bg-gray-200 rounded-full h-2.5">
<div class="bg-primary-100 h-2.5 rounded-full" style="width: 4%"></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Bar Chart
const barCtx = document.getElementById('barChart').getContext('2d');
const barChart = new Chart(barCtx, {
type: 'bar',
data: {
labels: ['Self-driven learning', 'External courses', 'Internal sharing', 'Formal education', 'No opportunities'],
datasets: [{
label: 'Percentage',
data: [46, 28, 15, 7, 4],
backgroundColor: [
'rgba(14, 165, 233, 0.7)',
'rgba(59, 130, 246, 0.7)',
'rgba(99, 102, 241, 0.7)',
'rgba(168, 85, 247, 0.7)',
'rgba(236, 72, 153, 0.7)'
],
borderColor: [
'rgba(14, 165, 233, 1)',
'rgba(59, 130, 246, 1)',
'rgba(99, 102, 241, 1)',
'rgba(168, 85, 247, 1)',
'rgba(236, 72, 153, 1)'
],
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
max: 50,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
},
plugins: {
legend: {
display: false
},
tooltip: {
callbacks: {
label: function(context) {
return context.parsed.y + '%';
}
}
}
}
}
});
// Pie Chart
const pieCtx = document.getElementById('pieChart').getContext('2d');
const pieChart = new Chart(pieCtx, {
type: 'pie',
data: {
labels: ['Self-driven learning', 'External courses', 'Internal sharing', 'Formal education', 'No opportunities'],
datasets: [{
data: [46, 28, 15, 7, 4],
backgroundColor: [
'rgba(14, 165, 233, 0.7)',
'rgba(59, 130, 246, 0.7)',
'rgba(99, 102, 241, 0.7)',
'rgba(168, 85, 247, 0.7)',
'rgba(236, 72, 153, 0.7)'
],
borderColor: [
'rgba(14, 165, 233, 1)',
'rgba(59, 130, 246, 1)',
'rgba(99, 102, 241, 1)',
'rgba(168, 85, 247, 1)',
'rgba(236, 72, 153, 1)'
],
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'right',
},
tooltip: {
callbacks: {
label: function(context) {
const label = context.label || '';
const value = context.raw || 0;
const total = context.dataset.data.reduce((a, b) => a + b, 0);
const percentage = Math.round((value / total) * 100);
return `${label}: ${value}% (${percentage}% of total)`;
}
}
}
}
}
});
feather.replace();
});
</script>
</body>
</html>