Solved

Filter graph data in prefuse

Posted on 2009-04-13
1
792 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
login jsp example 24 69
tomcat administrtor 12 61
sql import cannot be resolved jsp 3 50
Crystal Reports Licensing Questions 4 37
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This video teaches viewers about errors in exception handling.

821 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