Skip to content

Commit 90d4ba0

Browse files
updated overview
1 parent 801879b commit 90d4ba0

5 files changed

Lines changed: 89 additions & 20 deletions

File tree

docs/country_overview.html

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@
114114
<!-- Top Section: Name/Text Left, Stats Grid Right -->
115115
<div class="overview-top-section">
116116
<div class="overview-left-info">
117-
<div class="overview-museum-label">EXHIBIT II — COUNTRY OVERVIEW</div>
117+
<div class="overview-museum-label">EXHIBIT III — COUNTRY OVERVIEW</div>
118118
<h1 class="overview-country-title" id="overviewCountryName">
119-
<span id="overviewCountryMainName"></span>,<br>
120-
<em id="overviewCountrySubtitle">over the years.</em>
119+
<span id="overviewCountryMainName"></span><br>
120+
<em id="overviewCountrySubtitle">over fifty years.</em>
121121
</h1>
122122
<p class="overview-description">
123123
A half-century of seismic, atmospheric and aquatic disturbance — distilled into one wall of the exhibit.
@@ -196,17 +196,38 @@ <h3>Total <em>damage</em></h3>
196196
<script>
197197
// Get country ISO from URL parameter
198198
const urlParams = new URLSearchParams(window.location.search);
199-
const countryISO = urlParams.get('country');
199+
const countryISO = urlParams.get('iso');
200200

