Visio Guy

Visio Guy Website & General Stuff => Latest Visio Guy Articles => Topic started by: Visio Guy on February 09, 2010, 02:47:41 AM

Title: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: Visio Guy on February 09, 2010, 02:47:41 AM
Finally a connector that knows where it's going!

Text Along a Connector’s Path in Microsoft Visio 2010 (http://www.visguy.com/2010/02/09/text-along-a-connectors-path-in-microsoft-visio-2010/)
Title: Re: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: vojo on February 09, 2010, 08:54:10 AM
Nice.   Any thought about how to offset this above/below line.   aka does the text transform act based on position on this path construct?
Any thought to intelligence....above or below based on angle or position?
Title: Re: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: Visio Guy on February 09, 2010, 09:31:51 AM
Shouldn't be hard at all. That User.angPathEnd cell will tell you what the outgoing angle is at the end of the path. Moving the TxtLocPinY cell to the top or bottom of the shape, depending on the angle, should get your text block properly offset from the line.

The Text Transform section has some logic that I didn't talk about in the article, but you should be able to get what you need without too much tweaking.
Title: Re: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: Will on April 27, 2010, 04:43:53 PM
I have a serious use case for dual text boxes positioned at the ends.

I'm currently putting together a drawing of multiple microwave tower sites. Each site has a transmit frequency (Tx) that is matched by a receive frequency (Rx) on the other end. The other end has Tx & Rx to match.

I'd like to be able to show frequencies on both ends of the connector. I'll be retrieving frequency info from shape data using fields.

Any insight?

Thanks,
-Will
Title: Re: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: vojo on April 28, 2010, 07:58:26 AM
so do the following:

1. get a connector you like
2. add 2 boxes (format as you want....clear, etc)
3. group them
4. go into each box shape sheet and ref pinx, piny to one end of the group shape....something like start box  has group pinx*0+ offset...end box has group pinx*1 - offset
5. set group behavior as a 1D shape.

So now can move the hands and connector ends track to them....boxes offset from end/begin of the connector
Add text either by text in the box or via custom prop and use insert field to put prop in text in box.

if the connector is complex (sort of an S)...can add control points to move the middle segment(s) around.
Title: Re: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: Will on April 28, 2010, 10:01:33 PM
Thanks for your input.
I tried a similar solution, but can't seem to get the text boxes to pull shape data from the connector line (Shape Data is blank on the Insert Field Dialog Box).

What is the significance of a shape's text box? Can that box be duplicated or imitated?

Thanks,
-Will
Title: Re: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: Jumpy on April 29, 2010, 01:47:06 AM
Hello,
you could ad a User defined cell to each textbox shape, where you reference the ShapeData cell from the connector.
For example, if Connector is Sheet.123 and the Name of the ShapeData is Textbox1sText you could create the cell:
User.Text
with
 =Sheet.123!Prop.Textbox1sText
as it's formula.

Then in the insert Field dialog you don't go to the ShapeData but to the user defined cells.
Title: Re: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: Will on April 29, 2010, 09:16:24 AM
Thanks, Jumpy.
I'm curious... how scalable is your solution? I have hundreds of connectors to do. :-)

Thanks again,
-WILL-
Title: Re: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: Jumpy on April 29, 2010, 10:12:43 AM
You only do it one time and so create a new master. Put that in a stencil and use it from now on to get new connectors to connect your shapes.

Or didn't I unserstand the question?
Title: Re: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: Will on April 29, 2010, 11:06:26 AM
Using the new shape as a stencil makes sense.
I was more concerned with scaling the shape data connections. I need to link each connector to a line of an external data source. Will this still work?

Thanks again,
-WILL-
Title: Re: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: Jumpy on April 30, 2010, 01:03:45 AM
Can't say, but an example from one of my solutions.

I use Shapes on a background page as containers for words of different languages.
On the page I select a language. That influences from which (language-container)Shape my shapes got their text.

At the moment this supports only 6 languages, so only 6 shapes are conneted with an external data source.
So there is no information concerning your original question about the number of possible shapedata connections, so I guess it's big.

But - and thats the point - my vocabulary consists at the moment of perhaps 600 words, so 600 ShapeData values in one shape are connected or updated with an external Data Source without problems.
Title: Re: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: RBKBrown on September 13, 2012, 07:05:44 PM
Forgive me if this has been covered but I cant locate:
I can now adjust text to be at either end or middle by hacking the ANGLEALONGPATH(Geometry1.Path,X)
Where X=1 gives arrow end, 0.5 gives middle and something like 0.1 gives the start end .. all very nice
Can (sort of) even follow the code example to give these menu options ...

*BUT

(1) I need the "text" to be an importable data field (data graphic) ... how?
(2) I'd like THREE bits of data graphic text: start, end, middle .. is possible? How?

Many many thanks for any suggestions
Title: Re: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: RBKBrown on September 13, 2012, 07:43:16 PM
Oh dang! ... forgot one:
(3) is it possible to change the alignment of the text (left to right etc.) such that of the text is quite long, it doesn't run off the end of the connector? IE tie its position to the leftmost or rightmost char of the text string?
Title: Re: Text Along a Connector’s Path in Microsoft Visio 2010
Post by: MacGyver on October 23, 2012, 05:59:58 PM
Would it be possible to create a control who's X & Y Behavior were set using the POINTALONGPATH and the ANGLEALONGPATH commands? So that the control always tracks on the line?