简体   繁体   中英

Loading shapes into d3

I have a set of shapes that I want to use in D3. They have defined borders and are in png format. I can't figure out how to use them though. This seems like it should be supported, but I've searched around the web and on SO and can't seem to find out how to do so. Can someone point me in the right direction please?

SVG shapes are loaded as paths or, in the case of predefined shapes like circles, ellipses and rectangles, as those shapes with attributes that determine their size.

If you're loading pngs, you need to load an image, like this:

newImage = svg.append("svg:image")
.attr("xlink:href", "../yourImageNameAndPath.png")
.attr("width", 280)
.attr("height", 280);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM