Add date and file name into any graphJust 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
thanks
Sharing and Communicating ResultsRe: Add date and file name into any graphIt 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.
Re: Add date and file name into any graphWithout 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));
);
));Re: Add date and file name into any graphBrilliant - thanks