예제 #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            line.Add(new PointF(x, 1 + x / 1000000));
            line2.Add(new PointF(x, 2 + x / 1000000));
            x += 1000000 / 10;

            plot1.Refresh();
        }
예제 #2
0
        private void tmrPhase_Tick(object sender, EventArgs e)
        {
            FillVBO(phase += 0.1);

            tmrCount = (tmrCount + 1) % 10;
            if (tmrCount == rnd.Next(10))
            {
                _linesd.Add(new PointF((float)_dataSet.CurrentTimeOffset.ToRate(_linesd.SamplesPerSecond), (float)rnd.NextDouble()));
                //System.Diagnostics.Debug.WriteLine("Emit");
            }

            plot2.Refresh();
        }
예제 #3
0
        private void plot2_GLLoaded(object sender, EventArgs e)
        {
            _lines1 = new DataLine1D("Line 1", (int)X_MAX, (int)X_MAX)
            {
                LineColor = Color.Yellow
            };
            _lines2 = new DataLine1D("Line 2", (int)X_MAX / 2, (int)X_MAX / 2)
            {
                LineColor = Color.Red
            };
            _lines3 = new DataLine1D("Line 3", (int)X_MAX, (int)X_MAX)
            {
                LineColor = Color.Blue
            };
            _linesd = new DataLine2D("Line D", 1000)
            {
                LineColor = Color.DarkViolet, SamplesPerSecond = 1000000
            };

            //data  = new float[(int)_lines1.SamplesPerSecond / 20];
            //data2 = new float[(int)_lines2.SamplesPerSecond / 20];
            //data3 = new float[(int)_lines3.SamplesPerSecond / 20];

            data  = new NodeSystemLib2.FormatData1D.TimeLocatedBuffer1D <double>(_lines1.SamplesPerSecond / 10, _lines1.SamplesPerSecond);
            data2 = new NodeSystemLib2.FormatData1D.TimeLocatedBuffer1D <double>(_lines2.SamplesPerSecond / 10, _lines2.SamplesPerSecond);
            data3 = new NodeSystemLib2.FormatData1D.TimeLocatedBuffer1D <double>(_lines3.SamplesPerSecond / 10, _lines3.SamplesPerSecond);

            //var buffer = new float[1024];
            //for (int i = 0; i < buffer.Length; i++) {
            //    buffer[i] = i % 16 + (i % 12) / 10 + 2 * (float)Math.Sin(2 * Math.PI * 224 / 1000.0 * i);
            //}

            //var dft = DFT(buffer);

            //_linesFFT = new DataLine2D();
            //_linesFFT.AddRange(dft.Select((i, d) => new PointF(d, i)));
            //_linesFFT.LineColor = Color.Blue;

            //_dataSet = new FrequencyDataSet { SamplesPerSecond = 1000, FftSize = 1024 };
            //_dataSet.Data.Add(_linesFFT);

            //_dataSet.AxisX.AbsoluteMinimum = 0;
            //_dataSet.AxisX.AbsoluteMaximum = _linesFFT.Length;

            _dataSet = new TimeDataSet()
            {
                SamplesPerSecond = (int)X_MAX, Milliseconds = 10000
            };
            _dataSet.AxisX.VisibleMinimum = X_MIN;
            _dataSet.AxisX.VisibleMaximum = X_MAX;
            _dataSet.AxisY.VisibleMinimum = Y_MIN;
            _dataSet.AxisY.VisibleMaximum = Y_MAX;

            _dataSet.Data.Add(_lines1);
            _dataSet.Data.Add(_lines2);
            _dataSet.Data.Add(_lines3);
            _dataSet.Data.Add(_linesd);

            for (int i = 0; i <= 3; i++)
            {
                _linesd.Add(new PointF(i * 1000000 / 3f, i == 0 ? 1 : 1f / (i * i)));
            }

            FillVBO(0);

            plot2.Set = _dataSet;
            plot2.CreateLegend();
        }