2
當onerror被觸發時,如何隱藏svg:圖像?d3設置圖像可見性=隱藏onerror
node.append('svg:image')
.attr("x", "-30px")
.attr("y", "-40px")
.attr("width", "60px")
.attr("height", "80px")
.attr("xlink:href", function(d){
return 'https://somedomain.com/images/' + d.name;
})
.attr("onerror", function(d){
console.log('The image ' + d.name + ' failed to load');
// this.style("visibility", "hidden");
// d.style("visibility", "hidden");
});