infinite-agents-public/mapbox_test/mapbox_globe_9/index.html

419 lines
12 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Globe Viz 9: Global Educational Funding & Teacher Training</title>
<link href="https://api.mapbox.com/mapbox-gl-js/v3.0.1/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v3.0.1/mapbox-gl.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #000814;
color: #ffffff;
overflow: hidden;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
}
.title-overlay {
position: absolute;
top: 20px;
left: 20px;
background: rgba(0, 8, 20, 0.92);
padding: 20px 24px;
border-radius: 12px;
backdrop-filter: blur(10px);
border: 1px solid rgba(253, 231, 36, 0.2);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
max-width: 380px;
z-index: 1;
}
.title-overlay h1 {
font-size: 24px;
font-weight: 700;
margin-bottom: 8px;
background: linear-gradient(135deg, #fde724 0%, #35b779 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.title-overlay p {
font-size: 13px;
color: #aaa;
line-height: 1.6;
margin-bottom: 14px;
}
.stats-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
margin-top: 14px;
}
.stat-item {
background: rgba(255, 255, 255, 0.05);
padding: 10px;
border-radius: 8px;
border: 1px solid rgba(255, 255, 255, 0.08);
}
.stat-label {
font-size: 11px;
color: #888;
margin-bottom: 4px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.stat-value {
font-size: 18px;
font-weight: 700;
color: #fde724;
}
.legend {
position: absolute;
bottom: 40px;
left: 20px;
background: rgba(0, 8, 20, 0.92);
padding: 16px 20px;
border-radius: 12px;
backdrop-filter: blur(10px);
border: 1px solid rgba(253, 231, 36, 0.2);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
z-index: 1;
}
.legend h3 {
font-size: 14px;
font-weight: 600;
margin-bottom: 12px;
color: #fde724;
}
.legend-item {
display: flex;
align-items: center;
margin-bottom: 8px;
font-size: 12px;
}
.legend-color {
width: 24px;
height: 16px;
border-radius: 4px;
margin-right: 10px;
border: 1px solid rgba(255, 255, 255, 0.3);
}
.legend-circle {
width: 16px;
height: 16px;
border-radius: 50%;
margin-right: 10px;
border: 2px solid #ffffff;
}
.controls {
position: absolute;
top: 20px;
right: 20px;
display: flex;
flex-direction: column;
gap: 10px;
z-index: 1;
}
.control-btn {
background: rgba(0, 8, 20, 0.92);
border: 1px solid rgba(253, 231, 36, 0.3);
color: #fde724;
padding: 10px 18px;
border-radius: 8px;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
backdrop-filter: blur(10px);
font-family: 'Inter', sans-serif;
}
.control-btn:hover {
background: rgba(253, 231, 36, 0.15);
border-color: #fde724;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(253, 231, 36, 0.3);
}
.control-btn.active {
background: rgba(253, 231, 36, 0.2);
border-color: #fde724;
}
.top-countries {
position: absolute;
bottom: 40px;
right: 20px;
background: rgba(0, 8, 20, 0.92);
padding: 16px 20px;
border-radius: 12px;
backdrop-filter: blur(10px);
border: 1px solid rgba(253, 231, 36, 0.2);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
width: 320px;
max-height: 400px;
overflow-y: auto;
z-index: 1;
}
.top-countries h3 {
font-size: 14px;
font-weight: 600;
margin-bottom: 12px;
color: #fde724;
position: sticky;
top: 0;
background: rgba(0, 8, 20, 0.95);
padding-bottom: 8px;
z-index: 2;
}
.country-item {
display: flex;
align-items: center;
padding: 8px 10px;
margin-bottom: 6px;
background: rgba(255, 255, 255, 0.05);
border-radius: 6px;
border: 1px solid rgba(255, 255, 255, 0.08);
cursor: pointer;
transition: all 0.2s ease;
}
.country-item:hover {
background: rgba(253, 231, 36, 0.1);
border-color: rgba(253, 231, 36, 0.3);
transform: translateX(4px);
}
.country-item .rank {
font-size: 11px;
font-weight: 700;
color: #888;
width: 30px;
}
.country-item .name {
flex: 1;
font-size: 12px;
color: #fff;
}
.country-item .value {
font-size: 12px;
font-weight: 600;
color: #35b779;
}
.top-countries::-webkit-scrollbar {
width: 6px;
}
.top-countries::-webkit-scrollbar-track {
background: rgba(255, 255, 255, 0.05);
border-radius: 3px;
}
.top-countries::-webkit-scrollbar-thumb {
background: rgba(253, 231, 36, 0.3);
border-radius: 3px;
}
.top-countries::-webkit-scrollbar-thumb:hover {
background: rgba(253, 231, 36, 0.5);
}
.mapboxgl-popup-content {
background: rgba(0, 8, 20, 0.95);
border-radius: 10px;
border: 1px solid rgba(253, 231, 36, 0.3);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
padding: 0;
}
.mapboxgl-popup-tip {
border-top-color: rgba(0, 8, 20, 0.95);
}
.mapboxgl-popup-close-button {
color: #fde724;
font-size: 18px;
padding: 6px;
}
.mapboxgl-popup-close-button:hover {
background: rgba(253, 231, 36, 0.1);
}
.web-source {
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 8, 20, 0.85);
padding: 8px 16px;
border-radius: 6px;
font-size: 11px;
color: #888;
border: 1px solid rgba(255, 255, 255, 0.1);
z-index: 1;
}
.web-source a {
color: #35b779;
text-decoration: none;
margin-left: 4px;
}
.web-source a:hover {
color: #fde724;
text-decoration: underline;
}
@media (max-width: 768px) {
.title-overlay {
max-width: calc(100% - 40px);
top: 10px;
left: 10px;
padding: 14px 16px;
}
.title-overlay h1 {
font-size: 18px;
}
.title-overlay p {
font-size: 11px;
}
.stats-grid {
grid-template-columns: 1fr 1fr;
gap: 8px;
}
.stat-value {
font-size: 14px;
}
.legend,
.top-countries {
display: none;
}
.controls {
top: auto;
bottom: 20px;
right: 10px;
}
}
</style>
</head>
<body>
<div id="map"></div>
<div class="title-overlay">
<h1>Global Educational Funding</h1>
<p>Choropleth visualization of education spending per capita and teacher training infrastructure across 180+ countries</p>
<div class="stats-grid">
<div class="stat-item">
<div class="stat-label">Avg Spending</div>
<div class="stat-value" id="avg-spending">$0</div>
</div>
<div class="stat-item">
<div class="stat-label">Countries</div>
<div class="stat-value" id="total-countries">0</div>
</div>
<div class="stat-item">
<div class="stat-label">Training Centers</div>
<div class="stat-value" id="total-centers">0</div>
</div>
<div class="stat-item">
<div class="stat-label">Avg Salary</div>
<div class="stat-value" id="avg-salary">$0</div>
</div>
</div>
</div>
<div class="legend">
<h3>Education Spending per Capita</h3>
<div class="legend-item">
<div class="legend-color" style="background: #440154;"></div>
<span>$0 - $500 (Critical)</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background: #31688e;"></div>
<span>$500 - $1,000 (Low)</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background: #35b779;"></div>
<span>$1,000 - $2,000 (Medium)</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background: #fde724;"></div>
<span>$2,000+ (High)</span>
</div>
<div style="margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.1);">
<h3 style="margin-bottom: 8px;">Other Indicators</h3>
<div class="legend-item">
<div class="legend-circle" style="background: #ff6b6b;"></div>
<span>Training Centers</span>
</div>
<div class="legend-item">
<div style="width: 16px; height: 3px; background: #00ff00; margin-right: 10px; border-radius: 2px;"></div>
<span>High Education Quality</span>
</div>
</div>
</div>
<div class="controls">
<button class="control-btn active" id="toggle-centers">Hide Training Centers</button>
<button class="control-btn active" id="toggle-labels">Hide Labels</button>
</div>
<div class="top-countries">
<h3>Top Countries by Spending</h3>
<div id="top-countries-list"></div>
</div>
<div class="web-source">
Choropleth technique from
<a href="https://docs.mapbox.com/mapbox-gl-js/example/updating-choropleth/" target="_blank">
Mapbox GL JS Documentation
</a>
</div>
<script src="src/data/data.js"></script>
<script src="src/index.js"></script>
</body>
</html>