Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/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
SVG:链接文本路径上未显示文本_Svg - Fatal编程技术网

SVG:链接文本路径上未显示文本

SVG:链接文本路径上未显示文本,svg,Svg,我用JS和D3生成一个SVG。 下面的代码是生成的SVG的代表性摘录。 在文本中不是在路径上绘制,而是在页面中间,虽然它指的是组11。 我是一个绝对的svg初学者,所以对于一个专家来说可能只是几秒钟的事情。。。 提前谢谢 <?xml version="1.0" encoding="UTF-8"?> <svg id="svg" width="960" height="750"> <g transform="translate(480,375)">

我用JS和D3生成一个SVG。 下面的代码是生成的SVG的代表性摘录。 在文本中不是在路径上绘制,而是在页面中间,虽然它指的是组11。 我是一个绝对的svg初学者,所以对于一个专家来说可能只是几秒钟的事情。。。 提前谢谢

<?xml version="1.0" encoding="UTF-8"?>
<svg id="svg" width="960" height="750">
<g transform="translate(480,375)">       
    <g class="group">
        <path d="M-146.8148124720131,-340.98676416953145A371.25000000000006,371.25000000000006 0 0,1 -18.55476659174032,-370.78603417163123L-16.867969628854837,-337.07821288330103A337.5,337.5 0 0,0 -133.46801133819372,-309.98796742684675Z"
            style="fill: rgb(170, 170, 170); stroke: rgb(170, 170, 170);"
            id="group-11" />
        <text>
            <textPath href="#group-11">Some text that should be connected to group-11</textPath>
        </text>
    </g>
</g>
</svg>

某些文本应连接到第11组
您应该在textPath元素中使用“xlink:href”属性,并在svg根元素中为svg和xlink添加xmlns


某些文本应连接到第11组

Oh damn…我使用firebug访问动态呈现的SVG,由于缺少xmlns属性,他显然返回了href而不是xlink:href。谢谢,现在我更进一步了xlink:href已被弃用,此解决方案在iOS中不起作用。
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg" width="960" height="750">
    <g transform="translate(480,375)">       
        <g class="group">
            <path d="M-146.8148124720131,-340.98676416953145A371.25000000000006,371.25000000000006 0 0,1 -18.55476659174032,-370.78603417163123L-16.867969628854837,-337.07821288330103A337.5,337.5 0 0,0 -133.46801133819372,-309.98796742684675Z"
                style="fill: rgb(170, 170, 170); stroke: rgb(170, 170, 170);"
                id="group-11" />
            <text>
                <textPath xlink:href="#group-11">Some text that should be connected to group-11</textPath>
            </text>
        </g>
    </g>
</svg>