cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
PatB
Level II

Set Title of Graph Builder Charts

I've written a script in JMP 18 which creates line charts in rows of 3 using 'graph builder', 'fit group'.  Basically, the tables contain measure values for 'analytes' in multiple 'bioreactors' over multiple 'time points'.  In JMP 18 I get a title for each chart, but a colleague using JMP 17 finds that the title is missing which renders the chart meaningless. I'm completely stumped!  Any suggestions as to what I can do to add a title?

 

Here's the script:

 

newWindow = New Window(reportName, tb = Tab Box());
	//loop through the dataTables and add tab page box for each with a local data filter for dilution factor on left, and line charts on the right
	for( i = 1, i <= NItems(dataTables), i++,
		tb << Add(
			Tab Page Box(
						Title(dataTables[i] << get name),
						Data Filter Context Box(
							H List Box(
								dataTables[i] << Data Filter(
											Local,
											Add Filter( columns( :Dilution Factor, :Type ) ),
											Mode( Select( 1 ), Show( 1 ), Include( 1 ) )
										),
								V List Box(
									dataTables[i] << Fit Group(
										
										Graph Builder(
											Size( 300, 300 ),
											Show Control Panel( 0 ),
											Variables( 
												X( :Time point ), 
												Y( :"Mean(Value)"n ),
												Overlay( :Vessel )
											),
											Elements( Line( X, Y, Legend( 20 ) ) ),
											By( :Analyte )
										),
										<<{Arrange in Rows( 3 )}
									)
								)		
							)
						)
			)
		)
	);
	tb << set selected(1);
In JMP 17 the title highlighted with the red arrow is missing for each chart:
 PatB_0-1726766959113.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Set Title of Graph Builder Charts

As @jthi points out, the data filter is one source of the differences.  The way that Fit Group responds to the data filter has changed in JMP 18+.

 

Another big difference between JMP 17 and JMP 18 is the addition of the Group Platform for by-groups.  In JMP 18, this new platform has layout options similar to Fit Group.  In JMP 17 you could replace the Fit Group by a Line Up Box for the layout.  Combining the two together, this script works reasonably well for me in both:

dataTables = EvalList({
	Open("$SAMPLE_DATA/Big Class.jmp"),
	Open("$SAMPLE_DATA/Big Class Families.jmp")
});
newWindow = New Window("Reports", tb = Tab Box());
//loop through the dataTables and add tab page box for each with a local data filter for dilution factor on left, and line charts on the right
for( i = 1, i <= NItems(dataTables), i++,
	tb << Add(
		Tab Page Box(
					Title(dataTables[i] << get name),
					Data Filter Context Box(
						H List Box(
							dataTables[i] << Data Filter(
										Local,
										Add Filter( columns( :sex ) )
									),
							V List Box(
								 Line Up Box(NCol(3),		
									dataTables[i] << Graph Builder(
										Size( 300, 300 ),
										Show Control Panel( 0 ),
										Variables( 
											X( :height ), 
											Y( :weight )
										),
										Elements( Line( X, Y, Legend( 20 ) ) ),
										By( :age ),
										Group Options( Layout( "Arrange in Rows", N Across( 3 ) ) )
									)
								)
							)		
						)
					)
		)
	)
);
tb << set selected(1);

The layout between 17/18 will be different - in JMP 17 the LineUpBox is managing the grid, while in JMP 18 the Group Platform manages the layout, and all the LineUpBox only has 1 child.

 

Your other option might be to use the Wrap role in Graph Builder rather than using By, but that would give you shared axes and legend, which you may not want.

 

-Dan

 

 

 

View solution in original post

7 REPLIES 7
hogi
Level XII

Re: Set Title of Graph Builder Charts

To rule out strange settings in the preferences, could you please compare the output of:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

New Window( "test",
	dt << Fit Group(
										
		Graph Builder(
		Ignore Platform Preferences(1), // next step: disable this line
			Size( 300, 300 ),
			Show Control Panel( 0 ),
			Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
			Elements( Line( X, Y, ) ),
			By( :age )
		),
		<<{Arrange in Rows( 3 )}
	)
);


Next step: disable the line and check again.
If there is no issue with the sample data set we have to find the issue
a) in your data.
-> possible to share?

b) in the remaining part of the code ....
...

jthi
Super User

Re: Set Title of Graph Builder Charts

Your data filter is breaking it in JMP17

Names Default To Here( 1 );
dts = {};
Insert Into(dts, Open("$SAMPLE_DATA/Big Class.jmp"));
Insert Into(dts, Open("$SAMPLE_DATA/Big Class Families.jmp"));

nw = New Window("", tb = Tab Box());

For(i = 1, i <= N Items(dts), i++,
	tb << Add(
		Tab Page Box(Title(dts[i] << get name),
			Data Filter Context Box(
				H List Box(
					/*dts[i] << Data Filter(
						Local, 
						Add Filter(
							columns(:sex)), 
							Mode(Select(1), Show(1), Include(1))
					),*/
					V List Box(
						dts[i] << Fit Group(
							Graph Builder(
								Size(300, 300), 
								Show Control Panel(0), 
								Variables(X(:height), Y(:weight), Overlay(:sex)), 
								Elements(Line(X, Y, )), By(:age)
							),
							<<{Arrange in Rows(3)}
						)
					)
				)
			)
		)
	)
);

