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
 GraphLayer array

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
flieger Posted - 05/01/2015 : 07:00:02 AM
Origin Ver. and Service Release (Select Help-->About Origin): 9.1
Operating System: Win7
Hello,
in order to plot different columns with a simpler code, I'd like to use an array of GraphLayer as follows:

GraphLayer gl[5];

Unfortunately this does not work and I get an error after executing a file similar to the following one:

Worksheet wks;
wks.Create();
GraphPage gp[5];
for (int j=0; j<=4;j++){
 gp[j].Create();
}
GraphLayer gl[5];
DataRange dr[5];
for (int i=0; i<=4;i++){
 dr[i].Add(wks,0,"X");
 dr[i].Add(wks,i+1,"Y");
 gl[i]=gp[i].Layers(); <-error
 gl[i]=AddPlot(dr[i], IDM_PLOT_LINESYMB);
 gl[i].Rescale();

}

Does Origin support arrays of graph layers? Is the initialization correct?
1   L A T E S T    R E P L I E S    (Newest First)
jasonzhao Posted - 05/04/2015 : 05:45:18 AM
Hello flieger,

Please refer to the code below, and check with the execute results.


void GraphLayer_AddPlot()
{
    Worksheet wks=Project.ActiveLayer();  // get the active worksheet
    
    for(int i=1;i<5;i++){
    DataRange dr;    
    dr.Add(wks, 0, "X");
    dr.Add(wks, i, "Y");  //plot the 1_ith columns as XY scatter
    GraphPage gp;
    gp.Create("origin");
    GraphLayer gl = gp.Layers();
    gl.AddPlot(dr, IDM_PLOT_SCATTER);
    gl.Rescale();
    gp.SetShow();
    }   
}




Best regards!
Jason
OriginLab Technical Service

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