201201
if (countryISO && typeof Scene5 !== 'undefined') {
202202
// Update timeline link
203203
const timelineLink = document.getElementById('timelineLink');
204204
if (timelineLink) {
205-
timelineLink.href = `country_timeline.html?country=${countryISO}`;
205+
timelineLink.href = `country_timeline.html?iso=${countryISO}`;
206206
}
207207

208-
// Render overview
209-
Scene5.render(countryISO);
208+
// Wait for data to load, then render overview
209+
async function loadAndRender() {
210+
try {
211+
// Initialize data if not already loaded
212+
if (typeof initData === 'function') {
213+
await initData();
214+
}
215+
216+
// Render overview after data is loaded
217+
Scene5.render(countryISO);
218+
} catch (error) {
219+
console.error('Error loading data:', error);
220+
document.querySelector('.overview-container').innerHTML = `
221+
<div style="text-align: center; padding: 100px 20px;">
222+
<h1 style="color: var(--text-mid);">Error loading data</h1>
223+
<p style="color: var(--text-dim); margin-top: 20px;">Failed to load disaster data. Please try again.</p>
224+
<a href="globe.html" class="back-button" style="margin-top: 30px; display: inline-block;">Go to Globe</a>
225+
</div>
226+
`;
227+
}
228+
}
229+
230+
loadAndRender();
210231
} else {
211232
console.error('No country specified or Scene5 not loaded');
212233
document.querySelector('.overview-container').innerHTML = `

docs/country_timeline.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,5 +1009,22 @@ <h2 class="dc-title" id="detailTitle">—</h2>
10091009
</div>
10101010

10111011
<script src="js/scene3_timeline.js"></script>
1012+
<script>
1013+
// Update overview links with current country ISO parameter
1014+
(function() {
1015+
const iso = new URLSearchParams(location.search).get('iso');
1016+
if (iso) {
1017+
const overviewBtn = document.getElementById('overviewBtn');
1018+
const endOverviewBtn = document.getElementById('endOverviewBtn');
1019+
1020+
if (overviewBtn) {
1021+
overviewBtn.href = `country_overview.html?iso=${iso}`;
1022+
}
1023+
if (endOverviewBtn) {
1024+
endOverviewBtn.href = `country_overview.html?iso=${iso}`;
1025+
}
1026+
}
1027+
})();
1028+
</script>
10121029
</body>
10131030
</html>

docs/css/style.css

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1784,20 +1784,22 @@ button {
17841784
}
17851785

17861786
.overview-country-title {
1787-
font-family: 'Playfair Display', Georgia, serif;
1788-
font-size: 3rem;
1787+
font-family: 'Cormorant Garamond', serif;
1788+
font-size: 4.5rem;
17891789
font-weight: 400;
1790-
line-height: 1.1;
1790+
line-height: 0.92;
1791+
letter-spacing: -0.02em;
17911792
margin: 0;
1792-
background: var(--gradient-primary);
1793-
-webkit-background-clip: text;
1794-
background-clip: text;
1795-
color: transparent;
1793+
color: var(--text-bright);
17961794
}
17971795

17981796
.overview-country-title em {
17991797
font-style: italic;
18001798
font-weight: 300;
1799+
background: var(--gradient-primary);
1800+
-webkit-background-clip: text;
1801+
background-clip: text;
1802+
color: transparent;
18011803
}
18021804

18031805
.overview-description {

docs/js/data.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ function processData() {
154154
type: e.type,
155155
name: e.name,
156156
deaths: e.deaths,
157+
affected: e.affected,
157158
damage: e.damage
158159
}));
159160
});

docs/js/scene5_overview.js

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ const Scene5 = {
8484
const height = container.clientHeight || 450;
8585

8686
// Reserve space for legend at bottom
87-
const legendHeight = 80;
87+
const legendHeight = 120;
8888
const pieHeight = height - legendHeight - 10;
8989
const centerX = width * 0.5;
9090
const centerY = pieHeight * 0.45;
91-
const radius = Math.min(width * 0.25, pieHeight * 0.35);
91+
const radius = Math.min(width * 0.8, pieHeight * 0.42);
9292

9393
console.log('Composition chart dimensions:', width, height, radius);
9494

@@ -244,7 +244,7 @@ const Scene5 = {
244244
.attr('text-anchor', 'middle')
245245
.attr('dy', '-0.2em')
246246
.attr('fill', '#FFF')
247-
.attr('font-size', '2.5rem')
247+
.attr('font-size', '2rem')
248248
.attr('font-weight', '400')
249249
.attr('font-family', 'Playfair Display, Georgia, serif')
250250
.text(total);
@@ -259,8 +259,8 @@ const Scene5 = {
259259
.text('EVENTS');
260260

261261
// Populate legend
262-
const itemsPerRow = Math.ceil(typeData.length / 2);
263-
const itemWidth = Math.min(150, (width - 60) / itemsPerRow);
262+
const itemsPerRow = Math.min(Math.ceil(typeData.length / 2), Math.floor((width - 60) / 180));
263+
const itemWidth = Math.max(180, (width - 60) / itemsPerRow);
264264

265265
typeData.forEach((d, i) => {
266266
const row = Math.floor(i / itemsPerRow);
@@ -563,6 +563,8 @@ const Scene5 = {
563563
return;
564564
}
565565

566+
console.log('Sample events for', iso, ':', events.slice(0, 3));
567+
566568
const width = container.clientWidth || 600;
567569
const height = Math.max(container.clientHeight || 300, 300);
568570
const margin = { top: 20, right: 70, bottom: 50, left: 70 };
@@ -606,6 +608,10 @@ const Scene5 = {
606608
return;
607609
}
608610

611+
console.log('Deaths & Affected data sample:', combinedData.slice(0, 5));
612+
console.log('Max deaths:', d3.max(combinedData, d => d.deaths));
613+
console.log('Max affected:', d3.max(combinedData, d => d.affected));
614+
609615
// Scales - use separate y scales for deaths and affected
610616
const x = d3.scaleLinear()
611617
.domain(d3.extent(combinedData, d => d.year))
@@ -692,6 +698,28 @@ const Scene5 = {
692698
const peakDeaths = combinedData.reduce((max, d) => d.deaths > max.deaths ? d : max, combinedData[0]);
693699
const peakAffected = combinedData.reduce((max, d) => d.affected > max.affected ? d : max, combinedData[0]);
694700

701+
// Highlight peak deaths with circle
702+
if (peakDeaths && peakDeaths.deaths > 0) {
703+
g.append('circle')
704+
.attr('cx', x(peakDeaths.year))
705+
.attr('cy', yDeaths(peakDeaths.deaths))
706+
.attr('r', 6)
707+
.attr('fill', 'var(--volcano)')
708+
.attr('stroke', '#FFF')
709+
.attr('stroke-width', 2);
710+
}
711+
712+
// Highlight peak affected with circle
713+
if (peakAffected && peakAffected.affected > 0) {
714+
g.append('circle')
715+
.attr('cx', x(peakAffected.year))
716+
.attr('cy', yAffected(peakAffected.affected))
717+
.attr('r', 6)
718+
.attr('fill', 'var(--drought)')
719+
.attr('stroke', '#FFF')
720+
.attr('stroke-width', 2);
721+
}
722+
695723
// Update peak label
696724
const peakLabel = document.getElementById('deathsAffectedPeakLabel');
697725
if (peakLabel) {
@@ -792,7 +820,7 @@ const Scene5 = {
792820

793821
// Add legend
794822
const legend = svg.append('g')
795-
.attr('transform', `translate(${width - 120}, 30)`);
823+
.attr('transform', `translate(${width - 150}, 30)`);
796824

797825
legend.append('rect')
798826
.attr('width', 14)

0 commit comments

Comments
 (0)