var radius = Math.min(w, h) / 2; var arc = d3.svg.arc() .outerRadius(radius - 40) .innerRadius(radius - 70); var color = d3.scale.ordinal() .range(["#333333", "none"]); var pie = d3.layout.pie() .sort(null) .value(function(d) { return d.sales; }); var masterw = 1336; var masterh = 647; var w = masterw/3; var h = masterh/3; var middleDonut = svg.append("g"); d3.csv("donut.csv", function(error, data) { data.forEach(function(d) { //d.sales = +d.sales; d.sales = Math.random(); }); var g = svg.selectAll(".arc") .data(pie(data)) .enter().append("g") .attr("class", "arc") .attr("transform", "translate(" + (w + (radius*1.5)) + "," + (h+radius) + ")"); g.append("path") .attr("d", arc) .style("fill", function(d) { return color(d.data.product); }); });