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); } } } }
public override void AddAnnotations(pwiz.MSGraph.MSGraphPane graphPane, Graphics g, pwiz.MSGraph.MSPointList pointList, ZedGraph.GraphObjList annotations) { base.AddAnnotations(graphPane, g, pointList, annotations); }