DataPlot::ChangeData

Version Info

Minimum Origin Version Required: Origin 9.1 SR0

Description

Change the X or Y dataset in the data plot.

Syntax

BOOL ChangeData(Column& col, int nDesignation, BOOL bKeepModifiers = FALSE)
BOOL ChangeData(LPCSTR pcszWksName, int nCol, int nDesignation, BOOL bKeepModifiers = FALSE)
BOOL ChangeData(Worksheet& wks, int nCol, int nDesignation, BOOL bKeepModifiers = FALSE)

Parameters

col
[input]column object.
nDesignation
[input]
pcszWksName
[input]name of the worksheet.
wks
[input]worksheet object.
nCol
[input]column number in the worksheet.
bKeepModifiers
[input]Keep Modifiers.

Return

TRUE for success; FALSE otherwise.

Examples

EX1

void DataPlot_ChangeData_ex1()
{
        Worksheet wks;

        // Create a new workbook.
        WorksheetPage wpg;
        if( wpg.Create("origin") )
        {
                // Put some random data into the first worksheet.
                wks = wpg.Layers();
                wks.AddCol();
                wks.Columns(0).SetFormula("i");
                wks.Columns(0).ExecuteFormula(0, -1, FALSE, 0, 0);
                wks.Columns(1).SetFormula("uniform(32,0.1)");
                wks.Columns(1).ExecuteFormula(0, -1, FALSE, 1, 1);
                wks.Columns(2).SetFormula("uniform(32,0.1)");
                wks.Columns(2).ExecuteFormula(0, -1, FALSE, 1, 1);

                // Plot the first sheet.
                wpg.LT_execute("plotxy iy:=(2) plot:=202"); // Plot first Y column.
        }

        // Now we have a workbook and a graph containing
        // data from Sheet1's first two columns.

        GraphLayer gl = Project.ActiveLayer();
        if( gl )
        {
                DataPlot dp = gl.DataPlots();
                if( dp )
                {
                        // Change data plot's Y column to the 2nd Y column.
                        dp.ChangeData(wks, 2, OKDATAOBJ_DESIGNATION_Y);
                }
        }
}

Remark

See Also

DataPlot::ChangeSheet

header to Include

origin.h