static MsSpectrumGraphObject GetMsSpectrumGraphObject(ICompound compound, Color color, string legend)
        {
            string       spectrumName        = compound.FileName;
            SpectrumData spectrumData        = getSpectrumData(compound);
            var          spectrumGraphObject = new MsSpectrumGraphObject(spectrumData);

            spectrumGraphObject.DisplaySettings.Color = color;

            //if (legend != null)
            //    spectrumGraphObject.CreateLegendObject(legend);
            //else
            spectrumGraphObject.CreateLegendObject(new List <string> {
                spectrumData.Name
            });

            spectrumGraphObject.MassOfPrecursorIon = GetMassOfMostAbundantIon(spectrumData);
            spectrumGraphObject.DisplaySettings.ShowPrecursorIonAnnotation = false;
            spectrumGraphObject.DisplaySettings.PenSizeFocusedIon          = 2f;
            spectrumGraphObject.DisplaySettings.PenSizeDefaultIon          = 1f;

            // spectrumGraphObject.DisplaySettings.DefaultIonAnnotationFont = GraphicToolsRepository.FontArial10;
            // spectrumGraphObject.DisplaySettings.FocusedIonAnnotationFont = GraphicToolsRepository.FontArial12Bold;
            spectrumGraphObject.DisplaySettings.IonAnnotationFormatString                 = "{0:0.0000}";
            spectrumGraphObject.DisplaySettings.IonAnnotationLabelingMode                 = IonAnnotationLabelingMode.Always;
            spectrumGraphObject.DisplaySettings.IonAnnotationLabelsMayOverlapIons         = true;
            spectrumGraphObject.DisplaySettings.MaximumNumberOfVisibleIonAnnotationLabels = 20;
            return(spectrumGraphObject);
        }
        private void UpdatePlotControl()
        {
            UpdatePlotItems();
            int num_panes = GetNumberOfPanes();

            InitializePlotControl(num_panes, 1);
            foreach (PlotItem plotItem in PlotItems)
            {
                MsSpectrumGraphObject msSpectrumGraphObject = GetMsSpectrumGraphObject(plotItem.Compound, plotItem.Color, plotItem.Legend);
                this.PlotControl.AddItem(plotItem.HorizontalPosition, 0, msSpectrumGraphObject);
            }
        }