Parece que realmente necesita 'Crear controlador de cambio de filtro ()'. Encuentre un ejemplo:
NamesDefaultToHere(1);
// Example table
dt = New Table( "Test Circles",
Add Rows( 20 ),
New Column( "dataset",
Numeric,
"Nominal",
Format( "Best", 12 ),
Set Values( [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 5, 5, 5, 5] )
),
New Column( "x",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[0.1739, 0.4959, 0.3498, 0.4005, 0.6558, 0.5159, 0.7165, 0.7467, 0.6812,
0.902, 0.4638, 0.5823, 0.9902, 0.1275, 0.9176, 0.8493, 0.2, 0.2, 0.8,
0.8]
)
),
New Column( "y",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[0.8721, 0.0109, 0.2249, 0.3135, 0.2398, 0.6867, 0.236, 0.146, 0.1684,
0.7458, 0.7862, 0.6482, 0.4948, 0.8169, 0.2477, 0.1575, 0.8, 0.2, 0.8,
0.2]
)
),
New Column( "cx",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[0.4985, 0.4985, 0.4985, 0.4985, 0.4985, 0.4985, 0.4985, 0.4985, 0.4985,
0.4985, 0.4985, 0.4985, 0.4985, 0.4962, 0.4962, 0.4962, 0.5, 0.5, 0.5,
0.5]
)
),
New Column( "cy",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[0.5027, 0.5027, 0.5027, 0.5027, 0.5027, 0.5027, 0.5027, 0.5027, 0.5027,
0.5027, 0.5027, 0.5027, 0.5027, 0.4958, 0.4958, 0.4958, 0.5, 0.5, 0.5,
0.5]
)
),
New Column( "cRad",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[0.4918, 0.4918, 0.4918, 0.4918, 0.4918, 0.4918, 0.4918, 0.4918, 0.4918,
0.4918, 0.4918, 0.4918, 0.4918, 0.489, 0.489, 0.489, 0.4243, 0.4243,
0.4243, 0.4243]
)
)
);
// Initial parameters for drawing a circle (used when there is no selection in the data filter)
cx = cy = cRad = 0.0;
// Graph Builder with locked scales . . .
gb = dt << Graph Builder(
Show Control Panel( 0 ),
Lock Scales( 1 ),
Variables( X( :x ), Y( :y ) ),
Elements( Points( X, Y, Legend( 7 ) ) )
);
gbRep = Report(gb);
// Add graphics script for a circle
gbRep[FrameBox(1)] << Add Graphics Script(
2,
Description( "Circle" ),
Pen Color( "Blue" );
Circle( {cx, cy}, cRad );
);
// Add Local Data Filter . . .
ldf = gb << Local Data Filter();
// Add the filter column, and get a reference to the filter column object ('fc' is not actually used)
ldf << Add Filter( columns(:dataset));
fc = ldf << GetFilterColumn(:dataset);
// Function to get new circle parameters from the Local Data Filter selection
getCircleFromFilter =
Function( {x},
theseRows = ldf << getFilteredRows;
if(IsMatrix(theseRows),
// Assume it's safe to get the required values from just the first row in the current selection
cx = Column(dt, "cx")[theseRows[1]];
cy = Column(dt, "cy")[theseRows[1]];
cRad = Column(dt, "cRad")[theseRows[1]];
,
// No selection should give no visible circle
cx = cy = cRad = 0.0;
);
// Force the graphics script to be revaluated with the current parameters of the circle
gbRep[FrameBox(1)] << reShow;
);
// Assign the Filter Change Handler to the local data filter to do the work
rsh = ldf << Make Filter Change Handler(getCircleFromFilter);
Hola,
Solo he descubierto una pequeña parte de la solución iterando a través de la tabla con este breve script (se puede agregar en la ventana de entrada Personalizar> Script).
for (i= 1 , i <= N Row (), i++,
circle({:cx[i],:cy[i]},:cRad[i]);
);
Desafortunadamente, no pude encontrar una función que devuelva dinámicamente el estado de la selección de fila en el filtro local de GB. Es posible que desee preguntar específicamente sobre ese tema en una nueva publicación: tiene que haber una manera.
Lo siento por no ser de mucha ayuda.
Mejor,
TS