Hi,
The easiest way to do this is to just create a graph in the first place using a pre-existing template that suits your need. So in your case, you could do:
GraphPage gpg;
gpg.Create("RightY");
GraphLayer gly1, gly2;
gly1 = gpg.Layers(0);
gly2 = gpg.Layers(1);
which will create a 2-layer graph with the right-y axis already in place and layer 2 already linked to layer 1 via x-axis. You can then access each layer and move in data etc.
Note that if a template does not already exist, that meets your requirement, you can always create a custom template in the GUI by making an instance of the graph and then saving it as a template. You can then just create a new graph page in the code by pointing to your saved template.
Now, if you still want to build the graph from scratch layer by layer using Origin C code, you can do that as well, but that will be more work in setting all needed properties.
To see what properties are available, and how to set, you can get the various property branches and dump to script window to see what is there. For example:
GraphPage gpg;
gpg.Create("RightY");
GraphLayer gly1, gly2;
gly1 = gpg.Layers(0);
gly2 = gpg.Layers(1);
// Get the link properties of layer 2 and dump
Tree tr;
tr = gly2.Link;
out_tree(tr);
// Unlink layer 2:
gly2.Link.LinkTo.nVal = 0;
// Get and dump dimensions of layer2
tr = gly2.Dimension;
out_tree(tr);
// etc
Easwar
OriginLab
Edited by - easwar on 04/01/2005 2:11:02 PM