cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
ENTHU
Level IV

plotting multiple graphs from a large data table

Hi,

 

I have a data table in which I track rise in measurement for different devices in different weeks and every day in current week.This table is dynamic and can have 30-40 products in some weeks.I need to plot rise trend and no of measurements in a graph.If I plot all devices the graph becomes clumsy.So I create a column device_number and would like to plot 5 devices in one graph.At the end I want to combine all grpahs into one page.I manually selected 4 devices and generated the following script to plot the graph.But how do I extend this as per my requirement.

Looking for ideas to make this work on tables that change dynamically.

DeviceDateMeas_RiseNo_of_MeasurementsDevice_Number
MOSFETWeek1100.00%21
MOSFETWeek298.53%41
MOSFETWeek399.78%41
MOSFETWeek4.0100.00%41
MOSFETWeek4.1100.00%41
MOSFETWeek4.2100.00%41
DiodeWeek192.96%82
DiodeWeek241.01%82
DiodeWeek377.07%62
DiodeWeek4.00.00%62
DiodeWeek4.10.00%62
DiodeWeek4.20.00%62
BJTWeek137.63%63
BJTWeek255.81%43
BJTWeek373.78%43
BJTWeek4.040.95%43
BJTWeek4.121.96%43
BJTWeek4.274.91%43
OpampWeek1100.00%24
OpampWeek2100.00%24
OpampWeek3100.00%24
OpampWeek4.0100.00%24
OpampWeek4.1100.00%24
OpampWeek4.2100.00%24
Add Properties to Table(
	{New Script(
		"Option C",
		Graph Builder(
			Size( 534, 448 ),
			Show Control Panel( 0 ),
			Variables(
				X( :Date ),
				Y( :Meas_Rise ),
				Y( :No_0f_Measurements ),
				Overlay( :Device )
			),
			Elements(
				Position( 1, 1 ),
				Points( X, Y, Legend( 6 ) ),
				Line( X, Y, Legend( 10 ) )
			),
			Elements(
				Position( 1, 2 ),
				Bar(
					X,
					Y,
					Legend( 20 ),
					Bar Style( "Stacked" ),
					Label( "Label by Value" )
				)
			),
			SendToReport(
				Dispatch(
					{},
					"400",
					ScaleBox,
					{Legend Model(
						6,
						Base( 0, 0, 0, Item ID( "MOSFET", 1 ) ),
						Base( 1, 0, 0, Item ID( "Diode", 1 ) ),
						Base( 2, 0, 0, Item ID( "BJT", 1 ) ),
						Base( 3, 0, 0, Item ID( "Opamp", 1 ) )
					)}
				)
			)
		)
	)}
)
2 REPLIES 2
txnelson
Super User

Re: plotting multiple graphs from a large data table

Here is one approach to solve your problem.  It loops through your data, 4 devices at a time, generating a chart and then moving the graph to a JMP Journal window, and then moving on to the next 4 devices.  I have attached a sample data table that I used for the development.  Please note, that the first 4 devices and the second 4 devices generate the same look of the graph, since all of the data are the same, except for the device names.

multiple.PNG

The script is not real robust.  It assumes that there are multiples of 4 devices, all graphs are to be output in a single column down the output page, etc.  I am providing the JSL as a starting place for a possible solution, not the final, robust piece of code it probably should be

Add Properties to Table(
	{New Script(
		"Option C",
		dt = Current Data Table();
		
		// JMP changed the way Row Order Levels works in JMP 15, so 2 different
		// methods to set the option has to be handled
		If( Num( Word( 1, JMP Version(), "." ) ) >= 15,
			dt:Device << set Property( "Value Order", {Row Order Levels( 1 )} );
			dt:Device << set Property( "Row Order Levels", 1 );
		);
		
		// Get a list of the DeviceNames found in the order they exist in the
		// data table
		Summarize( dt, DeviceNames = By( dt:Device ) );
		
		// Create a window to save all of the graphs to
		nw = New Window( "Output", <<journal );
		
		// Loop across all of the Devices, 4 at a time to build the graph
		For( i = 1, i <= N Items( DeviceNames ), i = i + 4,
			
			// Get a list of the current 4 devices
			DeviceList = {};
			For( k = i, k <= i + 3, k++,
				Insert Into( DeviceList, DeviceNames[k] )
			);
			
			// Select the rows where the current 4 devices are found
			dt << select where( Contains( DeviceList, :Device ) );
		
			// Create a subset of the data with only the 4 current devices in it
			dtSub = dt << Subset( invisible, Selected Rows( 1 ), Selected columns only( 0 ) );
			
			// Wait for the new data table to be completed before processing
			wait(0);
			
			// Run the Graph Code, substituting in the new device's names where required
			Eval(
				Substitute(
						Expr(
							gb = dtSub << Graph Builder(invisible,
								Size( 534, 448 ),
								Show Control Panel( 0 ),
								Variables(
									X( :Date ),
									Y( :Meas_Rise ),
									Y( :Name( "No_of_Measurements" ) ),
									Overlay( :Device )
								),
								Elements(
									Position( 1, 1 ),
									Points( X, Y, Legend( 6 ) ),
									Line( X, Y, Legend( 10 ) )
								),
								Elements(
									Position( 1, 2 ),
									Bar(
										X,
										Y,
										Legend( 20 ),
										Bar Style( "Stacked" ),
										Label( "Label by Value" )
									)
								),
								SendToReport(
									Dispatch(
										{},
										"400",
										ScaleBox,
										{Legend Model(
											6,
											Base( 0, 0, 0, Item ID( __dev1__, 1 ) ),
											Base( 1, 0, 0, Item ID( __dev2__, 1 ) ),
											Base( 2, 0, 0, Item ID( __dev3__, 1 ) ),
											Base( 3, 0, 0, Item ID( __dev4__, 1 ) )
										)}
									)
								)
							)
						),
					Expr( __dev1__ ), DeviceList[1],
					Expr( __dev2__ ), DeviceList[2],
					Expr( __dev3__ ), DeviceList[3],
					Expr( __dev4__ ), DeviceList[4]
				)
			);
			
			// Add the output from the graph to the output window
			nw << append( Report( gb ) );
			
			// Cleanup the current working items to get ready for the next 4 devices
			report(gb) << delete;
			Close( dtSub, nosave );
		);
	)}
)


Jim
ENTHU
Level IV

Re: plotting multiple graphs from a large data table

I'm using JMP 12 and summarize function sorts column values alphabetically.

Is there a clean way to get column values w/o aplhabetizing?I checked other posts but could not find a good way to do this.