Hug*_*lpz 1 svg google-chrome chromium d3.js topojson
我通过d3js生成svg路径.要么data()+ mesh()或datum()+ mesh()工作.
svg.append("g").attr("id","border")
.attr("style", "fill: none; stroke:#646464;")
.selectAll("path")
.data([topojson.mesh(json, L0, function(a, b) { return a !== b; })])
.enter().append("path")
.attr("d", path);
Run Code Online (Sandbox Code Playgroud)
要么 :
//inland borders lines
svg.append("g").attr("id","coast")
.attr("style", "fill: none; stroke:#646464;")
.append("path")
.datum(topojson.mesh(json, json.objects.admin_0, function(a,b){return a===b;}))
.attr("d", path);
Run Code Online (Sandbox Code Playgroud)

将stroke-dasharray: 8,4结果添加到:

将其更改stroke-dasharray: 6,3,3,3为:

出现了一些文物,一半的笔画丢失/不可见(与Ind/Pakistan,Ind/Nepal,Ind/Myamar,Myamar/Cambodia的边界).如果我在海岸线生成中添加类似的笔划 - 达哈哈,那么同样的混乱会出现蓝线.
编辑:好的.首先,我因为topojson.mesh()总是返回一个MultiLineString而被捣乱,因为它反过来会生成一个路径.但为什么"dasharray:none"工作正常呢?

任何的想法 ?我认为这些dasharray使路径的一部分没有关闭.(检查正在进行中).
| 归档时间: |
|
| 查看次数: |
906 次 |
| 最近记录: |