/*
	xchart_9.dlg

*! VERSION 1.1.1  09aug2006  (deprecated)

*/

VERSION 9.0

INCLUDE graph_header
INCLUDE header

HELP hlp1, view("help xchart")
RESET res1

DIALOG main,label("xchart - Draws an X-bar (control-line) chart")	///
	tabtitle("Main")
BEGIN
  TEXT     tx_var         _lft       _top       _cwd1	   .,		///
	label("Variables:")
  VARLIST  vl_var         @          _ss        @          .,		///
	label("Variables")

  GROUPBOX gb_std         @          _ls        @          _ht6,	///
	label("Standard deviation of the process")

  RADIO    rb_range       _indent    _ss        _inwd      .,		///
	label("Calculate standard deviation based on range")		///
	first onclickon(script std_off)
  RADIO    rb_std         @          _ss        @          .,		///
	label("Use user-specified standard deviation")			///
	last onclickon(script std_on)

  EDIT     en_std         _indent2   _ss        _en7wd     .,		///
	label("User-specified standard deviation") default(0) 		///
	numonly option(std)
  TEXT     tx_std         _en7sep    @          130        .,		///
	label("Standard deviation")

  GROUPBOX gb_mean        _lft      _xls      _cwd1     _ht6, 		///
	label("Mean")

  RADIO    rb_cmean       _indent   _ss       _cwd3     .,  		///
	label("Calculate mean") first onclickon(script mean_off)
  RADIO    rb_mean        _ilft     _ss       @         ., 		///
	label("Use user-specified mean") 				///
	onclickon(script mean_on)					///
	last
  EDIT     en_mean        _indent2  _ss       _en7wd    .,		///
	label("User-specified mean") default(0) numonly option(mean)
  TEXT     tx_mean        _en7sep   @         130       .,		///
	label("Mean")

  CHECKBOX ck_xbar        _lft      _xls      _cwd1     _ht5,		///
	label("User-specified X-bar limits")				///
	groupbox onclickon(script sc_on) onclickoff(script sc_off)
  EDIT     en_lower       _indent   _ms       _en7wd    .,		///
	label("Lower limit" ) default(0) numonly option(lower)
  DEFINE   holdx @x
  TEXT     tx_lower       _en7sep   @         _en7r2b   .,		///
	label("Lower limit")
  EDIT     en_upper       holdx     _ms       _en7wd    .,		///
	label("Upper limit") default(0) numonly option(upper)
  TEXT     tx_upper       _en7sep   @         _en7r2b   .,		///
	label("Upper limit")
END

SCRIPT sc_on
BEGIN
	main.en_lower.enable
	main.en_upper.enable
END

SCRIPT sc_off
BEGIN
	main.en_lower.disable
	main.en_upper.disable
END

SCRIPT std_on
BEGIN
	main.en_std.enable
END

SCRIPT std_off
BEGIN
        main.en_std.disable
END

SCRIPT mean_on
BEGIN
        main.en_mean.enable
        main.tx_mean.enable
END

SCRIPT mean_off
BEGIN
        main.en_mean.disable
        main.tx_mean.disable
END

INCLUDE ifin

INCLUDE p1_opts
INCLUDE p2_opts
INCLUDE addplot
INCLUDE gr_twoway

SCRIPT PREINIT
BEGIN
	script p1_opts_createAsNoRange
	script p1_opts_setDefaultScatter
	script p2_opts_createAsRange
	script p2_opts_setDefaultRline
END

SCRIPT POSTINIT
BEGIN
	p2_opts.settabtitle "Control limits"
END

PROGRAM command
BEGIN
        put "xchart "
        varlist main.vl_var
        INCLUDE _ifin_pr
        beginoptions
        	if main.rb_std{
			require main.en_std
			optionarg main.en_std
		}
                if main.rb_mean{
			require main.en_mean
                        optionarg main.en_mean
                }
                if main.ck_xbar{
			require main.en_lower
			require main.en_upper
			optionarg main.en_lower
			optionarg main.en_upper
                }

		put " " /program p1_opts_output
		put " " /program p2_opts_cl_output
		put " " /program addplot_output
		put " " /program gr_twoway_output
        endoptions
END
/* end */
