I have added some code to your chart(untested code), that will calculate the overall and within deltas. The left and right delta calculations require the rules for defining the boxes.
I have also added a very simple display for the 2 values.
In both cases, I am providing you with the approach that needs to be taken to give you these next enhancements to your code. I can not guarantee perfect code, but you should see the concept and be able to take it from there
framex_value = "";
w = New Window( "Frame size X",// opens a window with a title and this content...
<<Return Result,
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ), // window dressing
V List Box( // V and H lists nest to organize the display boxes
H Center Box( Text Box( "Frame size X" ) ), // a second title, centered
Spacer Box( size( 1, 20 ) ), // a little vertical space
H List Box( Text Box( "Frame size X: " ), framex = Number Edit Box( "." ) ), // data entry
Spacer Box( size( 1, 10 ) ), // a little vertical space
H Center Box( // center the button
Button Box( "Create graph", // this script runs when the button is pressed...
framex_value = framex << get ;
column("X coordinate")<<data type(Numeric)<<Modeling Type(Continuous)<<Format(Best,12);
New Column ( "New Y", Numeric, Nominal, Width( 5), Formula(Round(Y coordinate)));
dt =Current Data Table();
dt << select where( :New Y != 50503 );
dt << delete rows;
New Column ( "Normalized", Numeric, Continuous, Width( 10 ), Precision ( 7 ), Formula(IntenCD/Col Max(IntenCD)) );
New Column ( "Delta" , Numeric, Continuous, Width( 10 ), Precision ( 7 ), Formula(Col Max(IntenCD)-(Col Min(IntenCD))));
FullMat = matrix(Col Max(IntenCD)-(Col Min(IntenCD)));
New Column ( "Normalized Field", Numeric, Continuous, Width( 10 ), Precision ( 7 ));
//New Column ( "Normalized Field", Numeric, Continuous, Width( 10 ), Precision ( 7 ));
//dt << select where( :X coordinate > (76200 - framex_value/2) & :X coordinate < (76200 - framex_value/2) );
//dt << delete rows:
//FieldMat = matrix(Col Max(IntenCD)-(Col Min(IntenCD)));
New Window( " Delta results: ", modal,
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ), // window dressing
V List Box( // V and H lists nest to organize the display boxes
H List Box( Text Box( "Full plate delta: " ), TextBox( Char( FullMat ) ) ),
//Spacer Box( size( 1, 10 ) ), // a little vertical space
//H List Box( Text Box( "Full field delta: " ), TextBox( Char( FieldMat ) ) ),
//Spacer Box( size( 1, 10 ) ), // a little vertical space
//H List Box( Text Box( "Edge of field delta: " ), TextBox( Char( 0 ) ) ),
))
);
// Determine X Matrix
xMat = matrix(76200 - (framex_value/2)) |/ matrix(76200 - (framex_value/2)) |/
matrix(76200 + (framex_value/2)) |/ matrix(76200 + (framex_value/2));
// The yMat is static
yMat = [1, 0.92, 0.92, 1];
// The overall delta
overallDelta = Col Max( :Normalized ) - Col Min( :Normalized );
// The delta between the lines
withinOrangeDelta = Col Max(
If( :X coordinate > (76200 - (framex_value / 2)) & :X coordinate < (76200 + (framex_value / 2)),
:Normalize,
.
)
) - Col Max( :Normalized ) - Col Min( :Normalized );
withinOrangeDelta = Col Min(
If( :X coordinate > (76200 - (framex_value / 2)) & :X coordinate < (76200 + (framex_value / 2)),
:Normalize,
.
)
);
// The leftDelta and rightDelta calculations will be similar to the above withinOrangeDelta, but
// I don't know what the upper and lower boundry values of :Normalized are or what the interior
// boundrys for the calclations are
gb = dt << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :X Coordinate ), Y( :Normalized ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
Report( gb )[FrameBox( 1 )] << Add Graphics Script(
Pen Color( "orange" );
Pen Size( 2 );
Line( xmat, ymat );
// Add the results to the chart
text ( 500,.92, "Overall Delta = " || char(format(overallDelta, 7,4)));
text ( 500,.915, "Within Delta = " || char(format(withinOrangeDelta, 7,4)));
);
report(gb)[AxisBox(2)] << min(.91);
w << closeWindow; // just the dialog, not the report
)
)
)
)
);
Jim