示例#1
0
        public LiveDataGrowing()
        {
            InitializeComponent();

            // plot the data array only once
            signalPlot = wpfPlot1.Plot.AddSignal(data);
            wpfPlot1.Plot.YLabel("Value");
            wpfPlot1.Plot.XLabel("Sample Number");

            // create a timer to modify the data
            _updateDataTimer          = new DispatcherTimer();
            _updateDataTimer.Interval = TimeSpan.FromMilliseconds(1);
            _updateDataTimer.Tick    += UpdateData;
            _updateDataTimer.Start();

            // create a timer to update the GUI
            _renderTimer          = new DispatcherTimer();
            _renderTimer.Interval = TimeSpan.FromMilliseconds(20);
            _renderTimer.Tick    += Render;
            _renderTimer.Start();

            Closed += (sender, args) =>
            {
                _updateDataTimer?.Stop();
                _renderTimer?.Stop();
            };
        }
示例#2
0
 public LiveDataIncoming()
 {
     InitializeComponent();
     signalPlot = formsPlot1.plt.PlotSignal(data);
     formsPlot1.plt.YLabel("Value");
     formsPlot1.plt.XLabel("Sample Number");
 }
示例#3
0
        public LiveDataIncoming()
        {
            InitializeComponent();
            signalPlot = formsPlot1.Plot.AddSignal(data);
            formsPlot1.Plot.YLabel("Value");
            formsPlot1.Plot.XLabel("Sample Number");

            Closed += (sender, args) =>
            {
                dataTimer?.Stop();
                renderTimer?.Stop();
            };
        }
示例#4
0
        public Form1()
        {
            InitializeComponent();

            // simulate 10 seconds of 48 kHz audio
            int    sampleRate = 48_000;
            Random rand       = new Random(0);

            double[] data = ScottPlot.DataGen.RandomWalk(rand, sampleRate * 10);
            Signal = formsPlot1.Plot.AddSignal(data, sampleRate);

            // markers to indicate where the mouse is
            HLine = formsPlot1.Plot.AddHorizontalLine(0, Color.Red, 1, ScottPlot.LineStyle.Dash);
            VLine = formsPlot1.Plot.AddVerticalLine(0, Color.Red, 1, ScottPlot.LineStyle.Dash);

            formsPlot1.Render();
        }
示例#5
0
        public LiveDataIncoming()
        {
            InitializeComponent();
            signalPlot = formsPlot1.Plot.AddSignal(data);
            formsPlot1.Plot.YLabel("Value");
            formsPlot1.Plot.XLabel("Sample Number");

            Closed += (sender, args) =>
            {
                dataTimer?.Stop();
                renderTimer?.Stop();
            };

            this.dataTimer.Interval = 0.001;
            this.dataTimer.Elapsed += this.dataTimer_Tick;
            this.dataTimer.Start();
            this.renderTimer.Interval = 0.02;
            this.renderTimer.Elapsed += this.renderTimer_Tick;
            this.renderTimer.Start();
            this.cbAutoAxis.CheckedChanged += this.cbAutoAxis_CheckedChanged;
        }
示例#6
0
        public FormGui()
        {
            InitializeComponent();

            Random rand = new Random(0);

            sig = formsPlot1.plt.PlotSignal(
                ys: ScottPlot.DataGen.RandomWalk(rand, 10_000_000),
                label: "Signal (10M)");

            sigConst = formsPlot1.plt.PlotSignalConst(
                ys: ScottPlot.DataGen.RandomWalk(rand, 10_000_000),
                label: "SignalConst (10M)");

            scat = formsPlot1.plt.PlotScatter(
                xs: ScottPlot.DataGen.Consecutive(1_000, spacing: 10_000),
                ys: ScottPlot.DataGen.RandomWalk(rand, 1_000, 20),
                label: "Scatter (1k)");;

            formsPlot1.plt.Legend();
            formsPlot1.plt.Axis();
            formsPlot1.Render(AntiAliasCheckbox.Checked);
        }
        public LiveDataGrowing()
        {
            InitializeComponent();

            // plot the data array only once
            signalPlot = wpfPlot1.plt.PlotSignal(data);
            wpfPlot1.plt.YLabel("Value");
            wpfPlot1.plt.XLabel("Sample Number");

            // create a timer to modify the data
            DispatcherTimer updateDataTimer = new DispatcherTimer();

            updateDataTimer.Interval = TimeSpan.FromMilliseconds(1);
            updateDataTimer.Tick    += UpdateData;
            updateDataTimer.Start();

            // create a timer to update the GUI
            DispatcherTimer renderTimer = new DispatcherTimer();

            renderTimer.Interval = TimeSpan.FromMilliseconds(20);
            renderTimer.Tick    += Render;
            renderTimer.Start();
        }
示例#8
0
        public SignalPlot PlotSignal(
            double[] ys,
            double sampleRate      = 1,
            double xOffset         = 0,
            double yOffset         = 0,
            Color?color            = null,
            double lineWidth       = 1,
            double markerSize      = 5,
            string label           = null,
            Color[] colorByDensity = null,
            int?minRenderIndex     = null,
            int?maxRenderIndex     = null,
            LineStyle lineStyle    = LineStyle.Solid,
            bool useParallel       = true
            )
        {
            SignalPlot signal = new SignalPlot()
            {
                ys             = ys,
                sampleRate     = sampleRate,
                xOffset        = xOffset,
                yOffset        = yOffset,
                color          = color ?? settings.GetNextColor(),
                lineWidth      = lineWidth,
                markerSize     = (float)markerSize,
                label          = label,
                colorByDensity = colorByDensity,
                minRenderIndex = minRenderIndex ?? 0,
                maxRenderIndex = maxRenderIndex ?? ys.Length - 1,
                lineStyle      = lineStyle,
                useParallel    = useParallel,
            };

            Add(signal);
            return(signal);
        }