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
 Forum for Origin C
 change the order of plots in a 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
UKrieger Posted - 11/01/2012 : 1:18:59 PM
Origin Ver. 8.6.0 and Service Release Sr3
Operating System: Windows 7

Hi,

is there a command in Origin C to put a certain plot in front if there are number of plots in one layer in a graph window? The same as you do manually by opening the layer content window and rearranging using the arrows?

Thanks, Uli
2   L A T E S T    R E P L I E S    (Newest First)
UKrieger Posted - 11/02/2012 : 06:13:04 AM
Hi Jessie,

thanks a lot, your code does exactly what I needed.

Uli
JessieWoo Posted - 11/02/2012 : 05:29:02 AM
Hi,

Please refer to the following example:
1. New a worksheet with three columns, filling with row number
2. Select the three columns to make two scatter plots, one in black and the other in red
//--> the red plot is on top
3. open layer content dialog to upgroup the two plots
4. run function test_changeplotorder() //--> the black plot should be on top

void test_changeplotorder()
{
               GraphLayer glActive = Project.ActiveLayer();
               if(!glActive)
                              return;
               
               DataPlot dp2 = glActive.DataPlots(1);
               if(!dp2)
                              return;
               
               string strDPName = "DataPlot";
               
               Tree trContents;
               glActive.GetLayerContents( trContents, GETLC_DATAPLOTS );
               TreeNode trContentsClone = trContents.Clone();
               TreeNode trLayer = trContentsClone.FirstNode;
               foreach(TreeNode trN in trLayer.Children)
               {
                              if( trN.tagName.Find(strDPName) == 0 )
                              {
                                             trN.Remove();
                              }                                            
               }
               
               int nPlot = 0;
               for(TreeNode trDataPlot = trContents.FirstNode.LastNode; trDataPlot.IsValid(); trDataPlot = trDataPlot.PrevNode)
               {                             
                              if( trDataPlot.tagName.Find(strDPName) != 0 )
                                             continue;
                              
                              string strName = strDPName + (string)(++nPlot);
                              TreeNode trNew = trLayer.AddNode(strName);
                              trNew.Replace(trDataPlot, true, true, false);                                        
                              trNew.DataID = nPlot;
               }
               
               DWORD dwAddPlotsCtrl = ADDPLOTSFROMTREE_EDIT|ADDPLOTSFROMTREE_IMPLICIT_STYLEHOLDERS;
               int nNewPlotNum = glActive.AddPlots( trContentsClone.FirstNode, dwAddPlotsCtrl );
}




Best Regard,
Jessie
Originlab Corp.

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