public virtual void AddAnnotations(pwiz.MSGraph.MSGraphPane graphPane, Graphics g, pwiz.MSGraph.MSPointList pointList, ZedGraph.GraphObjList annotations) { PointMap points = new PointMap(Points); foreach (IAnnotation annotation in annotationList) { annotation.Update(this, pointList, annotations); } }
/// <summary> /// add precursor and non-matched annotations /// </summary> public override void AddAnnotations(pwiz.MSGraph.MSGraphPane graphPane, Graphics g, pwiz.MSGraph.MSPointList pointList, ZedGraph.GraphObjList annotations) { base.AddAnnotations(graphPane, g, pointList, annotations); //using( Spectrum element = Element ) { foreach (Precursor p in Element.precursors) { foreach (SelectedIon si in p.selectedIons) { double precursorMz = (double)si.cvParam(CVID.MS_selected_ion_m_z).value; int precursorCharge = 0; CVParam precursorChargeParam = si.cvParam(CVID.MS_charge_state); if (precursorChargeParam.empty()) { precursorChargeParam = si.cvParam(CVID.MS_possible_charge_state); } if (!precursorChargeParam.empty()) { precursorCharge = (int)precursorChargeParam.value; } double stickLength = 0.1; ZedGraph.LineObj stickOverlay = new ZedGraph.LineObj(precursorMz, 1, precursorMz, stickLength); stickOverlay.Location.CoordinateFrame = ZedGraph.CoordType.XScaleYChartFraction; stickOverlay.Line.Width = 3; stickOverlay.Line.Style = System.Drawing.Drawing2D.DashStyle.Dot; stickOverlay.Line.Color = Color.Green; annotations.Add(stickOverlay); // Create a text label from the X data value string precursorLabel; if (precursorCharge > 0) { precursorLabel = String.Format("{0}\n(+{1} precursor)", precursorMz.ToString("f3"), precursorCharge); } else { precursorLabel = String.Format("{0}\n(precursor of unknown charge)", precursorMz.ToString("f3")); } ZedGraph.TextObj text = new ZedGraph.TextObj(precursorLabel, precursorMz, stickLength, ZedGraph.CoordType.XScaleYChartFraction, ZedGraph.AlignH.Center, ZedGraph.AlignV.Bottom); text.ZOrder = ZedGraph.ZOrder.A_InFront; text.FontSpec.FontColor = stickOverlay.Line.Color; text.FontSpec.Border.IsVisible = false; text.FontSpec.Fill.IsVisible = false; //text.FontSpec.Fill = new Fill( Color.FromArgb( 100, Color.White ) ); text.FontSpec.Angle = 0; annotations.Add(text); } } } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); pwiz.MSGraph.MSGraphPane msGraphPane1 = new pwiz.MSGraph.MSGraphPane(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager( typeof( GraphForm ) ); this.msGraphControl = new pwiz.MSGraph.MSGraphControl(); this.SuspendLayout(); // // msGraphControl // this.msGraphControl.Dock = System.Windows.Forms.DockStyle.Fill; this.msGraphControl.EditButtons = System.Windows.Forms.MouseButtons.Left; this.msGraphControl.EditModifierKeys = System.Windows.Forms.Keys.None; msGraphPane1.BaseDimension = 8F; msGraphPane1.IsAlignGrids = false; msGraphPane1.IsBoundedRanges = false; msGraphPane1.IsFontsScaled = true; msGraphPane1.IsIgnoreInitial = false; msGraphPane1.IsIgnoreMissing = false; msGraphPane1.IsPenWidthScaled = false; msGraphPane1.LineType = ZedGraph.LineType.Normal; msGraphPane1.Tag = null; msGraphPane1.TitleGap = 0.5F; this.msGraphControl.GraphPane = msGraphPane1; this.msGraphControl.IsEnableVZoom = false; this.msGraphControl.Location = new System.Drawing.Point( 0, 0 ); this.msGraphControl.Name = "msGraphControl"; this.msGraphControl.PanButtons2 = System.Windows.Forms.MouseButtons.None; this.msGraphControl.ScrollGrace = 0; this.msGraphControl.ScrollMaxX = 0; this.msGraphControl.ScrollMaxY = 0; this.msGraphControl.ScrollMaxY2 = 0; this.msGraphControl.ScrollMinX = 0; this.msGraphControl.ScrollMinY = 0; this.msGraphControl.ScrollMinY2 = 0; this.msGraphControl.Size = new System.Drawing.Size( 464, 413 ); this.msGraphControl.TabIndex = 0; // // GraphForm // this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 13F ); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScroll = true; this.ClientSize = new System.Drawing.Size( 464, 413 ); this.Controls.Add( this.msGraphControl ); this.MinimumSize = new System.Drawing.Size( 100, 50 ); this.Name = "GraphForm"; this.TabText = "GraphForm"; this.Text = "GraphForm"; this.ResizeBegin += new System.EventHandler( this.GraphForm_ResizeBegin ); this.ResizeEnd += new System.EventHandler( this.GraphForm_ResizeEnd ); this.ResumeLayout( false ); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); pwiz.MSGraph.MSGraphPane msGraphPane1 = new pwiz.MSGraph.MSGraphPane(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GraphForm)); this.msGraphControl = new pwiz.MSGraph.MSGraphControl(); this.SuspendLayout(); // // msGraphControl // this.msGraphControl.Dock = System.Windows.Forms.DockStyle.Fill; this.msGraphControl.EditButtons = System.Windows.Forms.MouseButtons.Left; this.msGraphControl.EditModifierKeys = System.Windows.Forms.Keys.None; msGraphPane1.BaseDimension = 8F; msGraphPane1.IsAlignGrids = false; msGraphPane1.IsBoundedRanges = false; msGraphPane1.IsFontsScaled = true; msGraphPane1.IsIgnoreInitial = false; msGraphPane1.IsIgnoreMissing = false; msGraphPane1.IsPenWidthScaled = false; msGraphPane1.LineType = ZedGraph.LineType.Normal; msGraphPane1.Tag = null; msGraphPane1.TitleGap = 0.5F; this.msGraphControl.GraphPane = msGraphPane1; this.msGraphControl.IsEnableVZoom = false; this.msGraphControl.Location = new System.Drawing.Point(0, 0); this.msGraphControl.Name = "msGraphControl"; this.msGraphControl.PanButtons2 = System.Windows.Forms.MouseButtons.None; this.msGraphControl.ScrollGrace = 0; this.msGraphControl.ScrollMaxX = 0; this.msGraphControl.ScrollMaxY = 0; this.msGraphControl.ScrollMaxY2 = 0; this.msGraphControl.ScrollMinX = 0; this.msGraphControl.ScrollMinY = 0; this.msGraphControl.ScrollMinY2 = 0; this.msGraphControl.Size = new System.Drawing.Size(464, 413); this.msGraphControl.TabIndex = 0; // // GraphForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScroll = true; this.ClientSize = new System.Drawing.Size(464, 413); this.Controls.Add(this.msGraphControl); this.MinimumSize = new System.Drawing.Size(100, 50); this.Name = "GraphForm"; this.TabText = "GraphForm"; this.Text = "GraphForm"; this.ResizeBegin += new System.EventHandler(this.GraphForm_ResizeBegin); this.ResizeEnd += new System.EventHandler(this.GraphForm_ResizeEnd); this.ResumeLayout(false); }
public override void AddAnnotations(pwiz.MSGraph.MSGraphPane graphPane, Graphics g, pwiz.MSGraph.MSPointList pointList, ZedGraph.GraphObjList annotations) { base.AddAnnotations(graphPane, g, pointList, annotations); }