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

anje18

USA
9 Posts

Posted - 07/18/2002 :  08:40:43 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
When I create a line graph I need to be able to quickly change the scale so I can scan over the graph horizontally without much problem. What is the easiest way to create such a function. I have seen it done in an origin test file.

Mike Buess

USA
3037 Posts

Posted - 07/18/2002 :  4:01:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can easily do that in LabTalk by assigning the following command to a macro or button...

getn (left margin) X1 (right margin) X2 (Enter X axis margins);

You can similarly adjust the Y scale... just replace all X with Y.

Mike Buess
Origin WebRing Member
Go to Top of Page

anje18

USA
9 Posts

Posted - 07/22/2002 :  2:37:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you for the function but I am receiving the following error:

C:\Program Files\OriginLab\OriginPro7\OriginC\Scroll.c(28) :Error, syntax error in variable declaration.

when entering the following command into LabTalk:

def Scroll() {
getn (left margin) X1 (right margin) X2 (Enter X axis margins);

}
Could you possibly tell me why I am running into errors with this? Thanks.
Go to Top of Page

easwar

USA
1965 Posts

Posted - 07/22/2002 :  3:04:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Looks like you want access to getting and setting the axis limits from Origin C. This functionality is being added to Origin C and should be available in the next service release. In the mean time, you can call LabTalk from within Origin C with code like below:


void scroll()
{
double x1, x2;
// Call LabTalk to bring up dialog, get and set axis limits
LT_execute("getn (left margin) X1 (right margin) X2 (Enter X axis margins)");
// Get LabTalk variables into Origin C variables
LT_get_var("X1", &x1);
LT_get_var("X2", &x2);
printf("%f %f\n", x1, x2);
}


Easwar
OriginLab.

Edited by - easwar on 07/22/2002 3:05:53 PM
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 07/22/2002 :  3:56:05 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Additionally, you can fix your macro by omitting the () in the definition:

def Scroll {
getn (left margin) X1 (right margin) X2 (Enter X axis margins);
}

PS... I think Easwar meant to use LT_set_var rather than LT_get_var in his OriginC function.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 07/22/2002 3:59:08 PM

Edited by - Mike Buess on 07/22/2002 4:00:14 PM
Go to Top of Page

easwar

USA
1965 Posts

Posted - 07/22/2002 :  3:58:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I stand corrected! You can access the x and y scale limits from Origin C in 7SR1. The following code scrolls the x axis by a percentage. Make a graph layer active and call from script window:
scrollx 10
to scroll x by 10% to right, and
scrollx -10
to scroll x by 10% left



void scrollx(int iscroll)
{
// scroll x axis by iscroll%
GraphLayer gl = Project.ActiveLayer();
if(!gl)
{
out_str("not a valid graph layer!");
return;
}
double xlow = gl.X.From;
double xhigh = gl.X.To;
gl.X.From = xlow + (xhigh - xlow) * iscroll / 100.;
gl.X.To = xhigh + (xhigh - xlow) * iscroll / 100.;
}


Easwar
OriginLab.
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