cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Clanlope
Level III

[Graph Builder] Element property setting not saved on the JSL

Dear all,

I would like to create a graph with multi Y with both left and right, and I want to set transparent to the bars on the left side only

this JSL works but once I manually modified the graph and then click save as script, the transparent setting is gone. is anybody aware why and how to achieve this? thanks!

df = Current Data Table();
cols = df << Get Column Names( String );

gb = Graph Builder( Size( 764, 644 ), Variables( X( :time), ) );
gbb = Report( gb )[Graph Builder Box( 1 )];
cnt = 0;
For Each( {val, ind}, cols,
	If( ind == 1, Continue() );
	If( Mod( ind, 2 ) == 0,
		pat = val
	);
	If( Mod( ind, 2 ) == 1 & Left( pat, 6 ) == Left( val, 6 ), // data like GROUP1_val GROUP1_
		cnt += 1;
		gbb << Add Variable( Expr( {As Column( pat ), Role( "Y" ), Side( "Right" )} ) );
		gbb << Add Variable( Expr( {As Column( val ), Role( "Y" ), Position( cnt )} ) );
		gbb << Update Element( 1, cnt, 2, {Bar( X, Y )} );
		gbb << Update Element( 1, cnt, 1, {Bar( X, Y ), Label( "Label by Value" )} );
	);
);

For( i = 1, i <= cnt, i++,
(Report( gb )[FrameBox( i )] << Find Seg( "Bar Seg" )) << Transparency(0);
);
3 REPLIES 3
jthi
Super User

Re: [Graph Builder] Element property setting not saved on the JSL

Can you provide example table and/or the script which you get when you copy the script from graph builder? Also which JMP version are you using?

-Jarmo
Clanlope
Level III

Re: [Graph Builder] Element property setting not saved on the JSL

Hi jthi,

my version is JMP16, and I found a solution by using this code below:

but I am still wondering if there is a guideline for graph builder elements like gb << xpath( "//AxisBox" )?

because I need customize the elements on the graph by JSL but failed most of time.

server = gb << Get Legend Server;
items = server << Get Legend Items;
For Each( {val, ind}, items,
	tp = val[1] << Get Type();
   if (tp == "Bar",
        val << Set Properties( {Transparency( 0 )} );  // here if type is Bar set transparency
))

I am not able to upload so the example data can be :

time ID1_val ID1_cnt ID2_val ID2_cnt

my code purpose is to create a X-Y plot with which X is time, left-Y is val and right-Y is cnt

 

jthi
Super User

Re: [Graph Builder] Element property setting not saved on the JSL

What type of guideline are you looking for? XPath isn't JMP specific thing and you can see the underlaying XML of JMP report using << Get XML message

Names Default To Here(1); 

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

gb = dt << Graph Builder(
	Variables(X(:weight), Y(:height), Overlay(:sex)),
	Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
);


Write(Report(gb) << Get XML);
-Jarmo

Recommended Articles