If you want to use << Fit Group (not really sure if it should be used as it's not meant for graph builder even though it works, you have few options: fix the titles after creation or create them in different manner.

 

This is most likely not very robust, but can give some idea of what you could do (using the values from column instead of relying on Where expression is most likely more robust option)

Names Default To Here( 1 );
dts = {};
Insert Into(dts, Open("$SAMPLE_DATA/Big Class.jmp"));
Insert Into(dts, Open("$SAMPLE_DATA/Big Class Families.jmp"));

nw = New Window("", tb = Tab Box());

For(i = 1, i <= N Items(dts), i++,
	tb << Add(
		Tab Page Box(Title(dts[i] << get name),
			Data Filter Context Box(
				H List Box(
					dts[i] << Data Filter(
						Local, 
						Add Filter(
							columns(:sex)), 
							Mode(Select(1), Show(1), Include(1))
					),
					V List Box(
						dts[i] << Fit Group(
							Graph Builder(
								Size(300, 300), 
								Show Control Panel(0), 
								Variables(X(:height), Y(:weight), Overlay(:sex)), 
								Elements(Line(X, Y, )), By(:age)
							),
							<<{Arrange in Rows(3)}
						)
					)
				)
			)
		)
	)
);

wait(0);

If(Word(1, JMP Version(), ".") == "17",
	gb_obs = nw << XPath("//OutlineBox[@helpKey = 'Graph Builder']");
	For Each({gb_ob}, gb_obs,
		gb = gb_ob << Get Scriptable Object;
		s = gb << get script;
		w = Extract Expr(s, Where(Wild List()));
		a = Substitute(Char(Arg(w, 1)), "==", "=");
		
		gb << Title("Graph Builder " || Substr(a, 2))
	);
);

Edit: The titles will break if data filter is used

-Jarmo
jthi
Super User

Re: Set Title of Graph Builder Charts

Might be easiest to use separate methods for different versions as how by columns work was changed in JMP18 and not all work with both

Names Default To Here( 1 );
dts = {};
Insert Into(dts, Open("$SAMPLE_DATA/Big Class.jmp"));
Insert Into(dts, Open("$SAMPLE_DATA/Big Class Families.jmp"));

nw = New Window("", tb = Tab Box());

For(i = 1, i <= N Items(dts), i++,
	tb << Add(
		Tab Page Box(Title(dts[i] << get name),
			Data Filter Context Box(
				H List Box(
					dts[i] << Data Filter(
						Local, 
						Add Filter(
							columns(:sex)), 
							Mode(Select(1), Show(1), Include(1))
					),
					If(Word(1, JMP Version(), ".") == "17",
						Lineup Box(N Col(3),
							gb = Graph Builder(
								Size(300, 300), 
								Show Control Panel(0), 
								Variables(X(:height), Y(:weight), Overlay(:sex)), 
								Elements(Line(X, Y, )), By(:age)
							)
						)
					,
						gb = Graph Builder(
							Size(300, 300), 
							Group Options(Layout("Arrange in Rows", N Across(3))),
							Show Control Panel(0), 
							Variables(X(:height), Y(:weight), Overlay(:sex)), 
							Elements(Line(X, Y, )), By(:age)
						)
					)
				)
			)
		)
	)
);

If you want your users to be able to change how many items are in each row, you can add outline box and script to that.

-Jarmo
PatB
Level II

Re: Set Title of Graph Builder Charts

Many thanks for this suggestion. I ended up using the Line Up Box for both JMP 17 and JMP 18

Re: Set Title of Graph Builder Charts

As @jthi points out, the data filter is one source of the differences.  The way that Fit Group responds to the data filter has changed in JMP 18+.

 

Another big difference between JMP 17 and JMP 18 is the addition of the Group Platform for by-groups.  In JMP 18, this new platform has layout options similar to Fit Group.  In JMP 17 you could replace the Fit Group by a Line Up Box for the layout.  Combining the two together, this script works reasonably well for me in both:

dataTables = EvalList({
	Open("$SAMPLE_DATA/Big Class.jmp"),
	Open("$SAMPLE_DATA/Big Class Families.jmp")
});
newWindow = New Window("Reports", tb = Tab Box());
//loop through the dataTables and add tab page box for each with a local data filter for dilution factor on left, and line charts on the right
for( i = 1, i <= NItems(dataTables), i++,
	tb << Add(
		Tab Page Box(
					Title(dataTables[i] << get name),
					Data Filter Context Box(
						H List Box(
							dataTables[i] << Data Filter(
										Local,
										Add Filter( columns( :sex ) )
									),
							V List Box(
								 Line Up Box(NCol(3),		
									dataTables[i] << Graph Builder(
										Size( 300, 300 ),
										Show Control Panel( 0 ),
										Variables( 
											X( :height ), 
											Y( :weight )
										),
										Elements( Line( X, Y, Legend( 20 ) ) ),
										By( :age ),
										Group Options( Layout( "Arrange in Rows", N Across( 3 ) ) )
									)
								)
							)		
						)
					)
		)
	)
);
tb << set selected(1);

The layout between 17/18 will be different - in JMP 17 the LineUpBox is managing the grid, while in JMP 18 the Group Platform manages the layout, and all the LineUpBox only has 1 child.

 

Your other option might be to use the Wrap role in Graph Builder rather than using By, but that would give you shared axes and legend, which you may not want.

 

-Dan

 

 

 

hogi
Level XII

Re: Set Title of Graph Builder Charts

Another option: let the colleague update to JMP18.1 and use the new page option which was introduced with JMP18

Bonus for him:
no issues anymore with  Find - or not find? 

hogi_0-1726773947401.png

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Graph Builder(
	Variables(
		X( :height ),
		Y( :weight ),
		Page( :age, Levels per Row( 3 ) ),
		Overlay( :sex )
	),
	Elements( Points( X, Y ), Smoother( X, Y ) )
);
PatB
Level II

Re: Set Title of Graph Builder Charts

Thank you for your help with this - it took a few days to get it tested in JMP 17 but it works fine.