Spaces:
Running
Running
File size: 1,179 Bytes
7341022 |
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 |
d3.select('body').selectAppend('div.tooltip.tooltip-hidden')
window.ages = '18 19 20 21 22'.split(' ')
window.states = 'RI NH NY CT VT'.split(' ')
window.init = function(){
// console.clear()
var graphSel = d3.select('#graph').html('').append('div')
window.c = d3.conventions({
sel: graphSel,
width: 460,
height: 460,
})
function sizeGraphSel(){
var clientWidth = d3.select('body').node().clientWidth
window.scale = d3.clamp(1, (c.totalWidth + 35)/(clientWidth - 10), 2) // off by one, s is 35
graphSel.st({
transform: `scale(${1/scale})`,
transformOrigin: `0px 0px`,
})
d3.select('#graph').st({height: scale == 1 ? 500 : 710})
}
sizeGraphSel()
d3.select(window).on('resize', sizeGraphSel)
c.svg = c.svg.append('g').translate([.5, .5])
window.axii = makeAxii()
window.sliders = makeSliders()
window.students = makeStudents()
window.sel = makeSel()
window.slides = makeSlides()
window.estimates = makeEstimates()
var error = 0
while (error < .02 || error > .05){
estimates.flipCoin()
error = Math.abs(estimates.active.val - .5)
}
makeGS()
}
init()
|