cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar

interactive plots

Does anyone have any ideas on how to create interactive reports?

In the report, I want to include graphs with multiple lines in each graph. On the left side of the window, I would like to have a list of the lines. When I click on a line from the list, I want the selected line in the graph to be more prominent, while the remaining lines are faded out.

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: interactive plots

They seem to have changed it in JMP18. In JMP17.2 this seemed to work

Names Default To Here(1); 

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

gb_collector = Tab Box(<< Set Style("Horizontal Spread"));

For(i = 1, i <= 3, i++,
	tab = Tab Page Box("",
		gb = dt << Graph Builder(
			Variables(X(:weight), Y(:height), Overlay(:sex)),
			Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
		)
	);
	tab << Title("Title " || Char(i));
	gb << title(Char(i));
	gb_collector << Append(tab)
);

nw = New Window("",
	gb_collector
);
-Jarmo

View solution in original post

19 REPLIES 19
jthi
Super User

Re: interactive plots

Having legend on the left side can be a bit tricky but if right side is fine, basic graph builder should be enough

jthi_0-1724840120932.png

https://www.jmp.com/support/help/en/18.0/#page/jmp/graph-builder.shtml#

-Jarmo

Re: interactive plots

Hello! I have used a for loop to create multiple graphs using the graph builder. Now, I would like to group all these graphs onto a single sheet and create an interactive interface for users to interact with all the graphs together. Is there a way to achieve this? Thank you! 

Re: interactive plots

Its nice idea to use just the basic graph builder , i just want to put them all together one under the other after i create all of them. 

jthi
Super User

Re: interactive plots

I bit more information is needed. You could for example collect them into V List Box and then display using New Window

Names Default To Here(1); 

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

gb_collector = V List Box();

For(i = 1, i <= 3, i++,
	gb_collector << Append(
		dt << Graph Builder(
			Variables(X(:weight), Y(:height), Overlay(:sex)),
			Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
		)		
	)
);

nw = New Window("",
	gb_collector
);

If you are utilizing For loop I assume you are doing scripting. Have you read Scripting Guide (for example https://www.jmp.com/support/help/en/18.0/#page/jmp/examples-of-creating-a-dashboard-from-two-reports... ).

-Jarmo

Re: interactive plots

I would like to combine the tab page box method with the for loop, but it doesn't work. 
Here is my part of the script: 

 

New Window("My Dashboard",
	H Splitter Box(
		Size(1000, 1000), 
// Loop for each parameter
		For(i = 1, i <= N Items(numPar), i++, 
// Column boxes for plots of all batches, actual data, and difference
			col1 = Col Box(""),
			col2 = Col Box(""),
			col3 = Col Box(""), 


// Tab Page Box for each parameter
			Tab Page Box(
				Title(numPar[i] || " vs. Time Point"), 
// Create all batches plot
				gb = Graph Builder(
					Size(500, 500),
					Variables(X(:Time Point Months), Y(:Result), Overlay(:Batch)),
					Elements(Points(X, Y))
				), 
// Local filter: set the batch to only the batches that are in cyc with a ref, not all other batches
				gb << Local Data Filter(
					invisible,
					Add Filter(
						columns(:Component, :Batch, :Source Table),
						Where(:Component == numPar[i]),
						Where(:Batch == {cyc, bat}),
						Where(:Source Table == dt_name)
					)
				),
				dt << Clear Select(), 
// Remove the filter display from the graph
				gb << Show Control Panel(0), 
// Report for changing plot
				gbb = Report(gb)[GraphBuilderBox(1)], 
// Add linear regression
				gbb << Add Element(
					1,
					1,
					{Type("Line Of Fit"), X, Y, Confidence of Fit(0), Equation(0)}
				), 
// Set Y axis
				minval = Min(
					:Result[dt << get rows where(
						:Component == numPar[i] & :Batch == cyc & :Source Table == dt_name |
						:Batch == bat & :Component == numPar[i] & :Source Table == dt_name
					)]
				) * 0.95,
				maxval = Max(
					:Result[dt << get rows where(
						:Component == numPar[i] & :Batch == cyc & :Source Table == dt_name |
						:Batch == bat & :Component == numPar[i] & :Source Table == dt_name
					)]
				) * 1.05,
				maxvalts = Max(
					:Time Point Months[dt << get rows where(
						:Component == numPar[i] & :Batch == cyc & :Source Table == dt_name |
						:Batch == bat & :Component == numPar[i] & :Source Table == dt_name
					)]
				) * 1.05,
				gbb[AxisBox(1)] << Min(-0.1),
				gbb[AxisBox(1)] << Max(maxvalts),
				gbb[AxisBox(2)] << Min(minval),
				gbb[AxisBox(2)] << Max(maxval),
				gbb[AxisBox(2)] << inc((maxval - minval) / 10), 
// Set Y axis label
				unitList = Associative Array(
					:Result Unit[dt << get rows where(
						:Component == numPar[i] & :Batch == cyc & :Source Table == dt_name |
						:Batch == bat & :Component == numPar[i] & :Source Table == dt_name
					)]
				) << Remove("") << Get Keys,
				If(N Items(unitList) == 1,
					gbb[Text Edit Box(4)] << Set text(numPar[i] || " [" || unitList[1] || "]"),
					gbb[Text Edit Box(4)] << Set text(numPar[i])
				), 
// Set graph title
				gbb[Text Edit Box(1)] << Set text(numPar[i] || " vs. Time Point"), 
// Append
				gbba = Report(gb),
				col1 << Append(gbba),
				<<Moveable(1)
			)
		)
	),
	<<Dockable(1)
);

Edit 2024-09-05 jthi: added jsl formatting

jthi
Super User

Re: interactive plots

Names Default To Here(1); 

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

gb_collector = Tab Box(<< Set Style("Horizontal Spread"));

For(i = 1, i <= 3, i++,
	gb_collector << Add("Title",
		dt << Graph Builder(
			Variables(X(:weight), Y(:height), Overlay(:sex)),
			Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
		)		
	)
);

nw = New Window("",
	gb_collector
);
-Jarmo

Re: interactive plots

What jmp version you have? Does it work in your jmp? Because I don't have the expected output using the above script

jthi
Super User

Re: interactive plots

I don't know what is your expected output and I do not have your data. The script use Tab Box to collect results from for loop

jthi_0-1725533984930.png

 

-Jarmo

Re: interactive plots

I have this output when i run the above script . Its not the same as you