#include <origin.h>
#include <GetNBox.h>
#include <xfutils.h>
//put additional include files here

//put your own support static functions here



void PlotCumulativeProb()
{
	GraphPage gpActive = Project.Pages();
	if( gpActive )
	{
		GraphLayer glPlotFrom = gpActive.Layers(0);
		GraphLayer glPlotTo = gpActive.Layers(1);
		if( glPlotTo )
		{
			LT_execute("OpenBinWks 1");	
			TreeNode trPlot2Bin;
			if( Project.GetTree("plot2bin", trPlot2Bin) )
			{
				DataRange dr;
				dr.Add("X", trPlot2Bin.rdOut.strVal);
				
				Worksheet wks;
				int nCol1 = 0;
				int nCol2 = 0;
				
				if( dr.GetRange(wks, nCol1, nCol2) )
				{
					Curve cv(wks, nCol1, nCol2);
					glPlotTo.AddPlot(cv, IDM_PLOT_SCATTER);
					/// YuI 11/19/09 QA70-14652 CUMULATIVE_PROBABILITY_RESCALE_PROBLEM
					// these layers are linked, so one resale with ALL_IN_FAMILY bit will do
					//	glPlotFrom.Rescale();
					//	glPlotTo.Rescale();
					glPlotTo.Rescale(ANL_ALL_LINKED_LAYERS_IN_FAMILY | ANL_CHK_EXPAND_SCALE);
					/// end CUMULATIVE_PROBABILITY_RESCALE_PROBLEM
					gpActive.SetShow();
					WorksheetPage wp;
					wks.GetParent(wp);
					if( wp )
						wp.SetShow(PAGE_HIDDEN);
				}
			}
		}
	}
}

//nGetNDialog = 0,1,2, corresponding to the XF GetN dropdown, 0 = dialog is not used
//you can change nRet to be one of XFEVT_PROCEED (defualt), XFEVT_ABORT, XFEVT_PROCEED_NO_DLG or XFEVT_PROCEED_WITH_DLG(when nGetNDialog = 0)
//nGetNDialog = -1 when Ok on GetN dialog to allow handler to preocess <auto> etc variables
//dwCntrl is combination of bits
//LTXF_FROM_GUI_MENU, LTXF_FROM_GUI_PROMPT, LTXF_FROM_AUTO_UPDATE, LTXF_FROM_FUNCTION, LTXF_THEME_USED, LTXF_CHANGE_PARAM
void PlotCumulativeProb_before_execute(TreeNode& trGetN, int nGetNDialog, int& nRet, int dwCntrl)
{

}
