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 & .Net Compact Framework
 SPC Control Chart Tools for .Net
 Reading plot points
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mikebsr

13 Posts

Posted - 06 Feb 2008 :  10:52:05  Show Profile  Reply with Quote
I'm sure this is information I've simply overlooked, but is there a way to read the plot points in an XBar chart into a double array (after data has been subgrouped)? I'm sure there is, but it never jumped out at me when looking through the documentation and examples.

Also, what is the best way to convert a double to a DoubleArray and vice versa? I think I have something that works, but it doesn't look right (looks too complicated).

Thanks!

quinncurtis

1164 Posts

Posted - 06 Feb 2008 :  13:01:25  Show Profile  Reply with Quote
We are not sure what you mean by "plot points", but if you mean the calculated x-bar values (primary chart) or range-value (secondary chart) you can grab the values, after they are plotted using code similar to below:

double [] ys primaryChart.ProcessVariableData.PlotSimpleDataset.GetYData();


We don't know what you mean by convert a double to a DoubleArray. Do you mean convert an array of double to a DoubleArray?

	int alen = 100;
	DoubleArray da = new DoubleArray(alen);
	double [] ad = new double[alen];
	// initialize
	for (int i=0; i <alen; i++)
		da[i] = (double) i;

// You copy the values in a block
	// DoubleArray -> array of double
	ad = da.GetElements();
	// array of double -> DoubleArray
	da.SetElements(ad);

// Or you can copy the values element by element
	// array of double -> DoubleArray
	for (int i=0; i < alen; i++)
		da[i] = ad[i];
	// DoubleArray -> array of double
	for (int i=0; i < alen; i++)
		ad[i] = da[i];

Go to Top of Page

mikebsr

13 Posts

Posted - 06 Feb 2008 :  15:10:54  Show Profile  Reply with Quote
My apologies for not explaining myself very well, but I think you still managed to get one of my questions answered. The GetYData seems to be the thing I need. I just want to look a the last 8 data points in the graph myself just like your WE Zone tests functions seem to do. I have some custom functions I'd like to run these values through for process state purposes.

As far as the double to DoubleArray question, my problems (although I seem to have it working) are probably far more fundamental than a conversion issue.

I read a bunch of values from records in a SQL database and store them in an array of type double that I want to pass into your library to generate charts. The time span between these samples are variable time frames that range from minutes to days to weeks to months (depending on which model of product they are running). I loop through these values one at a time and use the Me.ChartData.AddNewSampleRecord (I use VB) for each sample. That seems to work even if it is wrong. I convert each sample from a double and use them by:

dValues() As Double 'a previously sized array passed into the function containing all individual samples from the SQL database

Dim n_dCurrentValue As New DoubleArray 'the interface type to the QC library

For i = 0 To (m_NumberOfDataPoints - 1)
Dim timestamp As ChartCalendar = CType(m_StartTime.Clone(), ChartCalendar)

n_dCurrentValue.DataBuffer(0) = dValues(i)
n_dCurrentValue.Add(dValues(i))
Me.ChartData.AddNewSampleRecord(timestamp, n_dCurrentValue)
m_StartTime.Add(ChartObj.MINUTE, m_iTimeIncrementMinutes)

Next

Again, this appears to work as I am using a sub group of 1. Sorry for appearing so retarded, but I'm a little overwhelmed with the QC library learning curve and using the library to create limits for a new product on the fly based on these SPC results. Your stuff is working awesome, but would work better if I used it correctly.
Go to Top of Page

quinncurtis

1164 Posts

Posted - 06 Feb 2008 :  15:39:36  Show Profile  Reply with Quote
From what you say, your raw data is batch based, not time-based. You have a time stamp for each sample group, but you don't use it. You simulate a time stamp, incrementing it a minute for each sample group. Correct me if I'm wrong.

Are you using a SPCTimeVariableControlChart or a SPCBatchVariableControlChart? Since your data does not have a uniform sample interval, it seems you should be using a SPCBatchVariableControlChart. That way you would not have to simulate a fake time time stamp for your samples, and instead can use a batch number and the actual time stamp.

Your loop code looks wrong and we can't say why it would work. You seem to be increasing the size of the dCurrentValue array with every interation of the loop. Below, we create a new one for every update in the loop, dimension 1, and use that in the call to AddNewSampleRecord.

It seems to us that it ought to look like:

dValues() As Double 'a previously sized array passed into the function containing all individual samples from the SQL database

For i = 0 To (m_NumberOfDataPoints - 1)
Dim timestamp As ChartCalendar = CType(m_StartTime.Clone(), ChartCalendar)
Dim n_dCurrentValue As New DoubleArray(1) 'the interface type to the QC library

n_dCurrentValue(0) = dValues(i)
Me.ChartData.AddNewSampleRecord(timestamp, n_dCurrentValue)
m_StartTime.Add(ChartObj.MINUTE, m_iTimeIncrementMinutes)

Next
Go to Top of Page

mikebsr

13 Posts

Posted - 06 Feb 2008 :  16:00:03  Show Profile  Reply with Quote
Thanks very much for steering me in the right direction. I will try this out and report back either way.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07