コード例 #1
0
        private void plot1_GLLoaded(object sender, EventArgs e)
        {
            line = new DataLine2D("Line 1", 2000)
            {
                LineColor = Color.Blue, SamplesPerSecond = 1000000
            };
            line2 = new DataLine2D("Line 2", 2000)
            {
                LineColor = Color.Green, SamplesPerSecond = 1000000
            };

            set = new TimeDataSet {
                SamplesPerSecond = Samplerate,
                Milliseconds     = 2000
            };

            set.AxisX.VisibleMinimum = 0;
            set.AxisX.VisibleMaximum = 5000;
            set.AxisY.VisibleMinimum = -2;
            set.AxisY.VisibleMaximum = 10;

            set.Data.Add(line);
            set.Data.Add(line2);

            plot1.Set = set;
            plot1.CreateLegend();
        }
コード例 #2
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();
        }