2.2.4.8.37 DataPlot::SetModifier

Description

It sets a modifier, like to specify that a symbol size or color in a scatter plot, comes from another column.

Syntax

int SetModifier(int nDesig, Column &col)

Parameters

nDesig
[input]the property for which the modifier is specified:
COLDESIG_SIZE, symbol size
COLDESIG_COLOR, symbol color from a colormap
COLDESIG_VECTOR_ANGLE, vector plot angle column
COLDESIG_VECTOR_MAGNITUDE, vector plot magnitude column
COLDESIG_VECTOR_XEND, flow vector x-coordinate of the arrow end
COLDESIG_VECTOR_XEND, flow vector y-coordinate of the arrow end
col
[input]the column to be used as the modifier from which the dataplot will draw values for the modified property.

Return

Returns the previous modifier index, or 0 if previously the property was not a modifier value, or an error if the return value < -13000.

Examples

EX1

// have a worksheet active and import Samples\Graphing\group.dat into it.
void DataPlot_SetModifier_ex1()
{
	Worksheet		wks = Project.ActiveLayer();
	if( !wks )
	{
		out_str("Pls activate worksheet with group.dat data");
		return;
	}
	
	GraphPage		gp;
	gp.Create("bubble");
	
	GraphLayer		gl = Project.ActiveLayer();
	DataRange		dr;
	dr.Add(wks, 0, "X");
	dr.Add(wks, 1, "Y");
	int				nPlot = gl.AddPlot(dr, IDM_PLOT_SCATTER);
	DataPlot		dp = gl.DataPlots(0);
	Column			col = wks.Columns(1);
	dp.SetModifier(COLDESIG_SIZE, col);
	
	gl.Rescale(); 
}

EX2

// create an XY scatter plot with colormap from other columns
// have a worksheet that has at least three columns active before execution
void DataPlot_SetModifier_ex2()
{
	Worksheet wks = Project.ActiveLayer();
	DataRange dr;	
	dr.Add(wks, 0, "X");
	dr.Add(wks, 1, "Y");
	GraphPage gp;
	gp.Create("Origin");
	GraphLayer gl = gp.Layers();	
	gl.AddPlot(dr, IDM_PLOT_SCATTER);
        DataPlot dp = gl.DataPlots(0); 
	if( !dp )
		return;
	Column col(wks, 2);
	dp.SetModifier(COLDESIG_COLOR, col);
	gl.Rescale();
}

Remark

See Also

GraphLayer::AddPlot

Header to Include

origin.h