Al utilizar el generador de gráficos, le permite "resaltar" o "seleccionar" un subconjunto de datos específico dentro de la leyenda. La salida correspondiente en el generador de gráficos y la tabla de datos también se resaltarán. Cuando se selecciona un subconjunto de datos, los otros subconjuntos pasan a un segundo plano o aumentan su transparencia de forma interactiva.
¿Puedo agregar líneas de referencia que correspondan a un conjunto de datos seleccionado y se comporten de forma interactiva de la misma manera? ¿Y puedo hacer que estas líneas se coloreen automáticamente como lo hacen cuando coloco una columna nominal en el campo de leyenda?
Indexar la lista mediante
["addrefline"]
- buen truco 
¿Por qué funciona?
¿Encuentra el primer símbolo (independiente de mayúsculas/minúsculas y espacios) y devuelve el primer argumento?
Aquí hay algo de JSL inicial.
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" )} ) )
);
JSL instala una función de controlador RowState en la tabla de datos; esa función recibe una notificación cuando cambian los datos del estado de la fila de la tabla (cuando se selecciona/oculta/excluye una fila, o cambia el estilo o el color del marcador). La función calcula los valores mínimos y máximos de las columnas seleccionadas y elimina líneas de referencia antiguas y agrega nuevas líneas de referencia.
The a-b-c-d ref lines are interactively tracking the rectangular point selectionLas líneas de referencia abcd siguen interactivamente la selección del punto rectangular.
Parpadea a medida que se actualiza porque la pantalla se vuelve a dibujar cuando se agrega o elimina cada línea de referencia; puede volverse demasiado lento con datos grandes que requieren demasiado tiempo para volver a dibujar el gráfico.