Tutto,
Vorrei chiedere un input sul modo migliore per scrivere una trama GB con più parametri.
Diciamo che ho una tabella come questa:
New Table( "Untitled 140",
Add Rows( 12 ),
New Column( "Category",
Character,
"Nominal",
Set Values( {"A", "A", "A", "B", "B", "B", "C", "C", "C", "D", "D", "D"} )
),
New Column( "Value1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [1, 4, 2, 3, 6, 2, 3, 5, 4, 1, 3, 6] )
),
New Column( "Value2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [6, 3, 5, 2, 8, 6, 5, 2, 6, 3, 5, 4] )
)
)E voglio sceneggiare una trama come questa:

dove lo script generato automaticamente si presenta così:
;Graph Builder(
Size( 522, 450 ),
Show Control Panel( 0 ),
Variables( X( :Category ), Y( :Value1 ), Y( :Value2, Position( 1 ) ) ),
Elements( Bar( X, Y( 1 ), Y( 2 ), Legend( 4 ), Summary Statistic( "Range" ) ) )
)
con il fermo che c'è un numero arbitrario di colonne Y e anche i nomi sono arbitrari.
Per trame come la trama della variabilità vorrei qualcosa del genere:
parameters = {:"Value1"n, :"Value2"n};
yExpr = Expr( Y() );
For Each( {value, index}, parameters, Insert Into( yExpr, Name Expr( value ), 1 ) );
Eval(
Substitute(
Expr(
Variability Chart( placeholder, X( :Category ), Std Dev Chart( 0 ) )
),
Expr( placeholder ), Name Expr( yExpr )
)
);dove ricevo i nomi delle colonne come un elenco e quindi costruisco un'espressione Y e quindi la inserisco nello script per il grafico. Mi darebbe un elenco di grafici di variabilità, ma per me va bene.
Se voglio seguire la stessa strada nel caso dei GB, sembra che dovrò costruire due espressioni:
Y( :Value1 ), Y( :Value2, Position( 1 ) )
e
Elements( Bar( X, Y( 1 ), Y( 2 ), Legend( 4 ), Summary Statistic( "Range" ) ) )
Che è essenzialmente l'intera sceneggiatura.
La mia domanda: c'è un modo migliore piuttosto che fare un mucchio di sostituzioni con espressioni per assemblare queste due righe?
Grazie!