Reusing fonts, font styles and sizesIs there any way to reuse font styles?
Let's say I have many graphs and for each Axis Box I apply this:
Dispatch( {}, "X", ScaleBox, {Format( "Best", 12 ), Min( 0.5 ), Max( 0.6 ), Inc( 0.0005 ), Minor Ticks( 1 ), Label Row(
{Set Font( "Agency FB" ), Set Font Size( 8 )}
)} )Then I decide that size 8 is too small and now I have to go to each place I put it in and change it.
Any way to say something like:
myFontStyle = {Set Font( "Agency FB" ), Set Font Size( 8 )};and then just use:
Label Row(myFontStyle)
I suspect you could do that with Expression Evaluation somehow - but I just do not comprehend this whole deal with Expressions and evaluations. Any suggestions?
ScriptingRe: Reusing fonts, font styles and sizesInstead of using Dispatch it is often recommended to send messages to the scale boxes directly. You can search for them and then send a list of instructions to a list of objects to make all the changes at once. See this example:
names default to here(1);
dt = Open("$Sample_Data/Big Class.jmp");
gb = dt << Graph Builder(
Size( 321, 1012 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Page( :age ) ),
Elements( Points( X, Y, Legend( 22 ) ), Smoother( X, Y, Legend( 23 ) ) )
);
//use this to find charID:
gb << Get XML;
//Modify X Axes by first getting a list of scale boxes and then sending
//a list of messages to each.
(gb << XPath( "//ScaleBox[@charID='height']" )) << {
Format( "Best", 12 ),
Min( 50 ),
Max( 75 ),
Inc( 5 ),
Minor Ticks( 1 ),
Label Row( {
Set Font( "Agency FB" ),
Set Font Size( 8 )
} )
};
//Modify Y Axes:
(gb << XPath( "//ScaleBox[@charID='weight']" )) << {
Format( "Best", 12 ),
Min( 50 ),
Max( 150 ),
Inc( 25 ),
Minor Ticks( 1 ),
Label Row( {
Set Font( "Agency FB" ),
Set Font Size( 8 )
} )
};