Hi,
A couple of things to mention for you here:-
1) Do not forget that the post I made was based on a theoretical principal since as I mentioned at the time I had not actually written this at the time of posting. I wrote an example yesterday to make sure I could back up my post and my theory is about 90% accurate. Therefore as for all posts you should take the information given and make sure you adapt them to accommodate your own needs.
As to your questions:-
1) The first thing that you need to do is define a constant in your code which holds the number of DataPoints on the X axis that will be displayed at any one time. For this example lets say that's 10 DataPoints and the constant is called MaxPointsToDisplay.
2) The next thing to realise is that the HScroll Bar only becomes necessary when the number of inputs from the serial port becomes greater that the number of DataPoints that can be displayed on the X axis at any one time. Therefore you only need to start setting values for the HScroll Bar at that point in time.
3) Once the number of Inputs received becomes greater than the number of DataPoints then you can set the HSrollBar1.Maximum and HSrollBar1.Value to your array properties being ReceivedList.Count - MaxPointsToDisplay. By doing it this way what happens is that the HSrcollBar1.Value equals the index in the ReceviedList array which defines the start DataPoint of the graph to display when you then actually scroll your HScroll Bar.
Also notice that I am setting the HScrollBar1.Value to a numeric index which matches a point in your ReceivedList array. What you have done in your example is assigned an ELEMENT of your ReceivedList array to the HScrollBar1.Value property using ReceivedList(i), which is incorrect.
4) One additional thing that I found was that I not only had to save the information from the Input but I also had to save the information for the AxisLabel displayed on the X Axis. I did this by storing my data in a List(Of System.Windows.Forms.DataVisualization.Charting.DataPoint).
5) Once all that is done you can now code the HScrollBar1_Scroll event using a For Loop. See the example below:-
Chart1.Series(0).Points.Clear()
For Counter As Integer = HScrollBar1.Value To HScrollBar1.Value + (MaxPointsToDisplay - 1)
Chart1.Series(0).Points.Add(ReceivedList(Counter))
Next
You can see that we use the Value of the HScrollBar as the starting point, then we work out the maximum index in the ReceivedList Array which represents the total number of DataPoints to display on the chart, then we plot the points on a clean chart.
That should be it, so good luck.
Cheers,
Ian