안녕하세요,
저는 문제에 봉착했는데 몇 가지 조언을 주시면 감사하겠습니다.
우리는 샘플을 분석하여 각 샘플에 대한 모집단 A, B, C, D, E를 얻습니다.
A에 대한 정보는 "%"와 "count"로 나눌 수 있으며, B, C, D, E에 대해서도 마찬가지입니다.
데이터를 가져오면 "A 1"부터 "E 1"까지 이름이 붙은 열은 "%" 값을 나타내고, "A 2"부터 "E 2"까지 이름이 붙은 열은 "Count" 값을 나타냅니다.
가져오기는 항상 동일하므로 각 인구 유형(A, B, C 등)에 대해 2개의 Y축("%" 및 "count")이 있는 그래프를 생성하는 스크립트를 작성하는 것은 관리하기 쉬웠습니다. 아래 코드를 참조하세요.
문제: 때때로 우리는 일부 인구에 대한 추가 판독값을 얻습니다. 예를 들어, 인구 B와 E만이 "형광"이라는 세 번째 정보를 가질 것입니다. 이것들은 같은 표에 열 "B 3"과 "E 3"로 가져올 것입니다.
이러한 개체군은 수입마다 다를 수 있으므로 "B 3"을 "B"의 구성원으로 식별하고 개체군 "B" 그래프에서 3번째 Y축을 만드는 스크립트를 작성해야 합니다(이 예에서 "E 3"도 마찬가지입니다). 하지만 저는 이를 위해 충분히 똑똑하거나 경험이 없습니다.
물론, 저는 표를 재정렬하고, 새로운 열 대신 새로운 행을 만들고, "wrap"으로 작업하려고 했습니다. 하지만 거기에는 각 Y축에 대한 자동 크기 조정이 없습니다. 또한 세 가지 정보 유형에 대한 연관 배열을 시도했지만 코딩 경험이 부족하여 실패했습니다.
여러분 중에 도움이 될 만한 아이디어가 있으신 분이 계시다면 감사하겠습니다.
Names Default To Here( 1 );
dt = Current Data Table();
dt << clear select;
win = New Window( "Test", Outline Box( "", hb = V List Box() ) );
loopstart = Contains(dt << get column names, Column("A 1"));
loopend = (Contains(dt << get column names, Column("A 2")))-1;
icounts = (loopend+1)-loopstart;
For( i = loopstart, i <= loopend, i++,
gb = Graph Builder(
Size( 1500, 900 ),
Show Control Panel( 0 ),
Grid Color( "Black" ),
Graph Spacing( 2 ),
Legend Position( "Bottom" ),
Variables( X( :Group ), Y( Eval( i ) ), Y( Eval( i + icounts ) ), Color( :Subjects ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 11 ) ), Box Plot( X, Y, Legend( 13 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 12 ) ), Box Plot( X, Y, Legend( 14 ) ) ),
SendToReport(
Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( "DATA" ), Image Export Display( Normal )} ),
Dispatch( {}, "graph title", TextEditBox, {Set Text( "Title" )}, {Set Font Size( 16 )} ),
Dispatch( {}, "Y title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" ), Set Text( " [%]" )} ),
Dispatch( {}, "Y1 title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" ), Set Text( " Count" )} ),
Dispatch( {}, "X title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" )} ),
Dispatch(
{},
"400",
LegendBox,
{Set wrap( 12 ), Set Title( "" ), font( "Segoe UI", 12, "Plain" ), Legend Position(
{11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1], 13, [-1], 12, [-1], 14, [-1]
}
), Orientation( "Vertical" )}
)
)
);
hb << Append( Report( gb ) << child );
hb << append( Page Break Box() );
gb << close window;
);다음은 보기 흉한 코드이지만 필요한 것을 제공하는 것 같습니다.

