2.2.4.17.9 GraphLayer::ConvertByAxis

Description

It converts values back and forth between the real space and the "screen" space according to the axis scale of the graph layer. It really has effect only if the scale of the needed axis (the argument nAxis) is not linear.

Syntax

BOOL ConvertByAxis( double * prVals, int nSize, int nAxis, BOOL bForward, double * prValsOptnlDest = NULL )

Parameters

prVals
[input] pointer to the values to be converted. The size is nSize. If prValsOptnlDest is NULL, the output is also prVals
nSize
[input] the count of values in prVals.
nAxis
[input] the axis to use. Possible values are OKAXISTYPE_X or OKAXISTYPE_Y.
bForward
[input] if true, it converts from real space to screen space, otherwise reverse.
prValsOptnlDest
[output,optional]if supplied and the function returns TRUE, the result is put into this buffer (which must be of the same size nSize); the source buffer prVals is left unchanged.

Return

TRUE if any conversion made, otherwise FALSE. If TRUE is returned, the buffer prVals is left unchanged and prValsOptnlDest (if supplied) is left unchanged.

Examples

//Convert vector vY's screen space to real space according Y-axis scale.
void GraphLayer_ConvertByAxis_Ex1()
{
	vector vY;
	vY.Data(1, 32, 1);//fill with data
	//make sure there exists an active graphlayer, and set y axes type as log10;
	GraphLayer gl = Project.ActiveLayer();
	if ( !gl )
	{
		printf("Can not get active graphlayer!");
		return;
	}
	gl.ConvertByAxis(vY, vY.GetSize(), OKAXISTYPE_Y, false);
	return;
}

Remark

See Also

Header to Include

origin.h