文字註解大小和文字位置控制:需要幫助全部,
我需要在圖表上添加幾個文字註釋。
它們都是單行文本,但長度不同。所以我需要使用固定大小(0)來調整標籤長度以匹配文字。
但這樣做之後,它還會調整垂直方向的文字大小,把文字放得太高,這讓我非常困擾(左圖)。如果我設定“固定大小(1)”,就可以直接控制標籤的大小,文字位置看起來也還可以(右圖),但是我的文字長度不一致,要么標籤太長,要么文字超出標籤大小時,就會自動調整為“固定大小(0)”,看起來非常難看。


有沒有辦法調整標籤內文字的位置並使用固定大小(0)?
<< Vertical Alignment("bottom") 不起作用。
以下是代碼:
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = bivariate( y( :weight ), x( :height ) );
rbiv = biv << report;
taHeight = 20;
ta1 = rbiv << Add Text Annotation();
ta2 = rbiv << Add Text Annotation();
ta1 << Text( "We need to discuss this at the next meeting." );
ta1 << Text Box( {70, 80, 350, 80+taHeight} );
ta2 << Text( "We need to discuss this at the next " );
ta2 << Text Box( {70, 120, 350, 120+taHeight} );
{ta1, ta2} << Background Color( "Light Yellow" ) << Text Color( "red" )/*<
<SET wrap=""></SET>
<BR /> <BR />
<LINGO-LABS id="lingo-labs-913210" slang="en-US" mode="CREATE">
<LINGO-LABEL>自動化和腳本編寫</LINGO-LABEL>
</LINGO-LABS>
回覆:文字註解大小和文字位置控制:需要幫助我不確定在文字註釋中是否可以控制這一點,除非你自己計算文字方塊的大小。
您能否考慮使用圖形腳本?
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
biv = dt << bivariate(y(:weight), x(:height));
rbiv = biv << report;
fb = rbiv[FrameBox(1)];
fb << Add Graphics Script(
Back Color("Light Yellow");
Text Color("Red");
Text(Erased, {50, 150}, "We need to discuss this at the next meeting.");
Text(Erased, {50, 135}, "We need to discuss this at the next");
);
回覆:文字註解大小和文字位置控制:需要幫助新增圖形腳本的問題在於,文字位置是以圖表上的實際座標指定的。在我的情況下,這個座標可以是任意值,從 1e-07 到超過 9000 不等 
我可能對編寫一個函數來計算我想要的位置值感興趣,但前提是我能像第一個例子那樣為文字添加邊框。圖表可能比較複雜,我需要將其在視覺上分隔開來,以便快速閱讀和處理。
回覆:文字註解大小和文字位置控制:需要幫助我有個主意。
如果我先用固定大小(0)繪製文字註釋,測量長度,然後將其變更為固定大小(1),並手動設定測量的寬度和所需的高度,會怎麼樣?
問題是,<< Get Size() 回傳了一些錯誤值:
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = bivariate( y( :weight ), x( :height ) );
rbiv = biv << report;
taHeight = 40;
ta1 = rbiv << Add Text Annotation();
ta2 = rbiv << Add Text Annotation();
ta1 << Text( "We need to discuss this at the next meeting." );
ta1 << Text Box( {70, 80, 350, 80+taHeight} );
ta2 << Text( "We need to discuss this at the next " );
ta2 << Text Box( {70, 120, 350, 120+taHeight} );
{ta1, ta2} << Background Color( "Light Yellow" ) << Text Color( "red" )/*<
<SET wrap=""></SET>
<P>它產生:</P> //:*/
Show(ta1_x, ta2_x);
/*:
ta1_x = 328;
ta2_x = 328;
儘管圖表上的標籤長度明顯不同,但我是否漏掉了什麼?
回覆:文字註解大小和文字位置控制:需要幫助嘗試使用 < <>
回覆:文字註解大小和文字位置控制:需要幫助您也可以嘗試在新視窗中使用文字方塊進行尺寸檢查。
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = bivariate( y( :weight ), x( :height ) );
rbiv = biv << report;
taHeight = 20;
ta1 = rbiv << Add Text Annotation();
ta2 = rbiv << Add Text Annotation();
nw = new window("", << Window View("Invisible"),
tb1 = Text Box("We need to discuss this at the next meeting."),
tb2 = Text Box("We need to discuss this at the next ")
);
w1 = tb1 << Get Size;
w2 = tb2 << Get Size;
nw << close window;
ta1 << Text( "We need to discuss this at the next meeting." );
ta1 << Text Box( {70, 80, w1[1]+20+70, 80+taHeight});
ta2 << Text( "We need to discuss this at the next " );
ta2 << Text Box( {70, 120, w2[1]+20+70, 120+taHeight});
{ta1, ta2} << Background Color( "Light Yellow" ) << Text Color( "red" )/*<
<SET wrap=""></SET>
回覆:文字註解大小和文字位置控制:需要幫助謝謝你的提示,是的,我現在可以取得和設定標籤的大小了。
問題在於 JSL 不是逐行執行,而是分別計算不同屬性的最終狀態…然後再套用。
喜歡:
...
...
ta1<
<FIXED size=""></FIXED>
<P>所以寬度仍然保持我最初設定的值:</P> <CODE class=" language-jsl">ta1 << Text( "We need to discuss this at the next meeting." );
ta1 << Text Box( {70, 80, 350, 80+taHeight} );
ta2 << Text( "We need to discuss this at the next " );
ta2 << Text Box( {70, 120, 350, 120+taHeight} );
加入 Wait(0.5) 有助於克服這個問題。
所以最終的劇本是:
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = bivariate( y( :weight ), x( :height ) );
rbiv = biv << report;
taHeight = 40;
ta1 = rbiv << Add Text Annotation();
ta2 = rbiv << Add Text Annotation();
ta1 << Text( "We need to discuss this at the next meeting." );
ta1 << Text Box( {70, 80, 350, 80+taHeight} );
ta2 << Text( "We need to discuss this at the next " );
ta2 << Text Box( {70, 120, 350, 120+taHeight} );
{ta1, ta2} << Background Color( "Light Yellow" ) << Text Color( "red" )<
<FIXED size=""></FIXED> <BR />
回覆:文字註解大小和文字位置控制:需要幫助這個方法也行。主觀感覺比我的方案還快。我正在嘗試用調試工具來測量它的速度。
回覆:文字註解大小和文字位置控制:需要幫助設定 Wait(0) 可以加快速度 - 現在不會有實際的等待,但螢幕會重新繪製。
回覆:文字註解大小和文字位置控制:需要幫助沒關係,它能用。
循環之前:
taList = {};
循環內部:
Insert Into(taList, ta);
循環結束後:
Wait(0);
taList << Fixed Size(1);
For Each({height, index}, taList << Get Height(),
taList[index] << Set Height(height*0.93)
);
現在的問題是,當在實際場景中實現這一點時,當我有多個圖表和多個文字註釋時,對每個註釋執行兩級循環的技巧太慢了。
我嘗試創建一個文字註釋列表:
taList={};
然後在循環內部將當前 ta 添加到列表中:
Insert Into(taList, ta);
循環結束時,我得到:
taList
/*:
{DisplayBox[gtext], DisplayBox[gtext],......}
但是,對該清單或單一成員進行操作不起作用。
有什麼想法嗎?我的想法是:
1. 嘗試使用上下文框來分隔不同任務之間的變數。
2. 想辦法從報表中擷取這些註解-但當我擷取 XML 時(<