You can put a loop right in the chart code.
dt = New Table( "Example", Add Rows( 8 ),
New Column( "IDENT Code", Character, "Nominal",
Set Values( {"AA", "AA", "AA", "BB", "BB", "CC", "CC", "CC"} ) ),
New Column( "Exclusion Rate", Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [0.05, 0.07, 0.08, 0.5, 0.6, 0.4, 0.3, 0.2] ) )
);
ident_codes = dt:IDENT Code << get values;
unique_codes = get_unique_values(ident_codes);
ncodes = nitems(unique_codes);
dt << Chart(
X(:IDENT Code),
Y(Mean(:Exclusion Rate)),
Add Error Bars to Mean(Name("Confidence Interval (pooled)")(0.95)),
Overlay Axis << {{Format("Fixed Dec", 12, 3), Min(0.935), Max(0.9975),
Inc(0.005), Minor Ticks(1)}},
Overlay Stack Axis << {{Format("Fixed Dec", 12, 0), Min(-1.5), Max(8.5), Inc(1),
Minor Ticks(1)}},
// Assign each level the same color and marker
for (i = 1, i <= ncodes, i++,
level[i] << {Colors(-4221340), Markers(29)},
),
Y[1] << Point Chart(1),
SendToReport(
Dispatch({}, "102", ScaleBox, {Format("Percent", 6, 0), Show Major Grid(1)}),
Dispatch({}, "", AxisBox(2), {Add Axis Label("Mean(Exclusion Rate)")}),
Dispatch({}, "Mean(Exclusion Rate)", TextEditBox, {Set Font Size(20)}),
Dispatch(
{},
"Chart Graph",
FrameBox,
{Frame Size(704, 536), Marker Size(6)}
)
)
)
Here's the code for the get_unique_values function:
Get_unique_values = Function( {in_list},
{Default Local},
tmp = [=> 0];
Insert Into( tmp, in_list );
tmp << get keys;
);