499 lines
14 KiB
HTML
499 lines
14 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 5: Global Educational Institutions</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@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', sans-serif;
|
|
background: #0a0a0f;
|
|
color: #fff;
|
|
overflow: hidden;
|
|
}
|
|
|
|
#map {
|
|
position: absolute;
|
|
top: 0;
|
|
bottom: 0;
|
|
width: 100%;
|
|
}
|
|
|
|
/* Title Panel */
|
|
.title-panel {
|
|
position: absolute;
|
|
top: 20px;
|
|
left: 20px;
|
|
background: rgba(10, 10, 20, 0.92);
|
|
backdrop-filter: blur(12px);
|
|
border: 1px solid rgba(255, 255, 255, 0.12);
|
|
border-radius: 12px;
|
|
padding: 20px 24px;
|
|
max-width: 420px;
|
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
|
}
|
|
|
|
.title-panel h1 {
|
|
font-size: 22px;
|
|
font-weight: 700;
|
|
margin-bottom: 8px;
|
|
background: linear-gradient(135deg, #1e90ff, #00bfff);
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
background-clip: text;
|
|
}
|
|
|
|
.title-panel p {
|
|
font-size: 13px;
|
|
color: #aaa;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
/* Control Panel */
|
|
.control-panel {
|
|
position: absolute;
|
|
top: 140px;
|
|
left: 20px;
|
|
background: rgba(10, 10, 20, 0.92);
|
|
backdrop-filter: blur(12px);
|
|
border: 1px solid rgba(255, 255, 255, 0.12);
|
|
border-radius: 12px;
|
|
padding: 18px 20px;
|
|
max-width: 420px;
|
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
|
}
|
|
|
|
.control-panel h3 {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
margin-bottom: 14px;
|
|
color: #00bfff;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.control-group {
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.control-group:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.control-group label {
|
|
display: block;
|
|
font-size: 12px;
|
|
color: #999;
|
|
margin-bottom: 6px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
select {
|
|
width: 100%;
|
|
padding: 10px 12px;
|
|
background: rgba(30, 30, 45, 0.8);
|
|
border: 1px solid rgba(255, 255, 255, 0.15);
|
|
border-radius: 6px;
|
|
color: #fff;
|
|
font-size: 13px;
|
|
font-family: 'Inter', sans-serif;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
select:hover {
|
|
border-color: rgba(30, 144, 255, 0.5);
|
|
background: rgba(30, 30, 45, 1);
|
|
}
|
|
|
|
select:focus {
|
|
outline: none;
|
|
border-color: #1e90ff;
|
|
box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.15);
|
|
}
|
|
|
|
.button-group {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 10px;
|
|
margin-top: 16px;
|
|
}
|
|
|
|
button {
|
|
padding: 10px 16px;
|
|
background: rgba(30, 144, 255, 0.2);
|
|
border: 1px solid rgba(30, 144, 255, 0.4);
|
|
border-radius: 6px;
|
|
color: #1e90ff;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
font-family: 'Inter', sans-serif;
|
|
}
|
|
|
|
button:hover {
|
|
background: rgba(30, 144, 255, 0.3);
|
|
border-color: #1e90ff;
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
button:active {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
/* Statistics Panel */
|
|
.stats-panel {
|
|
position: absolute;
|
|
top: 20px;
|
|
right: 20px;
|
|
background: rgba(10, 10, 20, 0.92);
|
|
backdrop-filter: blur(12px);
|
|
border: 1px solid rgba(255, 255, 255, 0.12);
|
|
border-radius: 12px;
|
|
padding: 18px 20px;
|
|
min-width: 240px;
|
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
|
}
|
|
|
|
.stats-panel h3 {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
margin-bottom: 14px;
|
|
color: #00bfff;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.stat-item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 8px 0;
|
|
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
|
}
|
|
|
|
.stat-item:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.stat-label {
|
|
font-size: 12px;
|
|
color: #999;
|
|
}
|
|
|
|
.stat-value {
|
|
font-size: 15px;
|
|
font-weight: 700;
|
|
color: #1e90ff;
|
|
}
|
|
|
|
/* Legend Panel */
|
|
.legend-panel {
|
|
position: absolute;
|
|
bottom: 20px;
|
|
left: 20px;
|
|
background: rgba(10, 10, 20, 0.92);
|
|
backdrop-filter: blur(12px);
|
|
border: 1px solid rgba(255, 255, 255, 0.12);
|
|
border-radius: 12px;
|
|
padding: 18px 20px;
|
|
max-width: 420px;
|
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
|
}
|
|
|
|
.legend-panel h3 {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
margin-bottom: 14px;
|
|
color: #00bfff;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.legend-item {
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.legend-item:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.legend-label {
|
|
font-size: 11px;
|
|
color: #999;
|
|
margin-bottom: 8px;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.3px;
|
|
}
|
|
|
|
.legend-gradient {
|
|
height: 20px;
|
|
border-radius: 4px;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.quality-gradient {
|
|
background: linear-gradient(to right,
|
|
#8b0000 0%,
|
|
#dc143c 15%,
|
|
#ff6347 30%,
|
|
#ff8c00 40%,
|
|
#ffa500 50%,
|
|
#ffd700 60%,
|
|
#00ced1 75%,
|
|
#00bfff 90%,
|
|
#1e90ff 100%
|
|
);
|
|
}
|
|
|
|
.literacy-gradient {
|
|
background: linear-gradient(to right,
|
|
#8b0000, #dc143c, #ff6347, #ffa500, #ffd700, #00ced1, #00bfff, #1e90ff
|
|
);
|
|
}
|
|
|
|
.enrollment-gradient {
|
|
background: linear-gradient(to right,
|
|
#4a148c, #7b1fa2, #9c27b0, #ba68c8, #ce93d8, #e1bee7
|
|
);
|
|
}
|
|
|
|
.funding-gradient {
|
|
background: linear-gradient(to right,
|
|
#1a5490, #2874a6, #3498db, #5dade2, #85c1e9, #aed6f1
|
|
);
|
|
}
|
|
|
|
.legend-scale {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
font-size: 10px;
|
|
color: #777;
|
|
}
|
|
|
|
.size-legend {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
margin-top: 6px;
|
|
}
|
|
|
|
.size-circle {
|
|
width: 12px;
|
|
height: 12px;
|
|
border-radius: 50%;
|
|
background: rgba(30, 144, 255, 0.6);
|
|
border: 1px solid #1e90ff;
|
|
}
|
|
|
|
.size-circle.large {
|
|
width: 24px;
|
|
height: 24px;
|
|
}
|
|
|
|
.size-scale {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
width: 100%;
|
|
margin-top: 6px;
|
|
}
|
|
|
|
.size-scale-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
font-size: 10px;
|
|
color: #777;
|
|
}
|
|
|
|
/* Info Panel */
|
|
.info-panel {
|
|
position: absolute;
|
|
bottom: 20px;
|
|
right: 20px;
|
|
background: rgba(10, 10, 20, 0.92);
|
|
backdrop-filter: blur(12px);
|
|
border: 1px solid rgba(255, 255, 255, 0.12);
|
|
border-radius: 12px;
|
|
padding: 16px 18px;
|
|
max-width: 280px;
|
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
|
|
font-size: 11px;
|
|
color: #aaa;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.info-panel h4 {
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
color: #00bfff;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.info-panel .technique {
|
|
background: rgba(30, 144, 255, 0.1);
|
|
border-left: 2px solid #1e90ff;
|
|
padding: 8px 10px;
|
|
margin-top: 10px;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.info-panel .technique strong {
|
|
color: #1e90ff;
|
|
}
|
|
|
|
/* Popup styling */
|
|
.mapboxgl-popup-content {
|
|
background: rgba(15, 15, 25, 0.97);
|
|
border: 1px solid rgba(255, 255, 255, 0.15);
|
|
border-radius: 8px;
|
|
padding: 12px;
|
|
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
|
|
}
|
|
|
|
.mapboxgl-popup-tip {
|
|
border-top-color: rgba(15, 15, 25, 0.97) !important;
|
|
}
|
|
|
|
/* Responsive adjustments */
|
|
@media (max-width: 768px) {
|
|
.title-panel,
|
|
.control-panel,
|
|
.stats-panel,
|
|
.legend-panel,
|
|
.info-panel {
|
|
max-width: calc(100vw - 40px);
|
|
}
|
|
|
|
.stats-panel {
|
|
top: auto;
|
|
bottom: 180px;
|
|
right: 20px;
|
|
}
|
|
|
|
.info-panel {
|
|
display: none;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="map"></div>
|
|
|
|
<!-- Title Panel -->
|
|
<div class="title-panel">
|
|
<h1>Global Educational Institutions</h1>
|
|
<p>180 universities and schools worldwide with literacy rates, enrollment data, and educational quality metrics visualized through data-driven styling.</p>
|
|
</div>
|
|
|
|
<!-- Control Panel -->
|
|
<div class="control-panel">
|
|
<h3>Visual Encoding</h3>
|
|
|
|
<div class="control-group">
|
|
<label for="size-metric">Circle Size Represents:</label>
|
|
<select id="size-metric">
|
|
<option value="enrollment" selected>Student Enrollment</option>
|
|
<option value="quality">Educational Quality</option>
|
|
<option value="literacy">Literacy Rate</option>
|
|
<option value="funding">Annual Funding</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
<label for="color-metric">Circle Color Represents:</label>
|
|
<select id="color-metric">
|
|
<option value="quality" selected>Educational Quality</option>
|
|
<option value="literacy">Literacy Rate</option>
|
|
<option value="enrollment">Student Enrollment</option>
|
|
<option value="funding">Annual Funding</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="button-group">
|
|
<button id="toggle-rotation">Pause Rotation</button>
|
|
<button id="reset-view">Reset View</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Statistics Panel -->
|
|
<div class="stats-panel">
|
|
<h3>Global Statistics</h3>
|
|
<div class="stat-item">
|
|
<span class="stat-label">Total Institutions</span>
|
|
<span class="stat-value" id="total-institutions">180</span>
|
|
</div>
|
|
<div class="stat-item">
|
|
<span class="stat-label">Avg Quality Score</span>
|
|
<span class="stat-value" id="avg-quality">74</span>
|
|
</div>
|
|
<div class="stat-item">
|
|
<span class="stat-label">Avg Literacy Rate</span>
|
|
<span class="stat-value" id="avg-literacy">89%</span>
|
|
</div>
|
|
<div class="stat-item">
|
|
<span class="stat-label">Total Enrollment</span>
|
|
<span class="stat-value" id="total-enrollment">8.4M</span>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Legend Panel -->
|
|
<div class="legend-panel">
|
|
<h3>Legend</h3>
|
|
|
|
<div class="legend-item">
|
|
<div class="legend-label">Color Scale</div>
|
|
<div class="legend-gradient quality-gradient"></div>
|
|
<div class="legend-scale">
|
|
<span id="color-min-label">Low Quality (50)</span>
|
|
<span id="color-max-label">World Class (100)</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="legend-item">
|
|
<div class="legend-label">Size Scale</div>
|
|
<div class="size-scale">
|
|
<div class="size-scale-item">
|
|
<div class="size-circle"></div>
|
|
<span id="size-min-label">1K</span>
|
|
</div>
|
|
<div class="size-scale-item">
|
|
<div class="size-circle large"></div>
|
|
<span id="size-max-label">350K</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Info Panel -->
|
|
<div class="info-panel">
|
|
<h4>Web-Enhanced Learning</h4>
|
|
<p>This visualization applies data-driven styling techniques from Mapbox documentation.</p>
|
|
<div class="technique">
|
|
<strong>Technique Applied:</strong> Interpolate expressions for continuous data (quality, enrollment, literacy) and match expressions for categorical data (institution type).
|
|
</div>
|
|
<p style="margin-top: 10px; font-size: 10px; color: #666;">
|
|
Data includes 180 educational institutions with metrics: quality scores, enrollment, literacy rates, and funding levels.
|
|
</p>
|
|
</div>
|
|
|
|
<!-- Load data and main script -->
|
|
<script src="src/data/education-data.js"></script>
|
|
<script src="src/index.js"></script>
|
|
</body>
|
|
</html>
|