Built with blockbuilder.org
Created
August 27, 2016 19:55
-
-
Save anonymous/e7e13d559746b9b2a48c3fa9f7e6dcbd to your computer and use it in GitHub Desktop.
nate central limit theorem demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<!-- trying to demo what they did here with Java: http://onlinestatbook.com/2/sampling_distributions/clt_demo.html Except without Java --> | |
<meta charset="utf-8"><!-- Load c3.css --> | |
<link href="http://c3js.org/css/c3-b03125fa.css" rel="stylesheet" type="text/css"> | |
<!-- Load d3.js and c3.js --> | |
<script src="https://d3js.org/d3.v3.min.js"></script> | |
<script src="http://c3js.org/js/c3.min-4c5bef8f.js"></script> | |
</head> | |
<body> | |
<div id="chart"><div> | |
<script> | |
var s_dist = [2, 1, 9, 31, 64, 148, 243, 339, 483, 608, 700, 774, 774, 754, 757, 735, 621, 566, 447, 403, 289, 247, 234, 166, 141, 104, 95, 65, 38, 36, 23, 27, 25, 11, 7, 4, 7, 7, 6, 3, 1, 2, 0, 2, 0, 0, 0, 1]; | |
var s_dist_2 = [1, 0, 3, 10, 19, 23, 32, 35, 56, 68, 89, 63, 75, 70, 74, 63, 77, 47, 50, 28, 24, 26, 14, 9, 10, 6, 9, 5, 3, 5, 1, 1, 0, 0, 0, 1, 3]; | |
var pop_dist = [66, 3282, 12001, 17291, 17261, 14191, 10737, 7819, 5324, 3733, 2530, 1764, 1171, 811, 554, 412, 296, 224, 144, 115, 72, 43, 45, 31, 26, 10, 10, 12, 5, 4, 7, 2, 2, 2, 0, 0, 1, 1, 0, 0, 1]; | |
var chart = c3.generate({ | |
data: { | |
columns: [ | |
['data1'].concat(pop_dist), | |
//['data2', 130, 100, 140, 200, 150, 50] | |
], | |
type: 'bar' | |
}, | |
bar: { | |
width: { | |
ratio: 0.90 // this makes bar width 50% of length between ticks | |
} | |
// or | |
//width: 100 // this makes bar width 100px | |
} | |
}); | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment