Choose Language Hide Translation Bar
Highlighted
mikedriscoll
Level VI

JMP script progress indicator

Hi,

With some searching on this forum and digging in the JMP scripting book, I've managed to mostly get my progress script working.  The only thing I don't like is that the vertical (y) axis has numbers on it. Can I turn these off? I was not able to find a way to do this.  Not sure if I should be using something other than a graph box() but my knowledge of this is fairly limited.

dlgStatus = new window("Conversion Progress",

    dlg_gb = graph box(

        Title ("Conversion Progress"),

        FrameSize ( 200, 30),

        xscale(0,100),

        yscale(0, 1), // <---- how to turn off so i don't see the y axis values?

        yaxis (show major ticks (0), show minor ticks (0)),

       

        xname("% complete"),

        yname("")

    )

);

dlgStatus[FrameBox(1)] << Add Graphics Script({Fill Color("blue"),Rect(0,1,50,0,1)}); // 50% on a scale to 100% shown in the xscale above. does not get scaled to the pixel count in frame size()

dlgStatus[FrameBox(1)] << Add Graphics Script({Fill Color("blue"),Rect(0,1,75,0,1)}); // 75% on a scale to 100% shown in the xscale above.

// above is just  a test.  the 50 and 75 would be a loop index variable divided by loop count, in my real script. It would get executed once in each loop iteration.

dlgStatus << closewindow();

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
pmroz
Super User

Re: JMP script progress indicator

You can get rid of the axes with these commands:

 

 

dlg_gb[AxisBox( 2 )] << Delete;
dlg_gb[AxisBox( 1 )] << Delete;

 


Put these two lines just before the first dlgStatus[FrameBox(1)]... command.

View solution in original post

4 REPLIES 4
Highlighted
pmroz
Super User

Re: JMP script progress indicator

You can get rid of the axes with these commands:

 

 

dlg_gb[AxisBox( 2 )] << Delete;
dlg_gb[AxisBox( 1 )] << Delete;

 


Put these two lines just before the first dlgStatus[FrameBox(1)]... command.

View solution in original post

Highlighted
mikedriscoll
Level VI

Re: JMP script progress indicator

Thanks, that worked perfectly.

The (1) got rid of my y axis. I left the (2) in place to show %.

I also found I needed a bit of a wait (more than a wait(0);) to update the graphic... here is the end of my loop where i update the graph box:

    progress = floor((paramNum / numParams)*100);
    dlgStatus[FrameBox(1)] << Add Graphics Script({Fill Color("blue"),Rect(0,1,progress,0,1)}); //update progress
   wait(0.001);

    );

Not sure if i needed the "floor" function but it doesn't hurt in my case.

Highlighted

Re: JMP script progress indicator

I think that @pmroz offers a simple direct solution that is safe in this case. Be aware, though, that using the << Delete message to remove an display box object from the display tree might be dangerous in other cases. There are at least two other approaches for this reason. In general, you can modify the visibility of a display box with the << Visibility() message. Use the Collapse argument in this case. The other is a unique protocol for the Axis Box object. See examples here:

 

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

biv = dt << Bivariate( Y( :weight ), X( :height ), Fit Line );

axis box = Report( biv )[AxisBox( 1 )];

axis box << Remove Axis Label( "weight" );
axis box << Show Major Labels( 0 );
axis box << Show Major Ticks( 0 );
Learn it once, use it forever!
Highlighted
DS
DS
Level VI

Re: JMP script progress indicator

Hi @mikedriscoll and @pmroz,

 

  I recently came across this post as I was wanting to generate a similar progress window that actually gave the iteration number X out of Y in a long modeling run. Anyway, I took your solution and modified it and added to one that I was working on here., so now I have both the progress bar and actual numbers. I like it. I'll probably have to modify it for my user's preferences, but it's a great start. Thanks for starting this discussion!

Names Default To Here( 1 );
i = 1;
imax = 100;
dlgStatus = New Window( "Overall Modeling Progress",
	V List Box(
		dlg_gb = Graph Box(

			Title( "Overall Modeling Progress" ), 

			FrameSize( 150, 15 ), 

			X Scale( 0, 100 ), 

			Y Scale( 0, 1 ), 

			yaxis( show major ticks( 0 ), show minor ticks( 0 ) ), 

       

			xname( "% complete" ), 

			yname( "" )

		),
		tb = Text Box(
			" Current step " || Char( i ) || " of " || Char( imax ),
			<<Set Font Size( 12 ),
			<<Justify Text( "center" ),
			<<Set width( 200 )
		)
	)
);

dlg_gb[Axis Box( 2 )] << Delete;
dlg_gb[Axis Box( 1 )] << Delete;

For( i = 1, i <= imax, i++,
	prog = (i / imax) * 100;
	dlgStatus[FrameBox( 1 )] << Add Graphics Script( {Fill Color( "blue" ), Rect( 0, 1, prog, 0, 1 )} );
	tb << set text( " Current step " || Char( i ) || " of " || Char( imax ) );
	Wait( 0.1 );
);

dlgStatus << closewindow();

Snap1.png

DS

 

Article Labels

    There are no labels assigned to this post.