2.2.4.17.31 GraphLayer::Rescale

Description

It rescales the graphic layer axes to show all dataplot points that may be outside the current axis ranges.

Syntax

BOOL Rescale( DWORD dwCntrl = 0, int * lpnOutcome = NULL )

Parameters

dwCntrl
[input] bits to control the rescale options, ANL_* in oc_const.h. You can use OKAXISTYPE_X, OKAXISTYPE_Y to prevent that axis direction to be changed, and there are many other bits that control other details.
enum 
{
	ANL_FIT			=	0x00000010, // fit data to layer
	ANL_NO_ROUNDING =		0x00000020, // do not round From/To to major ticks
	ANL_OVERIDE_FIX =		0x00000040,
	ANL_AFTER_ZOOM	=		0x00000080, 

	ANL_NO_EXPAND=			0x00000100,// no X expand 
	ANL_NO_YMIN_EXPAND =		0x00000200,	// no Y min expand 
	ANL_NO_YMAX_EXPAND =		0x00000400,	// no Y max expand 
	ANL_NO_Y_EXPAND =		ANL_NO_YMIN_EXPAND | ANL_NO_YMAX_EXPAND,

	ANL_NO_INIT_LIMITS =		0x00000800,
	ANL_FROM_NEW_PLOT =		0x00001000,

	ANL_CHK_EXPAND_SCALE  =		0x00002000, // expand according to parent layer's scale
	ANL_CHECK_TYPE  =	        0x00004000,
	ANL_XY_FIT_NO_EXPAND =		0x00008000, // fit X and Y scale to data
	
	ANL_FIT_TO_MAJOR_TICK =		0x00010000,	
	ANL_NO_UPDATE =			0x00020000,
	ANL_REAL_TIME =			0x00040000,  
	ANL_NO_XINC_CHANGE =		0x00080000, // keep X increment value
	
	ANL_USE_DATA_IN_XRANGE=		0x00100000, // only rescale for data in X range
	ANL_NEW_1ST_PLOT	=	0x00200000, 
	ANL_NO_YINC_CHANGE =		0x00400000, // keep Y increment value
	ANL_INDIVIDUAL_SCALE	=	0x00800000,
	ANL_UNDO	=		0x01000000,
	ANL_NO_INC_CHANGE =		0x02000000,  // keep Y increment value
	ANL_KEEP_MISSING =		0x04000000,	
	ANL_ASK_OVERRIDE_FIXED_SCALE	= 0x08000000,	
	ANL_RUN_LT_SIZEMOVE =		0x10000000, // execute GRCT_MOVE script after rescale
	ANL_CHK_DATA_OUTSIDE =		0x20000000, //rescale if data outside
	ANL_ALL_LINKED_LAYERS_IN_FAMILY = 0x40000000, // rescale all linked layers
	ANL_AXIS_REVERSED		= 0x80000000
};
lpnOutcome
[output] indicate if rescale has actually taken place, -1 if not due to ANL_CHK_DATA_OUTSIDE is specified but no data significantly outside

Return

TRUE if OK, otherwise FALSE.

Examples

EX1

// rescale the active graph layer by controlling to rescale X or Y only, or rescale both
void GraphLayer_Rescale_ex1(int nDirection) //0 = both XY, 1 = X only, 2 = Y only
{
	GraphLayer	gl = Project.ActiveLayer();
	DWORD		dwCntrl = ANL_NO_ROUNDING;	//do not round From/To to major ticks		
	if(1 == nDirection)
		dwCntrl |= OKAXISTYPE_Y;//prevent Y to be modified
	else if(2 == nDirection)
		dwCntrl |= OKAXISTYPE_X;//prevent X to be modified
	
    gl.Rescale(dwCntrl);
}

Remark

See Also

Header to Include

origin.h