Solved

Filter graph data in prefuse

Posted on 2009-04-13
1
795 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Better way to make a string with template variables in java 3 51
sql import cannot be resolved jsp 3 115
ejb mdb examples 1 38
JVM error from eclipse 1 25
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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

732 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