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
 Ticks on axis etc
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

john19858585

United Kingdom
2 Posts

Posted - 11/10/2008 :  10:59:39 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi I'm new to Origin C and was wondering whether it is possible to do any of the following (and if so how):

1). Change the number of minor ticks on the graph axis
2). Create a Title
3). Rename the axis labels
4). Position labels on the sheet.

Many Thanks in Advance

John

Iris_Bai

China
Posts

Posted - 11/11/2008 :  8:37:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

The example below only for 1), but existed bug, we tracker in #12575.

void testOK1()
{
	GraphLayer gl = Project.ActiveLayer();
	if(!gl)
		return;	

	Tree tr;	
	tr.Root.Page.Layers.All.Axes.X.Scale.MinorTicksCount.nVal = 3; // auto add nodes and assign 3 to MinorTicksCount	
	
	if(0 == gl.UpdateThemeIDs(tr))//0 for no error. ==> Failed here now
	{
		bool bRet = gl.ApplyFormat(tr.Root);
		if(!bRet)
			out_str("Fail to apply");
	}
}


This example for 2) and 3):


//Include grobj_utils.h in order to do 2), this header only support from Origin80. 
#include "grobj_utils.h"

//Note!! before compiling please add grobj_utils.c from OriginC\Originlab directory to workspace
void testOK2()
{
	GraphLayer gl = Project.ActiveLayer();
	if(!gl)
		return;	
	
	// for 2) Create a Title
	GraphObject goNew;
	double x = 35, y = 50;
	string strText = "This is my new title";
	add_text(gl, goNew, x, y, strText);
	
	
	// for 3) do you really want change name? The following codes show how to change label text of Axis
	GraphObject goXL = gl.GraphObjects("XB"); // XB is the label name of X axis, YL is the label name of Y axis
	if(goXL)
	{
		string  str = goXL.Text;
		out_str("Old Label: " + str);
		goXL.Text = "New Label";
	}
	
	gl.GetPage().Refresh(); // to refresh page on changes
}

And could you give more detail about 4)?

Iris

Edited by - Iris_Bai on 11/11/2008 10:25:43 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