2.2.4.8.29 DataPlot::RemoveRelatedDataset


Description

Remove related dataset

Syntax

BOOL RemoveRelatedDataset( LPCSTR lpcszName = NULL )

Parameters

lpcszName
[input]name of related dataset to be removed, remove all datasets if lpcszName is NULL

Return

TRUE if successful, otherwise FALSE

Examples

EX1

//assume there is a "[Book1]Sheet1" WorkSheet
//and a graph plot active
void     DataPlot_RemoveRelatedDataset_Ex1()
{
    GraphLayer gl = Project.ActiveLayer();
    if( gl )
    {
        DataPlot dp = gl.DataPlots();
        Worksheet wks("[Book1]Sheet1");
        DatasetObject dsObject1 = wks.Columns(0);
        DatasetObject dsObject2 = wks.Columns(1);
        if( dp && dsObject1 && dsObject2)
        {
            string strDataset1 = "RelatedDataset1";
            string strDataset2 = "RelatedDataset2";
            int nRet = dp.SetRelatedDataset(strDataset1, dsObject1);
            nRet = dp.SetRelatedDataset(strDataset2, dsObject2);
            
            vector<string> arrNames;
            dp.GetRelatedDatasetNames(arrNames);
            out_str("before remove");
            for(int nn = 0; nn < arrNames.GetSize(); nn++)
            {
                printf("GetRelatedDatasetNames index of %d: %s\n", nn, arrNames[nn]);
            }
            
            dp.RemoveRelatedDataset(strDataset1);
            dp.GetRelatedDatasetNames(arrNames);
            out_str("after remove");
            for(nn = 0; nn < arrNames.GetSize(); nn++)
            {
                printf("GetRelatedDatasetNames index of %d: %s\n", nn, arrNames[nn]);
            }
        }
    }
}

Remark

See Also

DataPlot::GetRelatedDatasetNames

Header to Included

origin.h