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
 set shape/filling based on column values
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

rapt1

6 Posts

Posted - 03/29/2021 :  3:20:46 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I want to set the filling and the shape of symbols in a scatter plot based on values in a column like it works in the gui (custom construction -> by Column) see also that question:
https://my.originlab.com/forum/topic.asp?TOPIC_ID=46692
How to do it in origin C?

Do I follow the same approach for SetSymbol? I would need to replace the "color function" I guess, any hint?

Best,
D


win10
OriginPro 2021 (64-bit)
9.8.0.200


Edited by - rapt1 on 03/29/2021 3:22:05 PM

cpyang

USA
1406 Posts

Posted - 03/31/2021 :  8:35:14 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
We are adding this general support, so you need our next beta or wait for 2021b release. Our next beta is likely to be available by the end of this week and it is called Beta9.

Here is the code and the worksheet

void size_and fill_from_col()
{
	Worksheet wks = Project.ActiveLayer();  // get worksheet with group.dat data	
	DataRange dr;
	dr.Add(wks, 0, "X");
	dr.Add(wks, 1, "Y");
	
	GraphPage gp;
	gp.Create("scatter");  // create scatter graph	
	GraphLayer gl = gp.Layers(0);
	int nPlot = gl.AddPlot(dr, IDM_PLOT_SCATTER);  // add plot to layer
	gl.Rescale();

	DataPlot dp = gl.DataPlots(nPlot);
	dp.SetProp("symbol.kind", 2);//circle
	//from 1 col on the right of Y, col(C)
	double vv;LT_evaluate("modifier(1)",&vv);
	int nModi = (int)vv;
	dp.SetProp("symbol.size", nModi);//size 
	dp.SetProp("symbol.SizeFactor", 30);
	//from 2 col on the right of Y, col(D)
	LT_evaluate("modifier(2)",&vv);
	nModi = (int)vv;
	dp.SetProp("symbol.interior", nModi);//1=close, 2=open
}





To find the LT property for data plot, from script window:

layer.plot.=;
layer.plot.symbol.=


CP
Go to Top of Page

rapt1

6 Posts

Posted - 04/02/2021 :  11:58:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you.

win10
OriginPro 2021 (64-bit)
9.8.0.200
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