Exemple #1
0
        private void OnReaded(object sender, ReadedEventArgs e)
        {
            if (e.Text.Length == 0)
            {
                return;
            }

            var data = e.Text.Split(new string[] { "," }, StringSplitOptions.None);

            if (chart2.Series[0].Points.Count <= 100)
            {
                chart2.Series[0].Points.AddXY(0, double.Parse(data[0]));
                chart2.Series[1].Points.AddXY(0, double.Parse(data[1]));
            }
            else
            {
                for (int i = 1; i <= 100; i++)
                {
                    chart2.Series[0].Points[i - 1].YValues = chart2.Series[0].Points[i].YValues;
                    chart2.Series[1].Points[i - 1].YValues = chart2.Series[1].Points[i].YValues;
                }
                chart2.Series[0].Points.RemoveAt(100);
                chart2.Series[1].Points.RemoveAt(100);
                chart2.Series[0].Points.AddXY(0, double.Parse(data[0]));
                chart2.Series[1].Points.AddXY(0, double.Parse(data[1]));
            }
        }
Exemple #2
0
        private void OnTimerTick(object sender, EventArgs e)
        {
            var rowdata  = this.GetRowdata();
            var changes  = this.GetChanges();
            var datatext = rowdata.ToString() + "," + changes.ToString();

            // publish plot event
            var readEventArgs = new ReadedEventArgs
            {
                Text = datatext
            };

            var handler = this.Readed;

            if (handler != null)
            {
                handler.Invoke(this, readEventArgs);
            }
        }