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
NBrammer
Level II

Add date and file name into any graph

Just wondering if anyone has written an addin or some script that will add the current date and file name (of the source data table) onto any graph/report generated?

I've turned on preferences<reports to make it appear at the top of the report window, but would like it actually on the graph so that when the these are copied and pasted into PP, for example, these details are clearly visible.

thanks

2 ACCEPTED SOLUTIONS

Accepted Solutions
hogi
Level XII

Re: Add date and file name into any graph

Without the references to the data table and to the plot, you can access the gb Object via the report / get scriptable object()  - and the data table via << get data table().
Maybe add some code to skip the LDF and Column Switcher ...

Names Default To Here(1); 
/*
open("$SAMPLE_DATA/Big Class.jmp");

Graph Builder(
	Variables(X(:weight), Y(:height), Overlay(:sex)),
	Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
);
*/



fbs = current report() << XPath("//FrameBox");
nfbs = N items(fbs); // add the info to the last FB

OBs= current report() << XPath("//OutlineBox");
gb = OBs[1] << get scriptable Object; // add some code to skip LDF and Column Switcher 

str = Char(As Date(Today())) || " " || ((gb << get data table()) << getname);

Eval(EvalExpr(
	fbs[nfbs] << Add Graphics Script(
		Text Color("Red");
		Text(Right Justified, {X Origin() + X Range(), Y Origin()}, Expr(str));
	);
));

View solution in original post

NBrammer
Level II

Re: Add date and file name into any graph

Brilliant - thanks

 

View solution in original post

3 REPLIES 3
jthi
Super User

Re: Add date and file name into any graph

It isn't really that simple to create a script which would work with any graph/report.

 

The basic idea could be something like this but this makes already assumptions that you have a reference to the table and the analysis object. It also assumes that all frameboxes are based on the same table

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

gb = dt << Graph Builder(
	Variables(X(:weight), Y(:height), Overlay(:sex)),
	Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
);


str = Char(As Date(Today())) || " " || (dt << getname);

fbs = Report(gb) << XPath("//FrameBox");
Eval(EvalExpr(
	fbs << Add Graphics Script(
		Text Color("Red");
		Text(Right Justified, {X Origin() + X Range(), Y Origin()}, Expr(str));
	);
));

but figuring out which is the correct table for example can get fairly complicated.

-Jarmo
hogi
Level XII

Re: Add date and file name into any graph

Without the references to the data table and to the plot, you can access the gb Object via the report / get scriptable object()  - and the data table via << get data table().
Maybe add some code to skip the LDF and Column Switcher ...

Names Default To Here(1); 
/*
open("$SAMPLE_DATA/Big Class.jmp");

Graph Builder(
	Variables(X(:weight), Y(:height), Overlay(:sex)),
	Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
);
*/



fbs = current report() << XPath("//FrameBox");
nfbs = N items(fbs); // add the info to the last FB

OBs= current report() << XPath("//OutlineBox");
gb = OBs[1] << get scriptable Object; // add some code to skip LDF and Column Switcher 

str = Char(As Date(Today())) || " " || ((gb << get data table()) << getname);

Eval(EvalExpr(
	fbs[nfbs] << Add Graphics Script(
		Text Color("Red");
		Text(Right Justified, {X Origin() + X Range(), Y Origin()}, Expr(str));
	);
));
NBrammer
Level II

Re: Add date and file name into any graph

Brilliant - thanks