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
 Origin Forum
 Programmatically Place annotation on XY Graph
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

isroashish

India
2 Posts

Posted - 03/18/2020 :  05:35:36 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello Everyone,
In the XY graph, i want to find max value of y column and place annotation on XY graph Programmatically.
I would be very grateful for your suggestion or LabTalk script.

ASHISH

YimingChen

1592 Posts

Posted - 03/18/2020 :  10:57:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Suppose your xy data are saved in Col(A), Col(B) of [Book1]Sheet1. Then activate the graph and run the script below:

range rx = [Book1]Sheet1!col(A);
range ry = [Book1]Sheet1!col(B);
double dy = max(ry);
double dx = table(ry, rx, dy);
label -a dx dy max;


James

Edited by - YimingChen on 03/18/2020 10:57:27 AM
Go to Top of Page

isroashish

India
2 Posts

Posted - 03/20/2020 :  05:43:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Very Very Thanks,

I want to display max value in the form of (x,y).Can you give me hint to replace "max" label to "(x,y)" value, in this case (dx,dy).

I am trying to convert double to string but i am getting syntax error.


ASHISH
Go to Top of Page

YimingChen

1592 Posts

Posted - 03/20/2020 :  2:16:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Please try the script:

range rx = [Book1]Sheet1!col(A);
range ry = [Book1]Sheet1!col(B);
double dy = max(ry);
double dx = table(ry, rx, dy);
string strlbl$ = "(" + text(dx)$ + "," + text(dy)$ + ")";
label -s (%(strlbl$));
text.x= dx + text.dx/2;
text.y= dy - text.dy/2;


Notice here the object name text is hard coded, if the graph already contains text object, you may need to change.

James
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