您好我使用d3.d.ts库处理D3JS项目,我有这段代码
String command="your command here";
StringBuffer output = new StringBuffer();
Process p;
try {
p = Runtime.getRuntime().exec(command);
p.waitFor();
BufferedReader reader =
new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
while ((line = reader.readLine())!= null) {
output.append(line + "\n");
}
} catch (Exception e) {
e.printStackTrace();
}
log.inf(output.toString());
并且链接上的事件似乎无法正常工作
this.force
.nodes(this.graph.nodes)
.links(this.graph.edges)
.on("tick", () => this.tick())
.start();
this.links = this.svg.selectAll(".link")
.data(this.graph.edges)
.enter().append("line")
.on("click", (e: NVEdge) => { this.edge = e ; console.log("toto") })
.on("dblclick",(e:NVEdge) => { this.edgemodalstate = true })
.attr("class", "link");
this.nodes = this.svg.selectAll(".node")
.data(this.graph.nodes)
.enter().append("circle")
.attr("class", "node")
.attr("r", 10)
.attr("id", (n: NVNode) => { return n.id })
.style('fill', (n: NVNode) => { return n.branch.color })
.style('stroke', (n: NVNode) => { return n.branch.color })
.on("mousedown", (n: NVNode) => { this.mousedown(n) })
.call(this.force.drag)
.on("mouseup", (n: NVNode) => { this.mouseupNode(n) })
.on("dblclick", (n: NVNode) => { this.nodemodalstate = true });
this.nodes.append("title").text((n: NVNode) => { return n.name; });
如果有人知道如何解决这个问题,我会很高兴听到它:D