Add() public method

public Add ( OxyPlot.PlotModel pm, bool line ) : void
pm OxyPlot.PlotModel
line bool
return void
Exemplo n.º 1
0
        private void plot_xysum_vs_time(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            double y = 0;

            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                {
                    continue;
                }

                double x = events[i].ts + delay;
                y += events[i].lastx;
                update_minmax(x, y);
                main_comp.Add(x, y);
            }

            y = 0;

            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                {
                    continue;
                }

                double x = events[i].ts + delay;
                y += events[i].lasty;
                update_minmax(x, y);
                sec_comp.Add(x, y);
            }
        }
Exemplo n.º 2
0
        private void plot_yvelocity_vs_time(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            if (mlog.Cpi > 0)
            {
                for (int i = last_start; i <= last_end; i++)
                {
                    if (events[i].hDevice != mlog.hDevice)
                    {
                        continue;
                    }

                    double x = events[i].ts + delay;
                    double y;
                    if (i == 0)
                    {
                        y = 0.0;
                    }
                    else
                    {
                        y = (events[i].lasty) / (events[i].ts - events[i].lastts) / mlog.Cpi * 25.4;
                    }

                    update_minmax(x, y);
                    main_comp.Add(x, y);
                }
            }
            else
            {
                MessageBox.Show("CPI value is invalid, please run Measure");
            }
        }
Exemplo n.º 3
0
        private void plot_x_vs_y(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            double x = 0.0;
            double y = 0.0;

            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                {
                    continue;
                }

                x += events[i].lastx;
                y += events[i].lasty;
                update_minmax(x, x);
                update_minmax(y, y);
                main_comp.Add(x, y, false);
            }
        }
Exemplo n.º 4
0
        private void plot_frequency_vs_time(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                {
                    continue;
                }

                double x = events[i].ts;
                double y;
                if (i == 0)
                {
                    y = 0.0;
                }
                else
                {
                    y = 1000.0 / (events[i].ts - events[i].lastts);
                }

                update_minmax(x, y);
                main_comp.Add(x, y);
            }
        }
Exemplo n.º 5
0
        private void plot_yvelocity_vs_time(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            if (mlog.Cpi > 0)
            {
                for (int i = last_start; i <= last_end; i++)
                {
                    if (events[i].hDevice != mlog.hDevice)
                        continue;

                    double x = events[i].ts + delay;
                    double y;
                    if (i == 0)
                        y = 0.0;
                    else
                        y = (events[i].lasty) / (events[i].ts - events[i].lastts) / mlog.Cpi * 25.4;

                    update_minmax(x, y);
                    main_comp.Add(x, y);
                }
            }
            else
                MessageBox.Show("CPI value is invalid, please run Measure");
        }
Exemplo n.º 6
0
        private void plot_ysum_vs_time(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            double y = 0;

            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                    continue;

                double x = events[i].ts + delay;
                y += events[i].lasty;
                update_minmax(x, y);
                main_comp.Add(x, y);
            }
        }
Exemplo n.º 7
0
        private void plot_x_vs_y(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            double x = 0.0;
            double y = 0.0;
            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                    continue;

                x += events[i].lastx;
                y += events[i].lasty;
                update_minmax(x, x);
                update_minmax(y, y);
                main_comp.Add(x, y, false);
            }
        }
Exemplo n.º 8
0
        private void plot_interval_vs_time(MouseLog mlog, double delay, GraphComponents main_comp, GraphComponents sec_comp)
        {
            for (int i = last_start; i <= last_end; i++)
            {
                if (events[i].hDevice != mlog.hDevice)
                    continue;

                double x = events[i].ts;
                double y;
                if (i == 0)
                    y = 0.0;
                else
                    y = events[i].ts - events[i].lastts;

                update_minmax(x, y);
                main_comp.Add(x, y);
            }
        }
Exemplo n.º 9
0
        private void refresh_plot()
        {
            PlotModel pm = plot1.Model;

            pm.Series.Clear();
            pm.Axes.Clear();

            ResetPlotComponents();

            if (checkBoxLines.Checked)
            {
                BlueComponent.lines.Smooth = false;
                RedComponent.lines.Smooth  = false;

                if (dual)
                {
                    GreenComponent.lines.Smooth  = false;
                    YellowComponent.lines.Smooth = false;
                }
            }

            GraphType type = comboBoxPlotType.SelectedItem as GraphType;

            if (type == null)
            {
                MessageBox.Show("Something bad happened! SelectedItem is null...");
                return;
            }
            else
            {
                reset_minmax();

                type.PlotFunc(mlog, 0.0, BlueComponent, RedComponent);
                if (type.DualGraph == GraphType.GT.nolines)
                {
                    BlueComponent.Add(pm, checkBoxLines.Checked);
                }
                else
                {
                    BlueComponent.Add(pm, checkBoxLines.Checked, checkBoxStem.Checked);
                    if (type.DualGraph == GraphType.GT.dual)
                    {
                        RedComponent.Add(pm, checkBoxLines.Checked, checkBoxStem.Checked);
                    }
                }

                if (dual)
                {
                    type.PlotFunc(mlog2, -(double)numericUpDownDelay.Value, GreenComponent, YellowComponent);
                    if (type.DualGraph == GraphType.GT.nolines)
                    {
                        GreenComponent.Add(pm, checkBoxLines.Checked);
                    }
                    else
                    {
                        GreenComponent.Add(pm, checkBoxLines.Checked, checkBoxStem.Checked);
                        if (type.DualGraph == GraphType.GT.dual)
                        {
                            YellowComponent.Add(pm, checkBoxLines.Checked, checkBoxStem.Checked);
                        }
                    }
                }
            }

            var linearAxis1 = new LinearAxis();

            linearAxis1.AbsoluteMinimum    = x_min - (x_max - x_min) / 20.0;
            linearAxis1.AbsoluteMaximum    = x_max + (x_max - x_min) / 20.0;
            linearAxis1.MajorGridlineColor = OxyColor.FromArgb(40, 0, 0, 139);
            linearAxis1.MajorGridlineStyle = LineStyle.Solid;
            linearAxis1.MinorGridlineColor = OxyColor.FromArgb(20, 0, 0, 139);
            linearAxis1.MinorGridlineStyle = LineStyle.Solid;
            linearAxis1.Position           = AxisPosition.Bottom;
            linearAxis1.Title = type.AxisX;
            pm.Axes.Add(linearAxis1);

            var linearAxis2 = new LinearAxis();

            linearAxis2.AbsoluteMinimum    = y_min - (y_max - y_min) / 20.0;
            linearAxis2.AbsoluteMaximum    = y_max + (y_max - y_min) / 20.0;
            linearAxis2.MajorGridlineColor = OxyColor.FromArgb(40, 0, 0, 139);
            linearAxis2.MajorGridlineStyle = LineStyle.Solid;
            linearAxis2.MinorGridlineColor = OxyColor.FromArgb(20, 0, 0, 139);
            linearAxis2.MinorGridlineStyle = LineStyle.Solid;
            linearAxis2.Title = type.AxisY;
            pm.Axes.Add(linearAxis2);

            plot1.RefreshPlot(true);
        }