示例#1
0
        private void zedGraphControl1_Resize(object sender, EventArgs e)
        {
            ZedGraph.GraphPane pane = zedGraphControl1.GraphPane;
            int bins = (int)pane.CalcChartRect(zedGraphControl1.CreateGraphics()).Width;

            foreach (ZedGraph.CurveItem curve in pane.CurveList)
            {
                (curve.Points as SeemsPointList).SetScale(bins, pane.XAxis.Scale.Min, pane.XAxis.Scale.Max);
            }
            SetDataLabelsVisible(true);
        }
示例#2
0
        private void zedGraphControl1_ZoomEvent(ZedGraph.ZedGraphControl sender, ZedGraph.ZoomState oldState, ZedGraph.ZoomState newState)
        {
            ZedGraph.GraphPane pane = zedGraphControl1.GraphPane;
            int bins = (int)pane.CalcChartRect(zedGraphControl1.CreateGraphics()).Width;

            foreach (ZedGraph.CurveItem curve in pane.CurveList)
            {
                (curve.Points as SeemsPointList).SetScale(bins, pane.XAxis.Scale.Min, pane.XAxis.Scale.Max);
            }
            pane.AxisChange();
            SetDataLabelsVisible(true);
            Refresh();
        }
示例#3
0
        private void showData(int dataIndex, bool isOverlay)
        {
            SeemsScan scan = dataSource.CurrentScanHeaders[dataIndex];

            ZedGraph.GraphPane pane = zedGraphControl1.GraphPane;

            if (isOverlay && pane.CurveList.Count > overlayColors.Length)
            {
                MessageBox.Show("SeeMS only supports up to " + overlayColors.Length + " simultaneous overlays.", "Too many overlays", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }

            // set form title
            if (!isOverlay)
            {
                Text = String.Format("{0} - {1}", System.IO.Path.GetFileName(dataSource.CurrentFilepath), scan.Id);
            }
            else
            {
                Text += "," + scan.Id;
            }

            if (!isOverlay)
            {
                pane.CurveList.Clear();
            }

            if (shownScan != null && scan.IsMassSpectrum != shownScan.IsMassSpectrum)
            {
                zedGraphControl1.RestoreScale(pane);
                zedGraphControl1.ZoomOutAll(pane);
            }
            bool isScaleAuto = !pane.IsZoomed;

            //pane.GraphObjList.Clear();

            SeemsPointList pointList = scan.PointList;

            if (pointList.FullCount == 0)
            {
                // the header does not have the data points, assume it is a mass spectrum
                pane.YAxis.Title.Text = "Intensity";
                pane.XAxis.Title.Text = "m/z";

                bool doCentroid = SeemsMdiParent.CentroidMenuItem.Enabled && SeemsMdiParent.CentroidMenuItem.Checked;
                dataSource.InstrumentInterface.setCentroiding(doCentroid, doCentroid, SeemsMdiParent.UseVendorCentroidMenuItem.Checked);

                SeemsScan scanWithData = new SeemsScan(dataSource.InstrumentInterface.getScan(scan.Scan.ScanNumber));
                pointList = scanWithData.PointList;
                int bins = (int)pane.CalcChartRect(zedGraphControl1.CreateGraphics()).Width;
                if (isScaleAuto)
                {
                    pointList.SetScale(bins, pointList[0].X, pointList[pointList.Count - 1].X);
                }
                else
                {
                    pointList.SetScale(bins, pane.XAxis.Scale.Min, pane.XAxis.Scale.Max);
                }

                if (doCentroid || scanWithData.Scan.IsCentroided)
                {
                    ZedGraph.StickItem stick = pane.AddStick(scan.Id, pointList, Color.Gray);
                    stick.Symbol.IsVisible = false;
                    stick.Line.Width       = 1;
                }
                else
                {
                    pane.AddCurve(scan.Id, pointList, Color.Gray, ZedGraph.SymbolType.None);
                }
            }
            else
            {
                // the header has the data points, assume it is a chromatogram
                int bins = (int)pane.CalcChartRect(zedGraphControl1.CreateGraphics()).Width;
                if (isScaleAuto)
                {
                    pointList.SetScale(bins, pointList[0].X, pointList[pointList.Count - 1].X);
                }
                else
                {
                    pointList.SetScale(bins, pane.XAxis.Scale.Min, pane.XAxis.Scale.Max);
                }
                pane.YAxis.Title.Text = "Total Intensity";
                pane.XAxis.Title.Text = "Retention Time (in seconds)";
                pane.AddCurve(scan.Id, pointList, Color.Gray, ZedGraph.SymbolType.None);
            }
            pane.AxisChange();

            if (isOverlay)
            {
                pane.Legend.IsVisible = true;
                pane.Legend.Position  = ZedGraph.LegendPos.TopCenter;
                for (int i = 0; i < pane.CurveList.Count; ++i)
                {
                    pane.CurveList[i].Color = overlayColors[i];
                }
            }
            else
            {
                pane.Legend.IsVisible = false;
            }

            SetDataLabelsVisible(true);

            shownScan = scan;
            zedGraphControl1.Refresh();
            //zedGraphControl1.Focus();
        }