server එකෙන් එන data client එකේ GUI එකකින් plot කරන්න ඔනි. දැනට කරන්නෙ එන data ටික text box එකකට load කරල එකෙන් array එකකට load කරල chart plot කරන්න. මෙකට වඩා ලේසි විඩියක් තියනවද මෙක කරන්න. real time data plot කරන්න ඔනි
මෙ තියෙන්නෙ දැනට වැඩ කරන code එක.
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)));
}
}
මෙ තියෙන්නෙ දැනට වැඩ කරන code එක.
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)));
}
}