Come aggiungere un'etichetta alla linea di riferimento rossa?CIAO,
Come posso aggiungere un'etichetta alle linee di riferimento?
Ecco il mio codice:
Qualche consiglio?
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
sliderValue = 1;
dothisonchange = Function( {val},
tb << Set Text( "Cpk : " || Substr( Char( val ), 1, 4 ) )
);
Mean = 60;
std = 0.5;
New Window( "",
H List Box(
V List Box(
tb = Text Box( "Value: " || Char( sliderValue ) ),
sb = Slider Box(
1,
3,
sliderValue,
<<SET function=""></SET>
Personalizzazione di massaRi: Come aggiungere un'etichetta alla linea di riferimento rossa?.
Ri: Come aggiungere un'etichetta alla linea di riferimento rossa?La funzione Rimuovi linea di riferimento funziona correttamente sul mio sistema.Il problema con Ripristina asse è che se qualcosa sull'asse è stato modificato, tornerà all'impostazione originale quando viene eseguito Ripristina asse.Pertanto, se l'intervallo o gli incrementi effettivi dell'asse sono stati modificati, l'asse di ripristino riporta l'asse all'originale.Penso che il problema che stavi riscontrando sia probabilmente un problema di tempistica, quindi ho aggiunto un Wait(0) che credo potrebbe risolvere il problema per te.Inoltre, non indicavi più i grafici corretti dopo aver aggiunto la colonna Peso alla piattaforma di variabilità.Dopo tale modifica, la struttura del display di output viene modificata.Ora ci sono 2 rami di reporting separati.
GB[1]
E
GB[2]
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
sliderValue = 1;
dothisonchange = Function( {val},
tb << Set Text( "Cpk : " || Substr( Char( val ), 1, 4 ) )
);
Flag = 0;
Mean = 60;
wMean = 105;
wstd = 2;
std = 0.5;
LL = Mean - (sliderValue * 3 * std);
UL = Mean + (sliderValue * 3 * std);
holdLL = LL;
holdUL = UL;
wLL = wMean - (sliderValue * 3 * wstd);
wUL = wMean + (sliderValue * 3 * wstd);
wholdLL = LL;
wholdUL = UL;
New Window( "",
H List Box(
V List Box(
tb = Text Box( "Value: " || Char( sliderValue ) ),
sb = Slider Box(
1,
3,
sliderValue,
sliderValue = sb << Get;
LL = Mean - (sliderValue * 3 * std);
UL = Mean + (sliderValue * 3 * std);
wLL = wMean - (sliderValue * 3 * wstd);
wUL = wMean + (sliderValue * 3 * wstd);
//Set the slider and call the other function
sb << Set( sliderValue );
gbfb1 = Report( gb[1] )[AxisBox( 1 )];
gbfb2 = Report( gb[2] )[AxisBox( 1 )];
LL = Mean - (sliderValue * 3 * std);
UL = Mean + (sliderValue * 3 * std);
wLL = wMean - (sliderValue * 3 * wstd);
wUL = wMean + (sliderValue * 3 * wstd);
//gbfb1 << revert axis;
try(gbfb1 << remove ref line(holdLL));
try(gbfb1 << remove ref line(holdUL));
try(gbfb2 << remove ref line(wholdLL));
try(gbfb2 << remove ref line(wholdUL));
wait(0);
If( Flag == 1,
gbfb1 << add ref line( LL, Solid, red, "LL" );
gbfb1 << add ref line( UL, Solid, red, "UL" );
gbfb2 << add ref line( wLL, Solid, red, "LL" );
gbfb2 << add ref line( wUL, Solid, red, "UL" );
);
holdLL = LL;
holdUL = UL;
wholdLL = wLL;
wholdUL = wUL;
dothisonchange( sliderValue );
),
Button Box( "Add Reference line",
If( Flag == 0,
Flag = 1;
gbfb1 = Report( gb[1] )[AxisBox( 1 )];
gbfb2 = Report( gb[2] )[AxisBox( 1 )];
LL = Mean - (sliderValue * 3 * std);
UL = Mean + (sliderValue * 3 * std);
wLL = wMean - (sliderValue * 3 * wstd);
wUL = wMean + (sliderValue * 3 * wstd);
try(gbfb1 << remove ref line(holdLL));
try(gbfb1 << remove ref line(holdUL));
try(gbfb2 << remove ref line(wholdLL));
try(gbfb2 << remove ref line(wholdUL));
gbfb1 << add ref line( LL, Solid, red, "LL" );
gbfb1 << add ref line( UL, Solid, red, "UL" );
gbfb2 << add ref line( wLL, Solid, red, "LL" );
gbfb2 << add ref line( wUL, Solid, red, "UL" );
dothisonchange( sliderValue );
)
)
)
),
V List Box(
gb = dt << Variability Chart(
Y( :height, : weight ),
X( :sex ),
Show Range Bars( 0 ),
Std Dev Chart( 0 ),
Points Jittered( 1 )
);
)
);
Consulta il nuovo codice per sapere come viene gestita la modifica.
Ri: Come aggiungere un'etichetta alla linea di riferimento rossa?@txnelson La rimozione della linea di riferimento non funziona. Sono tornato sull'asse ripristinato.
Un'altra domanda: se, ad esempio, sto eseguendo 2 grafici di variabilità con altezza e peso, vorrei aggiungere una linea di riferimento a entrambi e variare con la casella di scorrimento. Come potrei implementarlo?
Ecco il codice con l'asse di ripristino: voglio aggiungere la linea di riferimento a entrambi i grafici di variabilità e variare la linea di riferimento con la casella di scorrimento
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
sliderValue = 1;
dothisonchange = Function( {val},
tb << Set Text( "Cpk : " || Substr( Char( val ), 1, 4 ) )
);
Flag = 0;
Mean = 60;
std = 0.5;
LL = Mean - (sliderValue * 3 * 0.5);
UL = Mean + (sliderValue * 3 * std);
holdLL = LL;
holdUL = UL;
New Window( "",
H List Box(
V List Box(
tb = Text Box( "Value: " || Char( sliderValue ) ),
sb = Slider Box(
1,
3,
sliderValue,
sliderValue = sb << Get;
LL = Mean - (sliderValue * 3 * std);
UL = Mean + (sliderValue * 3 * std);
//Set the slider and call the other function
sb << Set( sliderValue );
gbfb1 = Report( gb )[AxisBox( 1 )];
LL = Mean - (sliderValue * 3 * std);
UL = Mean + (sliderValue * 3 * std);
gbfb1 << revert axis;
If( Flag == 1,
gbfb1 << add ref line( LL, Solid, red, "LL" );
gbfb1 << add ref line( UL, Solid, red, "UL" );
);
holdLL = LL;
holdUL = UL;
dothisonchange( sliderValue );
),
Button Box( "Add Reference line",
If( Flag == 0,
Flag = 1;
gbfb1 = Report( gb )[AxisBox( 1 )];
LL = Mean - (sliderValue * 3 * 0.5);
UL = Mean + (sliderValue * 3 * std);
gbfb1 << revert axis;
gbfb1 << add ref line( LL, Solid, red, "LL" );
gbfb1 << add ref line( UL, Solid, red, "UL" );
dothisonchange( sliderValue );
)
)
)
),
V List Box(
gb = dt << Variability Chart(
Y( :height, : weight ),
X( :sex ),
Show Range Bars( 0 ),
Std Dev Chart( 0 ),
Points Jittered( 1 )
);
)
);Ri: Come aggiungere un'etichetta alla linea di riferimento rossa?Ecco una rielaborazione del codice che utilizza aggiungi riga di riferimento per mostrare le linee dinamiche

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
sliderValue = 1;
dothisonchange = Function( {val},
tb << Set Text( "Cpk : " || Substr( Char( val ), 1, 4 ) )
);
Flag = 0;
Mean = 60;
std = 0.5;
LL = Mean - (sliderValue * 3 * 0.5);
UL = Mean + (sliderValue * 3 * std);
holdLL = LL;
holdUL = UL;
New Window( "",
H List Box(
V List Box(
tb = Text Box( "Value: " || Char( sliderValue ) ),
sb = Slider Box(
1,
3,
sliderValue,
sliderValue = sb << Get;
LL = Mean - (sliderValue * 3 * std);
UL = Mean + (sliderValue * 3 * std);
//Set the slider and call the other function
sb << Set( sliderValue );
gbfb1 = Report( gb )["Graph Builder"][AxisBox( 2 )];
LL = Mean - (sliderValue * 3 * 0.5);
UL = Mean + (sliderValue * 3 * std);
Try( gbfb1 << remove ref line( holdLL ) );
Try( gbfb1 << remove ref line( holdUL ) );
If( Flag == 1,
gbfb1 << add ref line( LL, Solid, red, "LL" );
gbfb1 << add ref line( UL, Solid, red, "UL" );
);
holdLL = LL;
holdUL = UL;
dothisonchange( sliderValue );
),
Button Box( "Add Reference line",
If( Flag == 0,
Flag = 1;
gbfb1 = Report( gb )["Graph Builder"][AxisBox( 2 )];
LL = Mean - (sliderValue * 3 * 0.5);
UL = Mean + (sliderValue * 3 * std);
Try( gbfb1 << remove ref line( holdLL ) );
Try( gbfb1 << remove ref line( holdUL ) );
gbfb1 << add ref line( LL, Solid, red, "LL" );
gbfb1 << add ref line( UL, Solid, red, "UL" );
dothisonchange( sliderValue );
)
)
)
),
V List Box(
gb = dt << Variability Chart(
Y( :height ),
X( :sex ),
Show Range Bars( 0 ),
Std Dev Chart( 0 ),
Points Jittered( 1 )
);
gb = dt << Graph Builder(
Size( 373, 325 ),
Show Control Panel( 0 ),
Variables( X( Transform Column( "Row", Formula( Row() ) ) ), Y( :height ) )
);
)
);Ri: Come aggiungere un'etichetta alla linea di riferimento rossa?Lo script dello slider deve rimuovere la linea di riferimento precedente e aggiungere la nuova linea quando la variabile cambia.
Ri: Come aggiungere un'etichetta alla linea di riferimento rossa?Non sono sicuro che sia possibile spostare lo script grafico all'esterno di Frame Box, ma se per te va bene avere l'etichetta all'interno di FrameBox

Puoi aggiungere testo al tuo script grafico
Text Color("Red");
Text({0, LL}, "Lower");
Text({0, UL}, "Upper");Ri: Come aggiungere un'etichetta alla linea di riferimento rossa?@Jed_Campbell Grazie. Voglio spostare dinamicamente le linee di riferimento utilizzando la casella di scorrimento. L'aggiunta di linee di riferimento non si sposta dinamicamente variando la casella di scorrimento.
Ri: Come aggiungere un'etichetta alla linea di riferimento rossa?Invece di utilizzare il codice Aggiungi script grafica, potresti utilizzare Aggiungi linea di riferimento per risolvere il problema?
Graph Builder(
Transform Column( "Row", Formula( Row() ) ),
Variables( X( :Row ), Y( :height ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) ),
SendToReport(
Dispatch(
{},
"Row",
ScaleBox,
{Add Ref Line( LL, "Solid", "Black", "My Label", 1 )}
)
)
);Ri: Come aggiungere un'etichetta alla linea di riferimento rossa?forse questo: Aggiungi linee di riferimento ai grafici
Ri: Come aggiungere un'etichetta alla linea di riferimento rossa?