public FormsPlotLegendViewer(FormsPlot formsPlot, string windowTitle = "Detached Legend")
        {
            FormsPlot = formsPlot;
            Legend    = formsPlot.Plot.Legend(enable: true, location: null);
            Text      = windowTitle;

            Legend.IsDetached = true;
            Legend.IsVisible  = false;

            InitializeComponent();
            this.FormClosed += OnClosed;
            RefreshLegendImage();
            ResizeWindowToFitLegendImage();
            Show();
        }
        public PlotObjectEditor(FormsPlot formsPlot)
        {
            InitializeComponent();
            FormsPlot = formsPlot;

            listBox1.Items.Clear();
            foreach (Plottable.IPlottable plottable in formsPlot.Plot.GetPlottables())
            {
                listBox1.Items.Add(plottable);
            }

            if (listBox1.Items.Count > 0)
            {
                listBox1.SelectedIndex = 0;
            }
        }
Exemple #3
0
        public static void Plot(DeviceBase device, ScottPlot.FormsPlot plot)
        {
            if (device == null)
            {
                return;
            }
            double current_unixtime = UnixTime.Current();
            double cutoff           = current_unixtime - 5;

            device.PruneAmplitudeHistory(cutoff);

            double[] a_time = null, a_amp = null, b_time = null, b_amp = null;
            if (device.ExtractAmplitudeData(ref a_time, ref a_amp, ref b_time, ref b_amp))
            {
                plot.plt.Clear();
                plot.plt.PlotStep(a_time, a_amp);
                plot.plt.PlotStep(b_time, b_amp);
                plot.plt.Axis(cutoff, current_unixtime, 0, 255);
                plot.plt.Ticks(rulerModeX: false, rulerModeY: false, displayTicksX: false, displayTicksY: false);
                plot.plt.Frame(left: false, right: false, top: false);
                plot.plt.TightenLayout(padding: 0, render: true);
                plot.Render();
            }
        }