dashboardgraphics = {
const width = 800,
height = 800;
const padding = 20;
const viewBoxWidth = width + 2 * padding;
const viewBoxHeight = height + 2 * padding;
const svg = d3.create("svg")
.attr("viewBox", [0, 0, viewBoxWidth, viewBoxHeight]);
svg.append('image')
.attr('xlink:href','https://i.postimg.cc/Z567wyzq/shoe-background.jpg')
.attr('x', 0)
.attr('y', 0)
.attr('width', '900')
var p = svg.selectAll("polyline")
var i = svg.selectAll('image')
p.enter().append("polyline")
.data(dashboardtxt)
.enter()
.append("polyline")
.attr('points',function(d){return d})
.style('fill','snow')
.style('fill-opacity','0')
.style('stroke','none')
.style('stroke-width','.75')
var p = svg.selectAll("polyline")
p.enter().append("polyline")
.data(whites)
.enter()
.append("polyline")
.attr('points',function(d){return d})
.style('fill','whitesmoke')
.style('fill-opacity','.75')
.style('stroke','rgb(0,0,0)')
.style('stroke-width','1')
var p = svg.selectAll("polyline")
p.enter().append("polyline")//add svg to variable p
.data(textbackground)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.style('fill','rgb(128,0,0)')
.style('fill-opacity','1')
.style('stroke','black')
.style('stroke-width','1')
var p = svg.selectAll("polyline")
p.enter().append("polyline")//add svg to variable p
.data(shoeboxbox)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.style('fill','darkred')
.style('fill-opacity','1')
.style('stroke','rgb(0,0,0)')
.style('stroke-width','.5')
var p = svg.selectAll("polyline")
p.enter().append("polyline")//add svg to variable p
.data(mapborder)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.style('fill','rgb(45,46,48)')
.style('fill-opacity','1')
.style('stroke','dimgray')
.style('stroke-width','1')
var p = svg.selectAll("polyline")
p.enter().append("polyline")//add svg to variable p
.data(idkanymore2)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.style('fill','darkred')
.style('fill-opacity','1')
.style('stroke','black')
.style('stroke-width','1')
var p = svg.selectAll("polyline")
p.enter().append("polyline")//add svg to variable p
.data(idkanymore)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.style('fill','darkred')
.style('fill-opacity','1')
.style('stroke','black')
.style('stroke-width','1')
var p = svg.selectAll("polyline")
p.enter().append("polyline")//add svg to variable p
.data(textdashboard)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.style('fill','whitesmoke')
.style('fill-opacity','1')
.style('stroke','snow')
.style('stroke-width','1')
var p = svg.selectAll("polyline")
p.enter().append("polyline")//add svg to variable p
.data(shoerackrectangle)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.style('fill','whitesmoke')
.style('fill-opacity','1')
.style('stroke','rgb(0,0,0)')
.style('stroke-width','1')
var p = svg.selectAll("polyline")
p.enter().append("polyline")//add svg to variable p
.data(shoerack2)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.style('fill','brown')
.style('fill-opacity','1')
.style('stroke','rgb(0,0,0)')
.style('stroke-width','2')
var p = svg.selectAll("polyline")
p.enter().append("polyline")//add svg to variable p
.data(shoeWhite)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.style('fill','white')
.style('fill-opacity','1')
.style('stroke','rgb(0,0,0)')
.style('stroke-width','1')
var p = svg.selectAll("polyline")
p.enter().append("polyline")//add svg to variable p
.data(extras2)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.style('fill','darkred')
.style('fill-opacity','1')
.style('stroke','darkred')
.style('stroke-width','1')
var p = svg.selectAll("polyline")
p.enter().append("polyline")//add svg to variable p
.data(shoeredtext)
.enter() //there are more data than elements, this selects them
.append("polyline")
.attr('points',function(d){return d})
.style('fill','darkred')
.style('fill-opacity','1')
.style('stroke','rgb(0,0,0)')
.style('stroke-width','1')
i.enter().append('image')//these are our 4 shoe images
.data(curImages) // Assuming shoeList is an array of image URLs
.enter()
.append('image')
.attr('xlink:href',function(d) { return d.URL; })
.attr('x', '35')
.attr('y', function(d,i) { return i*135+60})
.attr('width', 140)
.on('click',shoeCheck)//click event upon clicking on shoe
function shoeCheck(event, d){
//console.log(d.Name)
//////this happens if answer is correct
if(d.Name==clickedIcon.data.Name){
console.log('correct!!!')
++mutable score
mutable shoeRack.push(d)//here we are pushing in the image/vector to draw upon a correct guess
shoeRack
}else{console.log('too bad so sad')
mutable guesses = mutable guesses - 1
}
}
chart
curImages
return svg.node();
}