Chart Does Not Change When New Data Selected
Hello, I'm a veteran programmer, but syncfusion beginner. I'm trying to get off the ground with stock charts. See the code below. It displays the first chart perfectly, however when I select another stock, the first chart remains. It does not display the newly selected stock even though the data has changed. Thanks for your help on this.
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click 'select contract and chart it.
Dim xStream As Stream = Nothing
Dim openFileDialog1 As New OpenFileDialog()
openFileDialog1.InitialDirectory = My.Settings.DriveLetter + ":\" + My.Settings.DataFolder + "\" + My.Settings.DailyDataFolder
openFileDialog1.Filter = "csv files (*.csv)|*.csv|txt files (*.txt)|*.txt|All files (*.*)|*.*"
openFileDialog1.RestoreDirectory = True
If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Try
xStream = openFileDialog1.OpenFile()
If (xStream IsNot Nothing) Then
dlines = GetData(openFileDialog1.FileName)
Dim chart1 As New ChartControl()
chart1.Dock = DockStyle.Fill
Controls.Add(chart1)
chart1.Titles.Clear()
chart1.Title.Text = path.GetFileNameWithoutExtension(openFileDialog1.FileName)
Dim TitleFont As New Font("Arial", 16, System.Drawing.FontStyle.Bold)
chart1.Title.Font = TitleFont
chart1.Series.Clear()
Dim trade As New ChartSeries("Prices", ChartSeriesType.HiLoOpenClose)
chart1.PrimaryYAxis.ValueType = ChartValueType.Double
chart1.PrimaryXAxis.ValueType = ChartValueType.Custom
chart1.PrimaryXAxis.RangeType = ChartAxisRangeType.Auto '.Set
trade.Points.Clear()
For i As Integer = startpoint To endpoint
trade.Points.Add(i, dlines(i).high, dlines(i).low, dlines(i).open, dlines(i).close)
Next
chart1.Series.Add(trade)
End If
Catch Ex As Exception
MessageBox.Show("Error: " & Ex.Message)
Finally
If (xStream IsNot Nothing) Then xStream.Close()
End Try
End If
End Sub
Hi ROGER HOTZ,
We have prepared the sample as per your expectations. Kindly review it and let us know if any additional details are required. Additionally, we’ve included user guides related to Customize data points for Chart Series | WinForms | Syncfusion.
Please feel free to reach out if you need further clarification or support.
Regards,
Vallarasu R.
Attachment: WinformChart_d47c5b79.zip
Solved my issue. Thank you very much
Hi ROGER HOTZ,
You are welcome.
We are glad to know that the reported problem has been resolved. Please let us know if you require any further
assistance on this. We will be happy to assist you.
Regards,
Preethi R
- 3 Replies
- 3 Participants
- Marked answer
-
RH ROGER HOTZ
- Oct 27, 2025 03:51 PM UTC
- Oct 31, 2025 05:51 AM UTC