如何在移动专利套装中添加属性

How do I add an attribute in Mobile Patent Suits?

本文关键字:添加 属性 移动      更新时间:2023-09-26

我想使用移动专利套装为两个节点之间的连接添加名称/文本

           is used by
i.e Oracle ----------> Google

节点在此处创建:

links.forEach(function(link) {
    link.source = nodes[link.source] || (nodes[link.source] = {name: link.source});
    link.target = nodes[link.target] || (nodes[link.target] = {name: link.target});
});

但是查看创建图形的代码,没有函数可以插入类似的东西

node.append("title")
    .text("my text");

(并且添加此它不起作用)。知道吗?

您可以将 textPath 附加到链接。

var path = svg.append("g").selectAll("path")
    .data(force.links())
    .enter()
    .append("g")
    .attr("class", "link-group")
    .append("path")
        .attr("class", "link")
        .attr("id", function(d, i) { return "link" + i;})
        .attr("marker-end", "url(#end)");
svg.selectAll(".link-group").append("text")
    .attr("dy", "-0.5em")
    .append("textPath")
    .attr("startOffset",function(d,i){return 8/20;})
    .attr("xlink:href",function(d,i){return "#link"+i;})
    .text("hello")
    ;

下面是一个示例:

http://vida.io/documents/FTC9fmmEP2Geg735z