cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
SDF1
Super User

How to have a preset graph for graph builder update axis upon re-running?

Hi All,

 

  Running JMP/JMP Pro on windows 11 machines.

 

  I am curious how to get around a very specific kind of problem -- and do it automatically (not manually). As an example, I am using the Air.jmp sample data table to show the issue at hand. I've attached a copy of the files with the script to show the problem.

 

  I have a data table where I'm adding data to it daily (sometimes weekly), and I have a built in script in the data table to plot data vs date. To mimic this, I split the Air.jmp data table into two halves and made the graph builder graph and then concatenated the "new" (second half of the data) to the first half of the other table and re-ran the script.

 

  Ideally I'd like to get an output where the graph builder date x-axis is automatically scaled to the most recent date, like this:

SDF1_0-1685642822659.png

 

  Instead, I get a graph where it only updates to the value of when I saved the last version of that graph builder script to the data table. So, the output looks like this:

SDF1_1-1685642878592.png

 

  This doesn't happen when you just graph the data points and don't modify the increment of the axis. The default increment on the axis for this data set (the first half) is 2 years. After you add the second half of the data, and rerun the script in the data table, it resets the default to 5 years and graphs all the data.

 

  However, if you change the default increment to 1 Month, for example, and save the script to the data table (first half), then add the new data and re-run the script, it keeps the axis settings the same as the original script -- it doesn't update to include the new data. The big difference in the script is the SendToReport command:

SendToReport(
		Dispatch(
			{},
			"date",
			ScaleBox,
			{Min( 1597574016 ), Max( 1925078400 ), Interval( "Month" ), Inc( 1 ),
			Minor Ticks( 1 )}
		)
	)

  In this command, there are the Min() and Max() date settings which are modified by the existing date range of the original data table. I'm not sure why this limitation is there and isn't updated to reflect new dates that are added to a data table and the script is re-run.

 

  Is there a way to get around this while maintaining the Month interval and also having the x-axis nested so that the months are also grouped in years? After adding new data to the table and re-running the script, I'd like the new graph to use the Min() and Max() settings from the latest data table, not from the original.

 

  Hopefully there's an easy fix for this. Otherwise, I think I'll put in a wish-list request that this is changed to allow for the Min() and Max() inputs for the axis to be updated automatically by the current values within the relevant column of the data table.

 

Thanks in advance for any thoughts/feedback!,

DS

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to have a preset graph for graph builder update axis upon re-running?

I think if you are fine with having empty places in plot you could just remove min and max from the sendtoreport.

Graph Builder(
	Size(522, 456),
	Show Control Panel(0),
	Graph Spacing(4),
	Variables(X(:date), Y(:Ozone Concentration)),
	Elements(
		Points(X, Y, Legend(3)),
		Smoother(
			X,
			Y,
			Legend(4),
			Lambda(0.0000231899600250505),
			Confidence of Fit(1)
		)
	),
	SendToReport(
		Dispatch(
			{},
			"date",
			ScaleBox,
			{Interval("Month"), Inc(1),
			Minor Ticks(1), Label Row Nesting(2)}
		)
	)
)

jthi_1-1685645980481.png

 

 

Or other option is to calculate them with a script and then add them with that (and you still might have to do some rescaling if JMP decides to add empty values).

Eval(EvalExpr(
		Current Data Table() << Graph Builder(
		Size(522, 456),
		Show Control Panel(0),
		Graph Spacing(4),
		Variables(X(:date), Y(:Ozone Concentration)),
		Elements(
			Points(X, Y, Legend(3)),
			Smoother(
				X,
				Y,
				Legend(4),
				Lambda(0.0000231899600250505),
				Confidence of Fit(1)
			)
		),
		SendToReport(
			Dispatch(
				{},
				"date",
				ScaleBox,
				{Min(Expr(Col Min(:date))), Max(Col Max(col max(:date))), Interval("Month"), Inc(1),
				Minor Ticks(1), Label Row Nesting(2)}
			)
		)
	)
));

jthi_0-1685645945225.png

 

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: How to have a preset graph for graph builder update axis upon re-running?

I think if you are fine with having empty places in plot you could just remove min and max from the sendtoreport.

Graph Builder(
	Size(522, 456),
	Show Control Panel(0),
	Graph Spacing(4),
	Variables(X(:date), Y(:Ozone Concentration)),
	Elements(
		Points(X, Y, Legend(3)),
		Smoother(
			X,
			Y,
			Legend(4),
			Lambda(0.0000231899600250505),
			Confidence of Fit(1)
		)
	),
	SendToReport(
		Dispatch(
			{},
			"date",
			ScaleBox,
			{Interval("Month"), Inc(1),
			Minor Ticks(1), Label Row Nesting(2)}
		)
	)
)

jthi_1-1685645980481.png

 

 

Or other option is to calculate them with a script and then add them with that (and you still might have to do some rescaling if JMP decides to add empty values).

Eval(EvalExpr(
		Current Data Table() << Graph Builder(
		Size(522, 456),
		Show Control Panel(0),
		Graph Spacing(4),
		Variables(X(:date), Y(:Ozone Concentration)),
		Elements(
			Points(X, Y, Legend(3)),
			Smoother(
				X,
				Y,
				Legend(4),
				Lambda(0.0000231899600250505),
				Confidence of Fit(1)
			)
		),
		SendToReport(
			Dispatch(
				{},
				"date",
				ScaleBox,
				{Min(Expr(Col Min(:date))), Max(Col Max(col max(:date))), Interval("Month"), Inc(1),
				Minor Ticks(1), Label Row Nesting(2)}
			)
		)
	)
));

jthi_0-1685645945225.png

 

-Jarmo
SDF1
Super User

Re: How to have a preset graph for graph builder update axis upon re-running?

Hi @jthi ,

 

  Thanks, that did it! I do prefer to use the Expr(Col Min( )) and Expr(Col Max( )) in the Min() and Max() arguments for the graph builder. And, nicely enough, JMP will do the padding for you on either end of the graph, which must be somehow scaled by how large of a time scale your graph is, as it seems with this data set, it pads 366 days.

 

Thanks for the quick response!,

DS