Skip to content

Commit f1125c8

Browse files
committed
fix: Switch Viz 4 and 5 on website. Resolve undefined errors in Viz 5 and 6.
1 parent acbe567 commit f1125c8

4 files changed

Lines changed: 8 additions & 16 deletions

File tree

src/App.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ function App() {
3737
<Viz3 />
3838
</section>
3939

40-
<section id="section4">
41-
<Viz4 />
42-
</section>
43-
4440
<section id="section5">
4541
<Viz5 />
4642
</section>
4743

44+
<section id="section4">
45+
<Viz4 />
46+
</section>
47+
4848
<section id="section6">
4949
<Viz6 />
5050
</section>

src/components/Viz3.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,9 @@ const Viz3: React.FC = () => {
383383
<p className="section-badge">/ Visualization 03</p>
384384
<h1 className="viz-title">Where in the world do planes crash?</h1>
385385
<p>
386-
Plane crashes are not distributed evenly across the globe. The choropleth map shades each
386+
Plane crashes are not distributed evenly across the globe. The choropleth map highlights this by shading each
387387
country by its incident count, while the treemap below shows the same data grouped by continent,
388-
making the relative scale of each region easier to read. The United States alone accounts for
389-
roughly a fifth of all recorded incidents, partly because of its vastly larger volume of
390-
domestic flights. Switch between incidents and fatalities, narrow the year range, and hover any
388+
making the relative scale of each region easier to read. Switch between incidents and fatalities, narrow the year range, and hover any
391389
country to see the figure highlighted in both views at once.
392390
</p>
393391
</div>

src/components/Viz5.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ const PALETTE = [
3636
'#a3e635','#fb7185','#e879f9','#86efac','#93c5fd','#fca5a5',
3737
]
3838

39-
const CONTINENT_IDX: Record<string,number> = {
40-
'North America': 0, 'Europe': 1, 'Asia': 2,
41-
'South America': 3, 'Africa': 4, 'Oceania': 5,
42-
}
43-
4439
// Darken a hex color for the arrival half of each arc
4540
function darken(hex: string, f = 0.5): string {
4641
const r = parseInt(hex.slice(1,3),16), g = parseInt(hex.slice(3,5),16), b = parseInt(hex.slice(5,7),16)
@@ -351,6 +346,7 @@ const Viz5: React.FC = () => {
351346
<p className="section-badge">/ Visualization 05</p>
352347
<h1 className="viz-title">Origin–destination flows: the most perilous routes</h1>
353348
<p>
349+
354350
Each arc segment represents a city, country, or continent. The bright
355351
portion marks departures; the darker portion marks arrivals. Ribbon
356352
thickness encodes crash count. Arrowheads point toward the arrival end.

src/components/Viz6.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const viz6: React.FC = () => {
100100
}, [])
101101

102102
// ── Filter combinations → compute λ ─────────────────────────────────────
103-
const { lambda, totalIncidents, decadesInRange } = useMemo(() => {
103+
const { lambda, totalIncidents} = useMemo(() => {
104104
if (!data) return { lambda: 0, totalIncidents: 0, decadesInRange: 1 }
105105

106106
// Build decade range
@@ -303,8 +303,6 @@ const viz6: React.FC = () => {
303303

304304
// Derived stats
305305
const p0 = poissonPMF(lambda, 0)
306-
const modeK = lambda <= 0 ? 0 : Math.max(0, Math.floor(lambda))
307-
const modeP = poissonPMF(lambda, modeK)
308306

309307
// Valid decade range for the "To" selector (must be ≥ decadeFrom)
310308
const decadeFromOptions = data?.decades ?? []

0 commit comments

Comments
 (0)