Newbie to Ravis and flex

57 views
Skip to first unread message

Sharada Patil

unread,
Nov 24, 2009, 3:54:27 PM11/24/09
to BirdEye
Hi

This might seem like a silly question but am new to Ravis and Flex
and have been stuck up with this issue .

I have created a graph using birdeye ravis with the following structre
of my code

graph.xml -> data of the nodes (name,color, dessciption,size) and
edges that connect the nodes

BasicNodeRenderer.mxml -> code representing each node as a circle like
<local:Circle id="circle" toolTip="{this.data.data.@name}:
{this.data.data.@desc}" />

BasicEdgeRenderer.mxml-> code representing each edge as a Box

and the main xml that has a combobox with options of the node names.

On selecting an option from the combobox I would want to highlight the
nodes with that name chosen.

This is the mx i have
<mx:ComboBox width="248" change="changeEvt(event)">
<mx:ArrayCollection>
<mx:String>No option</mx:String>
<mx:String>Option 1</mx:String>
<mx:String>Option 2</mx:String>
<mx:String>Option 3</mx:String>
</mx:ArrayCollection>
</mx:ComboBox>

private function changeEvt(event:Event):void {
if ( event.currentTarget.selectedItem.label =
this.data.data.@name)
{
<basicNodeRenderer> circle.color = 0xff0d00; </basicNodeRenderer>
}

}

This does not work and would like to know the issue in the code and
how I need to address the highlighting.I am not sure how to capture
the name of the nodes and use it to compare with the seleteditem in
the combobox as well as how it can be highlighted.

Are there any tutorials that can be suggested to understand this?

Thank you.
Best regards
Sharada




ebowler

unread,
Dec 4, 2009, 2:25:48 PM12/4/09
to BirdEye
Have you tried this?
if ( event.currentTarget.selectedItem.label ==
this.data.data.@name)
{
<basicNodeRenderer> circle.color = "0xff0d00"; </
basicNodeRenderer>
}

Sharada Patil

unread,
Dec 4, 2009, 3:27:46 PM12/4/09
to BirdEye
Hi

I tried that adn it doesnt work. Actually, I think the problem is that
it doesnt enter the if condition. I added a statement status.text =
"Funny" as String; for a text object inside the if and I did not see
"Funny" appearing.

Another way I did was checked
if (event.currentTarget.selectedItem.label ="Text" )
{
graph.nodeByStringId("2").vnode.data.color = 0xff0d00;
}

Though its not an efficient way (because I manually find the node with
the name "Text" and hardcoded it ) I did it just to test if it works
and it didnt work either!

Thank you.

Jane

unread,
Dec 11, 2009, 1:58:51 PM12/11/09
to BirdEye
Hi!

I'm trying to do the same stuff.
You can enter the if-condition as follows:

private funtion changeEvent():void{

if((String(comboboxId.selectedItem)) == "item"){
Alert.show("whohoo"); //or whatever you want :)
}
}

...but I can't tell you (yet) how to change the node color. If you
know it before me, just tell me :).


greetings,
jane

Jane

unread,
Dec 12, 2009, 6:01:19 AM12/12/09
to BirdEye

Sharada Patil

unread,
Dec 16, 2009, 8:35:44 PM12/16/09
to BirdEye
Hi

status.text = this.data.data.@name as String;
if ( status.text == "Maximizer CRM" as String)
{ var vnode:IVisualNode=graph.nodeByStringId("2").vnode;
vnode.data.@nodeColor = 0xff0d00;
}

doesnt work either! :(

On Dec 12, 6:01 am, Jane <minute_of_de...@web.de> wrote:
> This could help:http://groups.google.com/group/flexvizgraphlib/browse_thread/thread/2...

Jane

unread,
Dec 17, 2009, 3:25:45 AM12/17/09
to BirdEye
Hi!

What doesn't work exactly? Can you get into the if-condition?

If not try it like in my example...your code don't look like example
above.
It works pretty fine for me...and I think it can work pretty fine for
you too.
If you give the me more code of yours, I might help you with this
issue.

By the way: The Link I posted works as well...but I don't know how to
get the vnodes without saying the StringId.

Sharada Patil

unread,
Dec 17, 2009, 1:54:10 PM12/17/09
to BirdEye
Hi Jane

The If condition always worked. The problem I am facing is the same as
you do. I would want to compare a string (status.text or
combobox.selecteditem) with a node name or node description. If it
matches, then the node should change its color. So far I am not able
to match the selecteditem with the node name and I instead use a text
and then try to update the color of the node ( which I am not able to
do again).

Hence, I am facing 2 issues here.
1.Comparing the selecteditem with a node name
2. Updating the color of the node.

I think we both are facing similar issues.

In the previous post I sent, I tried comparing the selecteditem
( which is stored in a variable status.text) with a text and it would
enter the if condition. Then I tried getting the node , var
vnode:IVisualNode=graph.nodeByStringId("2").vnode , having the name
"Maximizer CRM" to update its color. Now thats the part that did not
work. Though comparing the selecteditem with a text is not an
efficient way as I am hard coding the name and is a manual way of
doing it leading to many if conditions, I was trying to check if the
way I mentioned would update the node color.

I hope it is more clearer now.

Thank you.
Sharada

Jane

unread,
Dec 17, 2009, 2:50:51 PM12/17/09
to BirdEye
Gotcha :)!

I've fixed the problem almost.

my Code for issue 1:

private function changeUser():void{

//TODO: delete previous selection

for(var j:int = 0; j < user.length; j++)
{ //
user names I have, stored in array
if((String(createdBy.selectedItem)) == user[j])
{ //
select one user name

for (var i:int = 0; i < ids.length; i++)
{ //
all nodes I have
if (createdByUser[i] == (String(createdBy.selectedItem)))
{ //if selected user name == username in node
var vnode:IVisualNode = vgraph.graph.nodeById(ids
[i]).vnode; // get this node
vnode.changeColor
(0xFFFFFF); //
change color of node
}
}
}
}
}

for issue 2: I already posted a link, which deals with that problem.
And could solve my problem in this way. But I don't know if you have
the same settings...

Sharada Patil

unread,
Dec 23, 2009, 3:39:35 PM12/23/09
to BirdEye
Hi Jane

Thanks for the help. Issue 1 seems to be resolved with your
suggestion. Issue 2, I will see what works out as the structure of my
project seems different.

Regards,
Sharada

Sharada Patil

unread,
Dec 24, 2009, 4:13:26 AM12/24/09
to BirdEye
Hi Jane

Regarding the second issue, changeName() , I think, is part of
IVisualNode.as file. So I created a file and added a function
changeColor() to it. Is that what it means?

Thank you.
Best regards
Sharada

Reply all
Reply to author
Forward
0 new messages