Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Tools for Microsoft .Net
 SPC Control Chart Tools for .Net
 Dynamic Updates

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
dbeard Posted - 02 Jul 2009 : 11:06:00
I am using the SPC Control Chart Tools for .NET 2.0 trial version. I have reviewed the BatchVariableControlCharts sample provided with the trial version of your software. In particular, I have looked over the BatchDynXBarSigma control provided in the sample project.

I am interested in retrieving data from a database and dynamically updating my chart with the results every x minutes, based on a timer. On the timer's Tick event, I am calling a method named GetData, which queries the top 20 values from my database, ordered by date. The dataset is converted into a Generic List of DataPoint objects. The DataPoint object has two properties, SampleDate and SampleValue. The following describes how the chart is setup:

Class = SPCBatchVariableControlChart
ChartType = Individual & Range
DataPointsInView = 20
SamplesPerSubgroup = 1


The code below is the GetData method.

private void GetData()
{
if (((this.updateCount + 1) % 200) == 0)
this.ResetSPCChartData();

this.updateCount++;

// Query the data from the database and convert to a List of DataPoints
List<DataPoint> dataPoints = RetrieveData();
if (dataPoints.Count == 0)
return;

foreach (DataPoint dataPoint in dataPoints)
{
this.batchCounter++;
ChartCalendar timestamp = (ChartCalendar)startTime.Clone();

DoubleArray samples = new DoubleArray();
samples.Add(dataPoint.SampleValue);

// Add the new sample subgroup to the chart
this.ChartData.AddNewSampleRecord(batchCounter, timestamp, samples);

// Simulate timeincrementminutes minute passing
startTime.Add(ChartObj.MINUTE, this.timeIncrementMinutes);
}

this.AutoCalculateControlLimits();
this.AutoScalePrimaryChartYRange();
this.RebuildChartUsingCurrentData();
}


The problem I am having is that the chart will only display 19 (DataPointsInView = 20) of the 20 datapoints. And when a new value is added to the chart, the chart won't scroll from left to right to show the latest value. I have tried to follow the BatchDynXBarSigma sample as closely as possible. The only difference is that I'm using an IR chart and I'm pulling the data from a database instead of the simulator. Can you please advise what I need to do to get the chart to update dynamically?
7   L A T E S T    R E P L I E S    (Newest First)
dbeard Posted - 02 Jul 2009 : 19:11:02
I have emailed an archived file that contains a solution and project that will demonstrate what we are discussing in this topic.

Instead of retrieving the values from a database, I have modified the project to retrieve the initial values from an XML file that is included in the project. The XML file gets copied to the output directory, so you can open it from the bin folder and append values to it to watch how the chart behaves real time.

Thanks for your help.
dbeard Posted - 02 Jul 2009 : 19:06:05
quote:

The way you have it setup, the chart will not update a record at a time, rather in a batch, with the batch size equal to the length of your dataPoints List variable. Is that what you want? Or are you expecting an update for every AddNewSampleRecord call?


The first batch contains the 20 data points that I'm trying to pre-load the chart with. So I want the chart to initialize with the first 20 data points. Then, I want the chart to update each time a new value read from the db. The new value will almost always be one data point, so the length of the dataPoints List variable will initially be 20, and for each subsequent call, the length will be 1. So yes, I want it to update for each batch.

quote:

When you place a breakpoint on the AddNewSampleRecord method, is it being called the 21st, 22nd, 23rd time, with the appropriate batch counter number?


Yes

quote:

Are you sure you are not pulling the same 20 records from the top of the database each time, rather than pulling subsequent records.


I'm sure. I keep track of the DateTime from the latest record retrieved and my query only retrieves subsequent records with a DateTime greater than the DateTime from the latest record.

quote:

Enable the scrollbar in the chart setup.

this.EnableScrollBar = true;

The chart will not update in real-time, but once you enter all of the records you should be able to scroll from beginning to end. Are you getting the number of records you expect. Is each batch of records different, or are you repeating the same batch each time?


With the scrollbar enabled, I can scroll to see all the data points and they match the values from my database (i.e. I'm getting the number of records I expect). Each batch is different. Again, each subsequent batch, after the initial load of the 20 records, is a size of 1.
quinncurtis Posted - 02 Jul 2009 : 17:27:00
You can send it to support@quinn-curtis.com

It would help if you try and answer our questions in the previous post.
dbeard Posted - 02 Jul 2009 : 17:08:30
I have a sample project that will recreate just what I described. I don't see a way to include an attachment. How can I get this (zipped) file to you?
quinncurtis Posted - 02 Jul 2009 : 13:51:36
We can only guess the error is in the GetData method.

The way you have it setup, the chart will not update a record at a time, rather in a batch, with the batch size equal to the length of your dataPoints List variable. Is that what you want? Or are you expecting an update for every AddNewSampleRecord call?

When you place a breakpoint on the AddNewSampleRecord method, is it being called the 21st, 22nd, 23rd time, with the appropriate batch counter number?

Are you sure you are not pulling the same 20 records from the top of the database each time, rather than pulling subsequent records.

Enable the scrollbar in the chart setup.

this.EnableScrollBar = true;

The chart will not update in real-time, but once you enter all of the records you should be able to scroll from beginning to end. Are you getting the number of records you expect. Is each batch of records different, or are you repeating the same batch each time?


dbeard Posted - 02 Jul 2009 : 13:20:26
protected override void InitializeChart()
{
SPCChartObjects.AxisTitleFont = new Font("Arial", 7.5f, FontStyle.Regular);
SPCChartObjects.AxisLabelFont = new Font("Arial", 7.5f, FontStyle.Regular);
SPCChartObjects.ControlLimitLabelFont = new Font("Arial", 7.5f, FontStyle.Regular);

// Initialize the chart
this.InitSPCBatchVariableControlChart(this.chartType, this.samplesPerSubgroup, this.datapointsInView);

// Change the default horizontal position of the chart
this.GraphStartPosX = 0.075;

this.SecondaryChart.DisplayChart = false;
this.PrimaryChart.PlotBackground.FillColor = Color.WhiteSmoke;
this.PrimaryChart.ProcessVariableData.LineMarkerPlot.LineColor = Color.DarkBlue;
this.PrimaryChart.ProcessVariableData.LineMarkerPlot.SymbolAttributes.PrimaryColor = Color.DarkBlue;
this.PrimaryChart.ProcessVariableData.LineMarkerPlot.SymbolAttributes.FillColor = Color.PowderBlue;

this.PrimaryChart.ProcessVariableData.LineMarkerPlot.SymbolAttributes.SymbolSize = 7;
this.PrimaryChart.ProcessVariableData.LineMarkerPlot.SymbolAttributes.LineWidth = 2;
this.PrimaryChart.ProcessVariableData.LineMarkerPlot.LineWidth = 2;

// Turn off display of table items.
this.EnableAlarmStatusValues = false;
this.EnableInputStringsDisplay = false;
this.EnableCategoryValues = false;
this.EnableCalculatedValues = false;
this.EnableTotalSamplesValues = false;
this.EnableNotes = false;
this.EnableTimeValues = false;

// Rebuild the chart using the current data and settings
this.RebuildChartUsingCurrentData();
}
quinncurtis Posted - 02 Jul 2009 : 12:43:35
Show the SPC chart setup portion of your code.

Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07