Plot with Shared Data Filter Object

Plot with Shared Data Filter Object

This example to show how to create new plot using Shared Data Filter Object

//pp_flt(2, 5, 3, "3:"between(11,15)"", 4, "3:"between(1700,2200)"")
void pp_flt(int nx=1, int ny=0, int nShDF1 = -1, string strShDF1 = "", int nShDF2 = -1, string strShDF2 = "", int nPlotType = 201)
{
        Worksheet               wks = Project.ActiveLayer();
        if(!wks)
                return;
        string strBook, strSheet;
        wks.GetPage().GetName(strBook);
        wks.GetName(strSheet);

        DWORD                   dwAuxTypeInfo, dwLTPlotInfo;
        string                  strColPattern;
        uint                    nExVal = 0;
        Tree                    tr;
        vector<string>  vsWksPages;
        vector<string>  vsLayers;
        vsWksPages.Add(strBook);
        vsLayers.Add(strSheet);
        vector<string> vsCols;
        vector<uint> vpdesig;
        Column cx = wks.Columns(nx);
        Column cy = wks.Columns(ny);
        string strName;
        
        cx.GetName(strName);
        vsCols.Add(strName);
        vpdesig.Add(COLDESIG_X);
        
        cy.GetName(strName);
        vsCols.Add(strName);
        vpdesig.Add(COLDESIG_Y);
        
        IntArray                arrFilterCols;
        vector<string>  vsShDFs;
        if (0 <= nShDF1)
        {
                arrFilterCols.Add(nShDF1);
                vsShDFs.Add(strShDF1);
        }
        if (0 <= nShDF2)
        {
                arrFilterCols.Add(nShDF2);
                vsShDFs.Add(strShDF2);
        }
        for (int iShDF = 0; iShDF < arrFilterCols.GetSize(); iShDF++)
        {
                if (0 <= arrFilterCols[iShDF] && !vsShDFs[iShDF].IsEmpty())
                {
                        Column cFilter = wks.Columns(arrFilterCols[iShDF]);
                        if (cFilter.IsValid())
                        {
                                cFilter.GetName(strName);
                                vsCols.Add(strName);
                                vpdesig.Add(COLDESIG_FILTER);
                        }
                        else
                                ASSERT(FALSE);
                }
                else
                        ASSERT(FALSE);
        }
        
        DWORD dwCntrl = DPEDTVIEW_HIDE_LIMITS;
        int                                nn = get_plot_type_info(nPlotType, EXIST_WKS, 0, dwAuxTypeInfo, dwLTPlotInfo, strColPattern);
        int        nRet =  0 == Project.MakeDataplotsTree(tr, nn, dwAuxTypeInfo, dwLTPlotInfo, strColPattern, nExVal, vpdesig, vsWksPages, vsLayers, vsCols, dwCntrl
                                , NULL
                                , &vsShDFs     
                                );
        
        GraphPage gp;
        gp.Create("scatter");  // create scatter graph      
        GraphLayer gl = gp.Layers(0);
        TreeNode                trLayer = tr.FirstNode;
        int                                nNumPlotsAdded = gl.AddPlots(trLayer, ADDPLOTSFROMTREE_NEW);
        gl.Rescale();

}