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

/***************************************************************************************
/// Modification Log :
/// Kyle 07/09/2009 QA80-13902-S1 FREQUENCY_SUPPORT_FRACTION_AND_PERCENT
***************************************************************************************/

//put your own support static functions here

BOOL	plot_paretoraw_CreatePlots(GraphLayer& gl, DataRange& dr, TreeNode& trGetN, BOOL bFromAutoUpdate)
{
	return plot_pareto_chart(gl, dr, trGetN, bFromAutoUpdate);
}


void plot_paretoraw(const Range& irng, ReportData& rd)
{
	
	///Kyle 07/09/2009 QA80-13902-S1 FREQUENCY_SUPPORT_FRACTION_AND_PERCENT, prototype changed
	//int		nErrCode = discrite_frequency_update_report_data(rd, irng, 1, 0, 1, 0, true);
	int		nErrCode = discrete_frequency_update_report_data(rd, irng, 1, 0, FREQUENCY_IN_PERCENT, 0, OKCOLTYPE_TEXT);
	///End FREQUENCY_SUPPORT_FRACTION_AND_PERCENT
	if (CER_NO_ERROR != nErrCode)
	{
		XF_THROW(nErrCode);
	}
}

//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 plot_paretoraw_before_execute(TreeNode& trGetN, int nGetNDialog, int& nRet, int dwCntrl)
{
	
	if ( is_xf_startup(nGetNDialog, dwCntrl) )
	{
		int	nErrCode = check_1_data(trGetN.irng, false, true);
		
		if (nErrCode != CER_NO_ERROR)
		{
			warning_msg_box(nErrCode, true);
			nRet = XFEVT_ABORT;
		}
	}
}
