cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
adam
Level IV

Grid line on Graph builder

Hi All

 

I have the following portion of a user input script. The script actually work well. The problem come from when I tried to add in grid line to the plot with jsl, that portion does not seems to work. I tried to replace X1 with x1col, Y1 with y1col(and so on) but does not seems to work too. When I hover the mouse to for example, X1, it is showing the correct column. I knew that I can just drag and drop but as I'm working on large data set and generating plots, it's good that I have them automated. Please advise how can I overcome this problem.

 

x1col = Column(dt, X1);
y1col = Column(dt, Y1);
y2col = Column(dt, Y2);
y3col = Column(dt, Y3);
y4col = Column(dt, Y4);
	
Graph Builder(
   
    Variables(X(Column(dt, X1)), Y(Column(dt, Y1)), Y(Column(dt, Y2)),Y(Column(dt, Y3)),Y(Column(dt, Y4)),
	
	 Group X( :Title )
    
    ),
    Elements( Position( 1, 1 ), Line( X, Y )),
	Elements( Position( 1, 2 ), Line( X, Y )),
	Elements( Position( 1, 3 ), Line( X, Y )),
	Elements( Position( 1, 4 ), 
		//Bar( X, Y, Legend( 36 ), Summary Statistic( "N" ) )
    Bar( X, Y, Summary Statistic( "N" ))),
   
   SendToReport(
		Dispatch(
			{},
			X1,
			ScaleBox,
			{Label Row( Label Orientation( "Vertical" ) )}
		),
		Dispatch( {}, :Y1, ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
		Dispatch(
			//{},
			Y2,
			ScaleBox,
			{Label Row( Show Major Grid( 1 ) )}
		),
		Dispatch( {}, Y3, ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
		Dispatch( {}, Y4, ScaleBox, {Label Row( Show Major Grid( 1 ) )} )
		) 
    
    ),

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
gzmorgan0
Super User (Alumni)

Re: Grid line on Graph builder

The GraphBuilder Scale Box Dispatch statement wants the column name.  A simple method to do that is to use

colref << getname.

 

Here is a slight modification of the script you provided using the JMP sample data table Candy Bars.jmp

Names Default to Here(1);
//Open the JMP Sample Data table Candy Bars, create a 4x2 display 
dt = Open("$Sample_Data/Candy Bars.jmp");

dt << select where(!Contains({"M&M/Mars","Hershey"}, :Brand) );
dt << delete rows();
:Brand << set name("Title");


x1col = Column(dt, "Carbohydrate g");
y1col = Column(dt, "Sugars g");
y2col = Column(dt, "Total fat g");
y3col = Column(dt, "Saturated fat g");
y4col = Column(dt, "Protein g");


candy_gb1 = dt << Graph Builder( 
  Variables(
     X(x1col), Y(y1col), Y(y2col),Y(y3col),Y(y4col),
	 Group X( :Title )
   ),
    Elements( Position( 1, 1 ), Line( X, Y ) ),
	Elements( Position( 1, 2 ), Line( X, Y ) ),
	Elements( Position( 1, 3 ), Line( X, Y ) ),
	Elements( Position( 1, 4 ), 
		//Bar( X, Y, Legend( 36 ), Summary Statistic( "N" ) )
    Bar( X, Y, Summary Statistic( "N" )) ),
	SendToReport(
		Dispatch(
			{},
			x1col<<getname,
			ScaleBox,
			{Label Row( Label Orientation( "Vertical" ) )}
		),
		Dispatch( {}, y1col<<getname, ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
		Dispatch( {}, y2col<<getname, ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
		Dispatch(
			{},
			y3col<<getname,
			ScaleBox,
			{Label Row( Show Major Grid( 1 ) )}
		),
		Dispatch( {}, y4col<<getname, ScaleBox, {Label Row( Show Major Grid( 1 ) )} )
	)
);

image.png

View solution in original post

2 REPLIES 2
gzmorgan0
Super User (Alumni)

Re: Grid line on Graph builder

The GraphBuilder Scale Box Dispatch statement wants the column name.  A simple method to do that is to use

colref << getname.

 

Here is a slight modification of the script you provided using the JMP sample data table Candy Bars.jmp

Names Default to Here(1);
//Open the JMP Sample Data table Candy Bars, create a 4x2 display 
dt = Open("$Sample_Data/Candy Bars.jmp");

dt << select where(!Contains({"M&M/Mars","Hershey"}, :Brand) );
dt << delete rows();
:Brand << set name("Title");


x1col = Column(dt, "Carbohydrate g");
y1col = Column(dt, "Sugars g");
y2col = Column(dt, "Total fat g");
y3col = Column(dt, "Saturated fat g");
y4col = Column(dt, "Protein g");


candy_gb1 = dt << Graph Builder( 
  Variables(
     X(x1col), Y(y1col), Y(y2col),Y(y3col),Y(y4col),
	 Group X( :Title )
   ),
    Elements( Position( 1, 1 ), Line( X, Y ) ),
	Elements( Position( 1, 2 ), Line( X, Y ) ),
	Elements( Position( 1, 3 ), Line( X, Y ) ),
	Elements( Position( 1, 4 ), 
		//Bar( X, Y, Legend( 36 ), Summary Statistic( "N" ) )
    Bar( X, Y, Summary Statistic( "N" )) ),
	SendToReport(
		Dispatch(
			{},
			x1col<<getname,
			ScaleBox,
			{Label Row( Label Orientation( "Vertical" ) )}
		),
		Dispatch( {}, y1col<<getname, ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
		Dispatch( {}, y2col<<getname, ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
		Dispatch(
			{},
			y3col<<getname,
			ScaleBox,
			{Label Row( Show Major Grid( 1 ) )}
		),
		Dispatch( {}, y4col<<getname, ScaleBox, {Label Row( Show Major Grid( 1 ) )} )
	)
);

image.png

adam
Level IV

Re: Grid line on Graph builder

Thank you gzmorgan0, it works perfectly !!