Hi @txnelson , @Craige_Hales , and @David_Burnham ,
Thanks again for your previous help. I'm hoping you might be able to help me on another aspect of this side project.
As mentioned in my last reply, I would like to implement this in a way that would be a toolbar hotbutton item that users in my organization can "install" in their JMP, like add-ins. That part I know how to do. What I'm stuck on is how to treat an existing open window as a report so you can manipulate it like in the above code on this post.
For example, a user opens the Big Class.jmp file, then manually starts using Graph Builder to plot height vs. weight. This opens a child window under the Big Class data table called Big Class - Graph Builder. I know how to get window names and all that, but unlike in the previous code, I don't have the following
gb = dt << Graph Builder( Show Control Panel( 0 ),
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 4 ) ) )
);
So I can't reference gb using Report (gb), where it's used for the following manipulations in the example code from Craige:
theMax = Max( Report( gb )[axisbox( 1 )] << get max, Report( gb )[axisbox( 2 )] << get max );
theMin = Min( Report( gb )[axisbox( 1 )] << get min, Report( gb )[axisbox( 2 )] << get min );
Report( gb )[framebox( 1 )] << Xaxis( Min( theMin ), Max( theMax ) );
Report( gb )[framebox( 1 )] << Yaxis( Min( theMin ), Max( theMax ) );
Report( gb )[framebox( 1 )] << AddGraphicsScript(Y Function(x,x), Pen Color("blue"));
Report( gb )[framebox( 1 )] << AddGraphicsScript(
xmin = X Origin();
xmax = X Origin() + X Range();
ymin = Y Origin();
ymax = Y Origin() + Y Range();
Pen Color( "red" );
Pen Size( 3 );
Line Style( "dotted" );
Line( {xmin, ymin}, {xmax, ymax} );// the diagonal
);
In this kind of coding, it's easy to reference the report gb because you sent the command to the data table when doing gb = dt << Graph Builder (.....). In my case, I wouldn't have that because the user is doing this manually (with whatever graph he's creating).
I'd like to make a toolbar hotbutton that one could push, the code then gets the current Graph Builder window name (in case there is more than one instance of Graph Builder open for that data table), and then performs the squarify and diagonal line as solved from before. I'm stumped on how to go from a window's name to assigning it as a report so all the other code can work.
Many thanks in advance!,
DS