Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一组要在 D3 中使用的形状。他们已经定义了边界并且是 png 格式。我不知道如何使用它们。这似乎应该得到支持,但我已经在网上和 SO 上进行了搜索,似乎无法找到如何做到这一点。有人可以指出我正确的方向吗?
SVG 形状作为路径加载,或者在预定义形状(如圆形、椭圆和矩形)的情况下,加载为具有确定其大小的属性的形状。
如果要加载 png,则需要加载图像,如下所示:
newImage = svg.append("svg:image") .attr("xlink:href", "../yourImageNameAndPath.png") .attr("width", 280) .attr("height", 280);