Using d3.js, how would I modify the following code to add nested radiused "inner_radius" filled with a yellow circle for each existing generated circles:
var circleData = [ { "cx": 300, "cy": 100, "radius": 80, "inner_radius": 40}, { "cx": 75, "cy": 85, "radius": 50, "inner_radius": 20}]; var svgContainer = d3.select("body").append("svg") .attr("width",500) .attr("height",500); var circles = svgContainer.selectAll("circle") .data(circleData) .enter() .append("circle"); var circleAttributes = circles .attr("cx", function (d) { return d.cx; }) .attr("cy", function (d) { return d.cy; }) .attr("r", function (d) { return d.radius; }) .style("fill", function (d) { return "red"; });
source share