以下代码片段的目的是绘制Current与Time 的关系。我有多个通过Serial区分的设备。
在 GraphBuilder 上,我按“页面”对序列进行分组。由于我的设备数量不定,因此页面数量也不定。
在设置比例时,我为每个页面(设备)设置了一条“调度”行 - 因此下面我有四条调度行来更新每个设备的四个图表。
如何在所有的 GraphBuilder 页面上实现相同的比例和图表设置?谢谢!
//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);})
);
);
您很可能将 Eval(EvalExpr()) 与 Expr() 一起使用使用 Eval Insert、Eval Expr、Parse 和 Substitute 将一个表达式插入另一个表达式,但我会尝试使用 XPath(或没有 XPath 的类似方法)来解决这个问题,因为这更灵活且更容易修改(在我看来)。
下面是使用 :age 作为页列并修改 x 轴 (:weight) min、max 和 inc 的 Big Class 表示例。 它也有一些调试打印,出于某种原因,有 7 个 scalebox,但只有 6 个组
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);