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
 Linking Layer in Origin C

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
SteveS2 Posted - 07/18/2006 : 5:31:29 PM
OriginPro 7.5 SP5
Windows 2000 SP4

I am trying to write a function that will link the Y axis from layer 2 to the Y axis from layer 1.

The data that I am charting is in Deg K. I have created an option on my dialog that will allow the user to display Deg R on the Secondary Y axis.

My code compiles, but when I run it, the chart does not update.

My program already creates the Right Y axis and that is working fine. I am just unable to link the two layers.


void LinkAxis()
{
GraphLayer gl("Graph1",1);
gl.Link.LinkTo.nVal=0;
gl.Link.YAxisLink.nVal=2;
gl.Link.Y1.strVal="1.8*Y1";
gl.Link.Y2.strVal="1.8*Y2";
}

Does anyone have any suggestions?

Thanks,



4   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 07/19/2006 : 10:06:43 PM
Hi Stephen,

Here is a possible workaround...

If all you want to do is show a second axis with a formula relating it to primary axis, you may not need a second layer and could do this by just turning on the secondary axis of the same layer and setting a formula.

Notes on how to do this can be found in this knowledge base item:
http://www.originlab.com/www/support/resultstech.aspx?ID=1116&language=English

Then, following method 1 outlines in that article, you could acheive that with code such as below, which will produce a graph such as pasted below. Note that with this method, the secondary y will have tick labels at same location as the primary y axis.

Easwar
OriginLab


void custom_formula()
{
GraphLayer gly = Project.ActiveLayer();
if( ! gly ) return;
gly.LT_execute("layer.y.showaxes = 3; layer.y.showlabels = 3;");
gly.LT_execute("layer.y2.label.formula$ = ""1.8*x"";");
}







Edited by - easwar on 07/19/2006 10:07:32 PM
easwar Posted - 07/19/2006 : 5:26:46 PM
Hi Stephen,

Sorry, there is no LT access to the custom link settings. So template seems to be the only solution at this point. If we can think of an alternative, we will post that

Easwar
OriginLab

SteveS2 Posted - 07/19/2006 : 4:30:39 PM
Thank for responding,
Is there an equavalent Lab Talk statment that will perform the same task?

Thanks
Stephen,

easwar Posted - 07/19/2006 : 4:03:23 PM
Hi,

I could reproduce the problem. Looks like only if the formula has been already set from GUI, then code can be used to change the formula. Setting formula from scratch in a new layer does not seem to work. We need to look into this.

In the mean time, you may want to consider creating a template where the layer is linked and formula is set? You could first manually create the graph they way you want, then save that graph as a template, and in your code just create a new instance of your saved template?

Easwar
OriginLab


P.S. The first line should be:
gl.Link.LinkTo.nVal=1;
which is the top level drop-down in plot details, but that does not solve the problem - custom formula works only if it has been set before and is just being changed by code


Edited by - easwar on 07/19/2006 4:23:26 PM

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