示例#1
0
 private void PlotChromatograms(ZedGraph.ZedGraphControl graph)
 {
     foreach (var msrun in _analysisResults.Results)
     {
         foreach (var chromatogram in msrun.Chromatograms)
         {
             var ChromLine = graph.GraphPane.AddCurve(String.Format("{0} ({1}): [{2}] - {3}", chromatogram.Peptide, chromatogram.IsotopeLabelType, chromatogram.PrecursorMZ, "PosMatch"),
                                                      chromatogram.RetentionTimes,
                                                      //chromatogram.SumOfNegativeMatch, // .SumOfPositiveMatch,
                                                      chromatogram.IonInjectionTimes,
                                                      Color.Green);
             ChromLine.Symbol.IsVisible = false;
         }
     }
     graph.GraphPane.Legend.IsVisible = true;
     graph.AxisChange();
     graph.Refresh();
 }
        public void CreateChart(ZedGraph.ZedGraphControl zgc, ref CW_PeakRegs[] IR)
        {
            EventHandler method = null;

            try
            {
                zgc.GraphPane = this.myPane;
                zgc.GraphPane.CurveList.Clear();
                zgc.GraphPane.GraphObjList.Clear();
                this.RedLimit                = (double)this.RedNumericUpDown.Value;
                this.BlueLimit               = (double)this.BlueNumericUpDown.Value;
                this.GreenLimit              = (double)this.GreenNumericUpDown.Value;
                this.myPane.Title.Text       = "CW Interference Detection";
                this.myPane.YAxis.Title.Text = "Power dB/Hz";
                this.myPane.XAxis.Title.Text = "Frequency (from L1 center)";
                this.myPane.BarSettings.Type = ZedGraph.BarType.Overlay;
                int num  = 0;
                int num2 = 0;
                int num3 = 0;
                for (int i = 0; i < 8; i++)
                {
                    if (IR[i].magD >= this.GreenLimit)
                    {
                        if (IR[i].magD >= this.RedLimit)
                        {
                            num++;
                        }
                        if ((IR[i].magD >= this.BlueLimit) && (IR[i].magD < this.RedLimit))
                        {
                            num2++;
                        }
                        if (IR[i].magD < this.BlueLimit)
                        {
                            num3++;
                        }
                    }
                }
                double[] x         = new double[num];
                double[] y         = new double[num];
                double[] numArray3 = new double[num3];
                double[] numArray4 = new double[num3];
                double[] numArray5 = new double[num2];
                double[] numArray6 = new double[num2];
                int      index     = -1;
                int      num6      = -1;
                int      num7      = -1;
                for (int j = 0; j < 8; j++)
                {
                    try
                    {
                        if (IR[j].magD >= this.GreenLimit)
                        {
                            if ((num > 0) && (IR[j].magD >= this.RedLimit))
                            {
                                index++;
                                x[index] = IR[j].freqD;
                                y[index] = IR[j].magD;
                            }
                            if (((num2 > 0) && (IR[j].magD >= this.BlueLimit)) && (IR[j].magD < this.RedLimit))
                            {
                                num6++;
                                numArray5[num6] = IR[j].freqD;
                                numArray6[num6] = IR[j].magD;
                            }
                            if ((num3 > 0) && (IR[j].magD < this.BlueLimit))
                            {
                                num7++;
                                numArray3[num7] = IR[j].freqD;
                                numArray4[num7] = IR[j].magD;
                            }
                        }
                    }
                    catch (IndexOutOfRangeException exception)
                    {
                        string str = exception.ToString();
                        string msg = "### Interference Report GUI handler error -- " + str;
                        this.comm.WriteApp(msg);
                    }
                }
                if (num > 0)
                {
                    string label = string.Format(">{0:F1}", this.RedLimit);
                    this.myPane.AddBar(label, x, y, Color.Red);
                }
                if (num2 > 0)
                {
                    string str4 = string.Format(">{0:F1}", this.BlueLimit);
                    this.myPane.AddBar(str4, numArray5, numArray6, Color.Blue);
                }
                if (num3 > 0)
                {
                    string str5 = string.Format("<{0:F1}", this.GreenLimit);
                    this.myPane.AddBar(str5, numArray3, numArray4, Color.Green);
                }
                AddlabelToBars(this.myPane, x, y);
                AddlabelToBars(this.myPane, numArray5, numArray6);
                AddlabelToBars(this.myPane, numArray3, numArray4);
                this.myPane.Chart.Fill          = new ZedGraph.Fill(Color.White, Color.LightGoldenrodYellow, 45f);
                this.myPane.YAxis.Scale.MaxAuto = false;
                this.myPane.YAxis.Scale.MinAuto = false;
                this.myPane.XAxis.Scale.MaxAuto = false;
                this.myPane.XAxis.Scale.MinAuto = false;
                this.myPane.YAxis.Scale.Max     = 100.0;
                this.myPane.YAxis.Scale.Min     = 0.0;
                this.myPane.XAxis.Scale.Min     = 1.57E+15;
                this.myPane.XAxis.Scale.Max     = 1.58E+15;
                this.myPane.BarSettings.ClusterScaleWidthAuto = false;
                this.myPane.BarSettings.ClusterScaleWidth     = 1000000000000;
                zgc.AxisChange();
                this.myPane.Fill = new ZedGraph.Fill(Color.WhiteSmoke);
                if (method == null)
                {
                    method = delegate {
                        zgc.Refresh();
                        zgc.Update();
                    };
                }
                base.Invoke(method);
                zgc.Size = new Size(base.ClientRectangle.Width - 0x19, base.ClientRectangle.Height - 90);
            }
            catch (Exception exception2)
            {
                string str6 = exception2.ToString();
                string str7 = "### Interference Report GUI handler error -- " + str6;
                this.comm.WriteApp(str7);
            }
        }
