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
 LabTalk Forum
 Get annotations xy from graph to sheet
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

bedibra

France
35 Posts

Posted - 08/24/2017 :  2:49:30 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Dear all,
I have a graph with annotations on it, and I am looking for a way to get each time when I add annotations on that graph, their coordinates on a sheet.
The idea is to use X and Y coordinate of each annotation for further calculation process.
Is there a script that a can put on the set values window (before formula script) to import from the graph the X and Y coordinates of the annotations on col(A) and col(B) of Sheet1.
Thanks for the help.

Hideo Fujii

USA
1582 Posts

Posted - 08/24/2017 :  6:30:07 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi bedibra,

Currently the annotation tool is not hooked to the doTool command in LabTalk. After putting
annotation labels, you cannot collect annotated points (I think, but I may be wrong). Alternatively,
you can make a dataset during the application of the Data Reader tool such by the following code,
if this way works in your application.:
ag$=%H;  //Graph name
window -t wks; //Make a new worksheet
aw$=%H;        //Worksheet name
range rwx=[%H]!1;  //X dataset
range rwy=[%H]!2;  //Y dataset
window -a %(ag$);  //Activate graph
count=0;           //counter of points
dotool 3;          // Start the Data Reader tool
// Define the macro that runs for each point selection
def pointproc {
  count++;         // Increment count
  rwx[count] = x;  // Get the X coordinate
  rwy[count] = y;  // Get the Y coordinate
  label -s -a x y "($(x,.3), $(y,.3))";  //Put a label of the point
  //type -b Point-$(count): ($(x,.3), $(y,.3)).\nPress Esc to finish;
}
// Define a macro that runs if user presses Esc key, or clicks the Pointer Tool:
def quittoolbox {
  type -b You have created $(count) points in %(aw$).;
  window -a %(aw$);
}
Hope this helps.

--Hideo Fujii
OriginLab

P.S. Please avoid double-posting for readers.
Go to Top of Page

bedibra

France
35 Posts

Posted - 08/24/2017 :  6:52:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This was helpful
Thanks

quote:
Originally posted by Hideo Fujii

Hi bedibra,

Currently the annotation tool is not hooked to the doTool command in LabTalk. After putting
annotation labels, you cannot collect annotated points (I think, but I may be wrong). Alternatively,
you can make a dataset during the application of the Data Reader tool such by the following code,
if this way works in your application.:
ag$=%H;  //Graph name
window -t wks; //Make a new worksheet
aw$=%H;        //Worksheet name
range rwx=[%H]!1;  //X dataset
range rwy=[%H]!2;  //Y dataset
window -a %(ag$);  //Activate graph
count=0;           //counter of points
dotool 3;          // Start the Data Reader tool
// Define the macro that runs for each point selection
def pointproc {
  count++;         // Increment count
  rwx[count] = x;  // Get the X coordinate
  rwy[count] = y;  // Get the Y coordinate
  label -s -a x y "($(x,.3), $(y,.3))";  //Put a label of the point
  //type -b Point-$(count): ($(x,.3), $(y,.3)).\nPress Esc to finish;
}
// Define a macro that runs if user presses Esc key, or clicks the Pointer Tool:
def quittoolbox {
  type -b You have created $(count) points in %(aw$).;
  window -a %(aw$);
}
Hope this helps.

--Hideo Fujii
OriginLab

P.S. Please avoid double-posting for readers.


Go to Top of Page

vlnew

United Kingdom
35 Posts

Posted - 08/25/2022 :  11:31:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi all, I am replying to this thread from 2017, hoping that may be the situation has changed by now. Could you please tell me, is it possible to collect the coordinates reported by the "annotate" tool in a worksheet? Thanks!
Go to Top of Page

YimingChen

1684 Posts

Posted - 08/26/2022 :  12:08:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Inspired by Hideo's reply, you can run the script below, then use the annotate tool.

ag$=%H;  //Graph name
window -t wks; //Make a new worksheet
aw$=%H;        //Worksheet name
range rwx=[%H]!1;  //X dataset
range rwy=[%H]!2;  //Y dataset
window -a %(ag$);  //Activate graph
count=0;           //counter of points
// Define the macro that runs for each point selection
def pointproc {
  count++;         // Increment count
  rwx[count] = x;  // Get the X coordinate
  rwy[count] = y;  // Get the Y coordinate
  //label -s -a x y "($(x,.3), $(y,.3))";  //Put a label of the point
  //type -b Point-$(count): ($(x,.3), $(y,.3)).\nPress Esc to finish;
}
// Define a macro that runs if user presses Esc key, or clicks the Pointer Tool:
def quittoolbox {
  type -b You have created $(count) points in %(aw$).;
  window -a %(aw$);
}


James
Go to Top of Page

vlnew

United Kingdom
35 Posts

Posted - 08/26/2022 :  12:36:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much!
Go to Top of Page

vlnew

United Kingdom
35 Posts

Posted - 09/01/2022 :  07:41:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Sorry, could you please clarify, where should I expect the data to appear? I run the script using menu View > Code Builder, pasted there your code and executed it. Then I run the Annotate tool to add points to the graph, but it is not adding any data to any workbook. Am I missing some steps?

quote:
Originally posted by YimingChen

Inspired by Hideo's reply, you can run the script below, then use the annotate tool.

ag$=%H;  //Graph name
window -t wks; //Make a new worksheet
aw$=%H;        //Worksheet name
range rwx=[%H]!1;  //X dataset
range rwy=[%H]!2;  //Y dataset
window -a %(ag$);  //Activate graph
count=0;           //counter of points
// Define the macro that runs for each point selection
def pointproc {
  count++;         // Increment count
  rwx[count] = x;  // Get the X coordinate
  rwy[count] = y;  // Get the Y coordinate
  //label -s -a x y "($(x,.3), $(y,.3))";  //Put a label of the point
  //type -b Point-$(count): ($(x,.3), $(y,.3)).\nPress Esc to finish;
}
// Define a macro that runs if user presses Esc key, or clicks the Pointer Tool:
def quittoolbox {
  type -b You have created $(count) points in %(aw$).;
  window -a %(aw$);
}


James


Edited by - vlnew on 09/01/2022 08:04:42 AM
Go to Top of Page

YimingChen

1684 Posts

Posted - 09/01/2022 :  08:55:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
After you execute the script, a new workbook should generate and the annotated data points should go there. See below:


James
Go to Top of Page

rg0634249

1 Posts

Posted - 09/02/2022 :  05:01:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This was helpful
https://teatv.ltd/

https://hellodear.in

Edited by - rg0634249 on 09/05/2022 2:26:25 PM
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