houseDwg = {
const width = 800,
height = 800;
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
var p = svg.selectAll("polyline")
if(houseButton=="On"){
p.enter().append("polyline")
.data(houseData)
.enter()
.append("polyline")
.attr('points',function(d){return d})
.style('fill','none')
.style('stroke','rgb(0,0,0)')
.style('stroke-width','2')
p.enter().append("polyline")
.data(housedetails)
.enter()
.append("polyline")
.attr('points',function(d){return d})
.style('fill','none')
.style('stroke','rgb(0,0,0)')
.style('stroke-width','1')
.style('stroke-dasharray','6,3')
}
if(chimneyButton=="On"){
p.enter().append("polyline")
.data(chimneyCombined)
.enter()
.append("polyline")
.attr('points',function(d){return d.geo})
.style('fill','white')
.style('stroke','rgb(0,0,0)')
.style('stroke-width','2')
.on('mouseover',chimneyData)
.on('mouseout',chimneyDataOut)
function chimneyData(event,d){
svg
.append("text")
.attr('x','100')
.attr('y','400')
.attr('class','chimneyText')
.style('font-family','helvetica')
.style('font-size','1em')
.style('font-weight','bold')
.style("fill", "rgb(0,0,0)")
.text('Nacho House')
svg
.append("text")
.attr('x','160')
.attr('y','570')
.attr('class','chimneyText')
.style('font-family','helvetica')
.style('font-size','10px')
.style('font-weight','100')
.style("fill", "rgb(0,0,0)")
.text(d.data.material)
svg
.append("text")
.attr('x','130')
.attr('y','590')
.attr('class','chimneyText')
.style('font-family','helvetica')
.style('font-size','10px')
.style('font-weight','100')
.style("fill", "rgb(0,0,0)")
.text(d.data.age)
svg
.append("text")
.attr('x','170')
.attr('y','610')
.attr('class','chimneyText')
.style('font-family','helvetica')
.style('font-size','10px')
.style('font-weight','100')
.style("fill", "rgb(0,0,0)")
.text(d.data.fabricator)
svg
.append("line")
.attr('class','hoverLine')
.attr('x1','100')
.attr('y1','580')
.attr('x2','100')
.attr('y2','250')
.style('stroke-width','.5')
.style('stroke','black')
svg
.append("line")
.attr('class','hoverLine')
.attr('x1','100')
.attr('y1','250')
.attr('x2','500')
.attr('y2','250')
.style('stroke-width','.5')
.style('stroke','black')
svg
.append("polyline")
.attr('class','hoverLine')
.attr('points','50,50 50,100 100,100')
.style('stroke-width','.5')
.style('fill','none')
.style('stroke','black')
d3.select(this).style('fill','cyan')
}
function chimneyDataOut(){
d3.selectAll('text.chimneyText').remove()
d3.selectAll('line.hoverLine').remove()
d3.selectAll('polyline.hoverLine').remove()
d3.select(this).style('fill','white')
}
svg
.append("text")
.attr('x','100')
.attr('y','570')
.style('font-family','helvetica')
.style('font-size','10px')
.style('font-weight','800')
.style("fill", "rgb(0,0,0)")
.text('Material: ')
svg
.append("text")
.attr('x','100')
.attr('y','590')
.style('font-family','helvetica')
.style('font-size','10px')
.style('font-weight','800')
.style("fill", "rgb(0,0,0)")
.text('Age: ')
svg
.append("text")
.attr('x','100')
.attr('y','610')
.style('font-family','helvetica')
.style('font-size','10px')
.style('font-weight','800')
.style("fill", "rgb(0,0,0)")
.text('Fabricator: ')
p.enter().append("polyline")
.data(chimneydetails)
.enter()
.append("polyline")
.attr('points',function(d){return d})
.style('fill','none')
.style('stroke','rgb(0,0,0)')
.style('stroke-width','1')
.style('stroke-dasharray','6,3')
}
if(roofButton=="On"){
p.enter().append("polyline")
.data(roof)
.enter()
.append("polyline")
.attr('points',function(d){return d})
.style('fill','none')
.style('stroke','rgb(0,0,0)')
.style('stroke-width','2')
p.enter().append("polyline")
.data(roofdetails)
.enter()
.append("polyline")
.attr('points',function(d){return d})
.style('fill','none')
.style('stroke','rgb(0,0,0)')
.style('stroke-width','1')
.style('stroke-dasharray','6,3')
}
return svg.node();
}