That's fascinating that you can start i at 0 and it just 'magically' iterates like that... I got the errors pasted below, but seems to have at least worked some. I created a show(i) command just before creating the graphInfo variable.
It seems to have worked great for the two graphs, but for some reason it also iterated two more times resulting in an inability to locate biv[i] ... so I wrapped that part in a Try() and it seemed to work as necessary!
1) I am not sure why "i" iterates like that or when I could potentially utilize that for other functions in jsl
2) I am not sure why it seems to iterate two more times ... one per graph, one per graphics script??
3) Thank you so much for the help here... I may not understand the how/why it works yet, but if I can get it to work consistently, that's the win!
Names default to here(1);
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
i=0;
biv = dt << Bivariate(
Y( :height ),
X( :weight ),
By( :sex ),
SendToReport(
Dispatch(
{},
"1",
ScaleBox,
{Format( "Fixed Dec", 12, 0 ), Min( 30 ), Max( 180 ), Inc( 20 ),
Minor Ticks( 1 )}
),
Dispatch(
{},
"Bivar Plot",
FrameBox,
{Add Graphics Script(
2,
Description( "" ),
i++;
test = Associative Array( {{"F", {0.1, 50}}, {"M", {.8, 0}}} );
///gather graph info to get "F" or "M" from output
show(i);
Try(
graphInfo = word(2,report(biv[i])[OutlineBox(1)] << get title,"=");
show(graphinfo);
);
Y Function( test[graphInfo][1] * x + test[graphInfo][2], x );
), Grid Line Order( 1 ), Reference Line Order( 3 )
}
)
)
);