Solved

Filter graph data in prefuse

Posted on 2009-04-13
1
784 Views
Last Modified: 2012-05-06
I'm trying to filter some data using the prefuse visualization toolkit.
I can create a Graph and show all my data. I need to filter some data.
If I use a ListQueryBinding and add the query to a AndPredicate, thisone to a VisibilityFilter and the filter to an ActionList, nothing happens.
The ComboBox I created using ListQueryBinding.createComboBox(), works fine (it shows all possibility I want to have to filter my data).

I load my data from a GraphML file and my data stucture is a Graph.
Can you help me?

I attach the code that may be useful.
"anno" is a field in my XML source file.

Graph g = new GraphMLReader().readGraph("data/outGraph.xml");

final Visualization vis = new Visualization();

vis.add(graph,g);
 

ListQueryBinding annoQ = new ListQueryBinding(vis.getGroup(edges), "anno");

AndPredicate filter = new AndPredicate(annoQ.getPredicate());

ActionList update = new ActionList(Activity.INFINITY);

update.add(new VisibilityFilter("anno", filter));

update.add(new RepaintAction());

vis.putAction("update", update);

Open in new window

0
Comment
Question by:usilunet
1 Comment
 

Accepted Solution

by:
usilunet earned 0 total points
ID: 24137095
I found the solution!!!!
Create binding, visibility filter and actionlist as follows:

final ListQueryBinding annoQ = new ListQueryBinding((Table)vis.getGroup(edges), "anno",false);
final VisibilityFilter anno_fil = new VisibilityFilter(edges,annoQ.getPredicate());
ActionList anno_filter = new ActionList();
anno_filter.add(anno_fil);
anno_filter.add(new RepaintAction());

then I used a comboBox as follows:

JComboBox timeCombo = annoQ.createComboBox();
timeCombo.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent arg0) {
            vis.removeAction("anno_filter");
            VisibilityFilter anno_fil = new VisibilityFilter(edges, annoQ.getPredicate());
            ActionList anno_filter = new ActionList(1000);
            anno_filter.add(anno_fil);
            anno_filter.add(new RepaintAction());
            vis.putAction("anno_filter", anno_filter);
            vis.putAction("layout", layout);
            vis.run("anno_filter");
      }});
timeCombo.setSelectedIndex(0);

and by selecting a list item the visualization will be updated.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video teaches viewers about errors in exception handling.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now