Author Topic: Align Shapes by Field  (Read 1972 times)

0 Members and 1 Guest are viewing this topic.

tor

  • Newbie
  • *
  • Posts: 2
Align Shapes by Field
« on: December 13, 2017, 12:24:47 AM »
Hi friends! I want to align my data-linked shapes in a column based on a data field. Specifically, I have a date for each task I have and I want to vertically align all shapes associated with a date. Is this possible? What are some other options? Can I force them into a certain swimlane?

Thanks!

Thomas Winkel

  • Full Member
  • ***
  • Posts: 180
Re: Align Shapes by Field
« Reply #1 on: December 13, 2017, 08:03:38 AM »
Hi,

possible, but need to be done with code.
Maybe this topic helps you to get startet:
http://visguy.com/vgforum/index.php?topic=4927.0

Best regards,
Thomas

Yacine

  • Hero Member
  • *****
  • Posts: 2449
Re: Align Shapes by Field
« Reply #2 on: December 13, 2017, 10:16:51 AM »
Can't you use the provided time line shapes?
Yacine

vojo

  • Hero Member
  • *****
  • Posts: 1130
Re: Align Shapes by Field
« Reply #3 on: December 13, 2017, 03:02:15 PM »
so could try this
Basically use an origin point  and calculate a distance by the difference between this shape data data and some origin date
(you may need to put in some SETFs in the event doublclk cell to update the origin from from page or page legend shape)

prop.starttime = <some sort of start time....a fixed static value...maybe pick up from the page shape>
prop.nowtime = <time for this shape
user.timedelta = prop.nowtime-prop.starttime   // find the delta to global start point
user.delta = user.timedelta * <some sort of increment...maybe 10mm>

pinx = guard (origin + user.delta)   // origin may be from page shape
piny = <same sort of approach as X dimension>

so if shape in stencil
1:  drag on to page
2: double click to get origin updated
     (maybe use on drop event in shape sheet cell for setf(getref(prop.starttime), page!user.starttime))
3: edit properties to
     A) confirm orgin (start date)
     B) set the date for this shape
4: save
5: Shape should move to desired location on page.

Start with a single shape, make sure algorithm works...then can broaden out to other shapes
Also, need to make width and height of shape are know to be less than some max...otherwise shapes could lay on top of each other if too wide

good luck


tor

  • Newbie
  • *
  • Posts: 2
Re: Align Shapes by Field
« Reply #4 on: December 20, 2017, 11:42:29 PM »
Thank you! Sorry I didn't respond sooner - I didn't think anyone responded since I didn't get an email. This is great - exactly what I am looking for! Another questions for you...

Can I force a shape to a container or swimlane through coding? Instead of offsetting from another object, just place it at a defined location that is linked to a swimlane?

I am looking through this resource and haven't had much luck. Basically if I name a swimlane a certain date, and that matches the feild value in my shape, then can I constrain that shape to a specific swimlane (or phase)?


Thank you thank you!


so could try this
Basically use an origin point  and calculate a distance by the difference between this shape data data and some origin date
(you may need to put in some SETFs in the event doublclk cell to update the origin from from page or page legend shape)

prop.starttime = <some sort of start time....a fixed static value...maybe pick up from the page shape>
prop.nowtime = <time for this shape
user.timedelta = prop.nowtime-prop.starttime   // find the delta to global start point
user.delta = user.timedelta * <some sort of increment...maybe 10mm>

pinx = guard (origin + user.delta)   // origin may be from page shape
piny = <same sort of approach as X dimension>

so if shape in stencil
1:  drag on to page
2: double click to get origin updated
     (maybe use on drop event in shape sheet cell for setf(getref(prop.starttime), page!user.starttime))
3: edit properties to
     A) confirm orgin (start date)
     B) set the date for this shape
4: save
5: Shape should move to desired location on page.

Start with a single shape, make sure algorithm works...then can broaden out to other shapes
Also, need to make width and height of shape are know to be less than some max...otherwise shapes could lay on top of each other if too wide

good luck
« Last Edit: December 20, 2017, 11:52:39 PM by tor »