cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
sanford78AQH
Level I

How to make time duration responsive to graph axis limits?

Hello,

 

I have a datatable that consists of:

  • absolute date-time
  • duration in seconds from first timestamp
  • datapoints associated with each date-time

 

When I plot the datapoints I often place duration on the X-axis and then crop / filter the X-axis to a period of interest.

 

However when cropping the X-axis in the graph builder the duration no longer starts at "zero". What is the simplest way to always start the duration at time "zero" in the graph? I'd like to do this so the graph cleaner and easier to read.

 

If it's possible to do this without modifying the underling data-table and simply change the axis display behavior that would be great. Otherwise I assume I might need to reference the graph window axis limits in the duration column formula - but after some searching I'm not seeing how to do to this.

 

Thanks in advance for any help or suggestions!

1 REPLY 1
jthi
Super User

Re: How to make time duration responsive to graph axis limits?

The solution I'm going to propose will require formula, global data filter (this will affect the datatable) and some scripting. Idea is to use formula column as X-axis which will always re-calculate the duration based on the first NON-excluded row:

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

dt << New Column("Date", Numeric, Continuous, Set Each Value(Today() + Row()));

dt << New Column("TimeSinceStart", Numeric, Continuous, Set Each Value(:Date - :Date[1]));

dt << New Column("TimeWithFormula",
	Numeric,
	"Continuous",
	Format("Best", 12),
	Formula(If(!Excluded(), :Date - Col Min(:Date, !Excluded()), .))
);

nw = New Window("",
	H List Box(
		dt << Data Filter(
			Mode(Include(1)),
			Add Filter(columns(:Date))
		),
		gb = dt << Graph Builder(
			Size(535, 457),
			Show Control Panel(0),
			Variables(X(:TimeWithFormula), Y(:weight)),
			Elements(Points(X, Y, Legend(3)), Smoother(X, Y, Legend(4)))
		)
	)
);

There are other ways to do this, but this should be fairly simple option

-Jarmo