Lorsque vous utilisez le générateur de graphiques, il vous permet de « mettre en surbrillance » ou de « sélectionner » un sous-ensemble de données spécifique dans la légende. La sortie correspondante sur le générateur de graphiques et le tableau de données se mettra également en évidence. Lorsqu'un sous-ensemble de données est sélectionné, les autres sous-ensembles s'effacent en arrière-plan ou augmentent leur transparence de manière interactive.
Puis-je ajouter des lignes de référence qui correspondent à un ensemble de données sélectionné et qui se comportent de manière interactive de la même manière ? Et puis-je faire en sorte que ces lignes se colorent automatiquement comme elles le font lorsque je dépose une colonne nominale dans le champ de légende ?
Indexation de la liste via
["addrefline"]
- Joli tour 
Pourquoi ça marche ?
Il trouve le premier symbole (indépendant des majuscules/minuscules et des espaces) - et renvoie le premier argument ?
Voici un JSL de démarrage.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
oldselection = [];// don't update when nothing changes by comparing old to new
f = Function( {a}, // this callback tells which points are changing selected state
// and may send between 1 and N row numbers in the matrix a.
// this example will ignore a and just ask the table about the range of the currently
// selected points.
{subset, hmin, hmax, wmin, wmax, newselection}, // local variables
newselection = dt << getselectedrows; // compare to previous selection...
If( Try( N Rows( newselection ) != N Rows( oldselection ) | Any( newselection != oldselection ), 1 ),
oldselection = newselection; // remember the new selection for next time
dtSubset = dt << subset( SelctedRows( 1 ), LinkToOriginalDataTable( 1 ), invisible ); // make a subset of the selection to summarize
dtSummary = dtSubset << Summary( Min( :height ), Min( :weight ), Max( :height ), Max( :weight ), Freq( "None" ), Weight( "None" ) );
Close( dtSubset, "nosave" ); // done with the subset, use the summary...
hmin = dtSummary:name( "Min(Height)" )[1]; // capture the range of the selected axis
hmax = dtSummary:name( "Max(Height)" )[1];
wmin = dtSummary:name( "Min(Weight)" )[1];
wmax = dtSummary:name( "Max(Weight)" )[1];
Close( dtSummary, "nosave" ); // done with the summary, use the captured values...
// remove 2 old reflines first, from each axis, then add 2 new ones
// remove the old ref lines from the weight axis (1==horizontal)
Report( gb )[axisbox( 1 )] << removerefline( (Report( gb )[axisbox( 1 )] << getscript)["addrefline"] );
Report( gb )[axisbox( 1 )] << removerefline( (Report( gb )[axisbox( 1 )] << getscript)["addrefline"] );
// remove the old ref lines from the height axis (2==vertical)
Report( gb )[axisbox( 2 )] << removerefline( (Report( gb )[axisbox( 2 )] << getscript)["addrefline"] );
Report( gb )[axisbox( 2 )] << removerefline( (Report( gb )[axisbox( 2 )] << getscript)["addrefline"] );
// add the new ref lines...extend the bounding box by .5 for the integer height/weight (not required)
Report( gb )[axisbox( 1 )] << addrefline( wmin - .5, "solid", "red", "a", 2 );
Report( gb )[axisbox( 1 )] << addrefline( wmax + .5, "solid", "green", "b", 2 );
Report( gb )[axisbox( 2 )] << addrefline( hmin - .5, "solid", "blue", "c", 1 );
Report( gb )[axisbox( 2 )] << addrefline( hmax + .5, "solid", "black", "d", 1 );
);
);
rs = dt << make row state handler( f );
gb = Graph Builder(
Size( 416, 300 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 3 ) ) ),
SendToReport( Dispatch( {}, "Graph Builder", OutlineBox, {Set Title( "" )} ), Dispatch( {}, "graph title", TextEditBox, {Set Text( "Demo" )} ) )
);
Le JSL installe une fonction de gestionnaire RowState dans la table de données ; cette fonction est notifiée lorsque les données d'état de la ligne de la table changent (lorsqu'une ligne est sélectionnée/masquée/exclue, ou que le style ou la couleur du marqueur change.) La fonction calcule les valeurs minimales et maximales des colonnes sélectionnées, supprime les anciennes lignes de référence et ajoute nouvelles lignes de référence.
The a-b-c-d ref lines are interactively tracking the rectangular point selectionThe a-b-c-d ref lines are interactively tracking the rectangular point selectionThe a-b-c-d ref lines are interactively tracking the rectangular point selectionThe a-b-c-d ref lines are interactively tracking the rectangular point selectionThe a-b-c-d ref lines are interactively tracking the rectangular point selectionThe a-b-c-d ref lines are interactively tracking the rectangular point selectionThe a-b-c-d ref lines are interactively tracking the rectangular point selectionThe a-b-c-d ref lines are interactively tracking the rectangular point selectionThe a-b-c-d ref lines are interactively tracking the rectangular point selectionLes lignes de référence abcd suivent de manière interactive la sélection du point rectangulaire
Il clignote lors de la mise à jour car l'affichage se redessine lorsque chaque refline est ajoutée ou supprimée ; cela peut devenir trop lent avec des données volumineuses qui prennent trop de temps pour redessiner le graphique.
Oui. Pas bien documenté, mais très utile avec la boîte de dialogue modale < Boîtes de dialogue modales 2/5 vers le bas à partir du haut.
axisbox<
Désolé, ce JSL méritait de meilleurs commentaires !