CIAO
Vorrei tracciare 3 linee e un'area ombreggiata tra le linee esterne utilizzando lo script di personalizzazione nel generatore di grafici. La prima è la linea y0=x. La seconda e la terza riga sono y1= a*x e y2 = b*x. (esempio a = 1,05 e b = 0,95 voglio ombreggiare tra le linee y1 e y2. Per farlo utilizzo un riempimento poligonale, ma la funzione poligono richiede valori fissi e non si adatta agli assi del grafico. Come posso ridimensionare la regione ombreggiata con il grafico così come le tre linee? cioè inserisci una variabile nella funzione poligono

Pen Size( 4 );
Line Style( dashed );
Pen Color( "black" );
Y Function( x, x );
Pen Size( 4 );
Line Style( dashed );
Pen Color( "red" );
Y Function( 1.1 * x, x );
Pen Size( 4 );
Line Style( dashed );
Pen Color( "red" );
Y Function( .9 * x, x );
Transparency( 0.5 );
Fill Color( {0.38, 0.84, 0.67} );
Polygon( [0.05, 1, 1, .05], [.045, .95, 1.05, .055] );
Grazie, l'ho adattato un po' e l'ho incluso Col Max (Colonna 2) come limite superiore, quindi tutto questo va nell'ambiente di script più piccolo del generatore di script senza dover definire un intero script del generatore di grafici. Grazie per l'aiuto
Pen Size( 4 );
Line Style( dashed );
Pen Color( "black" );
Y Function( x, x );
Pen Size( 4 );
Line Style( dashed );
Pen Color( "red" );
Y Function( 1.1 * x, x );
Pen Size( 4 );
Line Style( dashed );
Pen Color( "red" );
Y Function( .9 * x, x );
Transparency( 0.5 );
Fill Color( {0.38, 0.84, 0.67} );
xMat = [0];
yMat = [0];
xMax = 2*Col Max (Column 1);
yMax = 2*Col Max (Column 2);
xMat = xMat || xMax || xMax || [0];
yMat = yMat || xMax * 1.1 || xMax * .9 || [0];
Polygon( xMat, yMat );Ecco un semplice esempio di come modificare il poligono per adattarlo alle impostazioni dell'asse.


Names Default To Here( 1 );
dt = New Table( "Sample",
Add Rows( 7 ),
New Column( "Column 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.65] )
),
New Column( "Column 2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0.2, 0.3, 0.25, 0.3, 0.55, 0.68, 0.9] )
)
);
gb = Graph Builder(
Size( 528, 454 ),
Show Control Panel( 0 ),
Variables( X( :Column 1 ), Y( :Column 2 ) ),
Elements( Points( X, Y, Legend( 5 ) ) ),
SendToReport(
Dispatch(
{},
"Column 1",
ScaleBox,
{Min( -0.0389121338912134 ), Max( 1.21814306472226 ), Inc( 0.2 ), Minor Ticks( 1 ),
Label Row(
{Major Grid Line Color( 1 ), Minor Grid Line Color( 1 ), Show Major Grid( 1 ),
Show Minor Grid( 1 )}
)}
),
Dispatch(
{},
"Column 2",
ScaleBox,
{Min( -0.05302734375 ), Max( 1.20978927612305 ), Inc( 0.2 ), Minor Ticks( 2 ),
Label Row(
{Major Grid Line Color( 1 ), Minor Grid Line Color( 1 ), Show Major Grid( 1 ),
Show Minor Grid( 1 )}
)}
)
)
);
Report( gb )[FrameBox( 1 )] << Add Graphics Script(
Pen Size( 4 );
Line Style( dashed );
Pen Color( "black" );
Y Function( x, x );
Pen Size( 4 );
Line Style( dashed );
Pen Color( "red" );
Y Function( 1.1 * x, x );
Pen Size( 4 );
Line Style( dashed );
Pen Color( "red" );
Y Function( .9 * x, x );
Transparency( 0.5 );
Fill Color( {0.38, 0.84, 0.67} );
xMat = [0.05];
yMat = [.045];
xMax = Report( gb )[AxisBox( 2 )] << get max;
xMat = xMat || xMax || xMax || [0.045];
yMat = yMat || xMax * 1.1 || xMax * .9 || [0.055];
Polygon( xMat, yMat );
);