cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
blue1994
Level III

How to iterate the reference line on chart

Hi,
May I know how to make the iteration for adding the reference line on chart by using JSL script?
Because now I only can add the reference line on the chart for the first tab, other tab of the chart are not able to generate out.
Anyone can help?
Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to iterate the reference line on chart

You are not understanding how the pointer to each of your variability charts work.  You are using the following code:

vchart = dt_raw_dataset << Variability Chart(
	Y( Eval( IAT[i] ) ),
	X( :Name( "Lot" ), :Name( "Fab Lot" ) ),
	Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),

);

You are looping through this code multiple times.  Your thinking is that you can reference the output from the 1st time is by using the code

vc = vchart[m] << Report;

This is not a valid assumption.  Instead, each time you use the memory variable "vchart", it does not add a new value to some list of vchart values, it actually changes the value of "vchart" to a new value.  Therefore, you get exactly what you are reporting.  Only one of the charts get reference lines on them.  That is, it is because it is pointing to only the last instance of the Variability Chart.

What needs to be done, it to change your code so that rather than using "vchart" for each Variability Chart instance, to something like "vchart1" for the first one, "vchart2" for the second, etc.

And then, when you generate the Reference Lines, you then can point to the first, second, .....instance of the Variability Chart.

What you need to do is to create a list to store each of your vchart pointers in and then you will be able to recall them later

dt = Current Data Table();
dd = {};
ow = Oneway( Y( :height ), X( :sex ) );
dd[1] = ow;
ow = Oneway( Y( :weight ), X( :sex ) );
dd[2] = ow;

rpt = Report( dd[1] );
rpt[AxisBox( 1 )] << Add Ref Line( 65 );
rpt = Report( dd[2] );
rpt[AxisBox( 1 )] << Add Ref Line( 120 );

This same type of methodology you can expand on to produce the Reference lines, etc.

Jim

View solution in original post

8 REPLIES 8
Jeff_Perkinson
Community Manager Community Manager

Re: How to iterate the reference line on chart

We'll need some more information in order to point you in the right direction.

 

How are you creating your tabs? What JSL have you tried to put reference lines on charts in the other tabs?

What platform are you using to create your charts?

-Jeff
blue1994
Level III

Re: How to iterate the reference line on chart

Hi,

For creating the tabs, 

	tb << Insert(
			        distinctFamilyDevice[i],
				VListBox(
					dt_raw_dataset << Variability Chart(
	                    Y( Eval(IAT[i]) ),
	                    X( :Name( "Lot" ), :Name( "Fab Lot " ) ),
	                    Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),		
                  
						        );
						        	

While for create the reference lines, I have try use the expr function, but all of the script for using the expr function, it doesn't work.So, i do not use it.

I now using the code below, which can generate reference line, but which is only for the first tab of the chart only.

			vc = Variability Chart[i] << Report;
                        axisbox =  vc [axisbox(1)];
                        axisbox << Add Ref Line(-1.5,"Dashed",blue,"-1.5 Sigma",2);
	                axisbox << Add Ref Line(1.5, "Dashed", blue, "1.5 Sigma", 2);	
	                axisbox << Add Ref Line(0, "Solid", blue, "Target", 2);	
	                axisbox << Add Ref Line(-3, "Dashed", red, "-3 Sigma", 2);	
	                axisbox << Add Ref Line(3, "Dashed", red, "3 Sigma", 2);			        

Platform for creating the chart is variability chart.

 

Thanks.

 

txnelson
Super User

Re: How to iterate the reference line on chart

Here is a very simple example.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );

nw = New Window( "Tab Test",
	mytab = Tab Box(
		t1 = Tab Page Box( "One", onebiv = dt << Bivariate( Y( :weight ), X( :height ) ) ),
		t2 = Tab Page Box( "Two", twobiv = dt << Bivariate( Y( :weight ), X( :age ) ) )
	)
);

report(onebiv)[AxisBox(1)]<<add ref line(120,"Solid","Red","Mean");
report(twobiv)[AxisBox(1)]<<add ref line(130,"Solid","Green","Q3");
Jim
Jeff_Perkinson
Community Manager Community Manager

Re: How to iterate the reference line on chart

I would encourage you to look at the Axis Column Property. If you add this property to your column then every graph that uses that column will have the same axis settings, including reference lines.

 

dt = Open( "$SAMPLE_DATA\Big Class.jmp" );

Column( dt, "weight" ) <<
Add Column Properties(
	Set Property(
		"Axis",
		{Add Ref Line( 100, "Solid", "Black", "", 1 )}
	)
);

dt << Bivariate( Y( :weight ), X( :height ), Fit Line );
-Jeff
blue1994
Level III

Re: How to iterate the reference line on chart

Thanks @Jeff_Perkinson and @txnelson for replying.
But I still not able to solve my problem.
I still cannot make every tab for its charts have the reference line.

