D3附加图像但来自本地目录

时间:2017-05-02 10:00:31

标签: javascript d3.js

所以我使用它来在节点中附加图像并且效果很好:

 ```this.node.append("svg:image")
        .attr("class", "lock")
        .attr("dx", 12)
        .attr("dy", ".35em")
        .attr('x',5)
        
        .attr('y',-15)
        
        .attr('width', 10)
        .attr('height', 10)
        .attr("xlink:href", "https://example.com/png");```

问题是我想使用本地img作为img的src我无法加载它。

1 个答案:

答案 0 :(得分:-1)

问题是由于团队使用word press,所以我不得不给它一个不同的路径:

this.node.append("image")
    //...
    .attr("xlink:href", "http://localhost/wp-content/uploads/2017/lock.png");