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 如何使svg符号成为阴影_D3.js_Svg_Symbols - Fatal编程技术网

D3.js 如何使svg符号成为阴影

D3.js 如何使svg符号成为阴影,d3.js,svg,symbols,D3.js,Svg,Symbols,我试图使用svg.symbols将过滤器附加到路径,但它没有出现 这是我的密码 让namngu=d3.选择(“主体”) .append(“svg”) .attr(“宽度”、“5000”) .attr(“高度”、“5000”); 让namnguvcl=namngu.append(“defs”) 让filter=namnguvcl.append(“filters”) .attr(“id”、“阴影线”); filter.append(“feGaussianBlur”) .attr(“in”,“Sou

我试图使用svg.symbols将过滤器附加到路径,但它没有出现

这是我的密码

让namngu=d3.选择(“主体”)
.append(“svg”)
.attr(“宽度”、“5000”)
.attr(“高度”、“5000”);
让namnguvcl=namngu.append(“defs”)
让filter=namnguvcl.append(“filters”)
.attr(“id”、“阴影线”);
filter.append(“feGaussianBlur”)
.attr(“in”,“SourceAlpha”)
.attr(“stdDeviation”,4)
让namnhuconbo=filter.append(“feMerge”)
namnhuconbo.append(“feMergeNode”)
namnhuconbo.append(“feMergeNode”)
.attr(“in”,“SourceGraphic”)
让namngunhucho=namnguvcl.append(“符号”)
.attr(“id”,“may”)
.attr(“保留Aspectratio”、“无”)
.attr(“视图框”、“0 17275 8599”)
append(“svg:path”)
.attr(“d”,“M 5097.99967 2512.5 q 67-30 134 0”)
.attr(“样式”,“填充:透明;笔划:蓝色”)
namngu.append(“使用”)
.style(“过滤器”、“url(#放置阴影线)”)
.attr(“xlink:href”,“#may”)

结果SVG代码中的错误:

  • 您的代码中有
    而不是

  • 符号有一个视图框,但“使用”元素没有宽度和高度

  • svg元素很大,没有viewBox属性

  • 与形状的边界框相比,符号的viewBox属性非常重要

  • 纠正所有这些问题后,将应用过滤器

    svg{border:solid}

    我遵循了你的方法,但我无法在d3.js上显示它,我不知道你为什么会输入错误:使用
    viewBox
    而不是
    viewBox