Author Topic: DataGraphics - Stop text from rotating when shape is rotated?  (Read 16345 times)

0 Members and 1 Guest are viewing this topic.

Longhair

  • Newbie
  • *
  • Posts: 2
In the process of setting up a Visio solution for my work. Will be doing HVAC layout drawings using the built in symbol library and getting data from an excel workbook and displaying on the diagrams using data graphics. I have this all working, BUT when I rotate a shape so the diagram is correct, the text in the DG rotates and becomes upside down. Not really gonna work. Is there any way to stop this from happening?

Also is there any alternative to get the data from excel (like DGs do) but will let you reposition the text where I want it to be as opposed to it just circleing around the outline of the shape.
Thanks
LH

JuneTheSecond

  • Hero Member
  • *****
  • Posts: 1027
    • Visio Shapes, Stencils and Sample Drawings
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #1 on: April 08, 2010, 07:01:31 PM »
For the text, try Gravity function in the shapesheet.
« Last Edit: April 08, 2010, 07:12:59 PM by JuneTheSecond »
Best Regards,

Junichi Yoda
http://june.minibird.jp/

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3826
  • Ideas Visio-lized into solutions
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #2 on: April 08, 2010, 08:22:35 PM »
...or as an alternative, drop the Gravity function (pun intended) and just set the text angle to negative shape angle.  These behave in quite differently.

JuneTheSecond:  Gravity(Sheet.4!angle)

Alternative:  -Sheet.4!angle.

For more about text functions:  http://msdn.microsoft.com/en-us/library/aa200986(v=office.10).aspx

HTH
Wapperdude

Visio 2019 Pro

Jumpy

  • Hero Member
  • *****
  • Posts: 1061
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #3 on: April 09, 2010, 01:17:51 AM »
I used to use wapperdudes alternative, too, but got problems someday because a shape was flipped along one axis. Therefore I now use sth. like:

IF(Sheet.4!FlipX+Sheet.4!FlipY=1,Sheet.4!Angle,-Sheet.4!Angle)

It is possible to use one of the BITXOR, BITOR, BITAND... ShapeSheet functions,too. I have seen that somewhere, but can't remember how it really was done.

Jumpy

P.S.: I have to admit I used this not for DataGraphics but for text of subshapes inside a group, but I think it's the same(?).
« Last Edit: April 09, 2010, 01:19:48 AM by Jumpy »

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1718
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #4 on: April 09, 2010, 05:59:50 AM »
Because it is difficult to determine just how deep inside groups a Data Graphics text block will be, you might check out the ANGLETOPAR and ANGLETOLOC ShapeSheet functions.

These will allow you to get the "local" angle required to have a zero-angle at the page level.

Data Graphics are usually grouped shapes, with several levels of grouping. When they are applied to a shape on the page that is itself a group, then shapes containing text that you would like to "anti-rotate" could be 3 or 4 levels down.

In such a case, -Sheet.Parent!Angle won't work, because the parent isn't rotated, and it's parent isn't rotated either!

The angle functions above allow you to transform an angle of zero in the page's frame of reference to what it needs to be in a sub-shape's local coordinate system.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Jumpy

  • Hero Member
  • *****
  • Posts: 1061
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #5 on: April 09, 2010, 06:23:57 AM »
That's a good info. I had this problem sometimes with a grouped and rotated shape inside a grouped shape (I know this is bad behaviour, but sometimes not avoidable).  I often used then the formula in my post above with the known (and fixed) rotation-angle of the sub group as an offset, e.g.

-Sheet.ParentsParent!Angle + 90 deg

But your formula has the benefit to work, even if the rotation of the subgroup is not fix but changable, too.

Yacine

  • Hero Member
  • *****
  • Posts: 2708
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #6 on: July 28, 2014, 01:11:04 AM »
A propos old posts, here is one for which I'd need a solution.
Chris' remark is good, but I have no idea how to convert it to a working solution.

Furthermore, how need the PinX and PinY to be in order that several callouts rotate as group?
« Last Edit: July 28, 2014, 01:21:25 AM by Yacine »
Yacine

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3826
  • Ideas Visio-lized into solutions
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #7 on: July 28, 2014, 10:24:27 AM »
Can you upload the vsd file?

Also, not sure I understand the PinX, PinY comment re rotate as a group?
Visio 2019 Pro

Yacine

  • Hero Member
  • *****
  • Posts: 2708
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #8 on: July 28, 2014, 02:23:36 PM »
Yes, rotate the whole data graphics as group in the containing shape, not each sub-shape (callout) individually.
But it is not clear to me, how I can collect several callouts in one group.

I enclose a vsd with a datagraphics attempt and an example of a callout as it should be.

