Lots of assumptions made in this script and it definitely isn't robust
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
m = 4;
Eval(
Eval Expr(
Column(dt, m) << set property(
"Color Gradient",
{"Green to White to Red", Range(
{Expr(Col Min(Column(m))), Expr(Col Max(Column(m))), Expr(Col Mean(Column(m)))}
)}
) << Color Cell by Value(1);
)
);
// Lots of assumptions made in this solution
str = (dt << get as report) << get html;
// get just <table> and drop first row (headers)
l = Words(Regex(str, "<table.*</table>"), "\!N");
Remove From(l, 1,2);
Remove From(l, N Items(l));
// Get bgcolors
colors = {};
For Each({line}, l,
str = Regex(line, "bgcolor=#(.*?)>", "\1");
Insert Into(colors, str);
);
// Convert colors
// Option 1 (might work?)
jmp_colors = Transform Each({color}, colors, Hex To Number(color) * -1);
// Option 2
jmp_colors2 = Transform Each({color}, colors,
r = Hex To Number(Left(color, 2));
g = Hex To Number(Substr(color, 3, 2));
b = Hex To Number(Right(color, 2));
RGB Color({r,g,b});
);
// Set colors
// One row at the time
For Each Row(
:name << Color Cells(jmp_colors[Row()], Row());
);
// Or create list of lists and use that
color_list = Transform Each({jmp_color, idx}, jmp_colors2,
Eval List({jmp_color, idx});
);
Eval(EvalExpr(:age << Color Cells(Expr(color_list))));
-Jarmo