重用字體,字體樣式和大小有什麼辦法可以重用字體樣式嗎?
假設我有很多圖,對於每個“軸箱”,我都應用以下方法:
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 )
} )
};