为什么路径周围会出现灰线?

时间:2014-03-30 10:24:38

标签: svg d3.js

我开始在d3中进行可视化,以不同方式为每个邮政编码着色。到目前为止。抱歉,如何加载需要10秒钟: http://dl.dropboxusercontent.com/u/1531353/Misc/why_gray_lines_in_d3/index.html

这是javascript:

var width = 960,
    height = 500;

    var path = d3.geo.path();

    var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

    queue()
    .defer(d3.json, "zips_us_topo.json")
    .await(ready);

    function ready(error, us) {
      svg.append("g")
      .attr("class", "counties")
      .selectAll("path")
      .data(topojson.feature(us, us.objects.zip_codes_for_the_usa).features)
      .enter().append("path")
      .attr("class", "zip")
      .attr("data-zip", function(d) {return d.properties.zip; })
      .attr("d", path);
    }

我试图让邮政编码区域周围的灰线消失。我试过了

.zip {stroke-width: 0}

无济于事。灰线来自哪里?它们不是路径的fill,因为我将填充设置为黑色,而不是灰色。

1 个答案:

答案 0 :(得分:1)

尝试stroke:rgb(0,0,0); 另外,而不是stroke-width:0,最好使用stroke:none;

相关问题