{
const width = 500;
const height = 800;
const space = 25;
const svg = d3.create("svg").attr("width",width).attr("height",800);
const distinctCities = [...new Set(data.map(d=> d.place))];
console.log(distinctCities)
const findCityIndex = d3.scaleBand ()
.domain(distinctCities)
.range([0, distinctCities.length])
var myBuildData = _.map(data, d => {
var xPos = (d.month - 7 + 1) * space
var yPos = (d.year - 2003) * space
if(d.month < 7){
xPos = (d.month + 6) * space
yPos = (d.year - 2004) * space
}
var placeIndex = findCityIndex(d.place)
return {
xPos,
yPos,
placeIndex
}
}
)
svg
.selectAll('g')
.data(myBuildData)
.enter()
.append('path')
.attr("d",d => `${myPaths[d.placeIndex]}`)
.attr("transform", d => `translate(${d.xPos},${d.yPos})`)
.attr("fill", d => `${d3.interpolateYlOrBr(d.placeIndex/9 + .4)}`)
return svg.node()
}