I need to add usl and lsl at runtime for that iam not using Me.AutoCalculateControlLimits() insted of this iam using thr fallowing code here iam giving usl and lsl data for both x-bar and r-bar chart.
my question is when i run the program there is no control limit lines no alaram color change and no alaram message display.
for us usl and lsl will be set by operator so we cont use AutoCalculateControlLimits
Dim primarytarget As SPCControlLimitRecord = ChartData.GetControlLimitRecord(SPCControlChartData.SPC_PRIMARY_CONTROL_TARGET) primarytarget.ControlLimitValue = MeasuerNominal primarytarget.ControlLimitText = "XBarS" Dim primarylowercontrolLimit As SPCControlLimitRecord = ChartData.GetControlLimitRecord(SPCControlChartData.SPC_PRIMARY_LOWER_CONTROL_LIMIT) primarylowercontrolLimit.ControlLimitValue = MeasuerLSL primarylowercontrolLimit.ControlLimitText = "LCLs" Dim primaryUppercontrolLimit As SPCControlLimitRecord = ChartData.GetControlLimitRecord(SPCControlChartData.SPC_PRIMARY_UPPER_CONTROL_LIMIT) primaryUppercontrolLimit.ControlLimitValue = MeasuerUSL primaryUppercontrolLimit.ControlLimitText = "UCLs"
Dim secondarytarget As SPCControlLimitRecord = ChartData.GetControlLimitRecord(SPCControlChartData.SPC_SECONDARY_CONTROL_TARGET) secondarytarget.ControlLimitValue = 2.0 secondarytarget.ControlLimitText = "RBarS" Dim secondarylowercontrolLimit As SPCControlLimitRecord = ChartData.GetControlLimitRecord(SPCControlChartData.SPC_SECONDARY_LOWER_CONTROL_LIMIT) secondarylowercontrolLimit.ControlLimitValue = 0.0 secondarylowercontrolLimit.ControlLimitText = "LCLs" Dim secondaryUppercontrolLimit As SPCControlLimitRecord = ChartData.GetControlLimitRecord(SPCControlChartData.SPC_SECONDARY_UPPER_CONTROL_LIMIT) secondaryUppercontrolLimit.ControlLimitValue = 4.0 secondaryUppercontrolLimit.ControlLimitText = "UCLs"
We guess that you are setting the limits using your code AFTER you add data to the chart. You must set the initial limits BEFORE you start adding data to the chart.
The AutoCalculateControlLimits method will go back and apply the calculated limits to the data used in the calculation. That is why it works in your example.
If you set the control limits manually, it does not go back and apply the limits to previously collected data. Setting control limits manually only sets the limits from that instant in time, forward. In this way you can change the control limits, on-the-fly, but still have accurate display of previously set limit values.