News:

Happy New Year!

Main Menu

Data Graphic text font and rotation

Started by IAmDad, May 25, 2010, 05:37:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

IAmDad

I have a set of floor maps to display employee offices. Each office rectangle needs to display three data fields: Room, Name and Phone. The data comes from a linked Excel worksheet. For larger offices I use a Data Graphic that displays the three pieces of text data horizontally, top middle and bottom. However, smaller offices must display the Phone vertically along one edge. How do I create a Data Graphic that has the Phone properly rotated when I apply it? Also, how do I set the font size in the Data Graphic so that it applies the correct font when I link the data to the shape?

Yacine

#1
I usely don't dare touching shapes based on addons. There are too many unexpected side-effects.
Neverthless here is a modified Data Graphic. I added a user defined row
IF(Width<10 mm,SETF(GetRef(Angle),90 deg),SETF(GetRef(Angle),0 deg))
and set the txtwidth to TEXTWIDTH(TheText)
Is that what you wanted?

Still I would recommend to invest some work in making your *own data graphic* rather than reliying on an undocumented feature. At least you know what you get.
Yacine

Yacine

Quote from: IAmDad on May 25, 2010, 05:37:57 PM
Also, how do I set the font size in the Data Graphic so that it applies the correct font when I link the data to the shape?
What do you mean?
Yacine

IAmDad

If the answer is that I must create my own DG, I still do not see how that accomplishes my purpose. I have attached a file that might help me explain the questions.

You will see that I have two DGs. My intent is for one of them to position the phone like the upper left room and for the other one to be like the upper right. What I want is to do is...

1) select a room, 2) right click on row of data, 3) select "Link to Selected Shapes"

The result I want then, is to have the Data Graphic for the room be formatted like one of the two examples.

Also, when I link the Data Graphic, I want the text to reflect my desired font size (24 in the examples).

Yacine

It does not seem to be as bad as expected.
"Text Callout" is to be modify as explained in the previous post.
Sorry, if necessary, more explanations tomorrow. it's been a long day.
Yacine

Jumpy

#5
Try out this one. It doesn't use DataGraphics at all, but displays the shapeData in the text of the shape itself and in a new added textfield for the vertical phone number, that only shows, when the shape get's smaller than a critical value. This value can be defined in the shapesheet in a new user.cell named User.CriticalHeight.
The also new user.cell User.Display is used to create the text if the shape is big enough to display the phone number horizontally,too.

It should be easy now to change the font and charactersize.

I think my changes to the shape will not interfere with the addon. At least the height and width are still shown, if the shape is selected.

Yacine

Yacine

IAmDad

Thanks, I appreciate both of your suggested solutions. Now, is there any way to apply this to hundreds of rectangles (offices) across many pages (building floors) without having to edit each one individually?

Yacine

Hi Dad,

You need to iterate through the files of a directory, open each separately, process, close, next one.
In each document, through all the pages (if you know that there may be several ones)
Then through all the shapes, check for a certain property (if CellExistsAnywhere(...)= true and cellU(...)="it's the right one" then process
process:
Correct the shape according to Jumpy's solution and link to your data (not sure if that's not already the case)
Application.ActiveWindow.Selection.LinkToData 1, 5, True
  where 1 is the ID column and 5 the row.
I know that is very rough, but hope that it will get you started ;)
Yacine

Jumpy

#9
Quote from: Yacine on May 28, 2010, 01:15:51 AM
Correct the shape according to Jumpy's solution and link to your data (not sure if that's not already the case)

on that point:

I would put the shape I made in a new stencil.

Now when your code iterates to a shape that has to be altered, do the following:
- Let your code drop the new shape on the page.
- Lookup some values of the old (to be replaced) shape and assign them to the new shape (PinX, PinY, Width, Height,...)
- Lookup the DataRow the old shape is connected with via: Shape.GetLinkedDataRow
- Use it to link the new shape to the DataRecordset (see Yacines post)
- Delete the old shape
- Relax, drink a beer, then off to the next shape  ;)





Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 306 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1143KB.
Tokens: post-login.
Cache hits: 13: 0.00112s for 26,587 bytes (show)
Cache misses: 3: (show)
Queries used: 17.

[Show Queries]