The snippet's goal below is to plot Current against Time. I have multiple devices differentiated by Serial.
On GraphBuilder, I group the Serial by "pages". Since I have a variable number of devices, I have a variable number of pages.
In setting the scale, I have a "dispatch" line per number of page (device) -- so below I have four dispatch lines to update the four charts for each device.
How do I go about implementing the same scale and chart settings across all GraphBuilder pages? Thanks!
//t0 is minimum time
//tn is maximum time
Graph Builder(
Size(700, 5000),
Show Control Panel(0),
Variables(
X(:Column(Time)),
Y(:Column(Current)),
Page(:Serial)
),
Elements(
Points(X, Y(2), Legend(1)),
Points(X, Y(1), Legend(2))
),
SendToReport(
Dispatch({}, "Time (H)", ScaleBox(2),
{Min(t0), Max(tn), Inc(inc);}),
Dispatch({}, "Time (H)", ScaleBox(3),
{Min(t0), Max(tn), Inc(inc);}),
Dispatch({}, "Time (H)", ScaleBox(4),
{Min(t0), Max(tn), Inc(inc);}),
Dispatch({}, "Time (H)", ScaleBox(5),
{Min(t0), Max(tn), Inc(inc);})
);
);
You could most likely use Eval(EvalExpr()) with Expr() Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute , but I would try to solve this most likely with XPath (or similar method without XPath) because this is more flexible and easier to modify (in my opinion).
Below is example with Big Class table using :age as page column and modifying x-axis (:weight) min, max and inc. It also has some debug prints and for some reason there are 7 scaleboxes but only 6 groups
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(529, 2957),
Show Control Panel(0),
Variables(X(:weight), Y(:height), Page(:age)),
Elements(Points(X, Y, Legend(7)), Smoother(X, Y, Legend(8)))
);
Summarize(dt, uniq_groups = by(:age));
Show(N Items(uniq_groups));
rep = Report(gb);
//Show(rep << Get XML);
scale_boxes = rep << XPath("//ScaleBox[@charID='weight']");
Show(N Items(scale_boxes)); //this has one extra when compared to groups, not sure (yet) why
scale_boxes << Min(10);
scale_boxes << Max(200);
scale_boxes << Inc(5);