有没有人在创建d3.js可视化时尝试过使用将svg转换为canvas的库?我曾经尝试过在Android 2.3应用程序Webview中使用canvg.js和d3.js将svg转换为canvas,但当我调用以下内容时:
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 < 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;");
我遇到了错误: 未捕获的类型错误: 无法调用null的方法 setProperty
http://mbostock.github.com/d3/d3.js?2.5.0:1707
是否可以使用无头浏览器应用程序或服务器端js解析器来解决?有人遇到过这种情况吗?