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
 All Forums
 Origin Forum
 Origin Forum
 Graph doesn't change after data change with script

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
jacorem Posted - 07/18/2024 : 03:47:40 AM
Origin Version: OriginPro 2023
Service Release: 10.0.0.154
Operating System: Windows 11

Hello everybody,
a couple of days ago, some collaborators, asked my help to evaluate the samples they prepared using different methods (they varied 4/5 preparation parameters) using X-Ray Diffraction. I observed 7 peaks that I have analysed externally, and for each peak I would like to analyse 7 figures of merits (i.e. position, width, area, ...). In short, it means LOTS of datasets. And in theory I would like to make similar plots where each time I'm comparing the results vs. one of the preparation parameters.

My idea was then to prepare a folder with all the plots where the X data was one of the preparation parameters, copy the folder, change the X data using the following script (thanks for the version goes to YimingChen in https://my.originlab.com/forum/topic.asp?TOPIC_ID=48241):

range XDataCol=[fitData]1!93; // my new X data
doc -ef P { // loop over graph windows in the current folder
	doc -ef LW { // loop over the layers in the current window
		layerNo=Page.active;
		doc -ef DY { // loop over the datasets in the current layer
			int nplot = layer.plot;
			layer -cx XDataCol $(nplot); // set the range "XDataCol" to be used as X data in plot # nplot
		}
	}
	doc -uw; // tried this and other version of the command to force an update
}


This code more or less work because it changes the X data associated with all the datasets to the correct column in the "Plot setup" window (and if I click on "Preview" there, I can see the correct graph), however the graph itself remain unchanged (old x data are still used).

What am I doing wrong? How can I fix my script/force a graph update?

Thanks in advance,

Jacopo
3   L A T E S T    R E P L I E S    (Newest First)
aplotnikov Posted - 07/25/2024 : 03:29:02 AM
quote:
Originally posted by jacorem
I tried to run the command you suggested after my script, but it does not work.

I checked that out prior to replying, however I used the v.2024b - I guess, the version number does not matter in this particular case. It worked perfectly. You need to run it within the loop over the layers:
doc -ef LW {
     ...
     lay -a;
}
jacorem Posted - 07/19/2024 : 03:23:48 AM
quote:
Originally posted by aplotnikov

lay -a;



Dear aplotnikov,
I tried to run the command you suggested after my script, but it does not work.
Looking around (https://www.originlab.com/doc/LabTalk/ref/Layer-cmd#Options_for_Graph) it seems that your command rescale the X and Y axis so to show everything, however, my problem, is that the x data associated to each data point does not change (if it may help, the X title changes so to match the long name of the new column, but the position of each point remain unchanged).
Thanks anyway,
Jacopo
aplotnikov Posted - 07/18/2024 : 09:31:02 AM
lay -a;

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000