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
 X-Function Graph Preview with two Y axis.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Alex-qwerty

Russia
Posts

Posted - 05/02/2010 :  09:49:06 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin 8.0 SR6 Operating System: WinXP SP2
I want to create an X-Function with Graph Preview. My function has some vectors as input and two vectors as outputs. I wont to plot output vectors at preview graph one as Y1 (at left axis) and the second as Y2 (at right axis). The bottom X-axis is the input vector.
Can anybody give me an example of such preview?
Or may be there is an system X-Function with such preview graph?
Thanks.

eparent

118 Posts

Posted - 05/03/2010 :  4:53:10 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

In your X-Function's GetNGraphPreview_OnInitGraph function add the following to setup your preview graph with two layers and a left and right Y axis.

GraphPage gpPreview = pgTemp;
gpPreview.LoadTemplate("doubley");


In your X-Function's GetNGraphPreview_OnChange function add the following to add plots to your preview graph.

GraphPage gpPreview = pgTemp;
GraphLayer gl;

DataRange dr1;
dr1.Add("X", trGetN.x1.strVal);
dr1.Add("Y", trGetN.y1.strVal);
gl = gpPreview.Layers(0);
gl.AddPlot(dr1, IDM_PLOT_LINE);
gl.Rescale();

DataRange dr2;
dr2.Add("X", trGetN.x1.strVal);
dr2.Add("Y", trGetN.y2.strVal);
gl = gpPreview.Layers(1);
gl.AddPlot(dr2, IDM_PLOT_LINE);
gl.Rescale();

gpPreview.SetShow();


The trGetN argument holds all your variables. In my example I named the X input vector as x1 and the two Y output vectors as y1 and y2.
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