-
Notifications
You must be signed in to change notification settings - Fork 4
/
NeffBirthDeathGraph.html
527 lines (508 loc) · 9.61 KB
/
NeffBirthDeathGraph.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
<!DOCTYPE html>
<html>
<head>
<title class="setTitle"></title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="Neff,Our Changing Planet" name="description">
<!-- Bootstrap -->
<link href="css/bootstrap_eCourses_customized.css" rel="stylesheet" media="screen">
<link href="css/bootstrap_eCourses_responsive.css" rel="stylesheet" media="screen">
<link href="css/graphics_and_svg.css" rel="stylesheet">
<link href="css/learning-objective.css" rel="stylesheet">
<link href="css/eCourse-master.css" rel="stylesheet" media="screen">
</head>
<body>
<!-- Body Content -->
<div class="container">
<div class="titler"><span class='number setId'></span> <span class='setTitle'></span></div>
<div class="row-fluid">
<div class="span6 leftCol">
<p>As a result of advances in human health and nutrition, the past two centuries have brought profound declines in birth rates and death rates, the number of people who are born or die per 1,000 people over a year.<a class="term" href="#def0"><img class="info" alt="more information" src="img/info.png"></a> A transition from high birth and death rates to low birth and death rates has occurred in many countries as they have developed. This change is called a <a href="#def1" class="term">demographic transition</a>. The stages in a demographic transition are described in the table and figure. The figure also shows how the overall population growth rate changes in each of these stages. </p>
</div>
<div class="span6 rightCol">
<p>In the United States, this transition took more than 100 years, but many Asian countries have undergone most of it over the past 20-30 years. Most industrialized countries are now in stages 4 and 5. Many other countries are in stages 3 or 4, and a number of less developed countries--including some in sub-Saharan Africa--still remain in stages 1 or 2.</p>
</div>
</div>
<div class="row-fluid">
<div class="span6 leftCol">
<div id="graphTarget0" > </div>
</div>
<div class="span6 rightCol">
<div id="tableTarget0" ></div>
</div>
</div>
</div>
<div id="def0">
<div class="label">Crude birth and death rates</div>
<div class="content">
Birth and death rates are often referred to as 'crude birth or death rates'. The definition is similar and refers to the (live) births or deaths per 1,000 people in an area.
</div>
</div>
<div id="def1">
<div class="label">Demographic transition</div>
<div class="content">
This is an example of a key term glossary modal, which can contain any kind of markup, including images or more graphs and tables.
</div>
</div>
<script src="js/jquery-latest.js"></script>
<script src="js/toc-structure.js"></script>
<script src="js/eCourse-master.js"></script>
<script src="js/d3.v3.min.js"></script>
<script src="js/widget-base.js"></script>
<script src="js/widget-linegraph.js"></script>
<script src="js/widget-callouts.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/eventmanager.js"></script>
<script>
var category0= ["Stage 1","Stage 2","Stage 3","Stage 4","Stage 5"];
var litekey0 = [0,10,20,30,40];
console.log("test key and label data same length: ", category0.length === litekey0.length);
var title0 = "A conceptual model of the demographic transition";
var height=300, width=500, tickheight=10;
var margin0 = {top:10, right:10, bottom:6*tickheight, left:5*tickheight};
var value0 = [[10,height],[110,height],[210,height],[310,height],[410,height]];
var linkedRegions = ["#graph00","#tablerw"];
var title1 = "Time";
var time=[],popGrowth=[];
var birth = [
{x: 0,y: 2.0},
{x: 1,y: 1.95},
{x: 2, y: 1.9 },
{x: 3, y: 1.85},
{ x: 4, y: 1.9},
{ x: 5, y: 1.95},
{ x: 6, y: 2.0},
{ x: 7, y: 1.95 },
{ x: 8, y: 1.9 },
{ x: 9, y: 1.85
},
{ x: 10,
y: 1.9
},
{ x: 11,
y: 1.95
},
{ x: 12,
y: 2.0
},
{ x: 13,
y: 1.95
},
{ x: 14,
y: 1.9
},
{ x: 15,
y: 1.85
},
{ x: 16,
y: 1.9
},
{ x: 17,
y: 1.95
},
{ x: 18,
y: 1.96
},
{ x: 19,
y: 1.95
},
{ x: 20,
y: 1.94
},
{ x: 21,
y: 1.93
},
{ x: 22,
y: 1.94
},
{ x: 23,
y: 1.95
},
{ x: 24,
y: 1.94
},
{ x: 25,
y: 1.93
},
{ x: 26,
y: 1.8
},
{ x: 27,
y: 1.7
},
{ x: 28,
y: 1.6
},
{ x: 29,
y: 1.5
},
{ x: 30,
y: 1.4
},
{ x: 31,
y: 1.3
},
{ x: 32,
y: 1.2
},
{ x: 33,
y: 1.1
},
{ x: 34,
y: 1.0
},
{ x: 35,
y: 0.9
},
{ x: 36,
y: 0.8
},
{ x: 37,
y: 0.7
},
{ x: 38,
y: 0.6
},
{ x: 39,
y: .5
},
{ x: 40,
y: 0.4
},
{ x: 41,
y: 0.35
},
{ x: 42,
y: 0.35
},
{ x: 43,
y: 0.34
},
{ x: 44,
y: 0.33
},
{ x: 45,
y: 0.33
},
{ x: 46,
y: 0.32
},
{ x: 47,
y: 0.33
},
{ x: 48,
y: 0.31
},
{ x: 49,
y: 0.29
},
{ x: 50,
y: .25
},
{ x: 51,
y: .198
},
{ x: 52,
y: 0.2
},
{ x: 53,
y: 0.19
},
{ x: 54,
y: 0.18
},
{ x: 55,
y: 0.175
},
{ x: 56,
y: 0.172
},
{ x: 57,
y: 0.16
},
{ x: 58,
y: 0.155
},
{ x: 59,
y: 0.153
},
{ x: 60,
y: 0.151
},
{ x: 61,
y: 0.15
},
{ x: 62,
y: .145
},
{ x: 63,
y: 0.145
},
{ x: 64,
y: 0.15
},
{ x: 65,
y: 0.145
}];
var death = [
{x: 0,
y: 1.95
},
{x: 1,
y: 1.95
},
{ x: 2,
y: 1.98
},
{ x: 3,
y: 1.95
},
{ x: 4,
y: 1.95
},
{ x: 5,
y: 1.98
},
{ x: 6,
y: 1.95
},
{ x: 7,
y: 1.88
},
{ x: 8,
y: 1.85
},
{ x: 9,
y: 1.85
},
{ x: 10,
y: 1.84
},
{ x: 11,
y: 1.8
},
{ x: 12,
y: 1.7
},
{ x: 13,
y: 1.6
},
{ x: 14,
y: 1.5
},
{ x: 15,
y: 1.4
},
{ x: 16,
y: 1.3
},
{ x: 17,
y: 1.2
},
{ x: 18,
y: 1.1
},
{ x: 19,
y: 0.9
},
{ x: 20,
y: 0.8
},
{ x: 21,
y: 0.7
},
{ x: 22,
y: 0.55
},
{ x: 23,
y: 0.45
},
{ x: 24,
y: 0.35
},
{ x: 25,
y: 0.2
},
{ x: 26,
y: 0.195
},
{ x: 27,
y: 0.19
},
{ x: 28,
y: 0.18
},
{ x: 29,
y: 0.19
},
{ x: 30,
y: 0.195
},
{ x: 31,
y: 0.2
},
{ x: 32,
y: 0.195
},
{ x: 33,
y: 0.19
},
{ x: 34,
y: 0.195
},
{ x: 35,
y: 0.198
},
{ x: 36,
y: 0.2
},
{ x: 37,
y: 0.2
},
{ x: 38,
y: 0.19
},
{ x: 39,
y: 0.18
},
{ x: 40,
y: 0.19
},
{ x: 41,
y: 0.195
},
{ x: 42,
y: 0.2
},
{ x: 43,
y: 0.195
},
{ x: 44,
y: 0.198
},
{ x: 45,
y: 0.2
},
{ x: 46,
y: 0.2
},
{ x: 47,
y: 0.195
},
{ x: 48,
y: 0.192
},
{ x: 49,
y: 0.192
},
{ x: 50,
y: .19
},
{ x: 51,
y: .198
},
{ x: 52,
y: 0.2
},
{ x: 53,
y: 0.19
},
{ x: 54,
y: 0.18
},
{ x: 55,
y: 0.198
},
{ x: 56,
y: 0.195
},
{ x: 57,
y: 0.2
},
{ x: 58,
y: 0.19
},
{ x: 59,
y: 0.195
},
{ x: 60,
y: 0.198
},
{ x: 61,
y: 0.193
},
{ x: 62,
y: .145
},
{ x: 63, y: 0.192 },
{ x: 64, y: 0.198},
{ x: 65, y: 0.199
}];
var dataPts = birth.length;
var popGrowth = [];
for(i=0;i<dataPts;i++){
popGrowth[i] = {x: birth[i].x,
y: birth[i].y - death[i].y};
}
var markerX=[0,0,dataPts/5,dataPts/5,2*dataPts/5,2*dataPts/5,3*dataPts/5,3*dataPts/5,4*dataPts/5,4*dataPts/5,dataPts];
var markerY=[height,0,0,height,height,0,0,height,height,0,0];
// Create the callout array. These won't emit events, just get them.
var phases = new Callouts({
id: "phaseTable",
type: "table",
textBits: {
headers: ["Developmental Phase","Characteristics"],
content: [{col0:"Pre-development",
col1: "High birth and death rates offset each other, so the population grows slowly."
},
{col0:"Developing",
col1: "As a country's economy becomes stronger, medical care, clean water, and food are more available. The death rate declines and the birth rate remains high, so the population grows more rapidly."
},
{col0:"Modernizing",
col1: "Economic, educational, and social changes cause declines in the birth rate. Population growth starts to slow."
},
{col0:"Developed",
col1: "Birth and death rates fall to low levels, slowing population growth."
},
{col0:"Post-development",
col1: "In highly developed countries, the birth rate is falling while the death rate is relatively constant. The population growth rate is negative and the population declines."
}]
}});
phases.draw(d3.select("#tableTarget0"));
var litekey1 = [0,10,20,30,40];
var legendLabels=["Birth rate","Death rate","Population growth rate"];
//call graphing shell and stacked bar charts
var cont0 = new SVGContainer(
{node: d3.select("#graphTarget0"),
maxWid: 400,
maxHt: 300
}
);
var lines = new LineGraph ({
id: "birthdeathChart",
Data: [birth,death,popGrowth],
type: "lines",
xAxisFormat: { type: "linear",
ticks: 0,
orientation: "bottom",
label: "Time"},
yAxisFormat: { type: "linear",
orientation: "left",
ticks: 0,
label: "Relative Rate"},
});
cont0.append(lines, {topPercentOffset: 0, leftPercentOffset: 0, heightPercent: 1, widthPercent: 1});
/*legend({targetGraph: "#graph_0",
xPos: "right",
yPos: "top",
boxWid: 180,
maxWid: width,
maxHt: height,
margin: margin0,
labels: legendLabels,
type: "line"
}); */
</script>
</body>
</html>