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
 Y-axis label
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Belsinga

Netherlands
28 Posts

Posted - 05/03/2010 :  05:19:11 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

I am just starting to become familiar with scripts in Origin. I have a little C++ and Java experience, but I just don't seem to get how to let Origin change the label of a y-axis in a graph. Could someone please send me an example; it is nowhere to be found in the help files.

Regards,
B Elsinga

greg

USA
1378 Posts

Posted - 05/03/2010 :  5:33:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
A Y Axis label is an ordinary text object (GraphObject class) named YL.
Get the Graph, the Layer (indexed from zero in OriginC) and the name of the object and you're in business:

void set_text(string strGraph, uint iLayer, string strObject, string strText)
{
GraphPage gp(strGraph);
if(gp)
{
GraphLayer gl(gp.Layers(iLayer));
if(gl)
{
GraphObject go = gl.GraphObjects(strObject);
if(go)
{
go.Text = strText;
}
else
printf("No object named %s found\n", strObject);
}
else
printf("Layer %u not found\n", iLayer);
}
else
printf("Graph %s not found\n", strGraph);
}

set_text("Graph2", 0, "YL", "This is my Y axis");

(FYI : The example given in the GraphObject class outputs the text for YL.)

Edited by - greg on 05/03/2010 5:37:09 PM
Go to Top of Page

Belsinga

Netherlands
28 Posts

Posted - 05/17/2010 :  09:26:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thank you
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