private void Render(bool redrawFrame = false)
        {
            fig.BenchmarkThis(showBenchmark);
            if (redrawFrame)
            {
                fig.FrameRedraw();
            }
            else
            {
                fig.GraphClear();
            }

            // plot signals
            foreach (SignalData signalData in signalDataList)
            {
                fig.PlotSignal(signalData.values, signalData.xSpacing, signalData.offsetX, signalData.offsetY, signalData.lineWidth, signalData.lineColor);
            }

            // plot XY points
            foreach (XYData xyData in xyDataList)
            {
                if (xyData.lineWidth > 0 && xyData.Xs.Length > 1)
                {
                    fig.PlotLines(xyData.Xs, xyData.Ys, xyData.lineWidth, xyData.lineColor);
                }
                fig.PlotScatter(xyData.Xs, xyData.Ys, xyData.markerSize, xyData.markerColor);
            }

            // plot axis lines
            foreach (AxisLine axisLine in hLines)
            {
                fig.PlotLines(
                    new double[] { fig.xAxis.min, fig.xAxis.max },
                    new double[] { axisLine.value, axisLine.value },
                    axisLine.lineWidth,
                    axisLine.lineColor
                    );
            }
            foreach (AxisLine axisLine in vLines)
            {
                fig.PlotLines(
                    new double[] { axisLine.value, axisLine.value },
                    new double[] { fig.yAxis.min, fig.yAxis.max },
                    axisLine.lineWidth,
                    axisLine.lineColor
                    );
            }

            pictureBox1.Image = fig.Render();
        }
예제 #2
0
        static void Main(string[] args)
        {
            var fig = new ScottPlot.Figure(640, 460);

            double[] Xs = fig.gen.Sequence(1_000_000, 1.0 / 20e3); // 20 kHz
            double[] Ys = fig.gen.RandomWalk(1_000_000);
            fig.AxisAuto(Xs, Ys, null, .9);

            fig.BenchmarkThis();

            fig.PlotSignal(Ys, 1.0 / 20000);

            fig.Save("test.png");

            Console.Write("\nDONE");
        }