misc ideas
Opened this issue · 0 comments
1wheel commented
- Option to have
loadData
cache files; useful for hot reloading big things
if (window.resCache){
fmtData()
init()
} else{
d3.loadData('round-1.csv', 'round-2.csv', (err, res) => {
window.resCache = res
fmtData()
init()
})
}
- Fix named timers
- Besides
.key
,nestBy
should havesortBy
on array elements. The top level array should expose the map used to construct it. - Pass object to nestBy:
var stateData = d3.nestBy(may11, d => d.prediction_date + d.target_date + d.state)
stateData.forEach(d => {
var f = d[0]
d.prediction_date = d[0].prediction_date
d.target_date = d[0].target_date
d.state = d[0].state
- If
d
attribute is an array, join it with a space
.at({d: d => ['M', c.x(d.i), , 'H 0'].join(' ')})
.at({d: d => ['M', c.x(d.i), , 'H 0']})
- addAxisLabel
Maybe incorporate into drawAxis
function addAxisLabel(c, xText, yText){
c.svg.select('.x').append('g')
.translate([c.width/2, 35])
.append('text')
.text(xText)
.at({textAnchor: 'middle'})
.st({fill: '#000', fontWeight: 600})
c.svg.select('.y')
.append('g')
.translate([-50, c.height/2])
.append('text')
.text(yText)
.at({textAnchor: 'middle', transform: 'rotate(-90)'})
.st({fill: '#000', fontWeight: 600})
}