I really had try out myself, so may I ask is there any alternatives way still can make every tab of the chart that can genereate the reference line?

Thanks.

Jeff_Perkinson
Community Manager Community Manager

Re: How to iterate the reference line on chart

I'm afraid you're still not posting enough detail about the problem you're having for us to effectively provide you a solution. 

 

 

Can you construct a simple example using any of the Sample Data that demonstrates the techniques you're trying?

 

We need to know exactly what code you've tried, in a complete, runnable example, and exactly what problem you ran into. That is, did you receive an error message? Did the code behave in an unexpected way? Did you get a reference line on any graph? All lines on the same graph? In short, more details, please.

 

Here's an example using the Sample Data that shows a basic way to accomplish. Perhaps you can extend this example to demonstrate the difficulty you're running into.

 

dt = Open( "$SAMPLE_DATA\Semiconductor Capability.jmp" );

collist = {:NPN1, :NPN2, :NPN3, :NPN4};

varcharts = {};

tb = Tab Box();

For( i = 1, i <= N Items( collist ), i++,
	tb << Insert(
		collist[i] << get name,
		V List Box(
			varcharts[i] = dt << Variability Chart(
				Y( collist[i] ),
				X( :wafer ),
				Analysis Type( "Choose best analysis (EMS REML Bayesian)" )
			)
		)
	);
);

for(i=1, i<=nitems(varcharts),i++,
vc = varcharts[i] << Report;
                        axisbox =  vc [axisbox(1)];
                        axisbox << Add Ref Line(110,"Dashed",blue,"-1.5 Sigma",2);
	
	
);

new window("My Window", tb);

Tabboxes.gif

-Jeff
blue1994
Level III

Re: How to iterate the reference line on chart

Hi,

Actually every tab i have 5 charts.

Well, in each of the chart, I need have 5 reference line.

For the red color part, I able to generate out the reference line on chart for only one tab, other 4 tab of the chart, I not able to generate out the reference line.

But when i run the whole script, it doesnt show me any error, so I don't know how to fix it. 

 

Thanks.

 

variabilityWindow = New Window( "Variability Chart", tb = Tab Box() );


For( i = 1, i <= N Items(distinctFamilyDevice), i++, 

// Create a new tab and append the variability charts
	tb << Insert(
		distinctFamilyDevice[i],
		VListBox(
  
                vchart = dt_raw_dataset << Variability Chart(
	        Y( Eval(IAT[i]) ),
	        X( :Name( "Lot" ), :Name( "Fab Lot" ) ),
	        Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),		
                       );
    
		         )
				
	       );
 
	);

For(m = 1, m <= N Items(IAT), m++,
        vc = vchart[m] << Report; 
        axisbox = vc [axisbox(1)];
        axisbox << Add Ref Line(-1.5,"Dashed",red,"-1.5 Sigma",2);
        axisbox << Add Ref Line(1.5, "Dashed", red, "1.5 Sigma", 2);	
	axisbox << Add Ref Line(0, "Solid", red, "Target", 2);	
	axisbox << Add Ref Line(-3, "Dotted", red, "-3 Sigma", 2);
	axisbox << Add Ref Line(3, "Dotted", red, "3 Sigma", 2);
	                    
        ); 
                           
txnelson
Super User

Re: How to iterate the reference line on chart

You are not understanding how the pointer to each of your variability charts work.  You are using the following code:

vchart = dt_raw_dataset << Variability Chart(
	Y( Eval( IAT[i] ) ),
	X( :Name( "Lot" ), :Name( "Fab Lot" ) ),
	Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),

);

You are looping through this code multiple times.  Your thinking is that you can reference the output from the 1st time is by using the code

vc = vchart[m] << Report;

This is not a valid assumption.  Instead, each time you use the memory variable "vchart", it does not add a new value to some list of vchart values, it actually changes the value of "vchart" to a new value.  Therefore, you get exactly what you are reporting.  Only one of the charts get reference lines on them.  That is, it is because it is pointing to only the last instance of the Variability Chart.

What needs to be done, it to change your code so that rather than using "vchart" for each Variability Chart instance, to something like "vchart1" for the first one, "vchart2" for the second, etc.

And then, when you generate the Reference Lines, you then can point to the first, second, .....instance of the Variability Chart.

What you need to do is to create a list to store each of your vchart pointers in and then you will be able to recall them later

dt = Current Data Table();
dd = {};
ow = Oneway( Y( :height ), X( :sex ) );
dd[1] = ow;
ow = Oneway( Y( :weight ), X( :sex ) );
dd[2] = ow;

rpt = Report( dd[1] );
rpt[AxisBox( 1 )] << Add Ref Line( 65 );
rpt = Report( dd[2] );
rpt[AxisBox( 1 )] << Add Ref Line( 120 );

This same type of methodology you can expand on to produce the Reference lines, etc.

Jim