legend_update

 

Description

Update a Graph Layer's legend and may also set the Auto Legend mode

Syntax

bool legend_update( GraphLayer & gl, int nLegendMode = -1, bool bCreate = true, bool bReconstruct = true, LPCSTR lpcszCustomFormat = NULL, bool bOneforAll = false, bool bAscending = true )

Parameters

gl
[input] The layer to update legend
nLegendMode
[input] ignore if <0 otherwise to set the corresponding graph page's Auto Legend mode
bCreate
[input] Create a legend if not existed.
bReconstruct
[input] if true will reconstruct legend for all data plot, else will check legend for each data plot, if one data plot has legended will not update it's legend string.
lpcszCustomFormat
[input] this variable only be valid when nLegendMode is ALM_CUSTOM. It can be @D(dataset name) and so on.
bOneforAll
[input] if true, mean Graph Layer's legend is "One legend for all" for Graph Page
bAscending
[input] this variable is only valid when bReconstruct is true. It can control the order the legend according to DataPlots order

Return

If success then true else false

Examples

EX1

//For this example to run, make the graph layer to update legend active
void  legend_update_ex1()
{
    GraphLayer gl = Project.ActiveLayer();
    legend_update(gl, ALM_LONGNAME_UNITS);// set to be like in Origin 75 to use Long Name and Units
}

Remark

See Also

header to Include

origin.h

Reference