title: SVG to Canvas with d3.js
body: <p>Has anyone tried using a svg to canvas library when creating d3.js visualizations?  I've tried to use canvg.js and d3.js to convert svg to canvas from within an android 2.3 application webview, but when I call:</p>
  
  <pre><code>svg.selectAll(".axis")
      .data(d3.range(angle.domain()[1]))
      .enter().append("g")
      .attr("class", "axis")
      .attr("transform", function(d) { return "rotate(" + angle(d) * 180 / Math.PI + ")"; })
      .call(d3.svg.axis()
          .scale(radius.copy().range([-5, -outerRadius]))
          .ticks(5)
          .orient("left"))
      .append("text")
      .attr("y", 
          function (d) {
              if (window.innerWidth &lt; 455){
                  console.log("innerWidth less than 455: ",window.innerWidth);
                  return -(window.innerHeight * .33);
              }
              else {
                  console.log("innerWidth greater than 455: ",window.innerWidth);
                  return -(window.innerHeight * .33);
              }
          })
      .attr("dy", ".71em")
      .attr("text-anchor", "middle")
      .text(function(d, i) { return capitalMeta[i]; })
      .attr("style","font-size:12px;");
  </code></pre>
  
  <p>I get the error: Uncaught TypeError: Cannot call method <code>setProperty</code> of null <a href="http://mbostock.github.com/d3/d3.js?2.5.0:1707" rel="noreferrer">http://mbostock.github.com/d3/d3.js?2.5.0:1707</a></p>
  
  <p>Would some sort of headless browser application, or a server side js parser work?  Has anyone encountered this before?</p>