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 dataplots in a group inside a graph layer

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/26/2020 : 09:09:51 AM
Origin Ver. and Service Release (Select Help-->About Origin): 2018b
Operating System: Windows 10

Hello,

Is there any way to sort dataplots? Sort command only works with workshets, but I would need to sort dataplots which were created in the wrong order.

I have between 2 and 5 dataplots I need to order alphabetically, all of them pertaining to a group. There are other dataplots outside that group which do not need sorting.

The discrepancy between the creation order and desired sorting lies in a number inside the dataset names; i.e. names have numbers like 235, 56, 766, 98... creation order follows the first digit only (235-56-766-98), while desired order would be 26-98-235-766. The numbers are only part of the names, although they share the same prefix.

Is there any solution for this, either changing dataplot sorting order or changing creation order?

Thank you.
3   L A T E S T    R E P L I E S    (Newest First)
YimingChen Posted - 08/27/2020 : 09:58:08 AM
You can order the value in the name of workbook same way as I showed you to sort columns, then plot books in order, the script within loop can be:

for ( i = 1; i <= dslnsorted.GetSize(); i++)
{
	ln = dslnsorted[i];
	range r1 = ["ID$(i)"]1!2;
	plotxy iy:=r1 plot:=200 ogl:=1;
}

Assuming the book name is like ID235, ID56, etc.

James
Clairekun Posted - 08/26/2020 : 11:50:52 AM
The thing is, I'm plotting the same worksheet from different workbooks. I mean, what I should change is the workbook reading order. I could perhaps isolate the numbers within the workbook name in a string, so that I could type a command to sort them using that string, but I don't know how to actually order Origin to read workbooks in that order.
YimingChen Posted - 08/26/2020 : 11:11:02 AM
You can use a piece of Labtalk Script to control the plotting order. The script reads and sorts the column longnames by value, then plot columns with sorted order.


string bkname$ = %H;
dataset dsln, dslnsorted;

for (i = 2; i <= wks.ncols; i++)
{
	wks.col=i;
	dsln[i-1] = numbervalue(wks.col.lname$);
}

dslnsorted = sort(dsln);

for ( i = 1; i <= dslnsorted.GetSize(); i++)
{
	ln = dslnsorted[i];
	//type $(ln);
	range r1 = [bkname$]1!"$(ln)";
	plotxy iy:=r1 plot:=200 ogl:=1;
}

layer -g;




James

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