T O P I C R E V I E W |
george |
Posted - 09 Mar 2009 : 03:23:08 I'm evaluating SPC Chart for Java and I have a question about creating charts with custom control limits.
What's the best or the easiest way to create X-Bar R Chart with custom multiple control limits (LCLR1, LCLR2, UCLR1, UCLR2) that are not corresponded to 3,2,1 sigma?
If I understand correctly, I must not use autoCalculateControlLimits() method and have to calculate all values by myself. So I've tried to modify MultiLimitXBarChart in BatchVariableControlCharts example by using this portion of code that I found in this forum
double[] changedControlLimits = {63, 43, 83, // Target, L3, H3 for Primary Chart 12, 0, 22, // Target, L3, H3 for Secondary Chart 48, 78, // L2, H2 for Primary Chart 53, 73, // L1, H1 for Primary Chart 19, // H2 for Secondary Chart 17.5}; // H1 for Secondary Chart
chartdata.setControlLimitValues(changedControlLimits);
simulateData();
this.autoScalePrimaryChartYRange(); this.autoScaleSecondaryChartYRange(); this.rebuildChartUsingCurrentData();
but only XBAR, UCL, LCL were shown in the output.
It would be great if you can provide an example.
Thanks, George |
2 L A T E S T R E P L I E S (Newest First) |
quinncurtis |
Posted - 09 Mar 2009 : 13:14:07 The error in your program is that you did not add the additional control limits to the chart. The default limits are just a high, low and a target. You will see how additional control limits are added in the example program we referenced, TimeVariableControlChart.MultiLimitXBarChart.
// Create multiple limits SPCControlChartData chartData = this.getChartData(); double sigma2 = 2.0; double sigma1 = 1.0; // For PrimaryChart SPCControlLimitRecord lcl2 = new SPCControlLimitRecord(chartData, SPCControlLimitRecord.SPC_LOWERTHAN_LIMIT, 0,"LCLR2", "LCLR2"); SPCControlLimitRecord ucl2 = new SPCControlLimitRecord(chartData, SPCControlLimitRecord.SPC_GREATERTHAN_LIMIT, 0,"UCLR2", "UCLR2");
this.getPrimaryChart().addAdditionalControlLimit(lcl2, SPCChartObjects.SPC_LOWER_CONTROL_LIMIT_2, sigma2); this.getPrimaryChart().addAdditionalControlLimit(ucl2, SPCChartObjects.SPC_UPPER_CONTROL_LIMIT_2, sigma2);
SPCControlLimitRecord lcl3 = new SPCControlLimitRecord(chartData, SPCControlLimitRecord.SPC_LOWERTHAN_LIMIT, 0,"LCLR1", "LCLR1"); SPCControlLimitRecord ucl3 = new SPCControlLimitRecord(chartData, SPCControlLimitRecord.SPC_GREATERTHAN_LIMIT, 0,"UCLR1", "UCLR1");
this.getPrimaryChart().addAdditionalControlLimit(lcl3, SPCChartObjects.SPC_LOWER_CONTROL_LIMIT_1, sigma1); this.getPrimaryChart().addAdditionalControlLimit(ucl3, SPCChartObjects.SPC_UPPER_CONTROL_LIMIT_1, sigma1);
// For SecondarChart - high limits only SPCControlLimitRecord ucl4 = new SPCControlLimitRecord(chartData, SPCControlLimitRecord.SPC_GREATERTHAN_LIMIT, 0,"UCLR2", "UCLR2"); SPCControlLimitRecord ucl5 = new SPCControlLimitRecord(chartData, SPCControlLimitRecord.SPC_GREATERTHAN_LIMIT, 0,"UCLR1", "UCLR1");
this.getSecondaryChart().addAdditionalControlLimit(ucl4, SPCChartObjects.SPC_UPPER_CONTROL_LIMIT_2, sigma2); this.getSecondaryChart().addAdditionalControlLimit(ucl5, SPCChartObjects.SPC_UPPER_CONTROL_LIMIT_1, sigma1);
double[] changedControlLimits = {63, 43, 83, // Target, L3, H3 for Primary Chart 12, 0, 22, // Target, L3, H3 for Secondary Chart 48, 78, // L2, H2 for Primary Chart 53, 73, // L1, H1 for Primary Chart 19, // H2 for Secondary Chart 17.5}; // H1 for Secondary Chart
chartdata.setControlLimitValues(changedControlLimits);
|
quinncurtis |
Posted - 09 Mar 2009 : 09:58:46 Look at the example TimeVaribleControlCharts.MultiLimitXBarChart. It demonstrates using the setControlLimitValues method to set multiple limits to explicit values.
The setControlLimits method is called twice, with 200 samples added to the chart after each call.
Use the scroll bar to advance to the 200 sample point and you can see the transition from one set of limit values to another.
We can't see anything wrong with your code fragment. If you still cannot solve the problem, you can send us a simple example program, similar to our SPCApplication1 example, and we will take a look at it. Just replace the SPCPanel1.java graph building code with your own, and send that file to support@quinn-curtis.com, with a brief explanation.
|
|
|