Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
abpc1
Level I

how to adjust Bivariate plot x axis scale with weekly date/time data

Hello everyone:

 

This is my first posting. I am still a neophite with JSL and I've been trying to solve my problem for couple of days. Here is the problem setup...

 

I have a datafile that I need to analyze every Friday. This datafile consists of a date/time log of some values captured real time. So every Friday, this datafile has a new date range. I wrote a script to plot this data in a bivariate plot where the x axis is date/time and the y axis is some parameter of interest:

 

trendChart = Bivariate(
	Y( :PARAMETER ),
	X( :DATE ),
	SendToReport(
		Dispatch(
			{},
			"1",
			ScaleBox,
			{Format( "m/d/y", 10 ), Min( minDate ), Max( maxDate ),
			Interval( "Day" ), Inc( 7 ), Minor Ticks( 6 ),
			Label Row( Label Orientation( "Vertical" ) )}
		),
		Dispatch(
			{},
			"2",
			ScaleBox,
			{Max( myMaxValue ), Label Row( {Show Major Grid( 1 ), Show Minor Grid( 1 )} )}
		),
		Dispatch(
			{},
			"Bivar Plot",
			FrameBox,
			{Frame Size( 720, 360 ), Row Legend(
				PROGRAM_NAME,
				Color( 1 ),
				Color Theme( "JMP Vibrant" ),
				Marker( 1 ),
				Marker Theme( "Hollow" ),
				Continuous Scale( 0 ),
				Reverse Scale( 0 ),
				Excluded Rows( 0 )
			)}
		)
	)
);

I want this plot to be automatically scaled in the x-axis so that the minimum point is the oldest date in the datafile and the maximum point is the youngest date in the datafile. I think the best way to do this is to have 2 variables that depend on the actual contents of the datafile, minDate and maxDate and I defined these as:

 

minDate = col min(dt1, :DATE);
maxDate = col max(dt1, :DATE);

Running these code snips in my larger script generates an empty plot (no data shown). Debugging shows that both minDate and maxDate are blank so I must not be defining these variables correctly. 

 

I would appreciate some insight. 

 

Thank you for your help. 

1 REPLY 1
Highlighted
txnelson
Super User

Re: how to adjust Bivariate plot x axis scale with weekly date/time data

The structure of the Col Min() function is

     

x = Col Min( Column, By Column );

The column you are specifying in your code

minDate = col min(dt1, :DATE);
maxDate = col max(dt1, :DATE);

appears to not be asking for the :Date column to find the minimum and maximum values for, but for a column called "dt1".  I assume that "dt1" is actually a pointer to your data table.  I believe your code should be:

minDate = col min( :DATE);
maxDate = col max( :DATE);

 

Jim
Article Labels

    There are no labels assigned to this post.