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
 Axis tweaking.

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
Doltergost Posted - 04/15/2024 : 10:36:42 AM
Hello,

i feel a little bit dumb but i cant find a good documentation vor the manipulation of plots with Origin C and trees.

I want to change the display mode of the numbers displayed beyond the x-axis from decimal to scientiffic ( 10^2, 10^3....).

Additionally i want to remove the numbers of a second x-Axis in the same graphpage but another layer.

Thanks in advance.
5   L A T E S T    R E P L I E S    (Newest First)
YimingChen Posted - 04/24/2024 : 12:12:17 PM
I don't see the Nestor treenode in the format tree. Can you check this sample code and see if it helps to customize group plots format.
https://www.originlab.com/doc/OriginC/guide/Customizing-Data-Plots#Setting_Format_on_Grouped_Line_.2B_Symbol_PlotsGraph_Layer.2C_Set_Format_on_Grouping_Plot
Doltergost Posted - 04/23/2024 : 02:58:04 AM
Thank you greatly.

Now i found a Treenode:

Root.Groups.Group1.Nester

when i make a LINESYMB Plot and give the color -9, then all the curves get colored correctly in different colors. When i make a SCATTER Plot, all outher parameters are kept, all curves are black. The treenode above is the one thats different in both graphics. In the LINESYMB Plot the value of it is 1:{4} or 1:{0}. I tried to set it like

trFormat.Root.Groups.Group1.Nester.dVal = 4
trFormat.Root.Groups.Group1.Nester.dVal = 0
trFormat.Root.Groups.Group1.Nester.nVal = 0

but i always the errormassage that the treenode doesnt exist or that i dont have access to it.

Is there a way to assign the automated coloring for the scatterplot like for the linesymbplot?

My plotting code below:

void addplot(string graphname, int plottyp, int form, int color, Worksheet *ptrwks, int x1, int y1, string curvelabel, int keep = 1, int symbolsize = 3, int xscale = 1, string directory = "none", int layernumber = 0, int xscaletype = 0, string xlabel = "%(?X)", string ylabel = "%(?Y)")
{
	PageBase pb = Project.Pages(graphname); 
	GraphPage gp;
	
	int newgp = 0;
	// Überürüfung ob ein solches Fenster existiert.
	if( pb.IsValid() )
	{
		if(keep >= 1)
		{
			gp = pb;
		}
		if(keep == 0)
		{
			pb.Destroy();
		}
	}

	if( !pb.IsValid() )
	{
		gp.Create("Origin");
		gp.SetName(graphname);
		newgp = 1;
	}
	
	GraphLayer gl = gp.Layers(layernumber);
	
	if(newgp != 0)
	{
		GraphObject grXL = gl.GraphObjects("XB"); // Get X axis label
		GraphObject grYL = gl.GraphObjects("YL"); // Get Y axis label
	
		grXL.Text = xlabel;
		grYL.Text = ylabel;
	}
	// DataRange für plotten der Messdaten
	DataRange grafikdata1;
	grafikdata1.Add(*ptrwks,x1,"X");
	grafikdata1.Add(*ptrwks,y1,"Y");
	
	int iPlots = 0;

	foreach(DataPlot dp in gl.DataPlots)
	{
		iPlots++;
	}
		
	int nPlotIndex = gl.AddPlot(grafikdata1, plottyp);
	
	Tree tr0,tr1;
	
	tr0.Root.Axes.X.Labels.BottomLabels.DivideByFactor.dVal = xscale;
	tr0.Root.Axes.X.Scale.Type.nVal = xscaletype;
	
	if(xscale == 60)
	{
		tr0.Root.Axes.X.Scale.IncrementBy.nVal = 0;
		tr0.Root.Axes.X.Scale.Value.dVal = 600;
	}
	else if(xscale == 3600)
	{
		tr0.Root.Axes.X.Scale.IncrementBy.nVal = 0;
		tr0.Root.Axes.X.Scale.Value.dVal = 3600;
	}
	tr1.Root.Symbol.Size.nVal = symbolsize; // Size of symbol
	tr1.Root.Symbol.Shape.nVal = form;
	
	GraphObject go;
	go = gl.GraphObjects("Legend");

	string temp;
	temp = go.Text;
	if(iPlots == 0)
	{
		go.Text = "\l(" + (nPlotIndex+1) + ")\c"+ (color+1) + "(" + curvelabel + ")";
	}
	else
	{
		go.Text = go.Text + "\n\l(" + (nPlotIndex+1) + ")\c"+ (color+1) + "(" + curvelabel + ")";
	}
	
	if(layernumber == 1)
	{
		go = gp.Layers(0).GraphObjects("Legend");
		
		go.Show = 0;
		
		go = gl.GraphObjects("XB"); // Get X axis label
		
		go.Show = 0;
		
	}
	
	DataPlot dp1 = gl.DataPlots(nPlotIndex);
	dp1.SetColor(color,TRUE);	
	
	bool bRet;
	
	if(color == -9)
	{
		gp.Layers(layernumber).GroupPlots(0);
	}

	if( 0 == dp1.UpdateThemeIDs(tr1.Root))
	{
		bRet = dp1.ApplyFormat(tr1, true, true);
	}
	
	if(gp.Layers(layernumber).UpdateThemeIDs(tr0.Root) == 0)
	{
		gp.Layers(layernumber).ApplyFormat(tr0, true, true);
	}
	
	if(nPlotIndex >= 0)
	{
		gl.Rescale();
	}
	
	PageBase pb2 = Project.Pages(graphname);
	
	if( directory != "none")
	{
		Folder fldroot = Project.RootFolder;
		Folder fldpb = pb2.GetFolder();
	
		BOOL nRet = fldpb.Move(graphname,fldroot.GetPath() + directory);
	}
}


Thanks in advance
YimingChen Posted - 04/16/2024 : 10:06:52 AM
You can add a breakpoint in front of a line of code and run the program to debug. Then you can expand and check the contents of the format tree.



James
Doltergost Posted - 04/16/2024 : 02:19:09 AM
Thanks for the help. Yeah i checked the examples but i there is not a complete list of all values/options that you can change.

trFormat.Root.Axes.Y.Labels.LeftLabels.NumericFormat.nVal = 1; // tick label scientific notation.
trFormat.Root.Axes.Y.Labels.RightLabels.show.nVal = 0; // hide right axis tick labels.

Those arent on that page. Is there somewhere a list with all existing tree nodes?

Markus
YimingChen Posted - 04/15/2024 : 4:39:31 PM
Please check the sample code.
https://www.originlab.com/doc/ja/OriginC/examples/Axes-Formatting


void AccessTicks(){    
	GraphPage gp = Project.Pages();
	GraphLayer gl = gp.Layers(0);      
    Tree trFormat;
    trFormat = gl.GetFormat(FPB_ALL, FOB_ALL, TRUE, TRUE);
	trFormat.Root.Axes.Y.Labels.LeftLabels.NumericFormat.nVal = 1; // tick label scientific notation. 	
    bool bRet = gl.ApplyFormat( trFormat, true, true, true ); 
    if( !bRet )        
    	out_str("Fail to update graph format!!!");   
    	
    gl = gp.Layers(1);    
    trFormat = gl.GetFormat(FPB_ALL, FOB_ALL, TRUE, TRUE);
	trFormat.Root.Axes.Y.Labels.RightLabels.show.nVal = 0; // hide right axis tick labels.     	
    bRet = gl.ApplyFormat( trFormat, true, true, true ); 
    if( !bRet )        
    	out_str("Fail to update graph format!!!");   
}


James

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