chart = {
const svg = d3
.create("svg")
.attr("width", width)
.attr("height", config.height + 20);
svg
.selectAll("path")
.data([
{
xfrom: 0,
xto: 1,
yfrom: 0,
yto: 1,
fill: colors[0],
stroke: colors[1]
},
{
xfrom: 0,
xto: 0.3,
yfrom: 0,
yto: 0.4,
fill: colors[6],
stroke: colors[7]
},
{
xfrom: 0.3,
xto: 0.6,
yfrom: 0.4,
yto: 0.8,
fill: colors[2],
stroke: colors[3]
},
{
xfrom: 0.7,
xto: 0.8,
yfrom: 0.2,
yto: 1,
fill: colors[4],
stroke: colors[5]
}
])
.join("path")
.attr("d", (d) => arc([d.xfrom, d.xto, d.yfrom, d.yto]))
.attr("fill", (d) => d.fill)
.attr("stroke", (d) => d.stroke)
.attr("stroke-width", 1)
.attr("transform", `translate(${width / 2}, ${config.outerRadius})`);
svg
.append("circle")
.attr("fill", "white")
.attr("stroke", "black")
.attr("r", 10)
.attr("cx", cx(1, 0))
.attr("cy", -cy(1, 0))
.attr("transform", `translate(${width / 2}, ${config.outerRadius})`);
return svg.node();
}