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
 Merging Graphs and Worksheets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

kemeyer

39 Posts

Posted - 08/03/2009 :  1:57:05 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 7 and Service Release (Select Help-->About Origin):
Operating System:XP

I want to merge graphs in my program, but not in the same way the merge graph button does. I wanted to put them all on one layer. However, I came the the problem of how do I let the use select which graphs to merge?

I wanted to just merge the maximized graphs, but I don't know how you can tell whether a graph is maximized or not. Is it possible to get graph/active dataset names from maximized windows? If not, what is another way to let the user choose which graphs to merge so that I can store the names? (Aside from them typing in a name-the names generated are sometimes long and tedius to type).

Also, I was wanting to merge some columns from worksheets together. Data is taken and generated upon different ranges, some of which even overlap. I want to be able to throw them all into a worksheet so that the whole entire range is covered. Is there a good way to do this other than compare values of cells and paste selections? (There might be some positions that are duplicated with different collected data)

Thanks,
Katie

Iris_Bai

China
Posts

Posted - 08/03/2009 :  10:55:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Katie,

There is an example codes to find maxized graphs and add plots from selected graphs to a newly created graph on one layer. But this example need Origin8.


void testGraphs()
{
	// find maximized graphs
	vector<string> vsGraphs;
	foreach(GraphPage gp in Project.GraphPages)
	{
		if( PAGE_MAXIMIZED == gp.GetShow() )
			vsGraphs.Add( gp.GetName() );
	}
	
	GraphPage gpNew;
	gpNew.Create("Origin");
	GraphLayer glNew = gpNew.Layers();
	
	// add plots from selected graph to one new graph in one layer
	for(int nn = 0; nn < vsGraphs.GetSize(); nn++)
	{
		Page pg(vsGraphs[nn]);
		foreach(Layer lay in pg.Layers)
		{
			GraphLayer gl(lay);
			Tree tr;
			bool bWasGroup = gl.UngroupPlots();
			gl.GetLayerContents(tr, GETLC_DATAPLOTS | GETLC_NO_LIMITS);
			
			int nPlots = glNew.AddPlots(tr.FirstNode, ADDPLOTSFROMTREE_NEW | ADDPLOTSFROMTREE_IMPLICIT_STYLEHOLDERS); // returns total number of data plots in the layer 
		}
	}	
}


Iris
Go to Top of Page

Iris_Bai

China
Posts

Posted - 08/03/2009 :  10:59:52 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
About meger columns in worksheet please reference the sample in this wiki page: http://ocwiki.originlab.com/index.php?title=OriginC:Accessing_Worksheet_Format_with_Theme_Tree#Set_Merge_for_Units.2FComments.2FLong_Name.
This way only works when the content in cells is same.
And This example also need Origin8.

Iris
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