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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Configure all font sizes for a graph layer
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

fhtw

Germany
Posts

Posted - 09/21/2005 :  7:50:13 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

easwar

USA
1965 Posts

Posted - 09/22/2005 :  10:26:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Go to Top of Page

easwar

USA
1965 Posts

Posted - 09/22/2005 :  12:01:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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);
}




Go to Top of Page

fhtw

Germany
Posts

Posted - 09/23/2005 :  07:12:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.

Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 09/23/2005 :  08:16:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000