BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
helmon
Occasional Contributor

Graph builder - script speculations and labeling

Hi!

1)

I have data with one column that has two different names (depending on which data I am using).
It is either called "Storage condition" or "Temperature".
I made a graph with graph builder and saved the script, but I would like to use the same script for every database I am using.
I tried to add | to the script - but it doesn´t seem to work.
Any ideas?

 

Graph Builder(
	Variables(
		X( :Sample name ),
		Y( :Name( "main peak (%)" ) ),
		Y( :Name( "aggregate (%)" ), Position( 1 ) ),
		Y( :Name( "degradation (%)" ), Position( 1 ) ),
		Group X( :Storage condition | :Temperature, N View Levels( 1 ), First View Level( 3 ) ),
		Group Y( :Time point, N View Levels( 1 ), First View Level( 4 ) )
	),
	Elements(
		Bar(
			X,
			Y( 1 ),
			Y( 2 ),
			Y( 3 ),
			Legend( 14 ),
			Bar Style( "Stacked" ),
			Label( "Label by Value" )
		)
	),
	SendToReport(
		Dispatch(
			{},
			"main peak (%)",
			ScaleBox,
			{Min( 90 ), Max( 101 ), Inc( 1 ), Minor Ticks( 1 )}
		),
		Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ),
		Dispatch( {}, "X title", TextEditBox, {Set Text( "" )} ),
		Dispatch(
			{},
			"Y title",
			TextEditBox,
			{Set Text( "Relative peak area (%)" )}
		)
	)
)

2) 

I have a stacked bar and I added lable by value.

However, when I change the scale (Y-axis), the lower value is not shown (but it is shown when the scale hasn´t been changed).

Can I somehow have the Y-axis scale from 95-100 and yet see both values?

 

Skýring 2019-07-02 103617.png

 

Thanks! :) 

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Graph builder - script speculations and labeling

My error.....I did not change the column it was getting the conditional check from....try this code

 

names default to here(1);
dt=current data table();

If(try(dt:Storage condition<<get name)=="Storage condition", theName = "Storage condition", 
	theName = "Temperature" );

Graph Builder(
	Variables(
		X( :Sample name ),
		Y( :Name( "main peak (%)" ) ),
		Y( :Name( "aggregate (%)" ), Position( 1 ) ),
		Y( :Name( "degradation (%)" ), Position( 1 ) ),
		Group X( as column( theName ), N View Levels( 1 ), First View Level( 3 ) ),
		Group Y( :Time point, N View Levels( 1 ), First View Level( 4 ) )
	),
	Elements(
		Bar(
			X,
			Y( 1 ),
			Y( 2 ),
			Y( 3 ),
			Legend( 14 ),
			Bar Style( "Stacked" ),
			Label( "Label by Value" )
		)
	),
	SendToReport(
		Dispatch(
			{},
			"main peak (%)",
			ScaleBox,
			{Min( 90 ), Max( 101 ), Inc( 1 ), Minor Ticks( 1 )}
		),
		Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ),
		Dispatch( {}, "X title", TextEditBox, {Set Text( "" )} ),
		Dispatch(
			{},
			"Y title",
			TextEditBox,
			{Set Text( "Relative peak area (%)" )}
		)
	)
)

 

 

Jim
7 REPLIES 7
Highlighted
txnelson
Super User

Re: Graph builder - script speculations and labeling

All that needs to be done, is to determine which column has been extracted, and then specify it in the script.  Here is my modification of your script:

names default to here(1);
dt=current data table();

If(try(dt:sex<<get name)=="Storage condition", theName = "Storage condition", 
	theName = "Temperature" );

Graph Builder(
	Variables(
		X( :Sample name ),
		Y( :Name( "main peak (%)" ) ),
		Y( :Name( "aggregate (%)" ), Position( 1 ) ),
		Y( :Name( "degradation (%)" ), Position( 1 ) ),
		Group X( as column( theName ), N View Levels( 1 ), First View Level( 3 ) ),
		Group Y( :Time point, N View Levels( 1 ), First View Level( 4 ) )
	),
	Elements(
		Bar(
			X,
			Y( 1 ),
			Y( 2 ),
			Y( 3 ),
			Legend( 14 ),
			Bar Style( "Stacked" ),
			Label( "Label by Value" )
		)
	),
	SendToReport(
		Dispatch(
			{},
			"main peak (%)",
			ScaleBox,
			{Min( 90 ), Max( 101 ), Inc( 1 ), Minor Ticks( 1 )}
		),
		Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ),
		Dispatch( {}, "X title", TextEditBox, {Set Text( "" )} ),
		Dispatch(
			{},
			"Y title",
			TextEditBox,
			{Set Text( "Relative peak area (%)" )}
		)
	)
)

Concerning the stacked bar issue, I suggest you contact JMP Support

     support@jmp.com

Jim
helmon
Occasional Contributor

Re: Graph builder - script speculations and labeling

Hello, 

Thank you for this, but it only seems to work when I have "Storage condition" but not "Temperature".

Should I always change the script depending if I have "Storage condition" or "Temperature"? Or can I have in the script "Storage condition" OR "Temperature"?

Thanks!

 

 

0 Kudos
txnelson
Super User

Re: Graph builder - script speculations and labeling

When you run the script on a data table that has the Temperature column, what error is specified in the JMP Log?  

Jim
0 Kudos
helmon
Occasional Contributor

Re: Graph builder - script speculations and labeling

I´m sorry, I meant the other way around - it works with Temp but not Storage Cond

0 Kudos
txnelson
Super User

Re: Graph builder - script speculations and labeling

My error.....I did not change the column it was getting the conditional check from....try this code

 

names default to here(1);
dt=current data table();

If(try(dt:Storage condition<<get name)=="Storage condition", theName = "Storage condition", 
	theName = "Temperature" );

Graph Builder(
	Variables(
		X( :Sample name ),
		Y( :Name( "main peak (%)" ) ),
		Y( :Name( "aggregate (%)" ), Position( 1 ) ),
		Y( :Name( "degradation (%)" ), Position( 1 ) ),
		Group X( as column( theName ), N View Levels( 1 ), First View Level( 3 ) ),
		Group Y( :Time point, N View Levels( 1 ), First View Level( 4 ) )
	),
	Elements(
		Bar(
			X,
			Y( 1 ),
			Y( 2 ),
			Y( 3 ),
			Legend( 14 ),
			Bar Style( "Stacked" ),
			Label( "Label by Value" )
		)
	),
	SendToReport(
		Dispatch(
			{},
			"main peak (%)",
			ScaleBox,
			{Min( 90 ), Max( 101 ), Inc( 1 ), Minor Ticks( 1 )}
		),
		Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ),
		Dispatch( {}, "X title", TextEditBox, {Set Text( "" )} ),
		Dispatch(
			{},
			"Y title",
			TextEditBox,
			{Set Text( "Relative peak area (%)" )}
		)
	)
)

 

 

Jim
helmon
Occasional Contributor

Re: Graph builder - script speculations and labeling

This works! Thank you Jim :)
0 Kudos
txnelson
Super User

Re: Graph builder - script speculations and labeling

Now, your new task is to not just run the script, but you need to make sure you understand the script.
Jim
0 Kudos