The code below will produce:
and should get you started. You can use 'Help > Books > Scripting Guide' and 'Help > Scripting Index' to figure out what it's doing. Note that using the titles of the outline nodes is not currently very robust, but this could be improved, or done differently.
NamesDefaultToHere(1);
// Yield table
dt1 =
New Table( "Yield",
Add Rows( 11 ),
New Column( "Model",
Character,
"Nominal",
Set Values(
{"IC1", "IC1", "IC1", "IC2", "IC2", "IC2", "IC2", "IC3", "IC3", "IC3",
"IC3"}
)
),
New Column( "WaferID",
Character( 16 ),
"Nominal",
Set Values( {"A", "B", "C", "E", "F", "G", "H", "R", "S", "T", "Z"} )
),
New Column( "Yield",
Numeric,
"Nominal",
Format( "Best", 12 ),
Set Values( [50, 60, 70, 30, 40, 50, 60, 80, 90, 70, 65] )
)
);
// Reference table
dt2 =
New Table( "Reference",
Add Rows( 3 ),
New Column( "Model", Character, "Nominal", Set Values( {"IC1", "IC2", "IC3"} ) ),
New Column( "Value",
Numeric,
"Nominal",
Format( "Best", 12 ),
Set Values( [50, 40, 70] )
)
);
// Start here . . .
// Get the values in dt2 into lists for later
modelVal = Column(dt2, "Model") << getValues;
refVal = Column(dt2, "Value") << getValues;
// Control Charts
cc = dt1 << Control Chart(
Sample Label( :WaferID ),
Chart Col( :Yield, Individual Measurement ),
By( :Model )
);
// Loop over the control chart reports
for(r=1, r<=NItems(cc), r++,
ccRep = Report(cc[r]);
// Extract the level of 'Model' from the title of the outline node
title = ccRep[OutlineBox(1)] << getTitle;
delimPos = Munger(title, 1, "=");
level = Substr(title, delimPos+1, Length(title)-delimPos);
// Get the reference value and plot it using a graphics script
ref = refVal[Loc(modelVal, level)];
Eval(
Substitute(
Expr(ccRep[FrameBox(1)] << addGraphicsScript(PenColor("Blue"); HLine(TBD))),
Expr(TBD),
ref[1]
);
);
);