Sync independent shapes with timeline so they show the date?

Started by abssorb, May 04, 2011, 12:54:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

abssorb

I have a drawing which shows time across the top, an 18 month period.

I would like to have a shape (which can move independently anywhere in the X and Y axis), which contains text showing the day of the month.  At the moment this is done manually, a big enhancement would be for the text to update with the correct day-of-month when its X position changes.

A nice to have would be a dialogue box to enter a date and the shape move to the correct position (but this is secondary).

Looking at the Visio timeline addon fucntionality it should be possible to automate?  I've had a look at the timeline / schedule functionality but I can't work out a solution.  I'm a novice at shapesheet editing and as far as I can tell it calls on external addons.

I don't need any of the other timeline functionality or shapes.
Visio 2003 by the way.

Any help really appreciated. Thanks. :)

Jumpy

For the first you need a formula, that translates the x coordinate of the Shape, which you find in the PinX cell of the shapesheet, to a Date. To help you with this, we would have to know more about the Top of the page, where you show a timeline?
Because that timeline has to be the reference against which the formula is calculatetd.

wapperdude

Not sure this is the direction you were heading, but, here's a quick approach to what you're after without using timeline shapes...

The "timeline" shape allows double clicking to enter begin and end dates.

The rectangles reference the timeline shape and it's position.  Move them, the date will change.  Move the timeline and date will change.  The rectangles are constrained to remain within the horizontal boundries of the timeline.

HTH
Wapperdude
Visio 2019 Pro

wapperdude

Here's a version that uses Visio timeline shape.  Note that each rectangle uses a different time format.  This handled within each shapesheet -- in the User-defined section.

Enyoy.

Wapperdude
Visio 2019 Pro

abssorb

Wapperdude, that is superb!  Exactly the functionailty I was looking for. Thank you! :)

It remains now for me to play with the date formatting of the rectangles. 

abssorb

Quote from: abssorb on May 09, 2011, 11:23:10 AM
It remains now for me to play with the date formatting of the rectangles. 

Actually that's turned out to be hard for me.  I can't seem to find any way of doing this. ???

wapperdude

The choices seem to be somewhat limited... well, at least to the extent that I could discover.

Open the shapesheet for the various rectangles, then in the User Defined section, there is an entry user.date.  That's where I did the formatting.  There may be more examples in the SDK, which you can download for free, or, if you visit here:  http://msdn.microsoft.com/en-us/library/ms427031(v=office.12).aspx which talks about the shapesheet.

You might also check out this link, it's for V2002, but I believe everything still applies for V2003, 2007.  Don't know about V2010.  Anyway, it's a nicely organized discussion covering a large variety of Visio aspects.  http://msdn.microsoft.com/en-us/library/aa245244(v=office.10).aspx

HTH
Wapperdude
Visio 2019 Pro

abssorb

Thanks again Wapperdude!  The dev materials were too cryptic for me.  They offer detailed info about how a function works, but nothing about where to put it and little about how to syntax it.

I eventually worked it out using a walkthrough here (it's for 2007, but was still helpful):
http://support.d-tools.com/08Visio_Interface/zTips_Tricks/Title_Blocks_103

Your first example was the one most suited to my needs, and I've attached a revised version

In case others need this:
The date format is set in Prop.DateFormat in the VALUE entry (not the FORMAT entry - which confused the heck out of me)
I have set mine to ="d" as I only want to see day of the month, but the format can be set here using what seems similar syntax for excel date formatting.

I'm very happy to have a solution on this :)


Edit: A slight problem remains.  
I need to have many boxes all refering to a time line, so I need to duplicate the boxes. Also I need to copy the whole lot to other pages.  
When I copy and paste a box to duplicate the shapes, the pasted box is locked to the same x value as the original.  I added some user entries to try and prevent this, and when I paste a new box it's no longer locked, but the box text is broken and it shows the wrong value.  When I look at the shapesheet all the user entries I made have changed to REF().
(Yellow boxes in 2nd attachment)

Any idea how I can make this more "portable" ?

Jumpy

The timeline shape may have the name / will be referenced as Sheet.123 on page one for example.
On page two or in another dochument it may have a completly different name.
So all shapes referencing that name, have a problem. Therefore the Ref().

Every Workarround will be difficult, I guess.

One workarround could be to have start date, end date of the timelineshape along with its BeginX and EndX in ShapeData-Properties of the page. For example you create those four entrys on every page:

Prob.BegDate, Prob.EndDate, Prob.BegX, Prob.EndX

Than you make a new timelineshape-master, that looks after those values and adapts them, so the timeline is displayed according to thoose Prop-cells.

The shapes on your page now no longer reference the timeline shape, but the Prop-cells of the page, too.


abssorb

Page properties - interesting.  Thanks Jumpy.  I'll have a play....

abssorb

I had to leave this for a while and come back to it.  Now that I'm playing with page properties, I got this to work and I can duplicate shapes in the same page with no problems using =ThePage!User.Master_Date_Start
Where =Master_Date_Start gets the date from the properties in the timeline.

The next step is to have the timeline on the background page.  I've tried searching for hours, but I just can find the right syntax to refere to user-defined cells on the background page.  Plenty of info on how to find the ID of a shape, and how to reference a shape on another page, but not about the shape itself.

This was useful: http://www.visguy.com/2009/07/15/whats-my-shapes-id/  But it would be great if it also explained how to find a page ID.

I've tried these:
=page.background!user.Master_Date_Start
=pages.background!user.Master_Date_Start
=pages[background]!user.Master_Date_Start
=pages[background]!sheet.1!user.Master_Date_Start

I'm obviously missing something though.

wapperdude

Try using something like:  =Pages[Background-1]!ThePage!Prop.MyBkgnd

Where Background-1 is the name of the background page, and MyBkgnd is the name of the property on that page.

For reference, see http://msdn.microsoft.com/en-us/library/aa200961(v=office.10).aspx

Wapperdude
Visio 2019 Pro

abssorb

Thanks Wapperdude, I actually got it to work with:

=pages[background]!sheet.0!user.Master_Date_Start

It was a bit of a guess. I couldn't find any way to get visio to give me the name of the page.  I guessed that it might also have a shape designation, hence the sheet.1 above.  Further experimentation, and 0 did the job.  :)

wapperdude

It's not obvious why you're syntax should work.  The name inside [], should be the name of the background page, especially if you have more than one.

Normally, sheet.XXX refers to a shape.  Not seen sheet.0 before.  That's why in my syntax "ThePage" is used.  It refers to, the page.  It assumes that you are adding properties to the background page and not a shape on the page.

So, just beware.

Wapperdude
Visio 2019 Pro

wapperdude

For sake of completeness, here's a Visio file that shows the results.  The textbox has both regular text and Field>Insert text.  This helps separate what's going on in the shapesheet.  So, to check out the formulas, open the shapesheet and scroll down to the Text Fields section.

HTH
Wapperdude
Visio 2019 Pro