cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to use Accelerated Life Testing (ALT) to evaluate reliability. Register for June 5 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
SCWong
Level II

Reference line

Hi, I'm trying to edit a graph builder script to use my table variables instead to plot the reference lines in the graphs. it's a plot of pressure drop vs dates. I have no issues with the y axis reference line, but the x axis reference line is giving me issues. I tried using the Date MDY() function to incorporate my table variables but it's not working.
5 REPLIES 5
txnelson
Super User

Re: Reference line

  1. Is the X axis a numeric column?
  2. Is the X axis a JMP Date/Time column?
  3. Table variables are all character strings.  Are you trying to use it as a character, and the X axis is a numeric.  If so, you need to convert it to a numeric.
  4. Can you provide a sample data table, and a sample of the graph?
Jim
SCWong
Level II

Re: Reference line

Hi, x axis is a date/time column while y axis is a numeric continuous column. I plotted y vs x and saved the graph as a script. The reference lines were manually added inside e.g. y axis = 7, and x axis = 9/1/2023.
I then created a table variables called dp limit with a value of 7. I edited the graph script and replaced the reference line input to :dp limit, and it worked. So when I changed the dp limit variable, the graph reference line is changed. I can't do the same for the x axis reference line. It's a series of numbers in the script which I think is the date/time in seconds format. I'm not sure what I should input as a table variables for it to work. Hope this is clearer, thanks!
txnelson
Super User

Re: Reference line

The table variable is a character string, as I mentioned before.  The JMP DateTime values are the number of seconds since January 1, 1904.  So before you can use the table variable, it needs to be converted into a DateTime value.  In the JSL below, I choose to use an Informat() function to convert the value.

ref.PNG  

