Budhikakgsl
New member
- Joined
- Mar 10, 2021
- Messages
- 4
- Programming Experience
- Beginner
I need to plot the data from the server in a GUI in client. I am getting the data from the server to the client on PC. What I am currently doing is getting the data to a text box and each text is put into a array and data is taken from the array and plot the graph.
Is there any other easy method I can follow ?
this is my current code.
Is there any other easy method I can follow ?
this is my current code.
C#:
private void rbch1_CheckedChanged(object sender, EventArgs e)
{
timer1.Start();
chart1.Series[0].Points.Clear();
}
private void Timer1_Tick(object sender, EventArgs e)
{
t1 += timer1.Interval;
if (rbch1.Checked == true)
{
channelone = new Thread(ch1);
channelone.Start();
}
}
public void ch1()
{
if (rbch2.Checked == false)
{
chart1.Invoke((MethodInvoker)(() => chart1.Series[1].Points.Clear()));
}
String ch1 = txtdata.Text; ;
String[] ch1y = ch1.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
for (int a = 1; a < ch1y.Length - 1; a++)
{
chart1.Invoke((MethodInvoker)(() => chart1.Series[0].Points.AddXY(t1, Convert.ToDouble(ch1y[a]))));
chart1.Invoke((MethodInvoker)(() => chart1.ChartAreas[0].AxisX.Minimum = double.NaN));
chart1.Invoke((MethodInvoker)(() => chart1.ChartAreas[0].AxisX.Maximum = double.NaN));
if (chart1.Series[0].Points.Count > sampelsize())
chart1.Invoke((MethodInvoker)(() => chart1.Series[0].Points.RemoveAt(0)));
}
}
Last edited by a moderator: