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 for Programming
 LabTalk Forum
 Sort graph plots "alphabetically"

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
Clairekun Posted - 08/04/2022 : 8:57:51 PM
Origin Ver. and Service Release (Select Help-->About Origin): 2018b
Operating System: Win 10

Hello,

Please be patient with me as I am not too sure how to explain my problem clearly. I am sorry if it is confusing.

I have multiple samples with 3 different variable parameters, all of which appear in the workbook name with the same naming structure and number of characters. Example:

A100C200m02M for 200 °C, 100 min, 0.2M
A100C200m06M for 200 °C, 100 min, 0.6M
A100C200m10M for 200 °C, 100 min, 1.0M
and so on.

I store all workbook names in a string array; since I used a doc -ef W command to loop through all of them to save them in the array, I assume the array entries are stored alphabetically:
stringArray ArrSamples;
doc -ef W 
{
	win -a %(page.name$);
	string sName$ = page.name$;
	ArrSamples.Add(sName$);
}

My plots consist of 1 varying parameter, where the other 2 are fixed. In the names above, temperature and time are fixed. Whenever I plot my graphs, sometimes the plots are disorganized, as in:

0.6M
0.2M
1.0M

instead of

0.2M
0.6M
1.0M

just like the list of workbooks is sorted in the project explorer. It doesn't happen in all graphs, so I can't quite fathom the reason behind this. The grouped plots show as a colour increment, so a badly sorted group makes the data much harder to interpret.

I know I can manually reorder my plots; however, I am looking to do it programmatically, since there are over 100 graphs in total. I haven't been able to find anything similar to this within Origin Help files or Labtalk forum, although I might have missed something.

Any help is appreciated. Thank you.
3   L A T E S T    R E P L I E S    (Newest First)
Clairekun Posted - 08/05/2022 : 6:42:14 PM
After what Castiel said, I checked the entries in the string array. Strangely enough, all of them were in alphabetical order, except for the last 6 or 7.

To solve this, I added the command ArrSamples.Sort() right after the array is created and it's working fine now. I really thought the entries were already sorted since, at a first glance, everything seemed alright.

Thank you both!
YimingChen Posted - 08/05/2022 : 11:33:57 AM
Can you provide the code to make the graph from multiple workbooks? Have you checked whether the book name is properly ordered in the string array? Thanks.

James
Castiel Posted - 08/05/2022 : 01:04:08 AM
quote:

I assume the array entries are stored alphabetically.



Your assumption is wrong.


------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------

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