So far, my C# program has been taking real-time input from an COM gate, and draw it on a chart, like so:
// DATA is the input from the COM gate, TIMESTAMP is the time the data is taken
DataChart.Series["Data"].Points.AddXY(TIMESTAMP, DATA);
// Continue processing
I did not save the data into a separate array or class because they are rather large, and have caused our website namesake before.
Now the program is needed to "cut" the chart between two time points (called StartTime and EndTime) into another chart (called CutChart). Since I still do not want to keep them long term, I tried this:
foreach (Series series in DataChart.Series)
foreach(DataPoint point in series.Points)
if (point.XValue <= EndTime && point.XValue >= StartTime)
CutChart.Series[DataChart.Series.IndexOf(series)].Points.Add(point);
Yet it does not work (As in, the CutChart, which start with no point, and therefore appear empty, once that code line run, still appear empty, no error or exception recorded).
Strangely enough, when I add points in DataChart wrongly (TIMESTAMP in Y axis instead of X), the line of code above work perfectly.
The way I understand it, to draw a graph, the C# Chart class must be saving the XY coordinate of each point... somewhere. To produce a new graph that is a portion of the old graph between two points in time, just add the points with satisfactory X-value to the new graph. Except I do not know where that "somewhere" is.
Note: I need to draw the "cut" part of DataChart on a new chart, so just zoom in is not quite enough.