"笔划dasharray:X,Y;" 乱搞svg路径?(铬)

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使路径的一部分没有关闭.(检查正在进行中).

链接到实时代码:https://rugger-demast.codio.io/2_zoom/index.html