Hallo
Ich möchte mit dem Anpassungsskript im Graph Builder drei Linien und einen schattierten Bereich zwischen den Außenlinien zeichnen. Die erste ist die Linie y0=x. Die zweite und dritte Zeile sind y1= a*x und y2 = b*x. (Beispiel a = 1,05 und b = 0,95 Ich möchte zwischen den Linien y1 und y2 schattieren. Ich verwende dazu eine Polygonfüllung, aber die Polygonfunktion erfordert feste Werte und skaliert nicht mit den Diagrammachsen. Wie kann ich den schattierten Bereich genauso wie die drei Linien mit dem Diagramm skalieren lassen? dh fügen Sie eine Variable in die Polygonfunktion ein

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] );
Danke, ich habe das etwas angepasst und eingefügt Oberst Max (Spalte 2) als Obergrenze, damit dies alles in die kleinere Skriptumgebung des Skript-Builders gelangt, ohne dass ein komplettes Graph-Builder-Skript definiert werden muss. danke für die Hilfe
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 );Hier ist ein einfaches Beispiel dafür, wie Sie das Polygon an die Achseneinstellungen anpassen können.


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 );
);