{
var colors = ["#e27c7c", "#a86464", "#6d4b4b", "#503f3f", "#333333", "#3c4e4b", "#466964", "#599e94", "#6cd4c5"]
const field = d3.select(DOM.svg(width, 500))
const groupOutside = field.selectAll('g')
.data(goalAttempsVals)
.enter().append('g')
.attr('transform', function(d, i){
return 'translate(0,0)';
})
groupOutside.append("rect")
.attr("x", 0)
.attr("y", 0)
.attr("height", 400)
.attr("width", 600)
.style('fill', function(d, i){
console.log("datum " + d + " has the index " + i)
return colors[i];
})
const groupInside = field.selectAll('g')
.data([parseInt(selectedGame['attempts inside the penalty area team1'])])
.enter().append('g')
.attr('transform', function(d, i){
return 'translate(0,0)';
})
groupInside.append("rect")
.attr("x", 70)
.attr("y", 110)
.attr("height", 200)
.attr("width", 450)
.style('fill', function(d, i){
return colors[i];
})
field.append("image")
.attr("xlink:href", goal)
.attr('width', 600)
.attr('height', 500)
.attr('id', 'svg')
const group = field.selectAll('g')
.data(goalAttempsVals)
.enter().append('g')
.attr('transform', function(d, i){
return 'translate(0,0)';
})
group.append("text")
.attr("x", function(d,i) {
return i + 290; })
.attr("y", function(d,i){
return i * 150 + 50;
})
.attr("dy", ".35em")
.attr('fill', 'white')
.attr('stroke', 'yellow')
.attr('stroke-width', '0.5px')
.attr('font-size', '45px')
.text
(function(d)
{ return d; })
return field.node();
}