示例#3
0
        private void Draw()
        {
            if (DataConvertationClass.IsUndefinedElement(_dataAr))
            {
                MessageBox.Show(Text + ". Існують не визначені елементи!");
                return;
            }
            dataGridView1.ColumnCount = _degree + 2;
            dataGridView1.RowCount    = 2;
            dataGridView1[0, 0].Value = "Автокореляції";
            dataGridView1[0, 1].Value = "ЧАКФ";
            double[] ACArray  = Statistical.ACF(_dataAr, _degree);
            double[] PACArray = Statistical.PACF(_dataAr, _degree);
            double[] XList    = new double[_degree + 1];
            for (int i = 1; i < dataGridView1.ColumnCount; i++)
            {
                dataGridView1.Columns[i].Name = (i - 1).ToString();
                dataGridView1[i, 0].Value     = ACArray[i - 1].ToString("F6");
                if (Math.Abs(ACArray[i - 1]) >= level)
                {
                    dataGridView1[i, 0].Style.ForeColor = Color.Red;
                }
                else
                {
                    dataGridView1[i, 0].Style.ForeColor = Color.Black;
                }
                dataGridView1[i, 1].Value = PACArray[i - 1].ToString("F6");
                if (Math.Abs(PACArray[i - 1]) >= level)
                {
                    dataGridView1[i, 1].Style.ForeColor = Color.Red;
                }
                else
                {
                    dataGridView1[i, 1].Style.ForeColor = Color.Black;
                }
                XList[i - 1] = i - 1;
            }
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

            ZedGraph.LineObj levelLine1 = new ZedGraph.LineObj(Color.Red, -1, level, _degree + 1, level);
            levelLine1.Line.Width = 2;
            ZedGraph.LineObj levelLine2 = new ZedGraph.LineObj(Color.Red, -1, -level, _degree + 1, -level);
            levelLine2.Line.Width = 2;

            ZedGraph.GraphPane ACpane = ACzedGraphControl.GraphPane;
            ACpane.CurveList.Clear();
            ACpane.GraphObjList.Clear();
            ACpane.Title.Text                = "Автокореляція";
            ACpane.XAxis.Title.IsVisible     = false;
            ACpane.XAxis.MajorGrid.IsVisible = true;
            ACpane.XAxis.MajorGrid.DashOn    = 1;
            ACpane.XAxis.MajorGrid.DashOff   = 1;
            ACpane.XAxis.Scale.Min           = 0;
            ACpane.XAxis.Scale.Max           = ACArray.Length;
            ACpane.YAxis.Title.IsVisible     = false;
            ACpane.YAxis.MajorGrid.IsVisible = true;
            ACpane.YAxis.MajorGrid.DashOn    = 1;
            ACpane.YAxis.MajorGrid.DashOff   = 1;
            ACpane.YAxis.Scale.Min           = -2;
            ACpane.YAxis.Scale.Max           = 2;
            ZedGraph.PointPairList ACList = new ZedGraph.PointPairList(XList, ACArray);
            ACpane.AddBar("", ACList, Color.BlanchedAlmond);
            ACpane.GraphObjList.Add(levelLine1);
            ACpane.GraphObjList.Add(levelLine2);
            ACzedGraphControl.Refresh();

            ZedGraph.GraphPane PACpane = PACzedGraphControl.GraphPane;
            PACpane.CurveList.Clear();
            PACpane.GraphObjList.Clear();
            PACpane.Title.Text                = "ЧАКФ";
            PACpane.XAxis.Title.IsVisible     = false;
            PACpane.XAxis.MajorGrid.IsVisible = true;
            PACpane.XAxis.MajorGrid.DashOn    = 1;
            PACpane.XAxis.MajorGrid.DashOff   = 1;
            PACpane.XAxis.Scale.Min           = 0;
            PACpane.XAxis.Scale.Max           = ACArray.Length;
            PACpane.YAxis.Title.IsVisible     = false;
            PACpane.YAxis.MajorGrid.IsVisible = true;
            PACpane.YAxis.MajorGrid.DashOn    = 1;
            PACpane.YAxis.MajorGrid.DashOff   = 1;
            PACpane.YAxis.Scale.Min           = -2;
            PACpane.YAxis.Scale.Max           = 2;
            ZedGraph.PointPairList PACList = new ZedGraph.PointPairList(XList, PACArray);
            PACpane.AddBar("", PACList, Color.BlanchedAlmond);
            PACpane.GraphObjList.Add(levelLine1);
            PACpane.GraphObjList.Add(levelLine2);
            PACzedGraphControl.Refresh();
        }
