tanzania / index.html
smakubi's picture
create cool. visualization for this data
dfe8c41 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Poverty Rate 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 src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<style>
.chart-container {
position: relative;
height: 400px;
width: 100%;
}
.tooltip {
position: absolute;
padding: 8px;
background: rgba(0, 0, 0, 0.8);
color: white;
border-radius: 4px;
pointer-events: none;
font-size: 12px;
z-index: 100;
display: none;
}
</style>
</head>
<body class="bg-gray-50">
<div class="min-h-screen">
<!-- Header -->
<header class="bg-indigo-700 text-white py-8">
<div class="container mx-auto px-4">
<div class="flex items-center justify-between">
<div>
<h1 class="text-3xl font-bold">Poverty Rate Analysis</h1>
<p class="mt-2 opacity-90">Visualizing progress towards SDG Goal 1.1.1</p>
</div>
<i data-feather="bar-chart-2" class="w-12 h-12"></i>
</div>
</div>
</header>
<!-- Main Content -->
<main class="container mx-auto px-4 py-12">
<!-- Overview Section -->
<section class="mb-16" data-aos="fade-up">
<div class="bg-white rounded-xl shadow-md p-6 mb-8">
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Goal 1.1.1 Overview</h2>
<p class="text-gray-600 mb-4">
Proportion of the population living below the international poverty line by sex, age,
employment status and geographic location (urban/rural)
</p>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="bg-indigo-50 p-4 rounded-lg">
<h3 class="font-medium text-indigo-800">Data Source</h3>
<p class="text-gray-700">Poverty and Inequality Portal, World Bank</p>
</div>
<div class="bg-indigo-50 p-4 rounded-lg">
<h3 class="font-medium text-indigo-800">Time Period</h3>
<p class="text-gray-700">2000 - 2018</p>
</div>
<div class="bg-indigo-50 p-4 rounded-lg">
<h3 class="font-medium text-indigo-800">Geographical Coverage</h3>
<p class="text-gray-700">Mainland (Urban/Rural)</p>
</div>
</div>
</div>
</section>
<!-- Total Population Chart -->
<section class="mb-16" data-aos="fade-up">
<div class="bg-white rounded-xl shadow-md p-6">
<h2 class="text-2xl font-semibold text-gray-800 mb-6">Total Population Poverty Rate Trend</h2>
<div class="chart-container">
<canvas id="totalChart"></canvas>
</div>
<div class="mt-4 text-gray-600">
<p>The chart shows the percentage of total population living below the international poverty line from 2000 to 2018.</p>
</div>
</div>
</section>
<!-- Urban/Rural Comparison -->
<section class="mb-16" data-aos="fade-up">
<div class="bg-white rounded-xl shadow-md p-6">
<h2 class="text-2xl font-semibold text-gray-800 mb-6">Urban vs Rural Poverty Rate Comparison</h2>
<div class="chart-container">
<canvas id="comparisonChart"></canvas>
</div>
<div class="mt-4 text-gray-600">
<p>Comparison of poverty rates between urban and rural populations in 2011 and 2018.</p>
</div>
</div>
</section>
<!-- Data Table -->
<section data-aos="fade-up">
<div class="bg-white rounded-xl shadow-md overflow-hidden">
<h2 class="text-2xl font-semibold text-gray-800 p-6">Detailed Data</h2>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Year</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Location</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Value (%)</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2000</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Total</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">84.74</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2007</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Total</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">52.73</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2011</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Total</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">44.70</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2012</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Total</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">46.60</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2018</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Total</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">44.90</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2011</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Rural</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">20.70</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2018</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Rural</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">53.70</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2011</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Urban</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">54.40</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2018</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Urban</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">26.10</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
</main>
<!-- Footer -->
<footer class="bg-gray-800 text-white py-8">
<div class="container mx-auto px-4">
<div class="flex flex-col md:flex-row justify-between items-center">
<div class="mb-4 md:mb-0">
<p>© 2023 Poverty Rate Visualization</p>
<p class="text-gray-400 text-sm mt-1">Data from World Bank</p>
</div>
<div class="flex space-x-4">
<a href="#" class="hover:text-indigo-300 transition">
<i data-feather="github"></i>
</a>
<a href="#" class="hover:text-indigo-300 transition">
<i data-feather="twitter"></i>
</a>
<a href="#" class="hover:text-indigo-300 transition">
<i data-feather="linkedin"></i>
</a>
</div>
</div>
</div>
</footer>
</div>
<script>
// Initialize animations
AOS.init({
duration: 800,
easing: 'ease-in-out',
once: true
});
// Initialize feather icons
feather.replace();
// Total Population Chart
const totalCtx = document.getElementById('totalChart').getContext('2d');
const totalChart = new Chart(totalCtx, {
type: 'line',
data: {
labels: ['2000', '2007', '2011', '2012', '2018'],
datasets: [{
label: 'Poverty Rate (%)',
data: [84.74, 52.73, 44.7, 46.6, 44.9],
backgroundColor: 'rgba(79, 70, 229, 0.2)',
borderColor: 'rgba(79, 70, 229, 1)',
borderWidth: 3,
tension: 0.3,
pointBackgroundColor: 'rgba(79, 70, 229, 1)',
pointRadius: 5,
pointHoverRadius: 7
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'top',
},
tooltip: {
mode: 'index',
intersect: false,
}
},
scales: {
y: {
beginAtZero: false,
min: 0,
max: 100,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
}
}
});
// Urban/Rural Comparison Chart
const comparisonCtx = document.getElementById('comparisonChart').getContext('2d');
const comparisonChart = new Chart(comparisonCtx, {
type: 'bar',
data: {
labels: ['2011', '2018'],
datasets: [
{
label: 'Urban',
data: [54.4, 26.1],
backgroundColor: 'rgba(79, 70, 229, 0.7)',
borderColor: 'rgba(79, 70, 229, 1)',
borderWidth: 1
},
{
label: 'Rural',
data: [20.7, 53.7],
backgroundColor: 'rgba(220, 38, 38, 0.7)',
borderColor: 'rgba(220, 38, 38, 1)',
borderWidth: 1
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'top',
},
tooltip: {
mode: 'index',
intersect: false,
callbacks: {
label: function(context) {
return context.dataset.label + ': ' + context.raw + '%';
}
}
}
},
scales: {
y: {
beginAtZero: true,
max: 60,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
}
}
});
</script>
</body>
</html>