Post Reply 
Graph edges don't refresh inside flex app
23-01-2010, 01:07 AM
Post: #1
Graph edges don't refresh inside flex app
hi ppl,

I'm working on a social network visualization based on flare RadialTreeLayout example inside a flex project. Everything works fine using a small GraphML file (SocialNetwork2.xml, 30 nodes) but strange behaviour appears when visualizing more nodes (SocialNetwork.xml, >100 nodes). Edges of graph only refreshes when moving mouse over DataGrid component. I can't figure out how to refresh the graph edges from code. Any ideas?

Just run the socialnetwork.mxml to see the application. The project is for flex builder (linux version but should work fine on different OS).

greetings
Gerald


Attached File(s)
.zip  SocialNetwork.zip (Size: 525.39 KB / Downloads: 129)
Find all posts by this user
Quote this message in a reply
28-01-2010, 03:18 PM
Post: #2
RE: Graph edges don't refresh inside flex app
Hi!

It's a flash problem, not flare.
Well.... Flare listen to the flash Event.RENDER to render all sprites.
When flash is overbooked, he dont dispatch this event and flare cant redraw sprites.

The solution is to call with a timer for instance the renderDirty method of flare.

Quick and dirty but it works.... Smile

<joky />

One year ago, i didn't know flare. Thanks to this board, i do..
I now want to help you if I can. Ask for help...
Visit this user's website Find all posts by this user
Quote this message in a reply
01-02-2010, 05:07 AM
Post: #3
RE: Graph edges don't refresh inside flex app
1000 thanks Joky!

Inserting a Timer at function updateRoot (SocialNetwork.as: line 159) calling flare.display.DirtySprite.renderDirty() every 100 ms fixed the problem.

Just found another error in my application unrelated to the redraw issue: Clicking the last element in the DataGrid causes flash plugin and browser to hang up. Also resorting first column (click header) and selecting last element results in a blocked browser window. The problem is at Datagrid findString method: When I comment calling this function (socialnetwork.mxml: line 158) everything works fine. What is wrong calling datagrid.findString(label)?

greetings
g.
Find all posts by this user
Quote this message in a reply
13-02-2010, 05:22 AM
Post: #4
RE: Graph edges don't refresh inside flex app
I'm having the same problem with much smaller graphs (<10 nodes). can you please post the lines of code which fixed the problem? Is a timer really needed? can't we just cycle through the node or edge list and call .dirty() on each sprite? thanks, JH
Find all posts by this user
Quote this message in a reply
26-02-2010, 08:58 PM
Post: #5
RE: Graph edges don't refresh inside flex app
I solved it with a timer as proposed by joky. Download the Attached File from first posting in this thread, add startTimer(); in function updateRoot() and add the following two functions to SocialNetwork.as:

Code:
private function startTimer():void {
    var timer:Timer = new Timer(200,1);
    timer.addEventListener(TimerEvent.TIMER, timerHandler);
    timer.start();
}
        
public function timerHandler(event:TimerEvent):void {
    flare.display.DirtySprite.renderDirty();
}

As I use a Transitioner redrawing of edges is needed, I couldn't find a solution without a Timer.
Find all posts by this user
Quote this message in a reply
02-04-2010, 02:32 PM
Post: #6
RE: Graph edges don't refresh inside flex app
Nop, you cant "just" loop in edges and nodes because the dirty() method juste set the state dirty to this datasprite.

And the render method is called when sprite is dirty AND when flare listens to the RENDER event.

You have to call manually the renderDirty method.

<joky />

One year ago, i didn't know flare. Thanks to this board, i do..
I now want to help you if I can. Ask for help...
Visit this user's website Find all posts by this user
Quote this message in a reply
03-04-2010, 09:18 PM
Post: #7
RE: Graph edges don't refresh inside flex app
I had a similar problem, and finally found a fix in the sourceforge forum.

I have the following in my init() function in my mxml component that handles the graph:

Code:
    // fix for bug where the edges get forgotten
    // see: http://sourceforge.net/projects/prefuse/forums/forum/757572/topic/2190163
    this.visualization.addEventListener(VisualizationEvent.UPDATE, function ():void{DirtySprite.renderDirty(); });
Find all posts by this user
Quote this message in a reply
13-04-2010, 03:00 PM
Post: #8
RE: Graph edges don't refresh inside flex app
@AtomBoy : Yes it can work for fixing force directed layout bug...
But, when the bug occurs when we drag a node, it sont fix because event is not dispatched here.

<joky />

One year ago, i didn't know flare. Thanks to this board, i do..
I now want to help you if I can. Ask for help...
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: