Ciao,
Mi sono bloccato su un problema e ti sarei grato se potessi darmi qualche consiglio:
Analizziamo i campioni e otteniamo le popolazioni A, B, C, D ed E per ciascun campione.
Le informazioni per A possono essere divise in "%" e "conteggio", lo stesso vale per B, C, D ed E.
Importiamo i dati e le colonne denominate da "A 1" a "E 1" rappresentano i valori "%", quelle denominate da "A 2" a "E 2" rappresentano i valori "Conteggio".
Poiché l'importazione sarà sempre la stessa, scrivere uno script per generare grafici con 2 assi Y ("%" e "count") per ogni tipo di popolazione (A, B, C ecc.) è stato gestibile. Vedere il codice di seguito.
Il problema: a volte otteniamo una lettura aggiuntiva per alcune delle nostre popolazioni. Ad esempio, solo le popolazioni B ed E avranno una terza informazione chiamata "fluorescenza". Queste saranno importate come colonne "B 3" ed "E 3" nella stessa tabella.
Poiché queste popolazioni possono variare da importazione a importazione, ho bisogno di scrivere uno script che sia in grado di identificare "B 3" come membro dei "B" e di creare un terzo asse Y nel grafico della popolazione "B" (e lo stesso per "E 3" in questo esempio). Ma per questo non sono abbastanza intelligente/esperto.
Naturalmente, ho provato a riorganizzare la tabella, creare nuove righe invece di nuove colonne e lavorare con "wrap". Ma lì non abbiamo autoscale per ogni asse Y. Ho anche provato un array associato per i tre tipi di informazioni, ma non ci sono riuscito a causa della mancanza di esperienza di codifica.
Forse qualcuno di voi ha un'idea che potrebbe essere utile, grazie
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;
);Ecco un codice piuttosto brutto, ma sembra fornirti ciò di cui hai bisogno

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;
);