The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Configure all font sizes for a graph layer

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
fhtw Posted - 09/21/2005 : 7:50:13 PM
Origin Version (Select Help-->About Origin): 7.5G SR5
Operating System: Windows XP

Hi all,

is there any elegant way to configure all font sizes, i.e. all axes labels and the legend, of a GraphLayer? The manual is a bit rare about ... I am looking for something like GraphLayer.SetFontSize(n).

I have tried to realise it via a template and the <GraphPage>.Create(<template>) method, but it seems that the font size is not saved/not used in a new graph.

thanks
matthias
4   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 09/23/2005 : 08:16:43 AM
Hi Matthias,

Not sure why it doesn't work for you but all font sizes are preserved in my templates. Works for graphs created by win -t P <template> and <GraphPage>.Create(<template>). (7.5E SR5)

...As for your original question about how to change font sizes in Origin C, you can use LabTalk properties like this.

<GraphPage>.LT_execute("layer1.x.label.pt=28"); // set X axis tick label font size to 28 in layer 1
<GraphPage>.Layers(0).LT_execute("xb.fsize=8"); // set X axis title font size to 8 in layer 1

Of course it would be much easier if you could just get your template to work properly.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 09/23/2005 08:57:04 AM

Edited by - Mike Buess on 09/23/2005 09:07:17 AM
fhtw Posted - 09/23/2005 : 07:12:54 AM
Hi easwar,

thanks for your reply! I will use the theme method, because I want to change the font size of the tick labels too.

thanks again
matthias

ps: Probably it is a bug, that the size is not saved in the template file.

easwar Posted - 09/22/2005 : 12:01:17 PM
Hi Matthias,

I thought about it some more and if you are only concerned with axis labels and legend for say one layer, could be quicker to just set them individually rather than use theme, with code such as below.

Theme could be a better option if you have many layers and many other proerties to set.

Easwar
OriginLab



void change_each_font()
{
// Point to active graph layer
GraphLayer gly = Project.ActiveLayer();

GraphObject gobj;
// Point to X axis label object which has name XB, and change its font
gobj = gly.GraphObjects("XB");
gobj.Label.Font.Size.nVal = 30;
// Point to Y axis label object which has name YL, and change its font
gobj = gly.GraphObjects("YL");
gobj.Label.Font.Size.nVal = 30;
// Point to Legend label object which has name Legend, and change its font
gobj = gly.GraphObjects("Legend");
gobj.Label.Font.Size.nVal = 30;

// Can see what properties exist by loading into tree and dumping to script window
Tree tr;
tr = gobj.Label;
out_tree(tr);
}




easwar Posted - 09/22/2005 : 10:26:42 AM
Hi Matthias,

The easiest would be to
1> manually create a theme that sets font size and save the theme
2> then programmatically apply the theme to your graph

In the Programming help files, if you search with the word "theme", you will find topics relevant to this, and examples such as this one that applies one of the system themes to a graph page.


void Run_ApplyFormat()
{
Page pg = Project.Pages();
pg.ApplyFormat("themes\\Ticks All In.OTH");
}



When creating a theme, you should keep in mind to make the theme as minimal in size as possible so that only the properties that you want to change are saved.

Note that a theme can be loaded into a tree and changed before applying, so that if you save a theme with font size set to say 22, later you could load it, change the size specification to 24, and then apply to page.

Other than using a theme, one would have to point to each text object in the graph and change its font property. Axis titles etc need to be accessed in a different way than other text labels and so may need quite a few lines of code to do this.

Easwar
OriginLab


The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000