{
const width=500;
const height=800;
const space= 25;
const startMonth = 5;
const svg = DOM.svg(width,height);
const distinctCities = [...new Set(data.map(d=> d.place))]
var findCityIndex = d3.scaleBand()
.domain(distinctCities)
.range([0,distinctCities.length])
var myBuildData = _.map(data, d => {
var xPos = ( d.month - startMonth + 1) * space
var yPos = (d.year - 1993) * space
if(d.month < startMonth){
xPos = (d.month + 12 - startMonth + 1) * space
yPos = (d.year - 1994) * space
}
var placeIndex = findCityIndex(d.place)
return {
xPos,
yPos,
placeIndex }
})
console.log(myBuildData)
const myDrawing = d3.select(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 + .2)}`)
return svg
}