Is there a way to align a shape inside a group to a guide line?

Started by Jennifer, March 13, 2022, 07:43:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jennifer

I have several moderately complex groups of shapes consisting of a 10" horizontal line, representing a timeline, several short vertical lines marking events on the timeline, and text blocks over those markers. The text blocks over the left end point extend beyond the end of the timeline making the width of the group slightly wider than 10" and variable. I have turned on borders for these 2 text blocks for illustration.



I would like to be able to position the timeline so that the left end is exactly positioned 0.5" from the left edge of the page. This is very difficult if the shapes are grouped.

Is there a way to align the group to a point inside the group?

I have 2 reasons for wanting this alignment. One is so multiple timelines as in the example above are aligned with each other. The other, and more important one, is that the vertical lines are position at an exact distance from the left edge of the page as calculated by a spreadsheet. I need to be able to check these offsets from time to time. Since they are calculated from the edge of the page, I need the whole group positioned exactly.

Here's a snippet from that spreadsheet:



Is there a way to position the markers relative to the left end of the timeline? If so, that would solve most of the problem.

Thanks
Using Visio 2019, part of Office 365 on Windows 10

Yacine

Since you already have a spreadsheet, you can use it to position the markers for you.

Prepare the page, so you have one place for adjusting parameters to apply on all events.
- a scale so as to transform the years in lengths - prop.scale
- a left margin. This could be either years or a length and will influence the way you write the pinX formula for the events. Let's choose length: prop.leftMargin
This was for the horizontal positioning.
Now we can get fancy and automate also the vertical one.
- We add a prop in which we can write the semi-colon separated list of stories (eg "history of universe; history of earth; history of humanity") - prop.stories.
- And map to the above prepared list a second one with Y coordinates ("5in;7in;9in") - prop.Ystories

Set up  a master for the events.
- as group including the label and the marker
- add at least the following props: prop.years, prop.story, prop.event
- PinX = -prop.years * thepage!prop.scale + thepage!prop.leftMargin
- PinY - Here we look at the value of prop.story, find its position in thepage!prop.stories, use this position to get the according value in thepage!prop.Ystories.
  PinY = INDEX(LOOKUP(prop.story, thepage!prop.stories), thepage!prop.Ystories)

In the label-subshape you would insert the field prop.label.

Save this group to the document stencil. Now you can link your document to the excel spreadsheet and generate the drawing using the previously created master.





There are several advantages to this method.
1) Working we a master lets you modify the whole drawing from one place
2) You can reposition freely
3) You can even work with logarithmic scales by modifying the formula for PinX.

Yacine

Yacine

You can of course also choose the lazy method of using a CAD-like move function.
Drop the yellow square of the attached stencil on the canvas.
The red arrow defines the shifting coordinates (from - to), then select the group and press the "move" button.
Yacine

Jennifer

Quote from: Yacine on March 13, 2022, 08:42:50 AM
Since you already have a spreadsheet, you can use it to position the markers for you.

. . .

I'll have to study that. A lot of it is new to me.
Using Visio 2019, part of Office 365 on Windows 10

wapperdude

As an alternative approach...
Not at my computer, so, going from memory...

Before you add the beginning (& ending labels), I assume that the group bounding box for each timeline is uniform early at the beginning and end of each timeline.  Open the shapesheet, and, I believe it's in the Protection section, on the right most side, there's an entry to the effect, "locCalcGrpWidth".  That's not quite the correct spelling.  Set it to either 1 or true.

Now add your labels.  They should be positioned as you desire, within the group.  It does not matter if they extend beyond the boundaries of the group box.  The new shape sheet setting will ignore the excess overhang.

This will allow all your timelines to be aligned to a guideline as the size of the labels is suppressed.
Visio 2019 Pro

Jennifer

Quote from: wapperdude on March 13, 2022, 05:26:22 PM
As an alternative approach...
Not at my computer, so, going from memory...

Before you add the beginning (& ending labels), I assume that the group bounding box for each timeline is uniform early at the beginning and end of each timeline.  Open the shapesheet, and, I believe it's in the Protection section, on the right most side, there's an entry to the effect, "locCalcGrpWidth".  That's not quite the correct spelling.  Set it to either 1 or true.

Now add your labels.  They should be positioned as you desire, within the group.  It does not matter if they extend beyond the boundaries of the group box.  The new shape sheet setting will ignore the excess overhang.

This will allow all your timelines to be aligned to a guideline as the size of the labels is suppressed.

This looks like a very good option. Does this setting apply to the group? Does it get lost if I ungroup? I have been grouping, ungrouping, and regrouping the timelines as I add events or make changes. How would I preserve this setting through all that?

The closest setting I could find to locCalcGrpWidth is LockCalcWH. Is that it? I opened the shape sheet for the group, right?
Using Visio 2019, part of Office 365 on Windows 10

Jennifer

It works! Yea!!! 🥰🤗🤩

The part I was missing was how to add a shape to a group. I have been ungrouping and regrouping. Until now, I didn't know about the Add to Group and Remove from Group options.

This will make my life a lot easier.

Thank you.
Using Visio 2019, part of Office 365 on Windows 10

wapperdude

Cool!

LOL:  from personal experience, an all too familiar scenario:  I don't know what I don't know.   
Visio 2019 Pro

Jennifer

Quote from: wapperdude on March 13, 2022, 07:51:05 PM
Cool!

LOL:  from personal experience, an all too familiar scenario:  I don't know what I don't know.

Chuckle

This reminds me of that old Arab proverb:

He who knows not and knows not he knows not, he is a fool—shun him.
He who knows not and knows he knows not, he is simple—teach him.
He who knows and knows not he knows, he is asleep—wake him.
He who knows and knows he knows, he is wise—follow him.

When it comes to Visio, I probably fall somewhere between #1 & #2. 😥
Using Visio 2019, part of Office 365 on Windows 10