How to filter nodes AND links dynamically in a node-link network in protovis?

27 views
Skip to first unread message

Baptiste Gaultier

unread,
Oct 27, 2011, 4:52:50 AM10/27/11
to protovis
Hi there,

First, I would like to thank the guys behind protovis for the work
they have done !
Following the old thread I found here :
http://groups.google.com/group/protovis/browse_thread/thread/66ff2f40318e74e0
I wanted to filter dynamically not only the links but also the nodes.

I tried something like :

function update(newfiltervalue) {
filtervalue = newfiltervalue;
vis.render();
}

var w = 710,
h = 524
filtervalue = 1;

var vis = new pv.Panel()
.width(w)
.height(h)


var layout = vis.add(pv.Layout.Network);

layout.nodes(sensors.nodes.filter(function(d) { return d.group <=
filtervalue}));
layout.links(sensors.links);

/* ...some code... */

I tried also to filter nodes with the .visible attribute like
so : .visible(function(d) d.group <= filtervalue)
which works but I don't think it's the best way to filter nodes since
links are still visible.

Any help here ?


--
Baptiste Gaultier

Reply all
Reply to author
Forward
0 new messages