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

wuender2

Germany
2 Posts

Posted - 10/19/2009 :  03:47:26 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 8 SR1
Operating System: WinXP Pro Versin 2003, SP3

In my code I append several layers to a GraphPage and try to label the right axis of the layers:


Tree MyTree, MyTreeDebug;

MyTree.Root.Axes.Y.Scale.From.dVal = 3.1415; // Just a check

MyTree.Root.Axes.Y.Ticks.LeftTicks.show.nVal = 1;
MyTree.Root.Axes.Y.Ticks.LeftTicks.Major.nVal = 1;
MyTree.Root.Axes.Y.Ticks.LeftTicks.Minor.nVal = 1;
MyTree.Root.Axes.Y.Titles.LeftTitle.show.nVal = 1;
MyTree.Root.Axes.Y.Titles.LeftTitle.AddNode("Text").strVal = "TextLeft";

MyTree.Root.Axes.Y.Ticks.RightTicks.show.nVal = 1;
MyTree.Root.Axes.Y.Ticks.RightTicks.Major.nVal = 1;
MyTree.Root.Axes.Y.Ticks.RightTicks.Minor.nVal = 1;
MyTree.Root.Axes.Y.Titles.RightTitle.show.nVal = 1;
MyTree.Root.Axes.Y.Titles.RightTitle.AddNode("Text").strVal = "TextRight";

printf ("Before applying changed properties:\n");
MyTreeDebug = MyGp->Layers(3).GetFormat(FPB_ALL, FOB_ALL);
out_tree(MyTreeDebug);

MyGp->Layers(3).UpdateThemeIDs(MyTree.Root);
MyGp->Layers(3).ApplyFormat(MyTree, true, true, true);

printf ("\nAfter applying changed properties:\n");
MyTreeDebug = MyGp->Layers(3).GetFormat(FPB_ALL, FOB_ALL);
out_tree(MyTreeDebug);


I succeed in changing all other properties of the layer but the title of the right axis remains unchanged. Only the left axis title is set in the Titles/All branch as can be seen in the output of the code:


Before applying changed properties:
OriginStorage
Root
Page
Layers
All
[snip]
Axes
[snip]
Y
[snip]
Titles
All
Background
Dimension
Left = 5.8000000000000007
Top = 25.
Right = 5.6000000000000005
Bottom = 24.800000000000001
Angle = 90.
Text = %(?Y)
[snip]

After applying changed properties:
OriginStorage
Root
Page
Layers
All
[snip]
Axes
[snip]
Y
[snip]
Titles
All
Background
Dimension
Left = 5.8000000000000007
Top = 25.
Right = 5.6000000000000005
Bottom = 24.800000000000001
Angle = 90.
Text = TextLeft
[snip]


Any assistance is greatly appreciated.

With best regards,
Dirk

Iris_Bai

China
Posts

Posted - 10/22/2009 :  10:47:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Dirk,


Please try the following function. I tried to add right axes title by format tree, but failed. Seems this property cannot be created by this way. In Origin8.0, there is not OC function to do this, so I used LT command in below function. But in Origin8.1, add AxisObject::GetTitleObject to AxisObject class to get title object, if not existed, will add firstly.
void testFormatTree()
{
	GraphPage gp;
	gp.Create("Origin");
	GraphLayer gl = gp.Layers(0);
	
	Tree MyTree;	
	MyTree.Root.Axes.Y.Ticks.RightTicks.AddNode("Show").nVal = 1;
	MyTree.Root.Axes.Y.Labels.RightLabels.AddNode("Show").nVal = 1;
	
	int nn = gl.UpdateThemeIDs(MyTree.Root);
	if( 0 == nn )
	{
		if( gl.ApplyFormat(MyTree, true, true, true) )
			out_str("Set format done!!");
	}
	
	// In Origin8.1 you can use:
        /*	
	AxisObject aoYR = gl.YAxis.AxisObjects(AXISOBJPOS_AXIS_SECOND);
	if( aoYR )
	{
		GraphObject	goTitle = aoYR.GetTitleObject("TextRight");		
	}
	*/

	// In Origin8.0, you can use LT to add right axes title.	
	gl.LT_execute("lab -yr TextRight");
	
	// set right axes title Angle to 90 and set link it to variables.
	Tree trCheck;	
	trCheck = gl.GetFormat(FPB_ALL, FOB_ALL, true, true);
	trCheck.Root.Axes.Y.Titles.RightTitle.Angle.nVal = 90;
	trCheck.Root.Axes.Y.Titles.RightTitle.LinkToVars.nVal = 1;
	nn = gl.UpdateThemeIDs(trCheck.Root);
	if( 0 == nn )
	{
		if( gl.ApplyFormat(trCheck, true, true, true) )
			out_str("Set format done!!");
	}	
}


Iris

Edited by - Iris_Bai on 10/22/2009 10:48:46 PM
Go to Top of Page

wuender2

Germany
2 Posts

Posted - 10/23/2009 :  12:11:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Iris,

thanks a lot!

with best regards,
Dirk
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