I think this will require some scripting using filter change handler as those lines do not follow row states / value color column property (also if there is just single point, no line will be fit). I'm not sure what you mean by "not working for other filters"?
This might not be very robust option due to how filter change handler works, but first idea I came up with...
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Column(dt, "age") << Set Property(
"Value Colors",
{12 = -13912408, 13 = -4042310, 14 = -4354269, 15 = -13400361, 16 = -2668175, 17 = -10628061}
);
nw = new window("",
Lineup Box(
biv = dt << Bivariate(
Y(:height),
X(:weight),
Automatic Recalc(1),
SendToReport(
Dispatch({}, "1", ScaleBox, {Label Row(Label Orientation("Angled"))}),
Dispatch(
{},
"2",
ScaleBox,
{Min(-5), Max(250), Inc(7), Minor Ticks(1), Add Ref Line(30, "DashDot", "Red", "UCL", 2),
Label Row(Show Major Grid(1))}
),
Dispatch({}, "Bivar Plot", FrameBox, {Frame Size(800, 250)}),
Dispatch(
{},
"Bivar Plot",
FrameBox,
{Frame Size(800, 250), Row Legend(
age,
Color(1),
Color Theme(""),
Marker(0),
Marker Theme(""),
Continuous Scale(0),
Reverse Scale(0),
Excluded Rows(0)
)}
)
)
);
)
);
ldf = biv << Local Data Filter(
Conditional,
Add Filter(
columns(:sex, :name, :age),
Where(:sex == "M")
)
);
summarize(dt, groups = by(:age)); // based on your By column
fitlines = Function({a},
For(i = 1, i <= N Items(groups), i++,
biv << (Curve[1] << remove fit);
);
biv << group by(:age);
biv << fit spline(0.1, Standardized, {Line Width(2), Report(0)});
wait(0);
);
ss = ldf << Make Filter Change Handler(fitlines);
fitlines(1);
Write();
-Jarmo