Refresh edge and node labels without redrawing the whole graph

16 views
Skip to first unread message

kumarpandey

unread,
Jun 10, 2009, 8:30:40 PM6/10/09
to BirdEye
I'm exploring using ravis with enhanced graph in a real-time reporting
system.
I'm trying to refresh the edge label periodically with new text but
not having enough sucess. If someone could point me to the right
direction I'd appreciate it.
For now I have a simple requirement whereby the node and edges in the
graph is fixed and only the labels of the edge and node changes
(represents realtime data)

Here's what I have so far but this is not refreashing the labels on
the edges

var edges:Dictionary = vgraph.visibleVEdges;
for (var key:Object in edges) {
// iterates through each object key
var edge:EnhancedVisualEdge = (key as
EnhancedVisualEdge);
edge.data.edgeLabel="007";
}
vgraph.redrawEdges();
//vgraph.draw();
//vgraph.refresh();
//vgraph.draw(VisualGraph.DF_RESET_LL)


Thanks
Kumar

JB

unread,
Jun 11, 2009, 10:37:52 PM6/11/09
to BirdEye
Kumar,

You should be able to handle this with an event listener (for data
changes) in your node renderer. Have you tried this?

JB

kumarpandey

unread,
Jun 18, 2009, 6:20:29 PM6/18/09
to BirdEye
Thanks for the tip . Here is what I did and its working great..

In org.un.cava.birdeye.ravis.graphLayout.visual.IVisualEdge
added a method
function updateLabelText(txt:String):void;
Implemented it on
org.un.cava.birdeye.ravis.enhancedGraphLayout.visual.EnhancedVisualEdge
like so -

public function updateLabelText(txt:String):void{
var i:int=0;
if (data is XML)
{
data.@edgeLabel = txt;
}
else
{
data.edgeLabel=txt;
}
dispatchEvent(new VGEdgeEvent(VGEdgeEvent.VG_EDGE_LABEL_CHANGE));
}

This is invoked from the main application to update the label of the
edge


Now in
org.un.cava.birdeye.ravis.enhancedGraphLayout.visual.edgeRenderers.EdgeRenderer
under public function set data(value:Object):void
added
_data.addEventListener(VGEdgeEvent.VG_EDGE_LABEL_CHANGE,refreshLabel);

and implemeted refreshLabel in EdgeRenderer like so -

public function refreshLabel(event:Event):void
{
var edgeVO:Object = data.data;
var html:String = '';
if (edgeVO is XML)
{
if (edgeVO.@edgeLabel)
html = edgeVO.@edgeLabel.toString();
}
else
{
if (edgeVO.edgeLabel)
html = edgeVO.edgeLabel;
}

label.autoSize = TextFieldAutoSize.CENTER;
label.text = html;

cholid ridwan

unread,
Jun 25, 2009, 3:09:38 AM6/25/09
to flexviz...@googlegroups.com
hi there
in here
(http://flexlib.googlecode.com/svn/trunk/examples/DraggableSlider/Slider_Sample.swf)
has two slider,how to add source "change"?
Reply all
Reply to author
Forward
0 new messages