flower = {
const width = 600;
const height = 500;
const svg = d3.create("svg")
.attr("width", width)
.attr("height", height)
.attr("viewBox", `0 0 ${width} ${height}`);
const flowerGroup = svg.append("g")
.attr("transform", `translate(${width/2}, ${height/2})`);
const petalColors = [
"#ff91a4", "#ffb6c1", "#ff77a9", "#ffaec0",
"#ff91a4", "#ffb6c1", "#ff77a9", "#ffaec0"
];
const petalData = [70, 60, 50, 75, 50, 50, 50];
const pie = d3.pie().sort(null).value(d => d);
const pieData = pie(petalData);
flowerGroup.selectAll('.petal-outer')
.data(pieData)
.join("path")
.attr("class", "petal-outer")
.attr("transform", d => r((d.startAngle + d.endAngle) / 2))
.attr("d", d => petalPath(d, 60, 3))
.attr("fill", (d, i) => petalColors[i])
.attr("stroke", "#e66980")
.attr("stroke-width", 1.5);
const pieDataInner = pie(petalData.map(d => d * 0.8));
flowerGroup.selectAll('.petal-inner')
.data(pieDataInner)
.join("path")
.attr("class", "petal-inner")
.attr("transform", d => r((d.startAngle + d.endAngle) / 2 + Math.PI / petalData.length))
.attr("d", d => petalPath(d, 40, 2))
.attr("fill", (d, i) => petalColors[(i + 2) % petalColors.length])
.attr("stroke", "#e66980")
.attr("stroke-width", 1.5)
.attr("opacity", 0.9);
flowerGroup.append("circle")
.attr("cx", 0)
.attr("cy", 0)
.attr("r", 35)
.attr("fill", "#ff9900");
return svg.node();
}