Jam*_*mie 4 javascript svg d3.js
我正在尝试做一些相对简单的事情。我正在尝试在 D3 中进行以下工作:
我被困在如何将图像绘制为 SVG 元素。到目前为止,我有:
content.append("image")
.attr("xlink:href",this.store.image_url);
Run Code Online (Sandbox Code Playgroud)
但是我怎样才能得到这个元素的自然宽度/高度?
你可以用一点javascript来做到这一点
var img = new Image();
img.onload = function(){
img.naturalWidth and img.naturalHeight can be read off within here
};
img.src = this.store.image_url;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2511 次 |
| 最近记录: |