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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Linking Layer in Origin C
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

SteveS2

USA
Posts

Posted - 07/18/2006 :  5:31:29 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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,



easwar

USA
1965 Posts

Posted - 07/19/2006 :  4:03:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

SteveS2

USA
Posts

Posted - 07/19/2006 :  4:30:39 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank for responding,
Is there an equavalent Lab Talk statment that will perform the same task?

Thanks
Stephen,

Go to Top of Page

easwar

USA
1965 Posts

Posted - 07/19/2006 :  5:26:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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

Go to Top of Page

easwar

USA
1965 Posts

Posted - 07/19/2006 :  10:06:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000