Ciao,
Sto lavorando su un grafico di variabilità in cui ho dati continui che sto tracciando per sottogruppo.Ho 3 bande di temperatura di dati "1C a 13C", "16C a 28C" e "30C a 45C".Vorrei avere linee di riferimento tracciate per ogni categoria di filtro che seleziono nei dati, ci sono 3 diversi gruppi di linee di riferimento.
Vedere il file allegato e lo script di variabilità.
Sono relativamente nuovo nello scripting.Ho visto come il comando di scripting JMP consente di scrivere il comando per ogni riga di riferimento.Voglio rendere dinamico il comando in base a ciò che è selezionato dal filtro dati. (sezione sottolineata in grassetto dello script.
Si prega di avvisare,
Grazie
opaco
New Window( "Sample set 1 - Variability Chart by Lot",
V List Box(
Variability Chart(
Y( :Test 1 ),
X( :Lot ),
Std Dev Chart( 0 ),
Local Data Filter( Add Filter( columns( :Temp Band 2 ) ) ),
SendToReport(
Dispatch(
{"Variability Chart for Test 1"},
"2",
ScaleBox,
{Min( 0.814090277777778 ), Max( 1.13166666666667 ), Inc( 0.05 ),
Minor Ticks( 1 ), Add Ref Line(
0, "Dotted", "Medium Light Gray", "", 1
), Add Ref Line( <U><STRONG>1.1</STRONG></U>, "Solid", "Black", "", 1 ),
Add Ref Line(<U> <STRONG>0.9</STRONG></U>, "Solid", "Black", "", 1 )}
)
)
),
Variability Chart(
Y( :Test 2 ),
X( :Lot ),
Std Dev Chart( 0 ),
Local Data Filter( Add Filter( columns( :Temp Band 2 ) ) )
),
Variability Chart(
Y( :Test3 ),
X( :Lot ),
Std Dev Chart( 0 ),
Local Data Filter( Add Filter( columns( :Temp Band 2 ) ) )
)
)
)
Ciao @mcastner , direi che hai scelto un compito abbastanza complicato per iniziare a creare script!Di seguito è riportato un modo per fare ciò che hai chiesto (se ti ho interpretato correttamente), ma mi chiedo se potresti renderlo più semplice utilizzando il generatore di grafici per disegnare un box plot e una linea allo stesso tempo.Come si ottengono i valori per le linee di riferimento?C'è qualche possibilità che sia un riassunto dei dati disponibili (mediana, quantile, ecc.) O potresti farlo in una colonna formula?
Names default to here(1);
dt = Open( "$Sample_data/big class.jmp" );
//Valeus for ref lines - hopefully populated by your script
reflines = Associative Array({
{"height",
Associative Array({
{ 12, 62 },
{ 13, 63 },
{ 14, 64 },
{ 15, 65 },
{ 16, 66 },
{ 17, 67 }
})
},
{"weight",
Associative Array({
{ 12, 112 },
{ 13, 113 },
{ 14, 114 },
{ 15, 115 },
{ 16, 116 },
{ 17, 117 }
})
}
});
//A window with a single data filter that will be applied to all graphs inside it
New Window("charts",
Data Filter Context Box(
H List Box(
ldf = dt << Data Filter( Local,
Add Filter(
columns( :age ),
Where( :age == 13 ),
Display( :age, N Items( 6 ) )
),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
),
vc1 = Variability Chart(
Y( :height ),
X( :sex )
);
vc2 = Variability Chart(
Y( :weight ),
X( :sex )
);
)
)
);
//Function that is called when data filter changes and when the window is first opened, this will redraw lines on charts
UpdateRefLines = function({},
//find out what ages were selected, there is probably a better way to do this too
filteredagelast = filteredage;
filteredage = median(dt:age[ldf << get filtered rows()]);
//detect if there was a change in the age (prevents flickering of the screen)
if(is missing(filteredagelast) | (filteredagelast != filteredage),
//remove any existing ref lines
(vc1 << XPath("//AxisBox[@charID=2]"))[1] << Revert Axis;
(vc2 << XPath("//AxisBox[@charID=2]"))[1] << Revert Axis;
//draw new lines
(vc1 << XPath("//ScaleBox[@ID=2]")) << Add Ref Line( reflines["height"][FilteredAge], "Solid", "Black", "", 1 );
(vc2 << XPath("//ScaleBox[@ID=2]")) << Add Ref Line( reflines["weight"][FilteredAge], "Solid", "Black", "", 1 );
)
);
//function called when data filter changes, here it only redraws reference lines
UpdatesOnRowStateChanges = function({x}, if(is matrix(x), UpdateRefLines ) );
//variable used to keep track of the last filter applied
filteredage = .;
//Assign function to data filter
rsh = vc1 << Make Row State Handler( dt, UpdatesOnRowStateChanges );
//draw initial reference lines
UpdateRefLines();
