Solved

Filter graph data in prefuse

Posted on 2009-04-13
1
796 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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 about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

617 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