JSL > 圖形生成器 > 圖形腳本 >文本背景顏色和透明度?嗨 JMP 社區,
我正在嘗試通過圖形腳本(見下文)為動態添加的文本分配背景顏色和透明度,但我一直無法找到正確的方法。 此外,我希望將文本及其背景作為 GB 圖中的頂層,以淡化與文本重疊的任何繪圖元素。
正如您在之前的帖子中看到的那樣,我認為在文本後面繪製一個矩形多邊形就可以解決問題,但繪圖元素繪製在多邊形之上,這使得練習徒勞無功。
這是圖形腳本的一次迭代的示例:
Fill Color( "blue" );
Transparency( 0.6 );
Polygon( {-1, 5.5}, {-1, 4.45}, {4.5, 4.45}, {4.5, 5.5} );
Transparency( 1 );
Text Size( 14 );
Text Color( "black" );
Text( right Justified, {4, 5.15}, "r: 0.0072" );
Text Color( "black" );
Text( right Justified, {4, 4.8}, "BH p: 0.9194" );考慮到我可能需要採取完全不同的方法,非常感謝您的所有反饋。
最好的,
TS
圖形腳本回复:JSL > Graph Builder > Graphic script >文本背景顏色和透明度?在框架框完成渲染圖形生成器元素(例如點和線)後評估圖形腳本。 因此,附加圖形元素按順序繪製在原始內容之上。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
Size( 534, 454 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :height ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
);
Report( gb )[FrameBox(1)] << Add Graphics Script(
Fill Color( 33 );
// Transparency( 0.2 );
Rect( 63, 105, 67, 97, 1 );
// Transparency( 1 );
Text Color( "Red" );
Text( Center Justified, {65, 100}, "Centered" );
);
我使用淺灰色而不是改變透明度作為另一種顯示帶有背景的文本的方式。 我解釋了您想要隱藏原始渲染的任何部分而不是部分遮罩的請求。
回复:JSL > Graph Builder > Graphic script >文本背景顏色和透明度?使用 Add Graphics Script 消息上的 Position 元素,可以明確設置圖形元素將在圖形上顯示的順序。下面是 2 個 Graph Builder 圖,唯一改變的是將 Add Graphics Script 位置從 6 反轉為 5,然後反轉為 5 到 6。

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
gb = Graph Builder(
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 6 ) ), Smoother( X, Y, Legend( 7 ) ) ),
show control panel( 0 )
);
Report( gb )[axisbox( 1 )] << Min( 25 );
fgb = Report( gb )[framebox( 1 )];
fgb << Add Graphics Script(
6,
Description( "" ),
Text Color( "black" );
Text( right Justified, {45, 60}, "r: 0.0072" );
);
fgb << Add Graphics Script(
5,
Description( "" ),
Fill Color( "red" );
Transparency( .5 );
Polygon( [10 30 90], [88 22 44] );
);
gb = Graph Builder(
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 6 ) ), Smoother( X, Y, Legend( 7 ) ) ),
show control panel( 0 )
);
Report( gb )[axisbox( 1 )] << Min( 25 );
fgb = Report( gb )[framebox( 1 )];
fgb << Add Graphics Script(
5,
Description( "" ),
Text Color( "black" );
Text( right Justified, {45, 60}, "r: 0.0072" );
);
fgb << Add Graphics Script(
8,
Description( "" ),
Fill Color( "red" );
Transparency( .5 );
Polygon( [10 30 90], [88 22 44] );
);