示例#4
0
        private void CreateReportLine()
        {
            //panel
            Panel panel = new Panel();

            panel.Size = new System.Drawing.Size(DefaultSectionWidth, (int)(DefaultSectionWidth * 0.63));
            panel.Top  = PageHeight - FooterHeight - panel.Height - 15;
            //check box
            CheckBox cbLimit = new CheckBox();
            CheckBox cbIdeal = new CheckBox();
            CheckBox cbMark  = new CheckBox();

            cbLimit.Text    = "Show Alarm Limit";
            cbIdeal.Text    = "Show Ideal Range";
            cbMark.Text     = "Show Mark";
            cbLimit.Size    = new System.Drawing.Size(109, 18);
            cbIdeal.Size    = new Size(114, 18);
            cbMark.Size     = new Size(81, 18);
            cbLimit.Font    = new System.Drawing.Font("Arial", 8F);
            cbIdeal.Font    = new System.Drawing.Font("Arial", 8F);
            cbMark.Font     = new System.Drawing.Font("Arial", 8F);
            cbLimit.Left    = DefaultSectionWidth - 351;
            cbIdeal.Left    = DefaultSectionWidth - 241;
            cbMark.Left     = DefaultSectionWidth - 126;
            cbLimit.Checked = Common.GlobalProfile.IsShowAlarmLimit;
            cbIdeal.Checked = Common.GlobalProfile.IsFillIdealRange;
            cbMark.Checked  = Common.GlobalProfile.IsShowMark;
            cbLimit.Checked = Common.GlobalProfile.IsShowAlarmLimit;
            cbIdeal.Checked = Common.GlobalProfile.IsFillIdealRange;
            cbMark.Checked  = Common.GlobalProfile.IsShowMark;
            panel.Controls.Add(cbLimit);
            panel.Controls.Add(cbIdeal);
            panel.Controls.Add(cbMark);
            //zedgraph
            ZedGraph.ZedGraphControl reportZedGraph = new ZedGraph.ZedGraphControl();
            reportZedGraph.Size = new System.Drawing.Size(DefaultSectionWidth, (int)(DefaultSectionWidth * 0.63));
            reportZedGraph.Dock = DockStyle.Fill;
            reportZedGraph.GraphPane.CurveList.Clear();
            GraphHelper.SetGraphAsDefaultProperity(reportZedGraph, XAxisVisibility.DateAndTime);
            GraphHelper.SetMinMaxLimits(base.device);
            GraphHelper.SetGraphDataSource(reportZedGraph, base.device, XAxisVisibility.DateAndTime, cbMark.Checked);
            reportZedGraph.IsShowPointValues = false;
            reportZedGraph.IsEnableSelection = false;
            reportZedGraph.IsEnableZoom      = false;
            reportZedGraph.Font = new System.Drawing.Font("Arial", 8F);
            panel.Controls.Add(reportZedGraph);

            cbLimit.CheckedChanged += new EventHandler((sender, e) =>
            {
                GraphHelper.DrawLimitLintAndFillIdeal(reportZedGraph.GraphPane, base.device, cbIdeal.Checked, cbLimit.Checked);
                base.device.ReportGraph = Platform.Utils.CopyToBinary(reportZedGraph.GraphPane.GetImage(true));
                reportZedGraph.Refresh();
            });
            cbIdeal.CheckedChanged += new EventHandler((sender, e) =>
            {
                GraphHelper.DrawLimitLintAndFillIdeal(reportZedGraph.GraphPane, base.device, cbIdeal.Checked, cbLimit.Checked);
                base.device.ReportGraph = Platform.Utils.CopyToBinary(reportZedGraph.GraphPane.GetImage(true));
                reportZedGraph.Refresh();
            });
            cbMark.CheckedChanged += new EventHandler((sender, e) =>
            {
                GraphHelper.ReDrawUnCompareCurveItem(reportZedGraph.GraphPane, base.device, XAxisVisibility.DateAndTime, cbMark.Checked);
                base.device.ReportGraph = Platform.Utils.CopyToBinary(reportZedGraph.GraphPane.GetImage(true));
                reportZedGraph.Refresh();
            });
            GraphHelper.ReDrawUnCompareCurveItem(reportZedGraph.GraphPane, base.device, XAxisVisibility.DateAndTime, cbMark.Checked);
            GraphHelper.DrawLimitLintAndFillIdeal(reportZedGraph.GraphPane, base.device, cbIdeal.Checked, cbLimit.Checked);
            reportZedGraph.Refresh();
            base.device.ReportGraph = Platform.Utils.CopyToBinary(reportZedGraph.GraphPane.GetImage(true));
            this.AddSection(panel);
        }