Subscribe Bookmark RSS Feed

Set axis font size outside Graph builder script

Eduardo

Occasional Contributor

Joined:

Aug 5, 2017

Hello all,

I've been searching for this one...including the scripting index under help. I would like to change the font size  of my x-axis using a code line outside the graph builder script. Please see below. I tried the line 

Report(graph)[Axis Box( 1 )] << Axis Settings({Set Font Size(14)}) but this line does not work of course. I know how to change the font size within the script of graph builder, but how to do it via a code line outside so that at any time I can change the font size of my x-axis? Thanks for any help! I'm using JMP 12.

 

graph=Graph Builder(

Size( 1836, 599 ),
Show Control Panel( 0 ),
Legend Position( "Bottom" ),
Variables(
X( :marker ),
Y( :Name( "uma" ) ),
Y( :Name( "ina" ), Position( 1 ) )
),
Elements( Bar( X, Y( 1 ), Y( 2 ), Legend( 3 ) ) ),
SendToReport(
Dispatch(
{},
"marker",
ScaleBox,
{Label Row( {Show Major Grid( 1 ), Set Font Size( 6)} )} //this way I know but I want to do it from outside
),
Dispatch(
{},
"uma",
ScaleBox,
{Add Ref Line( -4, "Dotted", "Black", "", 1 ),
Add Ref Line( 4, "Dotted", "Black", "", 1 )}
)
)
);
 
Report(graph)[Axis Box( 1 )] << Axis Settings({Set Font Size(14)});

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

You need to pass your request to the Axis Box();

graph = Graph Builder(
	Size( 1836, 599 ),
	Show Control Panel( 0 ),
	Legend Position( "Bottom" ),
	Variables( X( :marker ), Y( :Name( "uma" ) ), Y( :Name( "ina" ), Position( 1 ) ) ),
	Elements( Bar( X, Y( 1 ), Y( 2 ), Legend( 3 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"marker",
			ScaleBox,
			{Label Row( {Show Major Grid( 1 ), Set Font Size( 6 )} )} //this way I know but I want to do it from outside
		),
		Dispatch(
			{},
			"uma",
			ScaleBox,
			{Add Ref Line( -4, "Dotted", "Black", "", 1 ),
			Add Ref Line( 4, "Dotted", "Black", "", 1 )}
		)
	)
);
 
report(graph)[axis box(1)]<<label row(set font size(14));
Jim
2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

You need to pass your request to the Axis Box();

graph = Graph Builder(
	Size( 1836, 599 ),
	Show Control Panel( 0 ),
	Legend Position( "Bottom" ),
	Variables( X( :marker ), Y( :Name( "uma" ) ), Y( :Name( "ina" ), Position( 1 ) ) ),
	Elements( Bar( X, Y( 1 ), Y( 2 ), Legend( 3 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"marker",
			ScaleBox,
			{Label Row( {Show Major Grid( 1 ), Set Font Size( 6 )} )} //this way I know but I want to do it from outside
		),
		Dispatch(
			{},
			"uma",
			ScaleBox,
			{Add Ref Line( -4, "Dotted", "Black", "", 1 ),
			Add Ref Line( 4, "Dotted", "Black", "", 1 )}
		)
	)
);
 
report(graph)[axis box(1)]<<label row(set font size(14));
Jim
Eduardo

Occasional Contributor

Joined:

Aug 5, 2017

Thanks a lot Jim, it worked! Just one note for the forum: the script of the graph builder should have the automatic font size set to zero (see below).

 

graph=Graph Builder(
Size( 1836, 599 ),
Show Control Panel( 0 ),
Legend Position( "Bottom" ),
Variables(
X( :marker ),
Y( :Name( "uma" ) ),
Y( :Name( "ina" ), Position( 1 ) )
),
Elements( Bar( X, Y( 1 ), Y( 2 ), Legend( 3 ) ) ),
SendToReport(
Dispatch(
{},
"marker",
ScaleBox,
{Label Row(
{Automatic Font Size( 0 ), Show Major Grid( 1 ), Set Font Size( 6 )}//THIS SETS AUTOMATIC FONT SIZE TO ZERO!!
)}
),
Dispatch(
{},
"uma",
ScaleBox,
{Add Ref Line( -4, "Dotted", "Black", "", 1 ),
Add Ref Line( 4, "Dotted", "Black", "", 1 )}
)
)
);

report(graph)[axis box(1)]<<label row(set font size(14));