public DistributionStatisticsForm(IDPickerForm owner) { InitializeComponent(); this.owner = owner; FormClosing += delegate(object sender, FormClosingEventArgs e) { e.Cancel = true; DockState = DockState.DockBottomAutoHide; }; Text = TabText = "Distribution Statistics"; Icon = Properties.Resources.BlankIcon; refreshButton.Image = new Icon(Properties.Resources.Refresh, refreshButton.Width / 2, refreshButton.Height / 2).ToBitmap(); refreshDataLabel.LinkClicked += (sender, e) => refreshButton_Click(sender, e); precursorMassErrorForm = new DockableGraphForm { Text = "Precursor Mass Error" }; precursorMassErrorForm.ZedGraphControl.GraphPane.YAxis.Title.Text = "Density"; precursorMassErrorForm.ZedGraphControl.GraphPane.XAxis.Title.Text = "Observed - Expected Mass"; precursorMassErrorForm.ZedGraphControl.GraphPane.XAxis.MajorTic.IsInside = false; precursorMassErrorForm.ZedGraphControl.GraphPane.XAxis.MinorTic.IsInside = false; precursorMassErrorForm.ZedGraphControl.GraphPane.Border.IsVisible = false; precursorMassErrorForm.ZedGraphControl.GraphPane.IsFontsScaled = false; precursorMassErrorForm.ZedGraphControl.GraphPane.IsPenWidthScaled = false; precursorMassErrorForm.ZedGraphControl.BorderStyle = BorderStyle.None; scanTimeDistributionForm = new DockableGraphForm { Text = "Scan Time" }; scanTimeDistributionForm.ZedGraphControl.GraphPane.YAxis.Title.Text = "Density"; scanTimeDistributionForm.ZedGraphControl.GraphPane.XAxis.Title.Text = "Scan Time (minutes)"; scanTimeDistributionForm.ZedGraphControl.GraphPane.XAxis.MajorTic.IsInside = false; scanTimeDistributionForm.ZedGraphControl.GraphPane.XAxis.MinorTic.IsInside = false; scanTimeDistributionForm.ZedGraphControl.GraphPane.Border.IsVisible = false; scanTimeDistributionForm.ZedGraphControl.GraphPane.IsFontsScaled = false; scanTimeDistributionForm.ZedGraphControl.GraphPane.IsPenWidthScaled = false; scanTimeDistributionForm.ZedGraphControl.BorderStyle = BorderStyle.None; chargeStatesForm = new DockableGraphForm { Text = "Charge States" }; chargeStatesForm.ZedGraphControl.GraphPane.YAxis.Title.Text = "Spectra"; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Title.Text = "Charge State"; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Type = AxisType.Text; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.MajorTic.IsOpposite = false; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.MajorTic.IsInside = false; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.MinorTic.IsAllTics = false; chargeStatesForm.ZedGraphControl.GraphPane.Legend.IsVisible = false; chargeStatesForm.ZedGraphControl.GraphPane.Border.IsVisible = false; chargeStatesForm.ZedGraphControl.GraphPane.IsFontsScaled = false; chargeStatesForm.ZedGraphControl.GraphPane.IsPenWidthScaled = false; chargeStatesForm.ZedGraphControl.IsEnableZoom = false; chargeStatesForm.ZedGraphControl.IsEnableHPan = false; chargeStatesForm.ZedGraphControl.IsEnableVPan = false; chargeStatesForm.ZedGraphControl.BorderStyle = BorderStyle.None; precursorMassErrorForm.ZedGraphControl.ZoomEvent += (sender, before, after, mousePosition) => { precursorMassErrorForm.ZedGraphControl.GraphPane.YAxis.Scale.Min = Math.Max(0, precursorMassErrorForm.ZedGraphControl.GraphPane.YAxis.Scale.Min); }; scanTimeDistributionForm.ZedGraphControl.ZoomEvent += (sender, before, after, mousePosition) => { precursorMassErrorForm.ZedGraphControl.GraphPane.YAxis.Scale.Min = Math.Max(0, precursorMassErrorForm.ZedGraphControl.GraphPane.YAxis.Scale.Min); }; chargeStatesForm.ZedGraphControl.ZoomEvent += (sender, before, after, mousePosition) => { chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Scale.MajorStepAuto = false; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Scale.MajorStep = 1; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Scale.Format = "f0"; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Scale.Min = Math.Max(0, chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Scale.Min); chargeStatesForm.ZedGraphControl.GraphPane.YAxis.Scale.Min = Math.Max(0, chargeStatesForm.ZedGraphControl.GraphPane.YAxis.Scale.Min); }; ppmMassErrorMenuItem = new ToolStripMenuItem("Show Mass Error in PPM", null, (x, y) => { if (ppmMassErrorMenuItem.Text.Contains("PPM")) { ppmMassErrorMenuItem.Text = "Show Mass Error in Daltons"; } else { ppmMassErrorMenuItem.Text = "Show Mass Error in PPM"; } refreshButton_Click(this, EventArgs.Empty); }); precursorMassErrorForm.ZedGraphControl.ContextMenuBuilder += (sender, menuStrip, mousePt, objState) => { int index = menuStrip.Items.Cast <ToolStripMenuItem>().TakeWhile(o => o.Text != "Show Point Values").Count(); menuStrip.Items.Insert(index, ppmMassErrorMenuItem); }; precursorMassErrorForm.ShowDataTable += (sender, e) => { e.DataTable = new DataTable(); e.DataTable.Columns.Add("Mass Error", typeof(double)); e.DataTable.Columns.Add("Charge", typeof(int)); // the grass plots, with a symbol type, hold the real data; the tag is the charge state e.DataTable.BeginLoadData(); foreach (var curve in precursorMassErrorForm.ZedGraphControl.GraphPane.CurveList.Where(o => (o as LineItem).Symbol.Type != SymbolType.None)) { int charge = (int)curve.Tag; foreach (var point in curve.Points as PointPairList) { e.DataTable.Rows.Add(point.X, charge); } } e.DataTable.EndLoadData(); }; chargeStatesForm.ShowDataTable += (sender, e) => { e.DataTable = new DataTable(); e.DataTable.Columns.Add("Charge State", typeof(int)); e.DataTable.Columns.Add("Spectra", typeof(int)); e.DataTable.BeginLoadData(); var points = chargeStatesForm.ZedGraphControl.GraphPane.CurveList[0].Points; for (int i = 0; i < points.Count; ++i) { e.DataTable.Rows.Add((int)points[i].X, (int)points[i].Y); } e.DataTable.EndLoadData(); }; lastActiveGraphForm = precursorMassErrorForm; }
public DistributionStatisticsForm (IDPickerForm owner) { InitializeComponent(); this.owner = owner; FormClosing += delegate(object sender, FormClosingEventArgs e) { e.Cancel = true; DockState = DockState.DockBottomAutoHide; }; Text = TabText = "Distribution Statistics"; Icon = Properties.Resources.BlankIcon; refreshButton.Image = new Icon(Properties.Resources.Refresh, refreshButton.Width / 2, refreshButton.Height / 2).ToBitmap(); refreshDataLabel.LinkClicked += (sender, e) => refreshButton_Click(sender, e); precursorMassErrorForm = new DockableGraphForm { Text = "Precursor Mass Error" }; precursorMassErrorForm.ZedGraphControl.GraphPane.YAxis.Title.Text = "Density"; precursorMassErrorForm.ZedGraphControl.GraphPane.XAxis.Title.Text = "Observed - Expected Mass"; precursorMassErrorForm.ZedGraphControl.GraphPane.XAxis.MajorTic.IsInside = false; precursorMassErrorForm.ZedGraphControl.GraphPane.XAxis.MinorTic.IsInside = false; precursorMassErrorForm.ZedGraphControl.GraphPane.Border.IsVisible = false; precursorMassErrorForm.ZedGraphControl.GraphPane.IsFontsScaled = false; precursorMassErrorForm.ZedGraphControl.GraphPane.IsPenWidthScaled = false; precursorMassErrorForm.ZedGraphControl.BorderStyle = BorderStyle.None; scanTimeDistributionForm = new DockableGraphForm { Text = "Scan Time" }; scanTimeDistributionForm.ZedGraphControl.GraphPane.YAxis.Title.Text = "Density"; scanTimeDistributionForm.ZedGraphControl.GraphPane.XAxis.Title.Text = "Scan Time (minutes)"; scanTimeDistributionForm.ZedGraphControl.GraphPane.XAxis.MajorTic.IsInside = false; scanTimeDistributionForm.ZedGraphControl.GraphPane.XAxis.MinorTic.IsInside = false; scanTimeDistributionForm.ZedGraphControl.GraphPane.Border.IsVisible = false; scanTimeDistributionForm.ZedGraphControl.GraphPane.IsFontsScaled = false; scanTimeDistributionForm.ZedGraphControl.GraphPane.IsPenWidthScaled = false; scanTimeDistributionForm.ZedGraphControl.BorderStyle = BorderStyle.None; chargeStatesForm = new DockableGraphForm { Text = "Charge States" }; chargeStatesForm.ZedGraphControl.GraphPane.YAxis.Title.Text = "Spectra"; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Title.Text = "Charge State"; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Type = AxisType.Text; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.MajorTic.IsOpposite = false; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.MajorTic.IsInside = false; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.MinorTic.IsAllTics = false; chargeStatesForm.ZedGraphControl.GraphPane.Legend.IsVisible = false; chargeStatesForm.ZedGraphControl.GraphPane.Border.IsVisible = false; chargeStatesForm.ZedGraphControl.GraphPane.IsFontsScaled = false; chargeStatesForm.ZedGraphControl.GraphPane.IsPenWidthScaled = false; chargeStatesForm.ZedGraphControl.IsEnableZoom = false; chargeStatesForm.ZedGraphControl.IsEnableHPan = false; chargeStatesForm.ZedGraphControl.IsEnableVPan = false; chargeStatesForm.ZedGraphControl.BorderStyle = BorderStyle.None; precursorMassErrorForm.ZedGraphControl.ZoomEvent += (sender, before, after, mousePosition) => { precursorMassErrorForm.ZedGraphControl.GraphPane.YAxis.Scale.Min = Math.Max(0, precursorMassErrorForm.ZedGraphControl.GraphPane.YAxis.Scale.Min); }; scanTimeDistributionForm.ZedGraphControl.ZoomEvent += (sender, before, after, mousePosition) => { precursorMassErrorForm.ZedGraphControl.GraphPane.YAxis.Scale.Min = Math.Max(0, precursorMassErrorForm.ZedGraphControl.GraphPane.YAxis.Scale.Min); }; chargeStatesForm.ZedGraphControl.ZoomEvent += (sender, before, after, mousePosition) => { chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Scale.MajorStepAuto = false; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Scale.MajorStep = 1; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Scale.Format = "f0"; chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Scale.Min = Math.Max(0, chargeStatesForm.ZedGraphControl.GraphPane.XAxis.Scale.Min); chargeStatesForm.ZedGraphControl.GraphPane.YAxis.Scale.Min = Math.Max(0, chargeStatesForm.ZedGraphControl.GraphPane.YAxis.Scale.Min); }; ppmMassErrorMenuItem = new ToolStripMenuItem("Show Mass Error in PPM", null, (x, y) => { if (ppmMassErrorMenuItem.Text.Contains("PPM")) ppmMassErrorMenuItem.Text = "Show Mass Error in Daltons"; else ppmMassErrorMenuItem.Text = "Show Mass Error in PPM"; refreshButton_Click(this, EventArgs.Empty); }); precursorMassErrorForm.ZedGraphControl.ContextMenuBuilder += (sender, menuStrip, mousePt, objState) => { int index = menuStrip.Items.Cast<ToolStripMenuItem>().TakeWhile(o => o.Text != "Show Point Values").Count(); menuStrip.Items.Insert(index, ppmMassErrorMenuItem); }; precursorMassErrorForm.ShowDataTable += (sender, e) => { e.DataTable = new DataTable(); e.DataTable.Columns.Add("Mass Error", typeof(double)); e.DataTable.Columns.Add("Charge", typeof(int)); // the grass plots, with a symbol type, hold the real data; the tag is the charge state e.DataTable.BeginLoadData(); foreach (var curve in precursorMassErrorForm.ZedGraphControl.GraphPane.CurveList.Where(o => (o as LineItem).Symbol.Type != SymbolType.None)) { int charge = (int) curve.Tag; foreach (var point in curve.Points as PointPairList) e.DataTable.Rows.Add(point.X, charge); } e.DataTable.EndLoadData(); }; chargeStatesForm.ShowDataTable += (sender, e) => { e.DataTable = new DataTable(); e.DataTable.Columns.Add("Charge State", typeof(int)); e.DataTable.Columns.Add("Spectra", typeof(int)); e.DataTable.BeginLoadData(); var points = chargeStatesForm.ZedGraphControl.GraphPane.CurveList[0].Points; for (int i = 0; i < points.Count; ++i) e.DataTable.Rows.Add((int)points[i].X, (int)points[i].Y); e.DataTable.EndLoadData(); }; lastActiveGraphForm = precursorMassErrorForm; }