Hello,
I am having a problem outputting data to a graph by creating new data points. I am trying to create 5 variables that get data every 20 secs from a ticker that contains the folder size. Then I am using those variables to add to the graph points but seem to only get one data point.
The code is here:
Graph data:
public void FillData()
{
double plotY = GetFolderSize();
double plotY2 = GetFolderSize();
try
{
if (Chart1.Series["Series1"].Points.Count > 0)
{
plotY = Chart1.Series["Series1"].Points[Chart1.Series["Series1"].Points.Count - 1].YValues[0];
plotY2 = Chart1.Series["Series2"].Points[Chart1.Series["Series1"].Points.Count - 1].YValues[0];
}
for (int pointIndex = 0; pointIndex <= 5; pointIndex++)
{
plotY = plotY + (float)(intArray[pointIndex]);
Chart1.Series["Series1"].Points.AddY(plotY);
// Chart1.Series["Series1"].Points.Add(new DataPoint(pointIndex, intArray[pointIndex]));
plotY2 = plotY2 + (float)(intArray1[pointIndex]);
Chart1.Series["Series2"].Points.AddY(plotY2);
}
}
Getting data:
int[] intArray = new int[6];
int[] intArray1 = new int[6];
public void Timer2_Tick1(object sender, EventArgs e)
{
int Point1 = GetFolderSize();
intArray[0] = Point1;
intArray1[0] = Point1;
Label6.Text = (Convert.ToString(intArray[0]));
//Stop timer 2 so that it keeps the same variable for the graph data
Timer2.Enabled = false;
}
public void Timer4_Tick(object sender, EventArgs e)
{
FillData();
Timer2.Enabled = true;
Timer5.Enabled = true;
}
public void Timer5_Tick(object sender, EventArgs e)
{
int Point2 = GetFolderSize();
intArray[1] = Point2;
intArray1[1] = Point2;
Label7.Text = (Convert.ToString(intArray[1]));
Timer5.Enabled = false;
}