2.2.4.8.31 DataPlot::SetColor

Description

Set the color of the dataplot (line, symbol).

Syntax

BOOL SetColor( int nColor, BOOL bRepaint = FALSE, BOOL bUndo = false )

Parameters

nColor
[input] the color index in the Origin palette (typically it is 0 - black, 1 - red, etc.).
bRepaint
[input] TRUE to cause graph repaint, FALSE not to repaint.
bUndo
[input] if bUndo is true, you can use Ctrl + Z to undo SetColor.

Return

TRUE for success, otherwise FALSE.

Examples

EX1

void    DataPlot_SetColor_ex1()
{
    Worksheet wks;
    wks.Create("origin");
    Dataset ds1(wks,0);
    Dataset ds2(wks,1);
    ds1.Data(1,20,1);
    ds2.Normal(20);
    GraphPage gp;
    gp.Create("origin");
    GraphLayer gl(gp.GetName(), 0);
    gl.AddPlot(wks);

    if(gl)
    {
        
        // Get the first data plot in the layer:
        DataPlot        dp = gl.DataPlots(0);
    
        // Set the color to red and repaint:
        dp.SetColor(1, TRUE);
    }
}

Remark

See Also

Header to Include

origin.h