2

Topojson: list of difference between v0 and v1? でMike Bostock の推奨事項を使用しました。コードを v0 から v1 に移行します。

その他の変更はありません。

私のデータは同じ final_adms_France.json ファイルです

どうした ?それを機能させる方法は?


コメント:問題が発生したようです:

 .attr("transform", function(d) { return "translate(" + projection(d.coordinates) + ")"; })

のうち :

// Positioning: place-label
    svg.selectAll(".place-label")
        .data(topojson.object(fra, fra.objects.places).geometries)
      .enter().append("text")
        .attr("class", "place-label")
        .attr("transform", function(d) { return "translate(" + projection(d.coordinates) + ")"; })
        .attr("dy", ".35em")
        .text(function(d) { if (d.properties.name!=="Paris"&&d.properties.name!=="Bremen"){return d.properties.name;} })
        .attr("x", function(d) { return d.coordinates[0] > -1 ? 6 : -6; })
        .style("text-anchor", function(d) { return d.coordinates[0] > -1 ? "start" : "end"; });
4

1 に答える 1

1

d.geometry.coordinatesの代わりに使用する必要がありd.coordinatesます。

于 2013-08-27T08:18:56.100 に答える