예제 #1
0
        public static void Show(double[] time, double[] data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (data.Length == 0)
            {
                throw new ArgumentException("Value cannot be an empty collection.", nameof(data));
            }

            var form = new PltForm();
            var plt  = form.Plot.plt;

            plt.Title("Title");
            plt.YLabel("Y");
            plt.XLabel("X");

            plt.PlotScatter(time, data);

            form.Plot.Render();
            form.ShowDialog();
        }
예제 #2
0
        public static void Show(OHLC[] data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (data.Length == 0)
            {
                throw new ArgumentException("Value cannot be an empty collection.", nameof(data));
            }

            var form = new PltForm();
            var plt  = form.Plot.plt;

            plt.Title("Title");
            plt.YLabel("Y");
            plt.XLabel("X");

            plt.PlotCandlestick(data);
            plt.Ticks(dateTimeX: true);

            form.Plot.Render();
            form.ShowDialog();
        }
예제 #3
0
        public static void Show(DoubleArray[] data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            if (data.Length == 0)
            {
                throw new ArgumentException("Value cannot be an empty collection.", nameof(data));
            }
            var props = data[0].Properties;


            var form = new PltForm();
            var plt  = form.Plot.plt;

            plt.Title("Title");
            plt.YLabel("Y");
            plt.XLabel("X");

            if (props == BarValue.Properties || props == TradeBarValue.Properties)
            {
                ScottPlot.OHLC[] ohlcs = data.Zip(DataGen.Consecutive(data.Length), (d, time) => new OHLC(d.Open, d.High, d.Low, d.Close, time)).ToArray();

                plt.PlotCandlestick(ohlcs);
                plt.Ticks(dateTimeX: true);
            }
            else
            {
                plt.PlotScatter(DataGen.Consecutive(data.Length), data.Select(d => d.Value).ToArray());
            }


            form.Plot.Render();
            form.ShowDialog();
        }