Automatically create PDF reports with one page per graph/analysis for any number of variables.
Create a graph/analysis and customize it only once (for the first variable) and apply it to any number of variables while retaining all display options e.g., reference lines, colors etc.
Example: Creating a control chart for 100 variables Y1, Y2, ..., Y100
- Create a control chart for variable Y1 and customize it according to your needs
- Add-Ins -> Multi-Column PDF Export
- Select your report from the dialog
- Select variables for which the report should be replicated (including Y1)
-Select destination directory for the PDF report (report.pdf):
- Open output PDF file (see attached example):
Types of graphs/analysis that have been tested so far:
- Control Charts
- Fit Y by X
- Graph Builder
- Variability Charts / Measurement Systems Analysis
A short video illustrating how to use the Add-In:
Great tool, but I am having issues getting it to run consistently, especially when I run a script then utilize your add in. I seem to have more success with a fresh startup of JMP. Making the graphs manually seems to work, but not the scriptd versions. this is the error I get:
It might be the fact that I have a local data filter in the scripted ones? But I swear it worked at some point!
Thanks
It seems like some of the objects won't allow you to send << Column Switcher to them unless you correctly define the initial choice (at least not in JMP17)
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
gb = dt << Graph Builder(
Size(1048, 476),
Show Control Panel(0),
Variables(X(:lot_id), Y(:PNP1)),
Elements(Points(X, Y, Legend(8)))
);
gb << Column Switcher("NPN1", {"NPN1", "PNP1", "PNP2","NPN2"});
dist = dt << Distribution(
Continuous Distribution(Column(:PNP1), Process Capability(0)),
Histograms Only
);
dist << Column Switcher("NPN1", {"NPN1", "PNP1", "PNP2","NPN2"});
ow = dt << Oneway(Y(:PNP1), X(:SITE));
ow << Column Switcher("NPN1", {"NPN1", "PNP1", "PNP2","NPN2"});
You might be able to workaround this by always including the current Y column as first in the column listing in add-in
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
gb = dt << Graph Builder(
Size(1048, 476),
Show Control Panel(0),
Variables(X(:lot_id), Y(:PNP1)),
Elements(Points(X, Y, Legend(8)))
);
gb << Column Switcher("PNP1", {"NPN1", "PNP1", "PNP2","NPN2"});
Here is a script which might be able to tackle that issue in some cases
Names Default To Here(1);
report_windows = Get Window List(Type("Reports")) << Get Window Title();
If(N Items(report_windows) == 0,
Throw("No report windows open");
);
nw = New Window("Select a Report", <<Modal, << return result,
hb = H List Box(
Panel Box("Select a report window",
lb = List Box(report_windows, Max Selected(1))
),
Panel Box("Actions",
Lineup Box(N Col(1),
Button Box("OK"),
Button Box("Cancel")
)
)
)
);
If(nw["Button"] != 1,
stop();
);
selected_window = Window(nw["lb"][1]);
obs_platform = (selected_window << XPath("//OutlineBox[@helpKey]"));
report = Empty();
For Each({ob_platform}, obs_platform << Get Scriptable Object,
// Three checks
If(Is Scriptable(ob_platform),
If((ob_platform << window class name) == "Report",
report = ob_platform;
);
)
);
If(IsEmpty(report),
Throw("No report found from report window");
);
dt = report << Get Data Table();
nw = New Window("Col Selections", << modal, << return result,
H List Box(
Panel Box("Select Colums",
fcs = Filter Col Selector(Datatable(dt))
),
Panel Box("Cast Columns",
Lineup Box(N Col(2),
Button Box("Y", << Set Function(function({this}, (this << sib) << append(fcs << get selected)))),
clb = Col List Box(Datatable(dt), Min Items(1))
)
),
Panel Box("Actions",
Lineup Box(N Col(1),
Button Box("OK",
cols = clb << get items;
),
Button Box("Cancel")
)
)
)
);
If(nw["Button"] != 1,
stop();
);
If(N Items(cols) < 1,
Throw("No columns selected"); // Should be moved to validator
);
save_path = Pick Directory("Select a directory");
new_report = report << Redo Analysis;
new_report << Show Window(0);
yexpr = Eval(EvalExpr(
Extract Expr(Expr(new_report << get script), Y(Wild())
)));
If(Is Empty(yexpr),
yexpr = Eval(EvalExpr(
Extract Expr(Expr(new_report << get script), Column(Wild())
)));
);
ycol = Arg(yexpr, 1);
ycolname = ycol << get name;
wait(0);
col_switcher = new_report << Column Switcher(ycolname, cols);
ncols = Length(col_switcher << Get List);
jrn = New Window("Reports", << Journal);
For(i = 1, i <= ncols, i++,
newrep = new_report << Report;
newrep << Show Window(0);
jrn << Append(newrep);
col_switcher << Next;
);
new_report << Remove Column Switcher;
jrn << Set page setup(margins(0.5, 0.5, 0.5, 0.5), scale(.7), portrait(0), paper size("Letter"));
jrn << save pdf(save_path || (selected_window << get window title) || "_report.pdf", Portrait(0));
jrn << Close Window;
new_report << Close Window;
wait(0);
Open(save_path);
Write();
Holy mackeral. That's stellar. Thanks a TON!