custom shape insert picture
JavaMrYang opened this issue · comments
JavaMrYang commented
I want to insert a picture in a custom shape
haex commented
Have you tried this?
function(parent, bbox, node, options) {
let { width, height } = bbox
let shapeSvg = parent
.append("img")
.attr('src', 'url_of_your_picture')
.attr('width', width)
.attr('height', height)
node.intersect = point => {
return dagreD3.intersect.rect(node, point)
}
return shapeSvg
}
haex commented
or you can add the image, after the node is rendered.
d3.select('id_node_where_image_goes').append('img').attr('src', 'url_of_image')
JavaMrYang commented
thank you,fixed