Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Labels of nodes (Read 9862 times)
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Labels of nodes
Feb 23rd, 2009 at 3:03pm
Print Post  
Hi,

Is there a way where I can put some labels to the shape nodes. The current property uses the text which I provide on the body of the image. I want the label to appear outside of the image (may be bottom). Please help. Thanks,

Amit
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Labels of nodes
Reply #1 - Feb 23rd, 2009 at 3:29pm
Print Post  
Hi Amit,

At this time you can do that only by creating a user control and using ControlNodes to display its instances in the diagram.

Stoyan
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Labels of nodes
Reply #2 - Feb 27th, 2009 at 7:01am
Print Post  
Hi Stoyan,

Is there any plan of having this feature inbuilt in the default ShapeNodes in near release of DG.

Regards,
Amit
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Labels of nodes
Reply #3 - Feb 27th, 2009 at 7:39am
Print Post  
Hi Amit,

There will be ImageAlign and TextFormat properties available in the 1.0.2 release; you could use them to align the image to the top of the node and the text to the bottom. This will let you create icon-like nodes when combined with the Transparent property.

We also plan to add support for ControlTemplates to this release - they will let you place the text below the geometric shape if you need to display the shape as well.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Labels of nodes
Reply #4 - Feb 27th, 2009 at 9:40am
Print Post  
Thanks very much Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Labels of nodes
Reply #5 - Mar 5th, 2009 at 11:55am
Print Post  
Hi Amit,

This version adds the ImageAlign and TextFormat properties:
https://mindfusion.eu/_beta/diaglite_align.zip

Stoyan
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Labels of nodes
Reply #6 - Mar 5th, 2009 at 12:39pm
Print Post  
Kudos to you and your team.  Cheesy

Regards,
Amit
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Labels of nodes
Reply #7 - Mar 17th, 2009 at 7:57am
Print Post  
Hi Stoyan,

The text is still coming on top of the image. I used both the properties for Image and Text like:

//create a new ShapeNode
//Assing to BitmapImage
mynode.ImageAlign = ImageAlign.TopCenter;
myNode.Text = "Node Text"; //node label
myNode.FontSize = 7; //reducing the sise to fit in
myNode.TextFormat.Alignment = StringAlignement.Far; //I tired with near, center no use;

The Image is shifted to top far, but the text is still coming on top of it, please help.

Regards,
Amit
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Labels of nodes
Reply #8 - Mar 17th, 2009 at 9:22am
Print Post  
Hi Amit,

Create a new TextFormat instance, set its alignment members and assign it to myNode.TextFormat.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Labels of nodes
Reply #9 - Mar 17th, 2009 at 9:55am
Print Post  
Hi Stoyan,

I think you meant create a new Instance of StringFormat correct?

I did this as well but the same problem:

StringFormat sfmt = new StringFormat();
sfmt.Alignment = StringAlignment.Far; //Near Center tried all 3
sfmt.LineAlignment = StringAlignment.Far; //Near Center tried all 3

myNode = sfmt;

//the text still appears on top of the images aligned to TopCenter

Thanks,
Amit
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Labels of nodes
Reply #10 - Mar 17th, 2009 at 11:01am
Print Post  
Hi Amit,

This worked for me

Code
Select All
private void OnChangeStringFormat(object sender, RoutedEventArgs e)
{
	if (diagram.ActiveItem != null)
	{
		if (diagram.ActiveItem is ShapeNode)
		{
			StringFormat sfmt = new StringFormat();
			sfmt.Alignment = StringAlignment.Far;
			sfmt.LineAlignment = StringAlignment.Far;

			(diagram.ActiveItem as ShapeNode).TextFormat = sfmt;
		}
	}
}
 



Are you sure you are using the latest version? What kind of Shape have you assigned to the node?

Stoyan
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Labels of nodes
Reply #11 - Mar 17th, 2009 at 11:40am
Print Post  
Hi Stoyan,

1. I am using the Assembly Version: 1.0.1.24923 (534KB)

1. I am using Rectange as the ShapeNode for my node

I have image also assigned to that node.

I too have a code similar like yours, but the image n text are overlapping.

Thanks,
Amit
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Labels of nodes
Reply #12 - Mar 17th, 2009 at 11:44am
Print Post  
Hey got this working now. I had created a StringFormat object only once for all nodes in my application load, and then was resuing for each nodes I created later. But that was not working.

Then I created a new object of StringFormat for each new node I create, and then it is working properly as expected (labels below images).
Any idea why is this behavior.


Thanks,
Amit
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Labels of nodes
Reply #13 - Mar 17th, 2009 at 12:06pm
Print Post  
Perhaps because the TextFormat setter checks if (textFormat != value) ...  8)
  
Back to top
 
IP Logged
 
jaiswalamit
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 64
Joined: Feb 17th, 2009
Re: Labels of nodes
Reply #14 - Mar 17th, 2009 at 12:48pm
Print Post  
Hi Stoyan,

My SF object was well initialized before I assigned it to any node's TextFormat property, hence even if the check you mentioned shouldn't cause this to fail. But it's fine, I don't mind creating new instances each time, just hope it's good on memory.

Btw, one issue which I am observing is that if my labels are big (areound 2 or 3 words) then they break into multiline - which is fine but sometimes they get overlapped by the image of the node. Is there anyway how I can make sure that the lablels always start below the image area (may be after a gap of a few pixels).

Is there any email id where I can send you the screen shot explaining the behavior.

Thanks,
Amit
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint