Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
D3.js 仅显示分划的线交点_D3.js_Svg - Fatal编程技术网

D3.js 仅显示分划的线交点

D3.js 仅显示分划的线交点,d3.js,svg,D3.js,Svg,我试图只显示分划中的线交点,而不是D3地图中的整条线 是否支持使用d3.geo.gracile实现此功能 非常感谢你的帮助! Thierry对您的问题的简短回答是:不,没有办法只渲染与d3.geo.gracile的交点 但是,通过将要绘制的交点放入一个辅助数组中,并将其传递给路径生成器进行渲染,可以轻松实现所需的结果。我用我的一个例子来演示解决方案: 设置包含要传递给对象的几何体对象的辅助对象数组 使用嵌套选择绑定二维(横向/纵向)阵列,并使用enter选择附加交点。实际绘图是通过将几何体对象

我试图只显示分划中的线交点,而不是D3地图中的整条线

是否支持使用d3.geo.gracile实现此功能

非常感谢你的帮助!
Thierry

对您的问题的简短回答是:不,没有办法只渲染与
d3.geo.gracile
的交点

但是,通过将要绘制的交点放入一个辅助数组中,并将其传递给路径生成器进行渲染,可以轻松实现所需的结果。我用我的一个例子来演示解决方案:

  • 设置包含要传递给对象的几何体对象的辅助对象数组

  • 使用嵌套选择绑定二维(横向/纵向)阵列,并使用enter选择附加交点。实际绘图是通过将几何体对象提供给路径生成器来完成的,路径生成器将考虑投影

    // Do a nested selection to bind the two-dimensional data.
    map.selectAll("g.lat")
        .data(lonLatIntersections)
      .enter().append("g")                  // Create groups per latitude.
        .classed("lat", true)
        .selectAll("circle")
          .data(function(d) { return d; })  // Data binding for longitudes
        .enter().append("path")
          .attr({
            "d": path,                      // Use the path generator to draw points
            "class": "confluence"
          });
    
  • // Do a nested selection to bind the two-dimensional data.
    map.selectAll("g.lat")
        .data(lonLatIntersections)
      .enter().append("g")                  // Create groups per latitude.
        .classed("lat", true)
        .selectAll("circle")
          .data(function(d) { return d; })  // Data binding for longitudes
        .enter().append("path")
          .attr({
            "d": path,                      // Use the path generator to draw points
            "class": "confluence"
          });