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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Setting Axis-Properties via Format-Tree

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
TreeNode Posted - 12/09/2010 : 09:50:59 AM
Origin Ver. and Service Release: Origin 8, SR6
Operating System: Windows XP

Hi,

I want to hide the begin and end Tick-Label of the Y-Axis of a GraphLayer.
I found this property in the Format-Tree of the GraphLayer gl (Tree tr = gl.GetFormat(...) ).

The following code changes this property, but of the X-Axis... thats wired!
void test_axis_custom_property()
{
	GraphLayer gl = Project.ActiveLayer(); // current active Layer
	Tree tr; // Format-Tree
		
	// Set begin and end of Y-Axis without Tick-Label
	// Begin
	tr.Root.Axes.Y.Labels.LeftLabels.Custom.Begin.Type.nVal = 3;     // Type: "Custom"
	tr.Root.Axes.Y.Labels.LeftLabels.Custom.Begin.Label.strVal = ""; // empty string
	// End
	tr.Root.Axes.Y.Labels.LeftLabels.Custom.End.Type.nVal = 3;
	tr.Root.Axes.Y.Labels.LeftLabels.Custom.End.Label.strVal = "";	
	
	// apply new format settings
	if( 0 == gl.UpdateThemeIDs(tr.Root) ) // 0 means no error
    {
        bool bRet = gl.ApplyFormat(tr, true, true); // return true if applied format successfully
    }
}


When I execute the function for the first time, it worked well, and changed the Y-Axis. Later, when I called it
again, it seemed that nothing happened. Then I realised that this property of the X-Axis has changed.

Can anybody reproduce this problem?


|-- TreeNode
...|-- a??
...|-- ha!!
3   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 12/15/2010 : 9:02:45 PM
Hi TreeNode,

Now, I can reproduce the bug, thanks for reporting this. We will try to fix it in our future version.

Penn
TreeNode Posted - 12/15/2010 : 08:22:42 AM
Hi Penn!

Thanks for reply!
You are right, I think its better to use Axis-Object to manage its settings.
But it did not prevent the appearance of the bug. I could figure out, that the bug appears, when
not getting the Format of the Axis-Object before changing settings:

Tree tr1;
tr1 = aY.GetFormat(FPB_ALL, FOB_ALL, TRUE, TRUE);

-> the lines that are commented out in your code.

I implemeted this as a method in one of my classes:
MyClass::ShowAxisBeginEndTickLabel(bool bX, bool bY)
{
	Axis aX, aY;
	aX = _gl.XAxis;
	aY = _gl.YAxis;
	
	if(!aY || !aX)
		return;

	// Default: show Begin/End Tick-Labels
	int nTypeX = 0, nTypeY = 0;
	
	if(!bX)
		nTypeX = 3; // dont show
	if(!bY)
		nTypeY = 3; // dont show
		
	// Format Trees
	Tree trX, trY;
	trX = aX.GetFormat(FPB_ALL, FOB_ALL, TRUE, TRUE);
	trY = aY.GetFormat(FPB_ALL, FOB_ALL, TRUE, TRUE);
	
	// X-Axis settings
	trX.Root.Labels.BottomLabels.Custom.Begin.Type.nVal = nTypeX;
	trX.Root.Labels.BottomLabels.Custom.Begin.Label.strVal = "";
	trX.Root.Labels.BottomLabels.Custom.End.Type.nVal = nTypeX;
	trX.Root.Labels.BottomLabels.Custom.End.Label.strVal = "";
	
	// Y-Axis settings
	trY.Root.Labels.LeftLabels.Custom.Begin.Type.nVal = nTypeY;
	trY.Root.Labels.LeftLabels.Custom.Begin.Label.strVal = "";
	trY.Root.Labels.LeftLabels.Custom.End.Type.nVal = nTypeY;
	trY.Root.Labels.LeftLabels.Custom.End.Label.strVal = "";
	
	// Update X-Axis
	if( 0 == aX.UpdateThemeIDs(trX.Root))
	{
		bool bRet = aX.ApplyFormat(trX, true, true);
	}
	
	// Update Y-Axis
	if( 0 == aY.UpdateThemeIDs(trY.Root))
	{
		bool bRet = aY.ApplyFormat(trY, true, true);
	}
	
	// Refresh Page
	_gl.GetPage().Refresh(true);
}


Works fine now. Thanks again for help!


|-- TreeNode
...|-- a??
...|-- ha!!
Penn Posted - 12/09/2010 : 10:01:48 PM
Hi TreeNode,

I have tried your code, but sorry to tell you that cannot reproduce the problem. Maybe you can try to use the Axis object to see whether the problem still exists. For example:

void test_y_axis()
{
	GraphLayer gl = Project.ActiveLayer();
	if(!gl)
		return;
	Axis aY = gl.YAxis;
	if(!aY)
		return;
	//Tree tr1;
	//tr1 = aY.GetFormat(FPB_ALL, FOB_ALL, TRUE, TRUE);
	Tree tr;
	tr.Root.Labels.LeftLabels.Custom.Begin.Type.nVal = 3;
	tr.Root.Labels.LeftLabels.Custom.Begin.Label.strVal = "";
	tr.Root.Labels.LeftLabels.Custom.End.Type.nVal = 3;
	tr.Root.Labels.LeftLabels.Custom.End.Label.strVal = "";
	
	if(0==aY.UpdateThemeIDs(tr.Root))
	{
		bool bRet = aY.ApplyFormat(tr, true, true);
	}
	gl.GetPage().Refresh(true);
}

If the problem still exists, it is better that you can send us the OPJ and then we have a try again to see whether we can reproduce this problem. To send us a file, click the link "Send File to Tech support" in the top-right corner of the webpage. Please refer to this post when sending us a file.

Penn

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000