我是 D3 的新手,我正在尝试将 D3 树状图从 V3 转换为 V4。我已经阅读了一些信息更新更新的代码,但我不知道如何让它工作。
树形图来自 Pivottable.js D3 渲染器。
这是部分。
color = d3.scale.category10();
width = opts.d3.width();
height = opts.d3.height();
treemap = d3.layout.treemap().size([width, height]).sticky(true).value(function(d) {
return d.size;
});
d3.select(result[0]).append("div").style("position", "relative").style("width", width + "px").style("height", height + "px").datum(tree).selectAll(".node").data(treemap.padding([15, 0, 0, 0]).value(function(d) {
return d.value;
}).nodes).enter().append("div").attr("class", "node").style("background", function(d) {
if (d.children != null) {
return "lightgrey";
} else {
return color(d.name);
}
}).text(function(d) {
return d.name;
}).call(function() {
this.style("left", function(d) {
return d.x + "px";
}).style("top", function(d) {
return d.y + …Run Code Online (Sandbox Code Playgroud) 我正在尝试为自定义 sdk 创建一个cordova插件。这个 sdk 使用蓝牙,有两个选项可供使用。
我认为我的问题是我必须创建一个自定义应用程序类。
使用cordova插件可以做到我需要的吗?