Javascript d3.js具有高图像的Sankey节点

Javascript d3.js具有高图像的Sankey节点,javascript,d3.js,sankey-diagram,Javascript,D3.js,Sankey Diagram,我能够将图像附加到节点;但是我无法设置图像的高度?任何帮助都将不胜感激 node.append("image") .attr("xlink:href", function(d) { if ( d.id.lastIndexOf("gp_", 0) === 0 ) return "raceflag.jpg";

我能够将图像附加到节点;但是我无法设置图像的高度?任何帮助都将不胜感激

node.append("image")
                    .attr("xlink:href", function(d) {
                        if ( d.id.lastIndexOf("gp_", 0) === 0 )
                            return "raceflag.jpg";
                        else if (d.id === "ct_ferrari")
                            return "ferrari.jpg";
                        else if (d.id === "ct_red_bull")
                            return "redbull.jpg";
                        else if (d.id === "ct_williams")
                            return "williams.jpg";
                        else if (d.id === "ct_force_india")
                            return "forceindia.jpg";
                        else if (d.id === "ct_mclaren")
                            return "mclaren.jpg";
                        else if (d.id === "ct_mercedes")
                            return "mercedes.jpg";
                        /*
                        else if (d.id === "dr_nico_rosberg" || d.id === "dr_sebastian_vettel")
                            return "german.jpg";
                        */
                    })
                    .attr("x", 1)
                    .attr("y", 1)
                    .attr("width", sankey.nodeWidth() - 1)
                    .attr("height", 200); //this only positions the image within the node

你所说的“设置图像高度”是什么意思?也许可以对图像进行压缩,使其不高于表示所讨论节点的矩形?@vigrad如果可能,我想拉伸图像以适合节点的高度。