The sole advantage of the datagraphics is that it would be done with less tweaking / more on board tools. My callout is ways better than the MS solution  :P .
« Last Edit: July 28, 2014, 02:33:43 PM by Yacine »
Yacine

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3826
  • Ideas Visio-lized into solutions
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #9 on: July 28, 2014, 03:45:33 PM »
Well, my first thought would be create another shape and add it to your sheet.1 group.  Make the new shape, let's say it's shape.xyz.  Now add your 2 datagraphics to shape.xyz, positioned as desired.  I would think you could make shape.xyz counter rotate vs shape.1.  This ought to keep your datagraphics correct reading and positionally correct relative to each other.

Just a thought.  Haven't tried it.  Don't know how viable this would be.  But, have an appointment to go, so can't give it more thought for now.

Later.
Wapperdude
Visio 2019 Pro

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3826
  • Ideas Visio-lized into solutions
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #10 on: July 28, 2014, 06:24:14 PM »
OK.  Had more time to think, and try.  Basically, I think you're on the right approach.  Don't need to do the grouping as I originally thought.

The key is to move the LocPinX and LocPinY for each datagraphic.  You want these to coincide...say lower left corner for the upper DG and upper left corner for the lower DG.  That way, both DGs are equally distance from the parent shape's LocPins.  Otherwise, it gets a lot more complicated when you rotate.

The next step is to set one of the DG's PinX = to the other's, and then off set the Y locations so the shapes are stacked.  Of course, the angles must have negative of the parent.

I've modified your file to add 2nd page and simple example just using regular shapes.  Avoids all the clutter of the datagraphics with the multitude of conditional statements.  But, the technique is just simple geometry and should extend to real DGs directly.

HTH
Wapperdude
Visio 2019 Pro

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3826
  • Ideas Visio-lized into solutions
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #11 on: July 28, 2014, 08:49:15 PM »
Ah.  A little more methodical in the approach...yields a solution without offsetting the LocPins.  See attached.  New solution has Sheet.9 as the parent.

Enjoy!
Visio 2019 Pro

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3826
  • Ideas Visio-lized into solutions
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #12 on: July 28, 2014, 10:14:37 PM »
...and finally a version that holds its center in the middle of the two datagraphics.

That's all folks.

Visio 2019 Pro

Yacine

  • Hero Member
  • *****
  • Posts: 2708
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #13 on: July 29, 2014, 12:03:59 PM »
Thank you for your effort Wayne, but that’s not yet what I’m looking for.
The thing is that I know how to build a callout. What I am “clueless” about are Datagraphics.
Some articles have been written about them when they came out with Visio 2007. But nothing since then.
There are so many questions, that I don’t know where to begin.

A simple callout can be setup. But when you insert more than one of it in a shape (a datagraphic), then Visio builds a huge collection of formulas to bind it to the control point of the containing shape.
These several callouts are not just included in one group, of which you could control easily the rotation and other properties.
--> Thus is there a possibility to make such a group?
How would such a structure look like?


The orientation options of datagraphics are terrible. Have a look at the simple callout I uploaded earlier. That’s the way I expect it to be. I mean that the texts get left justified, when the callout is on the right side and vice versa. Same for the vertical alignment.
If Visio controls that orientation behaviour, what are my chances to use my own formulas instead in a custome datagraphics shape?
 
« Last Edit: July 29, 2014, 12:06:56 PM by Yacine »
Yacine

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3826
  • Ideas Visio-lized into solutions
Re: DataGraphics - Stop text from rotating when shape is rotated?
« Reply #14 on: July 29, 2014, 03:16:04 PM »
Admittedly, I don't do much (anything?) with datagraphics.  Retired.  No need...other than this forum.

A lot of the conditional formulae are for just positioning the DGs relative to the control point.  That really can be relegated to the upper most DG.  Then, it's merely a matter of "slaving" the positions of the other DGs to the upper.  Unless, of course, the underlying code clobbers any formula changes.  Which is probably the case, and so, this exercise is a moot point.  Clearly, from the shape/code development, rotation of the parent shape is not part of development behind the DGs.

However, I think the attached does what you want, barring formulas being clobbered.  See page 3.  The upper DG, Textcallout2.3 is relatively unchanged except for the angle cell.  The lower DG does have its PinX, PinY, and angle cell entries changed.  This slaves the lower to upper and compensates for rotation induced displacements.

Also, as VisioGuy indicates, as the amount of vertical nesting increases, it becomes increasing difficult to track which angle is the controlling angle.

Seems it would have been easy to include this in the DG coding to allow parent rotation.  Too bad not the case.

Wapperdude

ED.:  Oops!  It's close.  ...the shapes don't do a Napoleon and pull apart.  Also, looks like upper DG formulas disappeared.  Anyway, it shows could work in principle.
« Last Edit: July 29, 2014, 03:46:14 PM by wapperdude »
Visio 2019 Pro