Ciao,
Ho solo capito una piccola parte della soluzione iterando attraverso la tabella con questo breve script (può essere aggiunto nella finestra di input Personalizza> Script).
for (i= 1 , i <= N Row (), i++,
circle({:cx[i],:cy[i]},:cRad[i]);
);
Sfortunatamente, non sono riuscito a trovare una funzione che restituisca dinamicamente lo stato della selezione della riga nel filtro locale GB. Potresti chiedere specificamente a quell'argomento in un nuovo post: deve esserci un modo.
Ci scusiamo per non essere stato di grande aiuto.
Migliore,
TS
Sembra che tu abbia effettivamente bisogno di 'Make Filter Change Handler ()'. Si prega di trovare un esempio:
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);