Skip to content

Commit b07b37e

Browse files
committed
Render page before loading D3 charts
1 parent d614c6f commit b07b37e

2 files changed

Lines changed: 38 additions & 5 deletions

File tree

milestone2/index.html

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>Teen Health Profile</title>
77
<link rel="stylesheet" href="style.css">
8-
<script src="https://d3js.org/d3.v7.min.js"></script>
8+
<script src="https://d3js.org/d3.v7.min.js" defer></script>
9+
<script src="main.js" defer></script>
910
</head>
1011
<body>
1112

@@ -21,7 +22,21 @@ <h1>Teen Health Profile</h1>
2122
<h2>Who Are We Looking At?</h2>
2223
<p class="section-desc">The YRBS starts as a survey cohort before it becomes a health profile. This opening view shows raw survey composition; later health estimates use the CDC survey weight.</p>
2324
<div class="orientation-layout">
24-
<aside id="survey-passport" class="survey-passport"></aside>
25+
<aside id="survey-passport" class="survey-passport">
26+
<div class="passport-label">Dataset Passport</div>
27+
<div class="passport-title">CDC YRBS 2023</div>
28+
<div class="passport-metrics">
29+
<div class="passport-metric">
30+
<span class="passport-value">20,103</span>
31+
<span class="passport-caption">student rows</span>
32+
</div>
33+
<div class="passport-metric">
34+
<span class="passport-value">250</span>
35+
<span class="passport-caption">variables after conversion</span>
36+
</div>
37+
</div>
38+
<p class="passport-note">Loading survey composition...</p>
39+
</aside>
2540
<div class="mosaic-panel">
2641
<div class="mosaic-toolbar">
2742
<div class="controls mosaic-controls">
@@ -30,7 +45,9 @@ <h2>Who Are We Looking At?</h2>
3045
</div>
3146
<div id="mosaic-legend" class="mosaic-legend"></div>
3247
</div>
33-
<div id="student-mosaic"></div>
48+
<div id="student-mosaic">
49+
<div class="loading-panel">Loading student mosaic...</div>
50+
</div>
3451
</div>
3552
</div>
3653
</section>
@@ -143,7 +160,5 @@ <h2>Is Teen Health Just A Digital-Behavior Story?</h2>
143160
<div id="phone-corr-summary" class="phone-summary-strip"></div>
144161
<div id="heatmap-chart"></div>
145162
</section>
146-
147-
<script src="main.js"></script>
148163
</body>
149164
</html>

milestone2/style.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,24 @@ section h2 {
266266
border-radius: 8px;
267267
background: #fff;
268268
padding: 10px 12px;
269+
min-height: 220px;
270+
}
271+
272+
.loading-panel {
273+
min-height: 198px;
274+
display: flex;
275+
align-items: center;
276+
justify-content: center;
277+
color: #6b7280;
278+
font-size: 0.86rem;
279+
background: repeating-linear-gradient(
280+
-45deg,
281+
#f8f9fb,
282+
#f8f9fb 10px,
283+
#f1f3f7 10px,
284+
#f1f3f7 20px
285+
);
286+
border-radius: 6px;
269287
}
270288

271289
/* ── Demographics grid ── */

0 commit comments

Comments
 (0)