I have a line chart, and with each new point added at the right, I want all the old line points to scroll one point position on the x-axis leftward, so that it appears to be sliding leftward.
I've used .AddXY to add all the points to fill the chart, and this works.
Me.Chart_window.Series( my_series ).Points.AddXY( x_axis_point, y_value)
But I can't figure out how to man
But I can't figure out how to manipulate the .Series.Points DataPointCollection to make the displayed line points appear to scroll leftward.
I tried .RemoteAt( 0 ) but this only deleted point at (0) without affecting displayed position of the other points.
I thought of copying all the existing points leftward one x-axis position before I append a new point, but I can't figure out how.
if CHART_IS_FILLING
' Graph not full of points yet, so new samples appear appending rightward.
' Show previous samples as same as before, and next samples appending:
Me.Chart_antenna_window.ChartAreas("ChartArea1").AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount
' Plot next point:
Me.Chart_antenna_window.Series( present_series_name & "_I" & graph_freq_index).Points.AddXY( x_axis_point, antenna_amplitude_I)
x_axis_point += 1
else ' CHART IS FULL, SO START SLIDING LEFTWARD
' (Overaly graph is now full, so scroll it leftward by deleting leftmost sample before each new sample appended at right.)
' Scroll graph leftward:
' (ie. Remove left-point point, which is now beyond overlay window x-axis (ie. time) size):
' Shift all points leftward:
Me.Chart_antenna_window.Series( present_series_name & "_I" & graph_freq_index).Points.RemoveAt(0)
' HOW DO I SHIFT ALL THE POINTS LEFTWARD? I can't see a way to read a point from DataPointCollection so that I can
' store it in the next index down.
' (All points shift left.)
Me.Chart_antenna_window.ChartAreas("ChartArea1").AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount
' Plot next point at right-most chart point:
Me.Chart_antenna_window.Series( present_series_name & "_I" & graph_freq_index).Points.AddXY( x_axis_point, antenna_amplitude_I)
end if