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
 Showing Top and Right Axes

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
rikseventyseven Posted - 06/20/2009 : 1:13:45 PM
Origin 8.0

I'm pretty new to OriginC programming.
I have the following problem:
I manipulated and did some math using some worksheet columns. Now, I wrote a small code that generates a plot using these datasets. I can set the line colors and marker size/type.
Now since I'm fanatic of Top and Right axes I would like to activate them.
I read an example where they use the tree structure to import the properties of the axes. I can set for example the position and the color of the Bottom and Left axes using :

trAxes.X.Ticks.BottomTicks.Major.nVal = 1; // Set the major ticks to In & Out format for X axes
//trAxes.X.Ticks.TopTicks.Show.nVal = true;
trAxes.Y.Ticks.LeftTicks.Major.nVal = 1; // Set the major ticks to In & Out format for Y axes
//trAxes.Y.Ticks.RightTicks.Show.nVal = true;
trAxes.All.Ticks.All.Color.nVal = 0; // Set the color of axes to bule
gl.ApplyFormat(tr1);


The frustrating thing is that if I uncomment the green lines I cannot compile and I get an error!
Why?!!?!?

I tryied to use the tree_to_str function on the layer's tree and these parameters for Top and Right axes are there!
What's wrong with this code?!

Thanks a lot!

rikseventyseven

-------------------------------
"Stay hungry, stay foolish."
2   L A T E S T    R E P L I E S    (Newest First)
rikseventyseven Posted - 06/22/2009 : 10:27:10 AM
That solved the problem!!!
Thank you very much for the hint!

In 30 sec you managed to do better then me in 2 hours...

Thank a lot!


-------------------------------
"Stay hungry, stay foolish."
cpyang Posted - 06/20/2009 : 8:35:12 PM
The problem is with the Show property. Origin C TreeNode has a built-in property called Show and thus a tree tagName called Show will lead to a conflict. We can fix this in later SR but for now, you can use lower case "show", since the theme tree tagname is case insensitive.

The following code will work fine:



void show_top_right_axes()
{
	GraphLayer gl = Project.ActiveLayer();
	if( !gl )
		return;    
	
	Tree trFormat;
	// first turn on top-right axes with a separate set theme call
	trFormat.Root.Axes.X.Ticks.TopTicks.show.nVal = 1;
	trFormat.Root.Axes.Y.Ticks.RightTicks.show.nVal = 1;
	int nErr = gl.UpdateThemeIDs( trFormat.Root ) ;//assign node IDs to all nodes in trFormat, return number of errors
	if(0 != nErr)
		out_str("Fail to Update Theme IDs, theme tree has wrong structure");
	gl.ApplyFormat( trFormat, true, true, true ); //update graphlayer's format
	// then change settings can be done after needed axes are already turned on
	trFormat.Root.Axes.X.Ticks.BottomTicks.Major.nVal = 1; // Set the major ticks to In & Out format for X axes
	trFormat.Root.Axes.Y.Ticks.LeftTicks.Major.nVal = 1; // Set the major ticks to In & Out format for Y axes
	trFormat.Root.Axes.All.Ticks.All.Color.nVal = SYSCOLOR_BLUE; // Set the color of axes to bule 
	nErr = gl.UpdateThemeIDs( trFormat.Root ) ;//assign node IDs to all nodes in trFormat, return number of errors
	if(0 != nErr)
		out_str("Fail to Update Theme IDs, theme tree has wrong structure");
	
	gl.ApplyFormat( trFormat, true, true, true ); 
}




Thanks for posting about this problem, and I have updated our ocwiki with a new example:

http://ocwiki.originlab.com/index.php?title=OriginC:Accessing_Graph_Format_with_Theme_Tree#Turn_On_Top-Right_Axes



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