Why don't you create a custom class to represent the dataset for the point being sampled. This way, you can then expand on this for a number of data streams by easily create a collection of datasets.
The dataset is based on a queue with new data pushed in at the top and dropped off at the bottom. In the class you can also add all the statistical calcs you want to do, e.g. Min / Max / Avg
When drawing your current point on the graph you just call read the current value from the dataset.
(Note: When drawing graphs it is quicker to bitblit than try and update a trend by redrawing each value from a seriers, but thats not the topic of this question :) )
Take a look at the sample below i have created;
class DataSet
{
const int MAXLENGTH = 256;
Queue<Double> _data;
private Double _maximum;
private Double _minimum;
private Double _average;
public DataSet()
{
_data = new Queue<Double>();
_maximum = new Double();
_minimum = new Double();
_average = new Double();
}
public readonly Double CurrentValue
{
get { return _data.Peek(); }
}
public readonly Double Maximum
{
get { return _maximum; }
}
public readonly Double Minimum
{
get { return _minimum; }
}
public readonly Double Average
{
get { return _average; }
}
public void AddValue(Double Value)
{
if (_data.Count > MAXLENGTH)
{
_data.Dequeue();
}
_data.Enqueue(Value);
calcStats();
}
public void Reset()
{
_data = new Queue<Double>();
_maximum = 0;
_minimum = 0;
_average = 0;
}
private void calcStats()
{
Double max = new Double();
Double min = new Double();
Double sum = new Double();
foreach (Double item in _data)
{
if (item > max)
{ max = item; }
if (item < min)
{ min = item; }
sum = sum + item;
}
_maximum = max;
_minimum = min;
_average = sum / _data.Count;
}
}
}
To use it you could then do;
DataSet series1 = new DataSet();
series1.AddValue( xx.xxx );
textbox1.text = series1.Average().toString();
textbox1.text = series1.CurrentValue().toString();