2.2.4.8.16 DataPlot::GetLegend

Description

Get plot legend as it is displayed.

Syntax

BOOL GetLegend( string & str, LPCSTR lpcszCustomFormat = NULL, BOOL bClean = true )

Parameters

str
[output] legend string.
lpcszCustomFormat
[input] force particular legend format, in the form of @LL, @LC etc.
bClean
[input] remove illegal characters like '"' in order for legend to be used in range string.

Return

TRUE for success or FALSE if lpcszCustomFormat is specified but is not in the valid format.

Examples

void DataPlot_GetLegend_Ex1()
{
	//make sure there exists a graph with dataplots on it before running this code.
	GraphLayer gl = Project.ActiveLayer();
	if ( gl )
	{
		DataPlot dp = gl.DataPlots(0); //get the first dataplot on graphlayer
		if ( dp )
		{
			string strLegend;
			if ( dp.GetLegend(strLegend) )
			{
				printf("DataPlot %s's Legend is : %s\n", dp.GetName(), strLegend);
			}
		}
	}
}

Remark

See Also

Header to Include

origin.h