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
 Sort graph plots "alphabetically"
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Clairekun

Germany
175 Posts

Posted - 08/04/2022 :  8:57:51 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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.

Castiel

343 Posts

Posted - 08/05/2022 :  01:04:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

I assume the array entries are stored alphabetically.



Your assumption is wrong.


------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------
Go to Top of Page

YimingChen

1684 Posts

Posted - 08/05/2022 :  11:33:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Clairekun

Germany
175 Posts

Posted - 08/05/2022 :  6:42:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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!
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