Names Default To Here( 1 );
dt = Current Data Table();
dt << clear select;
win = New Window( "Test", Outline Box( "", hb = V List Box() ) );
loopstart = Contains( dt << get column names, Column( "A 1" ) );
loopend = (Contains( dt << get column names, Column( "A 2" ) )) - 1;
fluorB3 = Contains( dt << get column names, Column( "B 3" ) );
fluorE3 = Contains( dt << get column names, Column( "E 3" ) );
icounts = (loopend + 1) - loopstart;
For( i = loopstart, i <= loopend, i++,
If( (Column( i ) << get name == "B 1" & fluorB3 > 0) | (Column( i ) << get name == "E 1" & fluorE3 > 0),
If( Column( i ) << get name == "B 1",
fluorcounts = fluorB3,
fluorcounts = fluorE3
);
gb = Graph Builder(
Size( 1517, 788 ),
Show Control Panel( 0 ),
Legend Position( "Bottom" ),
Grid Color( "Black" ),
Graph Spacing( 2 ),
Variables( X( :Group ), Y( Eval( i ) ), Y( Eval( i + icounts ) ), Y( Eval( fluorcounts ) ), Color( :Subjects ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 11 ) ), Box Plot( X, Y, Legend( 13 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 12 ) ), Box Plot( X, Y, Legend( 14 ) ) ),
Elements( Position( 1, 3 ), Points( X, Y, Legend( 15 ) ), Box Plot( X, Y, Legend( 16 ) ) ),
SendToReport(
Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( "DATA" ), Image Export Display( Normal )} ),
Dispatch( {}, "400", ScaleBox, {Legend Model( 12, Base( 0, 0, 0, Item ID( "Car", 1 ) ) )} ),
Dispatch( {}, "graph title", TextEditBox, {Set Text( "Title" )} ),
Dispatch( {}, "X title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "Bold" )} ),
Dispatch( {}, "Y title", TextEditBox, {Set Text( " [%]" ), Set Font Size( 14 ), Set Font Style( "Bold" )} ),
Dispatch( {}, "Y 1 title", TextEditBox, {Set Text( " Count" ), Set Font Size( 14 ), Set Font Style( "Bold" )} ),
Dispatch( {}, "Y 2 title", TextEditBox, {Set Text( " Fluor" ), Set Font Size( 14 ), Set Font Style( "Bold" )} ),
Dispatch(
{},
"400",
LegendBox,
{font( "Segoe UI", 12, "Plain" ), Orientation( "Vertical" ), Set Wrap( 12 ),
Legend Position(
{11, [0, 1, 2, 3], 13, [-1, -1, -1, -1, -1, -3], 12, [-1, -3, -3, -3], 14, [-1, -1, -1, -1, -1, -3], 15, [-1, -1,
-1, -1, -1, -3], 16, [-1, -1, -1, -1, -1, -3]}
)}
)
)
);
,
gb = Graph Builder(
Size( 1500, 900 ),
Show Control Panel( 0 ),
Grid Color( "Black" ),
Graph Spacing( 2 ),
Legend Position( "Bottom" ),
Variables( X( :Group ), Y( Eval( i ) ), Y( Eval( i + icounts ) ), Color( :Subjects ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 11 ) ), Box Plot( X, Y, Legend( 13 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 12 ) ), Box Plot( X, Y, Legend( 14 ) ) ),
SendToReport(
Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( "DATA" ), Image Export Display( Normal )} ),
Dispatch( {}, "graph title", TextEditBox, {Set Text( "Title" )}, {Set Font Size( 16 )} ),
Dispatch( {}, "Y title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" ), Set Text( " [%]" )} ),
Dispatch( {}, "Y1 title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" ), Set Text( " Count" )} ),
Dispatch( {}, "X title", TextEditBox, {Set Font Size( 14 ), Set Font Style( "bold" )} ),
Dispatch(
{},
"400",
LegendBox,
{Set wrap( 12 ), Set Title( "" ), font( "Segoe UI", 12, "Plain" ), Legend Position(
{11, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1], 13, [-1], 12, [-1], 14, [-1]}
), Orientation( "Vertical" )}
)
)
)
);
hb << Append( Report( gb ) << child );
hb << append( Page Break Box() );
gb << close window;
);