var spaceCircles = [30, 70, 110]; 2 3var svgContainer = d3.select("body").append("svg") 4 .attr("width", 200) 5 .attr("height", 200); 6 7var circles = svgContainer.selectAll("circle") 8 .data(spaceCircles) 9 .enter() 10 .append("circle"); 11 12var circleAttributes = circles 13 .attr("cx", function (d) { return d; }) 14 .attr("cy", function (d) { return d; }) 15 .attr("r", 20 ) 16 .style("fill", function(d) { 17 var returnColor; 18 if (d === 30) { returnColor = "green"; } else if (d === 70) { returnColor = "purple"; } else if (d === 110) { returnColor = "red"; } return returnColor; });