2

I am able to append images to a Node; however I am unable to set the height of the image? Any help would be much appreciated.

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
VividD
  • 10,456
  • 6
  • 64
  • 111
Rob
  • 1,226
  • 3
  • 23
  • 41
  • What do you mean by "setting the height" of an image? Maybe to corp the image so that it is not highter than the rectangle that represents the node in question? – VividD Dec 16 '14 at 18:56
  • @VividD I would like to stretch the image to fit the height of the node if possible. – Rob Dec 17 '14 at 19:08

0 Answers0