Please Open the attached project file, save the Graph4 to template PL. Then run the script below:
string strBook = %H; // %H is the active window name.
int numSheets = page.nlayers;
for(int ii = 1; ii <= numSheets; ii++) {
plotxy [%(strBook$)]$(ii)!(1,2) plot:=200 ogl:=[<new template:=PL>]; // Update graph
dataset ds;
pkFind iy:=1 npts:=10 ocenter_y:=ds ocenter:=<none> oleft:=<none> oright:=<none> ;
range -wx rx = 1;
range -wy ry = 1;
dataset ds_sorted = sort(ds);
int nn = ds_sorted.GetSize();
double x1 = rx[list(ds_sorted[nn], ry)];
double x2 = rx[list(ds_sorted[nn-1], ry)];
double x3 = rx[list(ds_sorted[nn-2], ry)];
label -s \v(peak @x=$(x1), @x=$(x2), @x=$(x3));
}
https://my.originlab.com/ftp/forum_and_kbase/Images/BatchPlottingSample.opju
James