Skip to content Skip to sidebar Skip to footer

How To Embed Bitmap Into D3js Generated Svg Code?

Given access to suitable topojson and bitmaps, I use the topoJSON file to generate a SVG viz via D3js. Then I append a bitmap to it via : // Append bitmap svg.append('image')

Solution 1:

This example shows how to draw an image to a canvas element and use the .toDataURL function to get a snapshot of this canvas into a string that you can then use as the xlink:href attribute:

http://bl.ocks.org/emeeks/707681f1f5b4a2063d6e

Post a Comment for "How To Embed Bitmap Into D3js Generated Svg Code?"