やあ、
問題に行き詰まってしまったので、アドバイスをいただければ幸いです。
サンプルを分析し、各サンプルの集団 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 軸 (「%」と「カウント」) を持つグラフを生成するスクリプトを記述することは容易でした。以下のコードを参照してください。
問題:一部の集団について追加の読み取り値が得られることがあります。たとえば、集団 B と E のみに「蛍光」と呼ばれる 3 番目の情報があります。これらは、同じテーブルに列「B 3」と「E 3」としてインポートされます。
これらの人口はインポートごとに異なる可能性があるため、「B 3」を「B」のメンバーとして識別し、人口「B」グラフに 3 番目の Y 軸を作成するスクリプトを作成する必要があります (この例では「E 3」についても同様です)。しかし、これには私の知識/経験が足りません。
もちろん、テーブルを再配置し、新しい列の代わりに新しい行を作成し、「折り返し」を操作してみました。しかし、各 Y 軸の自動スケールはありません。また、3 つの情報タイプに関連配列を試しましたが、コーディング経験不足のため失敗しました。
皆さんの中に役に立つアイデアをお持ちの方がいらっしゃるかもしれません。ありがとうございます
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;
);