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
 Plot XYXY in one graph
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

kanderlee

Taiwan
Posts

Posted - 10/02/2007 :  03:53:15 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version : 7.5 sp4
Operating System: XP

I have a worksheet with "XYXY" columns, and I want to plot two independent curves in one graphpage using the template "Vertical 2 Pannel". (The function in Origin is Plot -> Panel -> Vertical 2 Pannel)

void Plot_2_Vert_Pannel()
{

Worksheet wks = Project.ActiveLayer();
if( !wks )
{
out_str("Active layer is not a worksheet!");
return;
}

Dataset dsX(wks, 0);
Dataset dsY(wks, 1);
Dataset dsX2(wks, 2);
Dataset dsY2(wks, 3);

GraphPage gpg;
gpg.Create("PAN2VERT.OTP");

GraphLayer gly = gpg.Layers(0);

Curve crv(dsX, dsY);
gly.AddPlot(crv, IDM_PLOT_LINE);

GraphLayer gly2 = gpg.Layers(1);

Curve crv2(dsX2, dsY2);
gly2.AddPlot(crv2, IDM_PLOT_LINE);
}

This program can show the template correctly, but there is no any curve on the graphpage!
Could someone tell me what happened of my code? Thanks.

Edited by - kanderlee on 10/02/2007 04:17:25 AM

Mike Buess

USA
3037 Posts

Posted - 10/02/2007 :  09:48:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Your code works fine if you create the curves with crv(wks,0,1) or crv(dsX.GetName(),dsY.GetName()). Operations on a curve object created from two dataset objects, crv(dsX,dsY), do not affect those datasets which might have something to do with the fact that you can't plot your curves.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 10/02/2007 10:06:03 AM
Go to Top of Page

kanderlee

Taiwan
Posts

Posted - 10/02/2007 :  11:12:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you, Mike.

As your suggestion, My code can work properly now!
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