BookmarkSubscribe
Choose Language Hide Translation Bar
Françoise
Community Trekker

graph with different target or spec limits

hi,

 

I have a graph for 2 product (P and X) like this image below.

 

I would like to add a ref line and a  colored zone specific for each product with the jsl of the graph.

 

Is it possible?

 

best regards

graph pour cibles.jpg

 

 

 

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Staff

Re: graph with different target or spec limits

Think you may have to resort to graphics scripts. Making this general would take some work, but is perfectly possible. Use 'Help > Scripting Index' for more details.

 

Screen Shot 2019-01-15 at 11.41.37.png

NamesDefaultToHere(1);

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

// Using the axis gives common values for the groups
gb1 = dt << Graph Builder(
				Size( 534, 488 ),
				Show Control Panel( 0 ),
				Show Legend( 0 ),
				Variables( X( :weight ), Y( :height ), Group X( :sex ) ),
				Elements( Points( X, Y, Legend( 8 ) ), Smoother( X, Y, Legend( 9 ) ) ),
				SendToReport(
					Dispatch(
						{},
						"height",
						ScaleBox,
						{Add Ref Line( {60, 65}, "Solid", "Green", "Middle", 1, 0.25 ),
						Add Ref Line( {65, 70}, "Solid", "Medium Dark Cyan", "Top", 1, 0.25 ),
						Add Ref Line( 65, "Solid", "Orange", "", 1 )}
					)
				)
			);

// Different values for each group takes more work
gb2 = dt << Graph Builder(
				Size( 534, 488 ),
				Show Control Panel( 0 ),
				Show Legend( 0 ),
				Variables( X( :weight ), Y( :height ), Group X( :sex ) ),
				Elements( Points( X, Y, Legend( 8 ) ), Smoother( X, Y, Legend( 9 ) ) )
			);
gb2Rep = Report(gb2);
// Females . . .
gb2Rep[Framebox(1)] << addGraphicsScript(
							PenColor("Orange"); HLine(60);
							Transparency(0.25);
							FillColor("Green");
							Rect(50, 60, 180, 55, 1);
							FillColor("Blue");
							Rect(50, 65, 180, 60, 1);
						);
// Males . . .
gb2Rep[Framebox(2)] << addGraphicsScript(
							PenColor("Orange"); HLine(65);
							Transparency(0.25);
							FillColor("Green");
							Rect(50, 65, 180, 60, 1);
							FillColor("Blue");
							Rect(50, 70, 180, 65, 1);
						);
3 REPLIES 3
ian_jmp
Staff

Re: graph with different target or spec limits

Think you may have to resort to graphics scripts. Making this general would take some work, but is perfectly possible. Use 'Help > Scripting Index' for more details.

 

Screen Shot 2019-01-15 at 11.41.37.png

NamesDefaultToHere(1);

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

// Using the axis gives common values for the groups
gb1 = dt << Graph Builder(
				Size( 534, 488 ),
				Show Control Panel( 0 ),
				Show Legend( 0 ),
				Variables( X( :weight ), Y( :height ), Group X( :sex ) ),
				Elements( Points( X, Y, Legend( 8 ) ), Smoother( X, Y, Legend( 9 ) ) ),
				SendToReport(
					Dispatch(
						{},
						"height",
						ScaleBox,
						{Add Ref Line( {60, 65}, "Solid", "Green", "Middle", 1, 0.25 ),
						Add Ref Line( {65, 70}, "Solid", "Medium Dark Cyan", "Top", 1, 0.25 ),
						Add Ref Line( 65, "Solid", "Orange", "", 1 )}
					)
				)
			);

// Different values for each group takes more work
gb2 = dt << Graph Builder(
				Size( 534, 488 ),
				Show Control Panel( 0 ),
				Show Legend( 0 ),
				Variables( X( :weight ), Y( :height ), Group X( :sex ) ),
				Elements( Points( X, Y, Legend( 8 ) ), Smoother( X, Y, Legend( 9 ) ) )
			);
gb2Rep = Report(gb2);
// Females . . .
gb2Rep[Framebox(1)] << addGraphicsScript(
							PenColor("Orange"); HLine(60);
							Transparency(0.25);
							FillColor("Green");
							Rect(50, 60, 180, 55, 1);
							FillColor("Blue");
							Rect(50, 65, 180, 60, 1);
						);
// Males . . .
gb2Rep[Framebox(2)] << addGraphicsScript(
							PenColor("Orange"); HLine(65);
							Transparency(0.25);
							FillColor("Green");
							Rect(50, 65, 180, 60, 1);
							FillColor("Blue");
							Rect(50, 70, 180, 65, 1);
						);
Françoise
Community Trekker

Re: graph with different target or spec limits

hi,

 

there is a pb.

 

If you exclude M and then re include M, you will have the same spec limits for F and M.

 

best regards

0 Kudos
ian_jmp
Staff

Re: graph with different target or spec limits

Yes.

 

If you hide the 'Males' (for example, by using a local data filter), the frame box that holds these points (in this case 'FrameBox(2)') is deleted from the display, along with the associated graphics script. When the 'Males' are unhidden, JMP will create the frame box it needs, but it will inherit the graphics script from the 'Females'. One could argue that it shouldn't do this, but then of course you would have no lines for the 'Males'.

 

I think you could get the behaviour you want by using a row state handler but it would take some work to make this general.

0 Kudos