重用字体,字体样式和大小有什么办法可以重用字体样式吗?
假设我有很多图,对于每个“轴箱”,我都应用以下方法:
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 )}
)} )然后,我决定8号尺寸太小,现在我必须到放置它的每个位置进行更改。
可以这样说:
myFontStyle = {Set Font( "Agency FB" ), Set Font Size( 8 )};然后只需使用:
Label Row(myFontStyle)
我怀疑您可以通过某种方式使用表达式评估来做到这一点-但我只是不理解整个有关表达式和评估的内容。 有什么建议?
脚本编写回复:重用字体,字体样式和大小通常建议不要直接使用消息来发送消息到秤盒,而不要使用“调度”。您可以搜索它们,然后将指令列表发送到对象列表以一次进行所有更改。请参阅以下示例:
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 )
} )
};