Choose Language Hide Translation Bar
Highlighted
bio_grad
Level III

Possible to lock lower-bound of animation variable?

Hello,

 

I find the animation function incredibly useful to quickly scan through my data.

 

I have a dataset of three columns, time, variable 'X' and variable 'Y'. Plotting X vs. Y and running the animation over time is of interest but it seems that I can only set the start and end times and it keeps that same fixed time span as it progresses in time.

 

What I would like to do is have the upper time filter bound scan from 0 to time X but keep the lower time filter bound remain at zero which would essentially give me an infinite persist of the X vs. Y plot.

 

Does anyone know if this is possible? Thanks!

9 REPLIES 9
Highlighted
txnelson
Super User

Re: Possible to lock lower-bound of animation variable?

If you right click on on the axis you want to have fixed at 0 and set the minimum value of the axis to 0, you can then use a local data filter and the minimum value will remain static.  Below is a sample Script that show an example

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
Bivariate(
	Y( :height ),
	X( :weight ),
	Automatic Recalc( 1 ),
	Local Data Filter( Add Filter( columns( :age ), Display( :age, Size( 160, 90 ), List Display ) ) ),
	SendToReport( Dispatch( {}, "2", ScaleBox, {Min( 0 )} ) )
);
Jim
Highlighted
bio_grad
Level III

Re: Possible to lock lower-bound of animation variable?

Hi Jim,

 

Thank you for the reply. I am not sure what you mean by right-clicking on the axis and setting the min value.

 

I have a plot of Y vs. X but the animation that I would like to run is over a third variable (time), so there is no axis, just a data filter.

Highlighted
txnelson
Super User

Re: Possible to lock lower-bound of animation variable?

Could you please provide an example of the data and display you are attemping to set values for?  That would certainly be helpful in making sure I understand your request.

Jim
Highlighted
bio_grad
Level III

Re: Possible to lock lower-bound of animation variable?

Hi Jim,

 

If you take a look at the CO2.jmp sample dataset.

 

As a simple example of what I am trying to do would be to plot "CO2" on the y-axis and "Month" on the x-axis and have the Local Data Filter animation to sweep the "Year&Month" column but keep the lower-bound static while the upperbound is free to move and then loop back to the beginning.

 

Below are four snapshots in time of what it would look like.

 

animation_example.png

Highlighted

Re: Possible to lock lower-bound of animation variable?

The quick and dirty way would be to alter the graph builder script text directly with decreasing end years but fixed start years. You could generate a whole bunch of graph builder windows that directly overlapped and then close them sequentially with appropriate wait periods to give your desired effect.
Highlighted

Re: Possible to lock lower-bound of animation variable?

Another option for a work around.  Add the same filter 4 times using the "Or" option instead of "Add".  The image below shows what it will look like.  If you only want certain filters on then click the red hotspot for the slider of choice and click "Clear Selection"

Capture5.JPG

Highlighted
bio_grad
Level III

Re: Possible to lock lower-bound of animation variable?

I think my example may have derailed my initial question. 

 

I just chose four snapshots in time to illustrate the progression as I don't know how to save a GIF or video of the animation that I want to generate.

 

I want to create an animation of my data where the lower filter bound of the time variable stays at the minimum value in that column (time=0) and have the upper bound 'animated' to go from time=0 to end and loop.

Highlighted
bio_grad
Level III

Re: Possible to lock lower-bound of animation variable?

The Bubble Plot platform seems to be able to perform what I need but its maximum speed is very slow. My data is sample at 10 samples/s and ideally I would like to have the animation run 100x faster.

Highlighted
ih
ih
Level VII

Re: Possible to lock lower-bound of animation variable?

First a shameless plug for my own feature request: if nested data filter context boxes could be conditional on eachother this would be easy.

 

Hopefully someone knows of an easier way but my workaround for similar situations is to subset the data table and build the chart using that filtered table, like this:

 

maxdate.PNG

 

Names default to here( 1 );

dt = Open( "$Sample_data/Time Series/Raleigh Temps.jmp" );
dtfltrd = .;

enddate_unused = Date dmy( 1, 1, 1990 );

UpdateGraph = function( {enddate},
	
	//Close the subset data table
	Try( dtfltrd << Close Window; );
	
	//Make a subset table linked to the original table that is filtered based on the slider
	dtfltrd = dt << Subset( 
		Private, 
		Rows( Loc( ( Column( dt, "Month/Year" ) << Get values) <= enddate ) ),
		Link to original data table( 1 )
	);
	
	//Remove the existing graph
	Try( (bb_graph << Child ) << Delete );
	
	//add a new graph that only contains data in the subset data table
	bb_graph << Append(
		dtfltrd << Graph Builder(
			Size( 553, 561 ),
			Show Control Panel( 0 ),
			Variables( X( :Temperature ), Y( :Predicted Temperature ) ),
			Elements( Smoother( X, Y, Legend( 508 ) ), Points( X, Y, Legend( 509 ) ) ),
			Local Data Filter(
				Add Filter(
					columns( :Name( "Month/Year" ) )
				),
				Animation( Animate Column( :Name( "Month/Year" ) ), Animate Rate( 4 ) )
			)
		)
	);
	
	//Update text box with the filtered date
	tb_enddate << Set Text( Format( enddate, "yyyy-mm-dd" ) );
);
 
win = New Window( "Animation",
	H List Box(
		V List Box(
			H Center Box( Text Box("Set Max Date:", Set Font Style( "bold" ) ) ),
			H Center Box( tb_enddate = Text Box() ),
			H Center Box( sb_enddate = Slider Box(
				Col Min( Column( dt, "Month/Year" ) ),
				Col Max( Column( dt, "Month/Year" ) ),
				enddate_unused,
				UpdateGraph(enddate_unused)
			) ),
			<< Margin( 10 )
		),
		bb_graph = Border Box()
	)
);

//Put the first graph in the box
UpdateGraph( Date mdy( 1, 1, 1990 ) );

 

 

Article Labels

    There are no labels assigned to this post.