Ottieni le righe attualmente visualizzate su un dendrogrammaCiao,
Vorrei sapere se esiste un modo per sapere quali individui sono attualmente visualizzati su un dendrogramma dopo un'azione di zoom.
Ecco un esempio:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Birth Death Subset.jmp" );
Hierarchical Cluster(
Y( :birth, :death ),
Label( :country ),
Method( "Ward" ),
Standardize Data( 1 ),
Dendrogram Scale( "Distance Scale" ),
Number of Clusters( 4 ),
SendToReport(
Dispatch( {}, "Dendrogram", OutlineBox, {SetHorizontal( 1 )} ),
Dispatch(
{"Dendrogram"},
"2",
ScaleBox,
{Min( 18 ), Max( 31 ), Inc( 5 ), Minor Ticks( 0 )}
)
)
);Vorrei ottenere l'elenco dei 13 paesi selezionati.
Una buona soluzione, penso, sarebbe quella di ottenere i valori minimo e massimo (18 e 31) ma finora non riesco a trovare come estrarli...
Grazie in anticipo per il vostro aiuto!
Re: Ottieni righe attualmente visualizzate su un dendrogrammaCiao @txnelson ,
Non ho mai usato questa funzionalità ma amplia davvero le possibilità di JMP, è così bello!!
Nella mia situazione non ho davvero bisogno di selezionare le righe ma solo di ottenere i valori minOrder e maxOrder. Ecco perché penso che non ci saranno problemi di interferenza come menzionato da @giuliano . devo provarlo 
Grazie ancora ad entrambi per il vostro aiuto!
Re: Ottieni righe attualmente visualizzate su un dendrogrammaAh, eccoci qua. Avrei dovuto pensarci!
//Modifica: l'aggiunta dello script grafico sembra interferire con il doppio clic per ingrandire il cluster selezionato. C'è sicuramente un modo per farlo funzionare, ma al momento il pulsante sembra abbastanza infallibile, soprattutto se vuoi essere in grado di selezionare le persone nel dendrogramma ma poi ristabilire la selezione allo zoom corrente.
Re: Ottieni righe attualmente visualizzate su un dendrogrammaÈ possibile allegare uno script grafico
obj << aggiungi script grafico()
al framebox del dendografo.Si attiverà ogni volta che viene fatto qualcosa al grafico.Nello script aggiunto, puoi verificare se minOrder o MaxOrder sono cambiati.
Re: Ottieni righe attualmente visualizzate su un dendrogrammaCiao @anne_sa ,
È una grande idea, ma non ho trovato un modo semplice per realizzarlo. Che ne dici di un pulsante nella parte inferiore della finestra per richiamare la selezione?
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Birth Death Subset.jmp" );
hcPlatform = Hierarchical Cluster(
Y( :birth, :death ),
Label( :country ),
Method( "Ward" ),
Standardize Data( 1 ),
Dendrogram Scale( "Distance Scale" ),
Number of Clusters( 4 ),
SendToReport(
Dispatch( {}, "Dendrogram", OutlineBox, {SetHorizontal( 1 )} ),
Dispatch( {"Dendrogram"}, "2", ScaleBox, {Min( 18 ), Max( 31 ), Inc( 5 ), Minor Ticks( 0 )} )
)
);
//save the order displayed in the platform
displayOrd = hcPlatform << Save Display Order;
selectZoom = expr(
//get the script, which contains the Min() and Max() information
exprPlat = hcPlatform << Get Script;
//Extract the Min and Max. This is indexed in the reverse of the Display Order
//that is, the max value is the first in the order (as if it is an axis), so subtracting
//this value from the number of rows in the table brings things into alignment
minOrder = 1 + N Rows( dt ) - Arg( Extract Expr( exprPlat, Max( Wild() ) ) );
maxOrder = N Rows( dt ) - Arg( Extract Expr( exprPlat, Min( Wild() ) ) );
//select the rows in the table that meet the condition of being in the randge displayed
dt << Select Where( And( As Column( displayOrd ) >= minOrder, As Column( displayOrd ) <= maxOrder ) );
//get the matrix of row numbers for the selected rows, i.e., rows displayed in zoom
matchingRows = dt << get selected rows;
);
//add the button to the report
report(hcPlatform)<<APPEND></APPEND>
@giuliano
Re: Ottieni righe attualmente visualizzate su un dendrogrammaCiao @giuliano ,
Grazie mille per questa risposta veloce, è esattamente quello che stavo cercando!!!
Ho solo una piccola domanda aggiuntiva: c'è un modo per rilevare che è stata eseguita un'azione di zoom sul dendrogramma? Forse qualcosa basato sulla funzione <Re: Ottieni righe attualmente visualizzate su un dendrogrammaMolto ben fatto.
Re: Ottieni righe attualmente visualizzate su un dendrogramma
Ciao @anne_sa ,
Non conosco un modo diretto per ottenere quelle righe, ma poiché le informazioni Min e Max fanno parte dello script per la piattaforma e poiché possiamo salvare l'ordine di visualizzazione delle righe nel dendrogramma, possiamo scrivere a modo nostro al risultato con un po' di lavoro. Non è del tutto elegante, ma ecco un modo in cui mi sono inventato:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Birth Death Subset.jmp" );
hcPlatform = Hierarchical Cluster(
Y( :birth, :death ),
Label( :country ),
Method( "Ward" ),
Standardize Data( 1 ),
Dendrogram Scale( "Distance Scale" ),
Number of Clusters( 4 ),
SendToReport(
Dispatch( {}, "Dendrogram", OutlineBox, {SetHorizontal( 1 )} ),
Dispatch( {"Dendrogram"}, "2", ScaleBox, {Min( 18 ), Max( 31 ), Inc( 5 ), Minor Ticks( 0 )} )
)
);
//save the order displayed in the platform
displayOrd = hcPlatform << Save Display Order;
//get the script, which contains the Min() and Max() information
exprPlat = hcPlatform << Get Script;
//Extract the Min and Max. This is indexed in the reverse of the Display Order
//that is, the max value is the first in the order (as if it is an axis), so subtracting
//this value from the number of rows in the table brings things into alignment
minOrder = 1 + N Rows( dt ) - Arg( Extract Expr( exprPlat, Max( Wild() ) ) );
maxOrder = N Rows( dt ) - Arg( Extract Expr( exprPlat, Min( Wild() ) ) );
//select the rows in the table that meet the condition of being in the randge displayed
dt << Select Where( And( As Column( displayOrd ) >= minOrder, As Column( displayOrd ) <= maxOrder ) );
//get the matrix of row numbers for the selected rows, i.e., rows displayed in zoom
matchingRows = dt << get selected rows;
Spero che questo aiuti!
@giuliano