Names Default To Here( 1 );
dt = New Table( "Example",
	Add Rows( 355 ),
	New Table Variable( "Reference Date", "07/15/2001" ),
	New Column( "Event Date",
		Format( "m/d/y", 12 ),
		Input Format( "m/d/y" ),
		Set Values(
			[3061584000, 3061584000, 3061756800, 3061756800, 3062016000, 3062102400, 3062275200, 3062275200, 3062361600, 3062361600, 3062620800,
			3062707200, 3062880000, 3062966400, 3063052800, 3063139200, 3063139200, 3063139200, 3063398400, 3063484800, 3063830400, 3064089600,
			3064089600, 3064089600, 3064262400, 3064262400, 3064348800, 3064348800, 3064435200, 3064435200, 3064435200, 3064608000, 3064608000,
			3064694400, 3064780800, 3064867200, 3064867200, 3064953600, 3065040000, 3065040000, 3065040000, 3065126400, 3065299200, 3065299200,
			3065385600, 3065472000, 3065558400, 3065731200, 3065990400, 3066163200, 3066422400, 3066681600, 3066854400, 3066940800, 3066940800,
			3066940800, 3067027200, 3067200000, 3067804800, 3067891200, 3067891200, 3068064000, 3068236800, 3068409600, 3068582400, 3068668800,
			3068755200, 3068841600, 3068841600, 3068841600, 3068928000, 3069014400, 3069014400, 3069360000, 3069446400, 3069532800, 3069619200,
			3069619200, 3069705600, 3069705600, 3069705600, 3069878400, 3070051200, 3070051200, 3070310400, 3070310400, 3070396800, 3070483200,
			3070742400, 3070742400, 3070742400, 3070915200, 3071088000, 3071174400, 3071260800, 3071260800, 3071433600, 3071433600, 3071520000,
			3071865600, 3071952000, 3071952000, 3072384000, 3072384000, 3072470400, 3072470400, 3072556800, 3072556800, 3072556800, 3072643200,
			3072643200, 3072729600, 3072816000, 3072988800, 3073075200, 3073248000, 3073334400, 3073334400, 3073334400, 3073507200, 3073507200,
			3073680000, 3073680000, 3073766400, 3073766400, 3073766400, 3073852800, 3073852800, 3073852800, 3073939200, 3074284800, 3074284800,
			3074371200, 3074371200, 3074371200, 3074371200, 3074371200, 3074371200, 3074457600, 3074630400, 3074630400, 3074716800, 3074976000,
			3074976000, 3075062400, 3075235200, 3075321600, 3075321600, 3075408000, 3075494400, 3075494400, 3075494400, 3075494400, 3075494400,
			3075494400, 3075494400, 3075667200, 3075926400, 3075926400, 3076012800, 3076099200, 3076185600, 3076185600, 3076272000, 3076272000,
			3076272000, 3076876800, 3076876800, 3076963200, 3077222400, 3077308800, 3077308800, 3077568000, 3077568000, 3077654400, 3077654400,
			3077740800, 3077827200, 3077827200, 3077913600, 3077913600, 3078000000, 3078000000, 3078172800, 3078259200, 3078345600, 3078432000,
			3078518400, 3078518400, 3078518400, 3078518400, 3078518400, 3078604800, 3078604800, 3078691200, 3078777600, 3078777600, 3078777600,
			3078950400, 3078950400, 3078950400, 3079123200, 3079123200, 3079123200, 3079123200, 3079123200, 3079209600, 3079296000, 3079296000,
			3079382400, 3079382400, 3079468800, 3079468800, 3079641600, 3079728000, 3079728000, 3079814400, 3079814400, 3079814400, 3080160000,
			3080160000, 3080246400, 3080246400, 3080332800, 3080332800, 3080419200, 3080419200, 3080505600, 3080592000, 3080678400, 3080851200,
			3081024000, 3081024000, 3081024000, 3081196800, 3081283200, 3081283200, 3081369600, 3081369600, 3081369600, 3081456000, 3081456000,
			3081456000, 3081456000, 3081542400, 3081628800, 3081715200, 3081715200, 3081715200, 3081715200, 3081888000, 3081974400, 3082060800,
			3082060800, 3082060800, 3082492800, 3082492800, 3082492800, 3082492800, 3082752000, 3082838400, 3082838400, 3082838400, 3082924800,
			3083011200, 3083011200, 3083011200, 3083011200, 3083270400, 3083443200, 3083961600, 3084134400, 3084134400, 3084220800, 3084480000,
			3084566400, 3084566400, 3084739200, 3084912000, 3084912000, 3084998400, 3084998400, 3085084800, 3085257600, 3085516800, 3085516800,
			3085776000, 3086035200, 3086035200, 3086208000, 3086208000, 3086294400, 3086294400, 3086380800, 3086467200, 3086467200, 3086553600,
			3086553600, 3086553600, 3086553600, 3086640000, 3086985600, 3087072000, 3087244800, 3087244800, 3087331200, 3087590400, 3087590400,
			3087590400, 3087676800, 3087676800, 3087763200, 3087936000, 3088022400, 3088195200, 3088281600, 3088368000, 3088368000, 3088368000,
			3088454400, 3088540800, 3088627200, 3088713600, 3088713600, 3088886400, 3088972800, 3089145600, 3089145600, 3089232000, 3089232000,
			3089232000, 3089232000, 3089664000, 3090009600, 3090096000, 3090268800, 3090355200, 3090528000, 3090700800, 3090700800, 3090700800,
			3090787200, 3090873600, 3090960000, 3090960000, 3090960000, 3090960000, 3091132800, 3092083200, 3092256000, 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4,
			2, 1, 2, 1, 1, 1, 1, 5, 1, 1, 2, 2, 2, 2, 2, 4, 1, 2, 1, 4, 2, 1, 2, 2, 3, 1, 3, 4, 1, 2, 3, 2, 1, 1, 1, 1]
		)
	)
);

gb = Graph Builder(
	Size( 531, 464 ),
	Show Control Panel( 0 ),
	Variables( X( :Event Date ), Y( :Total Fatal Injuries ) ),
	Elements( Points( X, Y, Legend( 5 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Event Date",
			ScaleBox,
			{Min( 3059894016 ), Max( 3093859584 ), Interval( "Month" ), Inc( 1 ),
			Minor Ticks( 1 ), Label Row( Label Orientation( "Angled" ) )}
		),
		Dispatch(
			{},
			"Total Fatal Injuries",
			ScaleBox,
			{Format( "Best", 10 ), Min( -0.147373575211003 ),
			Max( 11.0505783676065 ), Inc( 2.5 ), Minor Ticks( 0 )}
		)
	)
);

gbr = gb << report;

refDate =informat(:Reference Date, "m/d/y");

gbr[axisbox(1)] << add ref line( refDate );
Jim
SCWong
Level II

Re: Reference line

Thanks that solved my problem, I just added Informat(:variable) into the ref line input and that solved the problem
Craige_Hales
Super User

Re: Reference line

Jim probably asked the right question, but here's an example Use Summary to Automatically Add Reference Lines to Graph Builder 

Craige

Recommended Articles