I have this code:
private void timer_Tick(object sender, EventArgs e)
{
timer.Stop();
for (int i = 0; i < TOTAL_SENSORS; i++)
{
DateTime d = DateTime.Now;
devices[i].Value = float.Parse(serialPort.ReadLine());
if (chart1.Series[i].Points.Count > MAX_POINTS)
{
}
chart1.Series[i].Points.AddXY(d, devices[i].Value);
}
timer.Start();
}
This part of my code is a timer event in which I draw a chart and I need to update it every time. I keep adding points, and when the number of points reaches MAX_POINTS (10), it removes the first point and adds a new one at the end.
The problem is when it reaches MAX_POINTS, it starts to delete points at the end, and the chart does not autoscroll. All points are deleted and no new points are added.
Please help me and tell me what I need to change the schedule to work, as I said.
EDIT 1: I am using Windows Forms.
EDIT 2: AddXY and RemoveAt are not mine from the point collection.
3: , "" .
4: , , /