T O P I C R E V I E W |
bedibra |
Posted - 08/24/2017 : 2:49:30 PM 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. |
8 L A T E S T R E P L I E S (Newest First) |
rg0634249 |
Posted - 09/02/2022 : 05:01:44 AM This was helpful https://teatv.ltd/
https://hellodear.in
|
YimingChen |
Posted - 09/01/2022 : 08:55:57 AM After you execute the script, a new workbook should generate and the annotated data points should go there. See below:

James |
vlnew |
Posted - 09/01/2022 : 07:41:21 AM 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
|
vlnew |
Posted - 08/26/2022 : 12:36:20 PM Thank you very much! |
YimingChen |
Posted - 08/26/2022 : 12:08:51 PM 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 |
vlnew |
Posted - 08/25/2022 : 11:31:50 AM 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! |
bedibra |
Posted - 08/24/2017 : 6:52:31 PM 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.
|
Hideo Fujii |
Posted - 08/24/2017 : 6:30:07 PM 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.
|
|
|