Example #1
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.plt.PlotSignalConst(data, sampleRate);

            // markers to indicate where the mouse is
            HLine = formsPlot1.plt.PlotHLine(0, Color.Red, lineStyle: ScottPlot.LineStyle.Dash);
            VLine = formsPlot1.plt.PlotVLine(0, Color.Red, lineStyle: ScottPlot.LineStyle.Dash);

            formsPlot1.Render();
        }
Example #2
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);
        }
Example #3
0
        public SignalPlotConst <T> PlotSignalConst <T>(
            T[] 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
            ) where T : struct, IComparable
        {
            SignalPlotConst <T> signal = new SignalPlotConst <T>()
            {
                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);
        }