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
 Changing line colors in 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

a.abc.b35

175 Posts

Posted - 07/21/2011 :  2:30:45 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.5.1
Operating System: win 7
.........
Can anyone help me with this, I am probably too lazy to look inside the wiki and find the commands for these:
I have a series of graphs. each graph has 4 sets of plots: data, multi gauss fit peak 1, multi gauss fit peak 1, multi gauss fit peak sum. Now I want a program which I can run on all these graphs (in a loop) and change the color of each sets, say, data pts are open circles of size 5 with/without error bars, multi gauss fit peak 1 is green line, multi gauss fit peak 2 is pink line, multi gauss fit peak sum is red line. Can anyone help me with that please.

AB

a.abc.b35

175 Posts

Posted - 07/21/2011 :  2:49:27 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I have got a code in the forum and modified it for the active graph layer. It seems to work for now:
#include <Origin.h>

void	ChangeColorofGrapgLines()
{
	// Create and attach a graph layer from current Graph:
	GraphLayer		gl = Project.ActiveLayer();
	if(gl)
	{
		DataPlot		dp1 = gl.DataPlots(0);	// Get the first data plot in the layer
		DataPlot		dp2 = gl.DataPlots(1);	// Get the 2nd data plot in the layer (error bar probably in my case)
		DataPlot		dp3 = gl.DataPlots(2);	// Get the 3rd data plot in the layer
		DataPlot		dp4 = gl.DataPlots(3);	// Get the 4th data plot in the layer
		DataPlot		dp5 = gl.DataPlots(4);	// Get the 5th data plot in the layer
		

		//dp1.SetColorRGB(0x00, 0xFF, 0x00, TRUE);// Set the color to green and repaint
		//dp2.SetColorRGB(0x00, 0xFF, 0x00, TRUE);// Set the color to green and repaint
		dp3.SetColorRGB(0x00, 0xFF, 0x00, TRUE);// Set the color to green and repaint
		dp4.SetColorRGB(0x00, 0x00, 0xFF, TRUE);// Set the color to blue and repaint
		dp5.SetColorRGB(0xFF, 0x00, 0x00, TRUE);// Set the color to red and repaint
		
	}
}


............
Question is : What will be the foreach statement for below :
"foreach graph (or graphlayer, am not sure) in the folder (call by given name from user)/active folder" ?

AB
Go to Top of Page

Penn

China
644 Posts

Posted - 07/21/2011 :  11:15:16 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi AB,

From your description and the code, it seems that your graph contains only one layer. So, when using the foreach statement, you can refer to this page. And please note that, you need to use the GetType method to make sure that the page is a graph.

Penn
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