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

couturier

France
291 Posts

Posted - 01/18/2022 :  2:09:53 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 2022
Operating System:win 10

Hi,

I'm facing a weird issue when trying to access axis tree.

void add_special_tick(double dTick, string strTick)
{
	GraphLayer gl = Project.ActiveLayer();
	if (gl)
	{
		Axis axesX = gl.XAxis;
		Scale scX(gl.X);
		Tree tr;
		
		tr = axesX.GetFormat(FPB_ALL, FOB_ALL, true, true);
		
		tr.Root.NewAxes.NewAxis2.Specials.SpecialCount.nVal = 1;
		tr.Root.NewAxes.NewAxis2.Specials.Specials.Special1.Type.nVal = 35;
		tr.Root.NewAxes.NewAxis2.Specials.Specials.Special1.Value.dVal = dTick;
		tr.Root.NewAxes.NewAxis2.Specials.Specials.Special1.EnableLabel.nVal = 1;
		tr.Root.NewAxes.NewAxis2.Specials.Specials.Special1.Label.strVal = strTick;
		
		double dX1 = scX.From;
		double dX2 = scX.To;
		double dTol = (dX2 - dX1) / 20;
		
		TreeNodeCollection tnc(tr.Root.NewAxes.NewAxis2.RefLines.RefLines, "RefLine");
		foreach (TreeNode tn in tnc)
		{
			if (dTick + dTol > tn.Value.dVal && dTick - dTol < tn.Value.dVal) 
				tn.Labels.Label1.Show.nVal = 0;
		}
		
		if (0 == axesX.UpdateThemeIDs(tr.Root))
		{
			bool bRet = axesX.ApplyFormat(tr, true, true);
		}
	}
}


1st Issue:
If I want to get axis from and to, I need to use Scale object
If I try to read tr.Root.Scale.From.dVal or tr.Root.Scale.To.dVal, I get an error saying that those variables are not declared.
Why that ?
When debugging, I can see that they exist
Moreover, it's a treenode, so compiler shouldn't care whether that leaf exists or not

2nd issue:
The function will add a special tick with label in a graph that has a few reflines with labels.
If the special tick is near reflines labels, I will hide them
Here again, I have an error saying that tn.Labels.Label1.Show.nVal is not declared

Thanks for the help

Castiel

343 Posts

Posted - 01/19/2022 :  05:38:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

1st Issue:
If I want to get axis from and to, I need to use Scale object
If I try to read tr.Root.Scale.From.dVal or tr.Root.Scale.To.dVal, I get an error saying that those variables are not declared.
Why that ?
When debugging, I can see that they exist
Moreover, it's a treenode, so compiler shouldn't care whether that leaf exists or not


The following code works.
double dX1 = gl.X.From;
double dX2 = gl.X.To;


I don't see any problem of tr.Root.Scale.From.dVal or tr.Root.Scale.To.dVal. You may show an example of this very issue.

quote:

2nd issue:
The function will add a special tick with label in a graph that has a few reflines with labels.
If the special tick is near reflines labels, I will hide them
Here again, I have an error saying that tn.Labels.Label1.Show.nVal is not declared

Thanks for the help



"Show" is a member of TreeNode. You have to write the code similar to this:
TreeNode tnShow = tn.Labels.Label1.GetNode("Show");
//tnShow.nVal = 1;



------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------
Go to Top of Page

couturier

France
291 Posts

Posted - 01/19/2022 :  09:13:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
The following code works.
double dX1 = gl.X.From;
double dX2 = gl.X.To;

Yes, that was my workaround
But the following doesn't work
double dX1 = tr.Root.Scale.From.dVal;
double dX2 = tr.Root.Scale.To.dVal;


Thaks a lot for the explanations about Show property
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