adding link names

18 views
Skip to first unread message

modern_novice

unread,
Oct 17, 2011, 10:41:20 PM10/17/11
to protovis
HI

I want to add link names to the links between the nodes . I am using
the arc diagram networks. I added this line:arc.link.text(function(d)
d.linkName);

But it is not adding anything above the link. What am i missing
conceptually?

var vis = new pv.Panel()
.width(880)
.height(310)
.bottom(90);

var arc = vis.add(pv.Layout.Arc)
.nodes(miserables.nodes)
.links(miserables.links)

arc.link.add(pv.Line);
arc.link.text(function(d) d.linkName);


arc.node.add(pv.Dot)
.fillStyle(pv.Colors.category19().by(function(d) d.group))
.strokeStyle(function() this.fillStyle().darker());

arc.label.add(pv.Label)

vis.render();


my data set looks like:
var miserables = {
nodes:[
{nodeName:"A", group:1},
{nodeName:"B", group:2},
{nodeName:"C", group:3},
{nodeName:"D", group:4},
{nodeName:"E", group:5},
{nodeName:"F", group:6},
{nodeName:"G", group:7},
{nodeName:"H", group:8},
{nodeName:"I", group:9},
{nodeName:"J", group:10}
],
links:[
{source:1, target:2, value:1,linkName:'1980'},
{source:2, target:4, value:1,linkName:'1990'},
]
};
Reply all
Reply to author
Forward
0 new messages