I don't know a great deal about MSChart but I believe it's a subject you are going to have to research on more appropriate forums, there is a great deal of info out there. To get you started I can help with something simple that allows you to alter values and play around with a template that assumes the values come from the Arduino once every second for a duration of five minutes.
Snippet 1 is code that resets the Arduino and clears the PC serial buffer giving you a clean start.
SerialPort1.DtrEnable = True
SerialPort1.Open()
SerialPort1.ReadExisting()
Snippet 2 is an addition to your existing DisplayData sub routine and passes the data to the chart.
Dim chartvalue As Integer
If txtarray(0) = "Sensor1" Then
TextBox1.Text = "Sensor 1 value=" & txtarray(1) & " %"
Integer.TryParse(txtarray(1), chartvalue)
Chart1.Series("Series1").Points.Add(chartvalue)
End If
If txtarray(0) = "Sensor2" Then
TextBox2.Text = "Sensor 2 value=" & txtarray(1) & " %"
Integer.TryParse(txtarray(1), chartvalue)
Chart1.Series("Series2").Points.Add(chartvalue)
End If
Snippet 3 is a sub routine with various chart settings that you can play around with to learn and modify the charts properties. Call this sub from the Form1 Load event handler.
Private Sub ChartSettings()
Chart1.BackColor = Color.Bisque
Chart1.Series("Series1").ChartType = SeriesChartType.Spline
Chart1.Series("Series2").ChartType = SeriesChartType.Spline
Chart1.Series("Series1").BorderWidth = 2
Chart1.Series("Series2").BorderWidth = 2
Chart1.Series("Series1").Color = Color.Red
Chart1.Series("Series2").Color = Color.DarkBlue
With Chart1.ChartAreas(0).AxisX
.Maximum = 300
.Minimum = 0
.LabelStyle.Format = "0S"
.Title = "Humidity"
.TitleFont = New Font(New FontFamily("Arial"), 9, FontStyle.Bold)
.MajorGrid.Interval = 1
.MajorGrid.Enabled = True
.MajorTickMark.Enabled = True
.MajorTickMark.Interval = 1
.MajorTickMark.Size = 2
.LabelStyle.Enabled = True
.LabelStyle.Interval = 10
End With
With Chart1.ChartAreas(0).AxisY
.Maximum = 100
.Minimum = 0
.MajorGrid.Interval = 10
.MajorGrid.Enabled = True
.MajorTickMark.Enabled = True
.MajorTickMark.Interval = 10
.MajorTickMark.Size = 2
.LabelStyle.Enabled = True
.LabelStyle.Interval = 10
End With
Chart1.ChartAreas(0).AxisX.ScrollBar.IsPositionedInside = False
Chart1.ChartAreas(0).AxisX.ScaleView.Zoom(1, 59)
End Sub
Snippet 4 is the Imports instruction required to use the chart properties.
Imports System.Windows.Forms.DataVisualization.Charting