Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net
 SPC Control Chart Tools for .Net
 MEAN_RANGE_CHART
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

seh-a

USA
14 Posts

Posted - 22 Aug 2013 :  16:44:10  Show Profile  Reply with Quote
I am implementing a new chart using a template of a successfully implemented MEAN_RANGE_CHART type chart. Code fragments as follows:

numsamplespersubgroup = 3;
numdatapointsinview = 20;
...
this.InitSPCBatchVariableControlChart(SPCControlChartData.MEAN_RANGE_CHART, numsamplespersubgroup, numdatapointsinview);
...
for (i=0; i<20; i++)
{
getdata(ref samples);
this.ChartData.AddNewSampleRecord(batchcounter++, timestamp, samples); // samples is DoubleArray of 2 or 4 elements
}
....
this.AutoScalePrimaryChartYRange();
this.AutoScaleSecondaryChartYRange();
System.Threading.Thread.Sleep(500);
...
this.ChartData.NumRecordsPerChart = total_records == 1 ? 2 : total_records; // total_records = 20
this.RebuildChartUsingCurrentData();

using this code, I get error 'Index was out of range. Must be non-nagative and less than the size of the collection. Parameter name: index' on all the samples that is 4 , not the 2 elements. So, I change numsamplespersubgroup to 4 and that eleminates this error message but I would get error 'Index was outside the bounds of the array' from calling this.AutoScalePrimaryChartYRange(). I am confused. What did I do wrong?

quinncurtis

1586 Posts

Posted - 23 Aug 2013 :  08:39:08  Show Profile  Reply with Quote
A MEAN_RANGE_CHART requires fixed sample size, i.e. the number of samples in a sub interval. In your setup you specify 3 for numsamplespersubgroup , which is OK.

But in your call to AddNewSampleRecord you say:

// samples is DoubleArray of 2 or 4 elements

Which is incorrect in both cases. If your numsamplespersubgroup is 3, then you must always pass in exactly 3 values in the samples array, and the samples array should be sized to 3.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07