2012-12-05 2 views
2

D3을 사용하여 선을 렌더링하려하지만이를 시도 할 때 선이 다각형으로 렌더링됩니다. 왜 그런지 모르겠습니다. 모양이 어떻게 보이는지 보여주는 스크린 샷을 포함 시켰습니다. 여기 코드입니다 :D3 라인이 다각형으로 렌더링되는 경우

// Creates a time scale using the x_extent 
    // defined above 
    var x_scale = d3.time.scale() 
    .range([margin, width - margin]) 
    .domain(x_extent); 

    // Creates a similarity scale using the y_extent. 
    // defined above. 
    var y_scale = d3.scale.linear() 
    .range([height - margin, margin]) 
    .domain(y_extent); 

    // Construct a line. 
    var line = d3.svg.line() 
    .x(function(d) { 
     return x_scale(d.date); 
    }) 
    .y(function(d) { 
     return y_scale(d.similarity); 
    }); 

    // Render a line. 
    d3.select("svg") 
    .append("path") 
    .attr("d", line(data)); 

enter image description here

답변

4

, 명시 적으로 fillstroke 설정 경로를 추가 할 때 시도 즉

d3.select("svg") 
    .append("path") 
    .attr("fill", "none") 
    .attr("stroke", "black") 
    .attr("d", line(data)); 
+0

는 너무 라스 감사합니다! – egidra