cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Neo
Neo
Level VI

Add Ref Line () not working if axes names are supplied from outside.

The first case works fine but the second case where the axes names are supplied from outside does not work, where am I going wrong?

 

Graph Builder(
	Size( 528, 457 ),
	Show Control Panel( 0 ),
	Variables( X( :Column (3) ), Y( :Column (4) ) ),
	Elements( Points( X, Y, Legend( 3 ) )), 
		SendToReport(
		Dispatch(
			{},
			"Median 1",
			ScaleBox,
			{Add Ref Line( _LSL1_, "Solid", "Black", "xLSL", 1 ),
			Add Ref Line( _USL2_, "Solid", "Black", "xUSL", 1 )}
		),
		Dispatch(
			{},
			"Median 2",
			ScaleBox,
			{Add Ref Line( _LSL2_, "Solid", "Black", "yLSL", 1 ),
			Add Ref Line( _USL2_, "Solid", "Black", "yUSL", 1 )}
		)
	)

);

second case

 

xColName =  Column Name( 3 ); show (xColName);
yColName =  Column Name( 4 ); show (yColName);

Graph Builder(
	Size( 528, 457 ),
	Show Control Panel( 0 ),
	Variables( X( :Column (3) ), Y( :Column (4) ) ),
	Elements( Points( X, Y, Legend( 3 ) )), 
		SendToReport(
		Dispatch(
			{},
			xColName, //"xColName"
			ScaleBox,
			{Add Ref Line( _LSL1_, "Solid", "Black", "xLSL", 1 ),
			Add Ref Line( _USL2_, "Solid", "Black", "xUSL", 1 )}
		),
		Dispatch(
			{},
			yColName, //"yColName"
			ScaleBox,
			{Add Ref Line( _LSL2_, "Solid", "Black", "yLSL", 1 ),
			Add Ref Line( _USL2_, "Solid", "Black", "yUSL", 1 )}
		)
	)

);

 

 

 

 

When it's too good to be true, it's neither
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Add Ref Line () nor working if axes names are supplied from outside.

I would use a better programming structure to accomplish what you are looking for.  The Reference Lines can be directly applied to the chart by modifying the Axis Object(s) in the display output.  See below:

gb = Graph Builder(
	Size( 528, 457 ),
	Show Control Panel( 0 ),
	Variables( X( :Column (3) ), Y( :Column (4) ) ),
	Elements( Points( X, Y, Legend( 3 ) ))); 
gbr = report(gb);
gbr[AxisBox(1)] << Add Ref Line( _LSL1_, "Solid", "Black", "xLSL", 1 );
gbr[AxisBox(1)] << Add Ref Line( _USL2_, "Solid", "Black", "xUSL", 1 );
gbr[AxisBox(2)] << Add Ref Line( _LSL2_, "Solid", "Black", "yLSL", 1 );
gbr[AxisBox(2)] << Add Ref Line( _USL2_, "Solid", "Black", "yUSL", 1 );

The details on how to modify the Display Tree output can be found in the Scripting Guide.  All of the messages that can be sent to the display objects are listed with definitions and examples in the Scripting Index.

Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Add Ref Line () nor working if axes names are supplied from outside.

I would use a better programming structure to accomplish what you are looking for.  The Reference Lines can be directly applied to the chart by modifying the Axis Object(s) in the display output.  See below:

gb = Graph Builder(
	Size( 528, 457 ),
	Show Control Panel( 0 ),
	Variables( X( :Column (3) ), Y( :Column (4) ) ),
	Elements( Points( X, Y, Legend( 3 ) ))); 
gbr = report(gb);
gbr[AxisBox(1)] << Add Ref Line( _LSL1_, "Solid", "Black", "xLSL", 1 );
gbr[AxisBox(1)] << Add Ref Line( _USL2_, "Solid", "Black", "xUSL", 1 );
gbr[AxisBox(2)] << Add Ref Line( _LSL2_, "Solid", "Black", "yLSL", 1 );
gbr[AxisBox(2)] << Add Ref Line( _USL2_, "Solid", "Black", "yUSL", 1 );

The details on how to modify the Display Tree output can be found in the Scripting Guide.  All of the messages that can be sent to the display objects are listed with definitions and examples in the Scripting Index.

Jim