Very Simple D3: How to Draw an Arc?

后端 未结 1 413
长情又很酷
长情又很酷 2021-01-13 00:20

It would be nice to learn D3. After reading many examples, I think I understand it. My first project is to make a color wheel, without transitions for simplicity. But it

1条回答
  •  孤城傲影
    2021-01-13 01:05

    Your example here doesn't have any data defined. If you just want to draw the svg statically, skip the selectAll() and data() bindings:

    chart
        .append("svg:path")
        .attr("fill", function(d, i){
            return d3.rgb("black");
        })
        .attr("d", arc)
        ;
    

    Or define some data and use that to drive the drawing:

    http://jsfiddle.net/findango/aGdMX/2/

    (plus .attr("fill"... should be .style("fill"...)

    0 讨论(0)
提交回复
热议问题