Here is an expansion of Jim's example that conditionally applies line style to the Overlay levels by looping over a list of levels.
In Graph Builder, each overlay level seems to be adressed by a number starting at 0. The order differs from the default if the Overlay column has a Value Ordering property. Thus, the ordering of levels needs to be considered when creating the list.
Names Default To Here(1);
// Example data table
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << New Column("group",
Character,
Formula(
If(
:sex == "F" & :height < Col Mean(:height, :sex), "F short",
:sex == "F" & :height >= Col Mean(:height, :sex), "F tall",
:sex == "M" & :height < Col Mean(:height, :sex), "M short",
"M tall"
)
)
);
// Graph builder with Overlay
OverlayCol = Column(dt, "group");
gb = Graph Builder(
Size(528, 447),
Show Control Panel(0),
Variables(X(:age), Y(As Column(YCol)), overlay(group)),
Elements(Line(X, Y)),
);
// Apply line style to overlay values that fulfill criteria
lstyle = "Dotted";
criteria = "M ";
Summarize(g = by(OverlayCol)); // List of overlay levels (alphabethical order)
// Uncomment below line if Value Ordering property is set for the Overlay column
// g=OverlayCol<<get property(value ordering); // List of overlay levels (custom order)
For(i = 1, i <= N Items(g), i++,
If(Contains(g[i], criteria),
gb << SendToReport(
Dispatch({}, "400", ScaleBox,
{Legend Model(4, Properties(i - 1, {Line Style(lstyle)}))}
)
)
)
);