houseDwg = {
const width = 800,
height = 800;
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
var p = svg.selectAll("polyline")
if (roofButton=="on"){
p.enter().append("polyline")
.data(roof)
.enter()
.append("polyline")
.attr('points',function(d){return d})
.style('fill','none')
.style('fill-opacity','.5')
.style('stroke-width','.3')
.attr('stroke-opacity','1')
.style('stroke','black')
}
if (windowButton=="on"){
svg
.append('text')
.attr('x','40')
.attr('y','450')
.style("font-family","Helvetica")
.style('font-size','.85em')
.style('font-weight', 'bold')
.style('fill','magenta')
.style('text-anchor','middle')
.text('Part: ')
svg
.append('text')
.attr('x','40')
.attr('y','500')
//.attr('class','windowText')
.style("font-family","Helvetica")
.style('font-size','.85em')
.style('font-weight', 'bold')
.style('fill','magenta')
.style('text-anchor','middle')
.text('Material: ')
svg
.append('text')
.attr('x','40')
.attr('y','550')
//.attr('class','windowText')
.style("font-family","Helvetica")
.style('font-size','.85em')
.style('font-weight', 'bold')
.style('fill','magenta')
.style('text-anchor','middle')
.text('Time: ')
svg
.append('text')
.attr('x','40')
.attr('y','600')
// .attr('class','windowText')
.style("font-family","Helvetica")
.style('font-size','.85em')
.style('font-weight', 'bold')
.style('fill','magenta')
.style('text-anchor','middle')
.text('Origin: ')
svg
.append('text')
.attr('x','40')
.attr('y','650')
//.attr('class','windowText')
.style("font-family","Helvetica")
.style('font-size','.85em')
.style('font-weight', 'bold')
.style('fill','magenta')
.style('text-anchor','middle')
.text('Fabricator: ')
p.enter().append("polyline")
.data(windowCombined)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d.geo})
.style('fill','none')
.style('fill-opacity','.5')
.style('stroke-width','.5')
.attr('stroke-opacity', '1')
.style('stroke','black')
.on('mouseover',windowData)
.on('mouseout',windowDataOut)
function windowData(event,d){
svg
.append('line')
.attr('class','hoverLine')
.attr('x1','50')
.attr('y1','560')
.attr('x2','150')
.attr('y2','560')
.style('stroke-width','.5')
.style('stroke','black')
.style('stroke', 'magenta')
.style('stroke-dasharray','4,4,4,4')
// svg
// .append('text')
// .attr('x','75')
// .attr('y','500')
// .attr('class','windowText')
//.style("font-family","Helvetica")
// .style('fill','magenta')
// .style('text-anchor','middle')
// .text('Guild House')
svg
.append('text')
.attr('x','110')
.attr('y','450')
.attr('class','windowText')
.style("font-family","Helvetica")
.style('font-size','.85em')
.style('font-weight', 'bold')
.style('fill','magenta')
.style('text-anchor','middle')
.text(d.data.Part)
svg
.append('text')
.attr('x','110')
.attr('y','500')
.attr('class','windowText')
.style("font-family","Helvetica")
.style('font-size','.85em')
.style('font-weight', 'bold')
.style('fill','magenta')
.style('text-anchor','middle')
.text(d.data.Material)
svg
.append('text')
.attr('x','110')
.attr('y','550')
.attr('class','windowText')
.style("font-family","Helvetica")
.style('font-size','.85em')
.style('font-weight', 'bold')
.style('fill','magenta')
.style('text-anchor','middle')
.text(d.data.Time)
svg
.append('text')
.attr('x','110')
.attr('y','600')
.attr('class','windowText')
.style("font-family","Helvetica")
.style('font-size','.85em')
.style('font-weight', 'bold')
.style('fill','magenta')
.style('text-anchor','middle')
.text(d.data.Origin)
svg
.append('text')
.attr('x','170')
.attr('y','650')
.attr('class','windowText')
.style("font-family","Helvetica")
.style('font-size','.85em')
.style('font-weight', 'bold')
.style('fill','magenta')
.style('text-anchor','middle')
.text(d.data.Fabricator)
d3.select(this).style('fill','cyan')
}
function windowDataOut(){
d3.selectAll('text.windowText').remove()
d3.selectAll('line.hoverLine').remove()
d3.select(this).style('fill','white')
}
}
if (baseButton=="on"){
p.enter().append("polyline")
.data(base)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.style('stroke-width','.3')
.attr('stroke-opacity','1')
.style('stroke','black')
//.style('stroke-dasharray','4,4,4,4')
.style('fill','none')
}
if (detailButton=="on"){
p.enter().append("polyline")
.data(detail)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.style('stroke-width','.1')
.attr('stroke-opacity','1')
.style('stroke','black')
//.style('stroke-dasharray','4,4,4,4')
.style('fill','none')
}
return svg.node();
}