2.2.4.17.18 GraphLayer::GetEnhancedLegend


Description

Get(Construct) Enhanced Legend string

Syntax

string GetEnhancedLegend( LPCSTR lpcszTitle = NULL, int nPlotObj = -1, DWORD dwProps = ENHANCEDLEGEND_AllProp )

Parameters

lpcszTitle
[input] prefix title of the return string
nPlotObj
[input] plot index, default -1: active plot
dwProps
[input] Enhanced Legend propeties:
ENHANCEDLEGEND_AllProp
ENHANCEDLEGEND_EDGECOLOR
ENHANCEDLEGEND_BACKCOLOR
ENHANCEDLEGEND_FORECOLOR
ENHANCEDLEGEND_SHAPE
ENHANCEDLEGEND_INTERIOR
ENHANCEDLEGEND_SIZE
ENHANCEDLEGEND_COLOR
ENHANCEDLEGEND_MaskColor
ENHANCEDLEGEND_FILLPATTERN
ENHANCEDLEGEND_COLOR_EX
ENHANCEDLEGEND_CtrlMask
ENHANCEDLEGEND_CombineCommonELP
ENHANCEDLEGEND_DisplayNoneIdxProp
ENHANCEDLEGEND_CAN_SHOW_ALL_CAT

Return

The Enhanced Legend.

Examples

EX1

void GraphLayer_GetEnhancedLegend_ex1()
{
    Worksheet wks;
    wks.Create("origin");
    
    string strFile = GetAppPath(TRUE)+"Samples\Graphing\Categorical Data.dat"; 
    ASCIMP ai;
    if(0 == AscImpReadFileStruct(strFile, &ai) &&0 == wks.ImportASCII(strFile, ai))
    {
        GraphPage gp;
        gp.Create("bubble");
        if( !gp.IsValid() )
            return;
        GraphLayer gl = gp.Layers();
        gl.AddPlot(wks, IDM_PLOT_INDEX_SIZE_COLOR);
        
        string strLegend = gl.GetEnhancedLegend("Title\n", 0);                
        printf("GetEnhancedLegend return: %s\n", strLegend);
        
        GraphObject goLegend;
        goLegend = gl.GraphObjects("Legend");
        if(!goLegend)                
            goLegend = gl.CreateGraphObject(GROT_TEXT, "Legend");
        gl.LT_execute("legend.LINK=1");
        goLegend.Text = strLegend;
    }
}

Remark

See Also

GraphLayer::CanHaveEnhancedLegend

Header to Included

origin.h