Need help with D3

I am trying to learn how to use Observable, so I just wanted to create a simple using below code but it is not working.

chart = {
var svg =,800)).append(“circle”).attr(“r”,20).attr(“cx”,10).attr(“cy”,10).attr(“fill”,“black”);
return svg.node() ;

selection.append returns a selection of the appended elements, so you’ve defined svg as a selection of a single circle element rather than an SVG element. Try this:

  const svg =, 800));

      .attr("r", 20)
      .attr("cx", 10)
      .attr("cy", 10)
      .attr("fill", "black");

  return svg.node();
1 Like