示例#1
0
        public void polowienia()
        {
            //p1 i p2 to przedziały ( początkowy i końcowy )
            Number p1 = new Number(1.0, 2.0);
            Number p2 = new Number(3.0, 2.0);
            //
            Random rnd = new Random();
            Number epsilon = new Number(rnd.Next(2, 7), 100.0);
            polowienieBox.AppendText("epsilon wynosi " + epsilon.value + "\nkolejne podziały: \n");

            Function f_p1 = new Function(p1.value);
            Function f_p2 = new Function(p2.value);

            if (f_p1.val * f_p2.val < 0.0)
            {
                PointPairList lista = new PointPairList();
                Random random = new Random();
                for (int i = 0; i < 15; i++)
                {
                    // dodawanie przedzialow na wykresie
                    lista.Add(f_p1.arg, 0); lista.Add(f_p1.arg, -20 + i * 2.5); lista.Add(f_p2.arg, -20 + i * 2.5); lista.Add(f_p2.arg, 0);
                    System.Threading.Thread.Sleep(25);
                    LineItem myCurve = zedGraphControl1.GraphPane.AddCurve("",
                    lista, Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)), SymbolType.None);
                    myCurve.Line.Width = 1.0f;
                    zedGraphControl1.AxisChange();
                    zedGraphControl1.Invalidate();
                    zedGraphControl1.Refresh();
                    //

                    polowienieBox.AppendText(i+1 + ". " + f_p1.arg + " - " + f_p2.arg + "\n");
                    Function srodek = new Function((f_p1.arg + f_p2.arg) / 2.0);
                    if (srodek.modulus() < epsilon.value)
                    {
                        polowienieBox.AppendText("\n\nMiejsce zerowe znalezione!\nPrzybliżone miejsce zerowe (" + srodek.val.ToString("0.###") + " < " + epsilon.value + ") znaleziono w x = " + srodek.arg.ToString("#.###"));
                        //dodawanie strzalki na wykresie
                        ArrowObj strzalka = new ArrowObj(Color.Black, 10.0f, srodek.arg, srodek.val + 45, srodek.arg, srodek.val + 5);
                        zedGraphControl1.GraphPane.GraphObjList.Add(strzalka);
                        zedGraphControl1.Refresh();
                        break;
                    }
                    else
                    {
                        if (f_p1.val * srodek.val < 0)
                            f_p2 = new Function(srodek.arg);
                        else
                            f_p1 = new Function(srodek.arg);
                    }
                }
            }
            else
            {
                MessageBox.Show("Kryczyny błąd",
                    "wartosci funkcji dla tego przedziału są tego samego znaku - algorytm nie może kontynuować",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        /// <summary>
        /// Renders the demo graph with one call.
        /// </summary>
        /// <param name="g">A <see cref="Graphics"/> object for which the drawing will be done.</param>
        /// <param name="pane">A reference to the <see cref="GraphPane"/></param>
        public static void RenderDemo( Graphics g, GraphPane pane )
        {
            // Set the titles and axis labels
            pane.Title.Text = "Wacky Widget Company\nProduction Report";
            pane.XAxis.Title.Text = "Time, Days\n(Since Plant Construction Startup)";
            pane.YAxis.Title.Text = "Widget Production\n(units/hour)";

            LineItem curve;

            // Set up curve "Larry"
            double[] x = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
            double[] y = { 20, 10, 50, 25, 35, 75, 90, 40, 33, 50 };
            // Use green, with circle symbols
            curve = pane.AddCurve( "Larry", x, y, Color.Green, SymbolType.Circle );
            curve.Line.Width = 1.5F;
            // Fill the area under the curve with a white-green gradient
            curve.Line.Fill = new Fill( Color.White, Color.FromArgb( 60, 190, 50 ), 90F );
            // Make it a smooth line
            curve.Line.IsSmooth = true;
            curve.Line.SmoothTension = 0.6F;
            // Fill the symbols with white
            curve.Symbol.Fill = new Fill( Color.White );
            curve.Symbol.Size = 10;

            // Second curve is "moe"
            double[] x3 = { 150, 250, 400, 520, 780, 940 };
            double[] y3 = { 5.2, 49.0, 33.8, 88.57, 99.9, 36.8 };
            // Use a red color with triangle symbols
            curve = pane.AddCurve( "Moe", x3, y3, Color.FromArgb( 200, 55, 135 ), SymbolType.Triangle );
            curve.Line.Width = 1.5F;
            // Fill the area under the curve with semi-transparent pink using the alpha value
            curve.Line.Fill = new Fill( Color.White, Color.FromArgb( 160, 230, 145, 205 ), 90F );
            // Fill the symbols with white
            curve.Symbol.Fill = new Fill( Color.White );
            curve.Symbol.Size = 10;

            // Third Curve is a bar, called "Wheezy"
            double[] x4 = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
            double[] y4 = { 30, 45, 53, 60, 75, 83, 84, 79, 71, 57 };
            BarItem bar = pane.AddBar( "Wheezy", x4, y4, Color.SteelBlue );
            // Fill the bars with a RosyBrown-White-RosyBrown gradient
            bar.Bar.Fill = new Fill( Color.RosyBrown, Color.White, Color.RosyBrown );

            // Fourth curve is a bar
            double[] x2 = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
            double[] y2 = { 10, 15, 17, 20, 25, 27, 29, 26, 24, 18 };
            bar = pane.AddBar( "Curly", x2, y2, Color.RoyalBlue );
            // Fill the bars with a RoyalBlue-White-RoyalBlue gradient
            bar.Bar.Fill = new Fill( Color.RoyalBlue, Color.White, Color.RoyalBlue );

            // Fill the pane background with a gradient
            pane.Fill = new Fill( Color.WhiteSmoke, Color.Lavender, 0F );
            // Fill the axis background with a gradient
            pane.Chart.Fill = new Fill( Color.FromArgb( 255, 255, 245 ),
                Color.FromArgb( 255, 255, 190 ), 90F );

            // Make each cluster 100 user scale units wide.  This is needed because the X Axis
            // type is Linear rather than Text or Ordinal
            pane.BarSettings.ClusterScaleWidth = 100;
            // Bars are stacked
            pane.BarSettings.Type = BarType.Stack;

            // Enable the X and Y axis grids
            pane.XAxis.MajorGrid.IsVisible = true;
            pane.YAxis.MajorGrid.IsVisible = true;

            // Manually set the scale maximums according to user preference
            pane.XAxis.Scale.Max = 1200;
            pane.YAxis.Scale.Max = 120;

            // Add a text item to decorate the graph
            TextObj text = new TextObj( "First Prod\n21-Oct-93", 175F, 80.0F );
            // Align the text such that the Bottom-Center is at (175, 80) in user scale coordinates
            text.Location.AlignH = AlignH.Center;
            text.Location.AlignV = AlignV.Bottom;
            text.FontSpec.Fill = new Fill( Color.White, Color.PowderBlue, 45F );
            text.FontSpec.StringAlignment = StringAlignment.Near;
            pane.GraphObjList.Add( text );

            // Add an arrow pointer for the above text item
            ArrowObj arrow = new ArrowObj( Color.Black, 12F, 175F, 77F, 100F, 45F );
            arrow.Location.CoordinateFrame = CoordType.AxisXYScale;
            pane.GraphObjList.Add( arrow );

            // Add a another text item to to point out a graph feature
            text = new TextObj( "Upgrade", 700F, 50.0F );
            // rotate the text 90 degrees
            text.FontSpec.Angle = 90;
            // Align the text such that the Right-Center is at (700, 50) in user scale coordinates
            text.Location.AlignH = AlignH.Right;
            text.Location.AlignV = AlignV.Center;
            // Disable the border and background fill options for the text
            text.FontSpec.Fill.IsVisible = false;
            text.FontSpec.Border.IsVisible = false;
            pane.GraphObjList.Add( text );

            // Add an arrow pointer for the above text item
            arrow = new ArrowObj( Color.Black, 15, 700, 53, 700, 80 );
            arrow.Location.CoordinateFrame = CoordType.AxisXYScale;
            arrow.Line.Width = 2.0F;
            pane.GraphObjList.Add( arrow );

            // Add a text "Confidential" stamp to the graph
            text = new TextObj( "Confidential", 0.85F, -0.03F );
            // use ChartFraction coordinates so the text is placed relative to the ChartRect
            text.Location.CoordinateFrame = CoordType.ChartFraction;
            // rotate the text 15 degrees
            text.FontSpec.Angle = 15.0F;
            // Text will be red, bold, and 16 point
            text.FontSpec.FontColor = Color.Red;
            text.FontSpec.IsBold = true;
            text.FontSpec.Size = 16;
            // Disable the border and background fill options for the text
            text.FontSpec.Border.IsVisible = false;
            text.FontSpec.Fill.IsVisible = false;
            // Align the text such the the Left-Bottom corner is at the specified coordinates
            text.Location.AlignH = AlignH.Left;
            text.Location.AlignV = AlignV.Bottom;
            pane.GraphObjList.Add( text );

            // Add a BoxObj to show a colored band behind the graph data
            BoxObj box = new BoxObj( 0, 110, 1200, 10,
                Color.Empty, Color.FromArgb( 225, 245, 225 ) );
            box.Location.CoordinateFrame = CoordType.AxisXYScale;
            // Align the left-top of the box to (0, 110)
            box.Location.AlignH = AlignH.Left;
            box.Location.AlignV = AlignV.Top;
            // place the box behind the axis items, so the grid is drawn on top of it
            box.ZOrder = ZOrder.D_BehindAxis;
            pane.GraphObjList.Add( box );

            // Add some text inside the above box to indicate "Peak Range"
            TextObj myText = new TextObj( "Peak Range", 1170, 105 );
            myText.Location.CoordinateFrame = CoordType.AxisXYScale;
            myText.Location.AlignH = AlignH.Right;
            myText.Location.AlignV = AlignV.Center;
            myText.FontSpec.IsItalic = true;
            myText.FontSpec.IsBold = false;
            myText.FontSpec.Fill.IsVisible = false;
            myText.FontSpec.Border.IsVisible = false;
            pane.GraphObjList.Add( myText );

            pane.AxisChange( g );
        }
示例#3
0
 /// <summary>
 /// Add the <see cref="ZedGraphWebGraphObj" /> objects defined in the webcontrol to
 /// the <see cref="GraphPane" /> as <see cref="GraphObj" /> objects.
 /// </summary>
 /// <param name="g">The <see cref="Graphics" /> instance of interest.</param>
 /// <param name="pane">The <see cref="GraphPane" /> object to receive the
 /// <see cref="GraphObj" /> objects.</param>
 protected void AddWebGraphItems( Graphics g, GraphPane pane )
 {
     try
     {
         ZedGraphWebGraphObj draw;
         for ( int i = 0; i < GraphObjList.Count; i++ )
         {
             draw = GraphObjList[i];
             if ( draw is ZedGraphWebTextObj )
             {
                 ZedGraphWebTextObj item = (ZedGraphWebTextObj)draw;
                 TextObj x = new TextObj();
                 item.CopyTo( x );
                 pane.GraphObjList.Add( x );
             }
             else if ( draw is ZedGraphWebArrowObj )
             {
                 ZedGraphWebArrowObj item = (ZedGraphWebArrowObj)draw;
                 ArrowObj x = new ArrowObj();
                 item.CopyTo( x );
                 pane.GraphObjList.Add( x );
             }
             else if ( draw is ZedGraphWebImageObj )
             {
                 ZedGraphWebImageObj item = (ZedGraphWebImageObj)draw;
                 ImageObj x = new ImageObj();
                 item.CopyTo( x );
                 pane.GraphObjList.Add( x );
             }
             else if ( draw is ZedGraphWebBoxObj )
             {
                 ZedGraphWebBoxObj item = (ZedGraphWebBoxObj)draw;
                 BoxObj x = new BoxObj();
                 item.CopyTo( x );
                 pane.GraphObjList.Add( x );
             }
             else if ( draw is ZedGraphWebEllipseObj )
             {
                 ZedGraphWebEllipseObj item = (ZedGraphWebEllipseObj)draw;
                 EllipseObj x = new EllipseObj();
                 item.CopyTo( x );
                 pane.GraphObjList.Add( x );
             }
         }
     }
     catch ( Exception )
     {
     }
 }
示例#4
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="ArrowObj"/> object from which to copy</param>
 public ArrowObj(ArrowObj rhs)
     : base(rhs)
 {
     _size        = rhs.Size;
     _isArrowHead = rhs.IsArrowHead;
 }
示例#5
0
文件: Form1.cs 项目: Jungwon/ZedGraph
        private void CreateGraph_SpiderPlot( ZedGraphControl z1 )
        {
            GraphPane myPane = z1.GraphPane;
            RadarPointList rpl = new RadarPointList();

            Random rand = new Random();

            for ( int i = 0; i < 7; i++ )
            {
                double r = rand.NextDouble() * 10.0 + 1.0;
                PointPair pt = new PointPair( PointPair.Missing, r, "r = " + r.ToString( "f1" ) );
                rpl.Add( pt );
            }
            LineItem curve = myPane.AddCurve( "test", rpl, Color.Green, SymbolType.Default );

            // Add the spokes as GraphItems
            for ( int i = 0; i < 7; i++ )
            {
                ArrowObj arrow = new ArrowObj( 0, 0, (float) rpl[i].X, (float) rpl[i].Y );
                arrow.IsArrowHead = false;
                arrow.Line.Color = Color.LightGray;
                arrow.ZOrder = ZOrder.E_BehindCurves;
                myPane.GraphObjList.Add( arrow );
            }

            myPane.XAxis.MajorGrid.IsZeroLine = true;
            myPane.XAxis.MajorTic.IsAllTics = true;
            myPane.XAxis.Title.IsTitleAtCross = false;
            myPane.XAxis.Cross = 0;
            myPane.XAxis.Scale.IsSkipFirstLabel = true;
            myPane.XAxis.Scale.IsSkipLastLabel = true;
            myPane.XAxis.Scale.IsSkipCrossLabel = true;

            myPane.YAxis.MajorTic.IsAllTics = true;
            myPane.YAxis.Title.IsTitleAtCross = false;
            myPane.YAxis.Cross = 0;
            myPane.YAxis.Scale.IsSkipFirstLabel = true;
            myPane.YAxis.Scale.IsSkipLastLabel = true;
            myPane.YAxis.Scale.IsSkipCrossLabel = true;
        }
示例#6
0
文件: Form1.cs 项目: Jungwon/ZedGraph
        // Basic curve test - Date Axis
        private void CreateGraph_DateAxis( ZedGraphControl z1 )
        {
            GraphPane myPane = z1.GraphPane;

            PointPairList list = new PointPairList();
            PointPairList list2 = new PointPairList();

            for ( int i = 0; i < 50; i++ )
            {
                double x = new XDate( 2005, 12 + i, 15 );
                double y = Math.Sin( i / 8.0 ) * 1000 + 1001;
                list.Add( x, y, 1500 );
                list2.Add( x, y * 1.2, 1500 );
            }

            LineItem line = myPane.AddCurve( "Line", list, Color.Blue, SymbolType.Diamond );
            //myPane.XAxis.Scale.Format = "MMM\nyyyy";
            myPane.XAxis.Type = AxisType.Date;

            //myPane.XAxis.Scale.MajorStep = 1;
            //myPane.XAxis.Scale.MajorUnit = DateUnit.Year;
            myPane.XAxis.Scale.MinorStep = 1;
            myPane.XAxis.Scale.MinorUnit = DateUnit.Month;

            /*
            BarItem myBar = myPane.AddBar( "Bar", list, Color.Blue );
            BarItem myBar2 = myPane.AddBar( "Bar2", list2, Color.Green );
            //LineItem myCurve = myPane.AddCurve( "curve", list, Color.Blue, SymbolType.Diamond );
            myPane.BarSettings.Type = BarType.ClusterHiLow;
            myPane.BarSettings.ClusterScaleWidth = 20.0;
            */

            z1.IsAutoScrollRange = true;
            z1.IsShowHScrollBar = true;
            z1.IsShowVScrollBar = true;

            XDate now = new XDate( DateTime.Now );
            ArrowObj arrow = new ArrowObj( Color.Black,
                    2.0f, (float) now.XLDate, 0.0f, (float) now.XLDate, 1.0f );
            arrow.IsArrowHead = false;
            arrow.Location.CoordinateFrame = CoordType.XScaleYChartFraction;
            arrow.IsClippedToChartRect = true;
            myPane.GraphObjList.Add( arrow );

            // Make the first year line
            double xDate = new XDate( 2006, 1, 1 ).XLDate;
            LineObj myLine = new LineObj();
            myLine.Location.X1 = xDate;
            myLine.Location.Y1 = 0.0;
            myLine.Location.Width = 0.0;
            myLine.Location.Height = 1.0;
            myLine.IsClippedToChartRect = true;
            myLine.Location.CoordinateFrame = CoordType.XScaleYChartFraction;
            myLine.Line.Width = 2.0f;
            myLine.Line.Color = Color.Red;
            myPane.GraphObjList.Add( myLine );

            // Repeat for each Grid by cloning
            xDate = new XDate( 2007, 1, 1 ).XLDate;
            ;
            myLine = new LineObj( myLine );
            myLine.Location.X1 = xDate;
            myPane.GraphObjList.Add( myLine );
        }
示例#7
0
        public void StandardUserControl()
        {
            testee.Chart.Fill = new Fill( Color.White, Color.LightGoldenrodYellow );

            double[] x = { 72, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
            double[] y = { 20, 10, 50, 40, 35, 60, 90, 25, 48, 75 };
            double[] x2 = { 300, 400, 500, 600, 700, 800, 900 };
            double[] y2 = { 75, 43, 27, 62, 89, 73, 12 };
            double[] x3 = { 150, 250, 400, 520, 780, 940 };
            double[] y3 = { 5.2, 49.0, 33.8, 88.57, 99.9, 36.8 };

            LineItem curve;
            curve = testee.AddCurve( "Larry", x, y, Color.Red, SymbolType.Circle );
            curve.Symbol.Size = 14;
            curve.Line.Width = 2.0F;
            curve = testee.AddCurve( "Curly", x2, y2, Color.Green, SymbolType.Triangle );
            curve.Symbol.Size = 14;
            curve.Line.Width = 2.0F;
            curve.Symbol.Fill.Type = FillType.Solid;
            curve = testee.AddCurve( "Moe", x3, y3, Color.Blue, SymbolType.Diamond );
            curve.Line.IsVisible = false;
            curve.Symbol.Fill.Type = FillType.Solid;
            curve.Symbol.Size = 14;

            testee.XAxis.MajorGrid.IsVisible = true;
            testee.XAxis.Scale.FontSpec.Angle = 60;

            testee.YAxis.MajorGrid.IsVisible = true;

            TextObj text = new TextObj( "First	Prod\n21-Oct-99", 100F, 50.0F );
            text.Location.AlignH = AlignH.Center;
            text.Location.AlignV = AlignV.Bottom;
            text.FontSpec.Fill.Color = Color.LightBlue;
            text.FontSpec.Fill.Type = FillType.Brush;
            text.FontSpec.IsItalic = true;
            testee.GraphObjList.Add( text );

            ArrowObj arrow = new ArrowObj( Color.Black, 12F, 100F, 47F, 72F, 25F );
            arrow.Location.CoordinateFrame = CoordType.AxisXYScale;
            testee.GraphObjList.Add( arrow );

            text = new TextObj( "Upgrade", 700F, 50.0F );
            text.FontSpec.Angle = 90;
            text.FontSpec.FontColor = Color.Black;
            text.Location.AlignH = AlignH.Right;
            text.Location.AlignV = AlignV.Center;
            text.FontSpec.Fill.Color = Color.LightGoldenrodYellow;
            text.FontSpec.Fill.Type = FillType.Brush;
            text.FontSpec.Border.IsVisible = false;
            testee.GraphObjList.Add( text );

            arrow = new ArrowObj( Color.Black, 15, 700, 53, 700, 80 );
            arrow.Location.CoordinateFrame = CoordType.AxisXYScale;
            arrow.Line.Width = 2.0F;
            testee.GraphObjList.Add( arrow );
            text = new TextObj( "Confidential", 0.8F, -0.03F );
            text.Location.CoordinateFrame = CoordType.ChartFraction;
            text.FontSpec.Angle = 15.0F;
            text.FontSpec.FontColor = Color.Red;
            text.FontSpec.IsBold = true;
            text.FontSpec.Size = 16;
            text.FontSpec.Border.IsVisible = true;
            text.FontSpec.Border.Color = Color.Red;
            text.Location.AlignH = AlignH.Left;
            text.Location.AlignV = AlignV.Bottom;
            testee.GraphObjList.Add( text );

            testee.AxisChange( control.CreateGraphics() );

            form.Show();

            Assert.IsTrue( TestUtils.promptIfTestWorked(
                "Is a graph visible with 3 sets of data and text labels?" ) );
        }
示例#8
0
        public void FindNearestObject()
        {
            testee = new GraphPane( new Rectangle( 10, 10, 10, 10 ),
            "Wacky Widget Company\nProduction Report",
            "Time, Days\n(Since Plant Construction Startup)",
            "Widget Production\n(units/hour)" );
            SetSize();

            double[] x = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
            double[] y = { 20, 10, 50, 25, 35, 75, 90, 40, 33, 50 };
            LineItem curve;
            curve = testee.AddCurve( "Larry", x, y, Color.Green, SymbolType.Circle );
            curve.Line.Width = 1.5F;
            curve.Line.Fill = new Fill( Color.White, Color.FromArgb( 60, 190, 50 ), 90F );
            curve.Line.IsSmooth = true;
            curve.Line.SmoothTension = 0.6F;
            curve.Symbol.Fill = new Fill( Color.White );
            curve.Symbol.Size = 10;
            curve.Tag = "Larry";

            double[] x3 = { 150, 250, 400, 520, 780, 940 };
            double[] y3 = { 5.2, 49.0, 33.8, 88.57, 99.9, 36.8 };
            curve = testee.AddCurve( "Moe", x3, y3, Color.FromArgb( 200, 55, 135 ), SymbolType.Triangle );
            curve.Line.Width = 1.5F;
            //curve.Line.IsSmooth = true;
            curve.Symbol.Fill = new Fill( Color.White );
            curve.Line.Fill = new Fill( Color.White, Color.FromArgb( 160, 230, 145, 205 ), 90F );
            curve.Symbol.Size = 10;
            curve.Tag = "Moe";

            double[] x4 = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
            double[] y4 = { 30, 45, -13, 60, 75, 83, 84, 79, 71, 57 };
            BarItem bar = testee.AddBar( "Wheezy", x4, y4, Color.SteelBlue );
            bar.Bar.Fill = new Fill( Color.RosyBrown, Color.White, Color.RosyBrown );
            bar.Tag = "Wheezy";
            //curve.Bar.Fill = new Fill( Color.Blue );
            //curve.Symbol.Size = 12;

            double[] x2 = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
            double[] y2 = { 10, 15, -7, 20, 25, 27, 29, 26, 24, 18 };
            bar = testee.AddBar( "Curly", x2, y2, Color.RoyalBlue );
            bar.Bar.Fill = new Fill( Color.RoyalBlue, Color.White, Color.RoyalBlue );
            bar.Tag = "Curly";
            //Brush brush = new HatchBrush( HatchStyle.Cross, Color.AliceBlue, Color.Red );
            //GraphicsPath path = new GraphicsPath();
            //path.AddLine( 10, 10, 20, 20 );
            //path.AddLine( 20, 20, 30, 0 );
            //path.AddLine( 30, 0, 10, 10 );

            //brush = new PathGradientBrush( path );
            //bar.Bar.Fill = new Fill( brush );

            testee.BarSettings.ClusterScaleWidth = 100;
            testee.BarSettings.Type = BarType.Stack;

            testee.Fill = new Fill( Color.WhiteSmoke, Color.Lavender, 0F );
            testee.Chart.Fill = new Fill( Color.White, Color.FromArgb( 255, 255, 166 ), 90F );

            testee.XAxis.MajorGrid.IsVisible = true;
            testee.YAxis.MajorGrid.IsVisible = true;
            testee.YAxis.Scale.Max = 120;
            testee.Y2Axis.IsVisible = true;
            testee.Y2Axis.Scale.Max = 120;

            TextObj text = new TextObj( "First Prod\n21-Oct-93", 175F, 80.0F );
            text.Location.AlignH = AlignH.Center;
            text.Location.AlignV = AlignV.Bottom;
            text.FontSpec.Fill = new Fill( Color.White, Color.PowderBlue, 45F );
            text.Tag = "First";
            testee.GraphObjList.Add( text );

            ArrowObj arrow = new ArrowObj( Color.Black, 12F, 175F, 77F, 100F, 45F );
            arrow.Location.CoordinateFrame = CoordType.AxisXYScale;
            testee.GraphObjList.Add( arrow );

            text = new TextObj( "Upgrade", 700F, 50.0F );
            text.FontSpec.Angle = 90;
            text.FontSpec.FontColor = Color.Black;
            text.Location.AlignH = AlignH.Right;
            text.Location.AlignV = AlignV.Center;
            text.FontSpec.Fill.IsVisible = false;
            text.FontSpec.Border.IsVisible = false;
            testee.GraphObjList.Add( text );

            arrow = new ArrowObj( Color.Black, 15, 700, 53, 700, 80 );
            arrow.Location.CoordinateFrame = CoordType.AxisXYScale;
            arrow.Line.Width = 2.0F;
            arrow.Tag = "Arrow";
            testee.GraphObjList.Add( arrow );

            text = new TextObj( "Confidential", 0.8F, -0.03F );
            text.Location.CoordinateFrame = CoordType.ChartFraction;

            text.FontSpec.Angle = 15.0F;
            text.FontSpec.FontColor = Color.Red;
            text.FontSpec.IsBold = true;
            text.FontSpec.Size = 16;
            text.FontSpec.Border.IsVisible = false;
            text.FontSpec.Border.Color = Color.Red;
            text.FontSpec.Fill.IsVisible = false;

            text.Location.AlignH = AlignH.Left;
            text.Location.AlignV = AlignV.Bottom;
            testee.GraphObjList.Add( text );

            testee.IsPenWidthScaled = false;

            EllipseObj ellipse = new EllipseObj( 500, 50, 200, 20, Color.Blue,
                Color.Goldenrod );
            ellipse.Location.CoordinateFrame = CoordType.AxisXYScale;
            ellipse.Tag = "Ellipse";
            testee.GraphObjList.Add( ellipse );

            //			Bitmap bm = new Bitmap( @"c:\temp\sunspot.jpg" );
            Bitmap bm = new Bitmap( @"c:\windows\winnt256.bmp" );
            Image image = Image.FromHbitmap( bm.GetHbitmap() );
            ImageObj imageItem = new ImageObj( image, new RectangleF( 0.8F, 0.8F, 0.2F, 0.2F ),
                CoordType.ChartFraction, AlignH.Left, AlignV.Top );
            imageItem.IsScaled = true;
            imageItem.Tag = "Bitmap";
            testee.GraphObjList.Add( imageItem );

            testee.AxisChange( form2.CreateGraphics() );
            SetSize();
            form2.Refresh();

            TestUtils.ShowMessage( "For each step, read the message in the Title Bar of the form" );

            HandleFind( "Select the ellipse object", "Ellipse", 0, typeof( GraphObj ) );
            HandleFind( "Select the 'First Prod' text object", "First", 0, typeof( GraphObj ) );
            HandleFind( "Select the upgrade arrow object", "Arrow", 0, typeof( GraphObj ) );
            HandleFind( "Select the Graph Title", "", 0, typeof( GraphPane ) );
            HandleFind( "Select the X Axis", "ZedGraph.XAxis", 0, typeof( Axis ) );
            HandleFind( "Select the Y Axis", "ZedGraph.YAxis", 0, typeof( Axis ) );
            HandleFind( "Select the Y2 Axis", "ZedGraph.Y2Axis", 0, typeof( Axis ) );
            HandleFind( "Select the second curve in the legend", "", 1, typeof( Legend ) );
            HandleFind( "Select the tallest blue bar", "Curly", 6, typeof( CurveItem ) );
            HandleFind( "Select the negative brown bar", "Wheezy", 2, typeof( CurveItem ) );
            HandleFind( "Select the negative blue bar", "Curly", 2, typeof( CurveItem ) );
            HandleFind( "Select the highest green circle symbol", "Larry", 6, typeof( CurveItem ) );
            HandleFind( "Select the windows bitmap object", "Bitmap", 0, typeof( GraphObj ) );
        }
示例#9
0
        public void MissingValues()
        {
            //	Create a new	graph
            testee = new GraphPane( new Rectangle( 40, 40, form2.Size.Width - 80, form2.Size.Height - 80 ),
                "Wacky	Widget Company\nProduction Report",
                "Time, Years\n(Since Plant Construction Startup)",
                "Widget Production\n(units/hour)" );

            double[] x = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
            double[] y = { 20, 10, PointPair.Missing, PointPair.Missing, 35, 60, 90, 25, 48, PointPair.Missing };
            double[] x2 = { 300, 400, 500, 600, 700, 800, 900 };
            double[] y2 = { PointPair.Missing, 43, 27, 62, 89, 73, 12 };
            double[] x3 = { 150, 250, 400, 520, 780, 940 };
            double[] y3 = { 5.2, 49.0, PointPair.Missing, 88.57, 99.9, 36.8 };

            double[] x4 = { 150, 250, 400, 520, 780, 940 };
            double[] y4 = { .03, .054, .011, .02, .14, .38 };
            double[] x5 = { 1.5, 2.5, 4, 5.2, 7.8, 9.4 };
            double[] y5 = { 157, 458, 1400, 100000, 10290, 3854 };

            LineItem curve;
            curve = testee.AddCurve( "Larry", x, y, Color.Red, SymbolType.Circle );
            curve.Line.Width = 2.0F;
            curve.Symbol.Fill.Type = FillType.Solid;
            curve = testee.AddCurve( "Moe", x3, y3, Color.Green, SymbolType.Triangle );
            curve.Symbol.Fill.Type = FillType.Solid;
            curve = testee.AddCurve( "Curly", x2, y2, Color.Blue, SymbolType.Diamond );
            curve.Symbol.Fill.Type = FillType.Solid;
            curve.Symbol.Size = 12;

            testee.Fill = new Fill( Color.White, Color.WhiteSmoke );
            testee.Chart.Fill = new Fill( Color.White, Color.LightGoldenrodYellow );
            testee.XAxis.MajorGrid.IsVisible = true;
            testee.XAxis.Scale.FontSpec.Angle = 0;

            testee.YAxis.MajorGrid.IsVisible = true;
            testee.YAxis.Scale.FontSpec.Angle = 90;

            TextObj text = new TextObj( "First	Prod\n21-Oct-93", 100F, 50.0F );
            text.Location.AlignH = AlignH.Center;
            text.Location.AlignV = AlignV.Bottom;
            text.FontSpec.Fill.Color = Color.PowderBlue;
            text.FontSpec.Fill.Type = FillType.Brush;
            testee.GraphObjList.Add( text );

            ArrowObj arrow = new ArrowObj( Color.Black, 12F, 100F, 47F, 72F, 25F );
            arrow.Location.CoordinateFrame = CoordType.AxisXYScale;
            testee.GraphObjList.Add( arrow );

            text = new TextObj( "Upgrade", 700F, 50.0F );
            text.FontSpec.Angle = 90;
            text.FontSpec.FontColor = Color.Black;
            text.Location.AlignH = AlignH.Right;
            text.Location.AlignV = AlignV.Center;
            text.FontSpec.Fill.Color = Color.LightGoldenrodYellow;
            text.FontSpec.Fill.Type = FillType.Brush;
            text.FontSpec.Border.IsVisible = false;
            testee.GraphObjList.Add( text );

            arrow = new ArrowObj( Color.Black, 15, 700, 53, 700, 80 );
            arrow.Location.CoordinateFrame = CoordType.AxisXYScale;
            arrow.Line.Width = 2.0F;
            testee.GraphObjList.Add( arrow );

            text = new TextObj( "Confidential", 0.8F, -0.03F );
            text.Location.CoordinateFrame = CoordType.ChartFraction;

            text.FontSpec.Angle = 15.0F;
            text.FontSpec.FontColor = Color.Red;
            text.FontSpec.IsBold = true;
            text.FontSpec.Size = 16;
            text.FontSpec.Border.IsVisible = false;
            text.FontSpec.Border.Color = Color.Red;
            text.FontSpec.Fill.Type = FillType.None;

            text.Location.AlignH = AlignH.Left;
            text.Location.AlignV = AlignV.Bottom;
            testee.GraphObjList.Add( text );

            testee.AxisChange( form2.CreateGraphics() );
            SetSize();
            form2.Show();

            for ( int iCurve = 0; iCurve < 3; iCurve++ )
            {
                PointPairList ppList = testee.CurveList[iCurve].Points as PointPairList;

                for ( int i = 0; i < ppList.Count; i++ )
                {
                    PointPair pt = ppList[i];

                    if ( i % 3 == 0 )
                        pt.Y = PointPair.Missing;
                    else if ( i % 3 == 1 )
                        pt.Y = System.Double.NaN;
                    else if ( i % 3 == 2 )
                        pt.Y = System.Double.PositiveInfinity;

                    ppList[i] = pt;

                    form2.Refresh();

                    //	delay for 10 ms
                    TestUtils.DelaySeconds( 300 );
                }
            }

            Assert.IsTrue( TestUtils.promptIfTestWorked( "Did you see an initial graph, with points disappearing one by one?" ) );

            //	Go	ahead	and refigure the	axes	with the	invalid data just to check
            testee.AxisChange( form2.CreateGraphics() );
        }
示例#10
0
文件: frmPOP.cs 项目: lovelll/DQHP
        private void CreateMutiLineChart()
        {
            dgDataSource.DataSource = dt;

            GraphPane myPane = zedGraphControl1.GraphPane;
            myPane.CurveList.Clear();
            myPane.GraphObjList.Clear();

            // Set up the title and axis labels
            myPane.Title.Text = "�˿���������";
            myPane.XAxis.Title.Text = "���";
            myPane.YAxis.Title.Text = "�˿�  ����";

            //PointPairList list1 = null, list3 = null, list2 = null, list = null;
            // Make up some data arrays based on the Sine function
            list1 = new PointPairList();
            list3 = new PointPairList();
            list2 = new PointPairList();
            list = new PointPairList();

            //double x = double.Parse(dt.Rows[0]["year"].ToString().Trim());
            //double y1 = double.Parse(dt.Rows[0]["apop"].ToString().Trim());
            //double y3 = double.Parse(dt.Rows[0]["citypop"].ToString().Trim());
            //double y2 = double.Parse(dt.Rows[0]["napop"].ToString().Trim());
            //double y = double.Parse(dt.Rows[0]["pop"].ToString().Trim());
            //list.Add(x, y);
            //list1.Add(x, y1);
            //list2.Add(x, y2);
            //list3.Add(x, y3);

            LineItem myCurve1=null, myCurve2=null, myCurve3=null, myCurve=null;

            // Generate a red curve with diamond
            // symbols, and "apop" in the legend
            myCurve1 = myPane.AddCurve("apop",
                list1, Color.Red, SymbolType.Diamond);

            // Generate a blue curve with circle
            // symbols, and "napop" in the legend
            myCurve2 = myPane.AddCurve("napop",
                list2, Color.Blue, SymbolType.Circle);

            // Generate a blue curve with circle
            // symbols, and "citypop" in the legend
            myCurve3 = myPane.AddCurve("citypop",
                list3, Color.Green, SymbolType.Star);

            // Generate a blue curve with circle
            // symbols, and "pop" in the legend
            myCurve = myPane.AddCurve("pop",
                list, Color.Orange, SymbolType.Square);

            // Change the color of the title
            myPane.Title.FontSpec.FontColor = Color.Green;

            // Add gridlines to the plot, and make them gray
            myPane.XAxis.MajorGrid.IsVisible = true;
            myPane.YAxis.MajorGrid.IsVisible = true;
            myPane.XAxis.MajorGrid.Color = Color.LightGray;
            myPane.YAxis.MajorGrid.Color = Color.LightGray;

            // Move the legend location
            myPane.Legend.Position = ZedGraph.LegendPos.Bottom;

            // Make both curves thicker
            myCurve1.Line.Width = 1.0F;
            myCurve2.Line.Width = 1.0F;
            myCurve3.Line.Width = 1.0F;
            myCurve.Line.Width = 1.0F;

            // Increase the symbol sizes, and fill them with solid white
            myCurve1.Symbol.Size = 2.0F;
            myCurve2.Symbol.Size = 2.0F;
            myCurve3.Symbol.Size = 2.0F;
            myCurve.Symbol.Size = 2.0F;

            myCurve1.Symbol.Fill = new Fill(Color.White);
            myCurve2.Symbol.Fill = new Fill(Color.White);
            myCurve3.Symbol.Fill = new Fill(Color.White);
            myCurve.Symbol.Fill = new Fill(Color.White);

            // Add a background gradient fill to the axis frame
            myPane.Chart.Fill = new Fill(Color.White,
                Color.FromArgb(255, 255, 210), -45F);

            // Add a caption and an arrow
            TextObj myText = new TextObj("Interesting\nPoint", 230F, 70F);
            myText.FontSpec.FontColor = Color.Red;
            myText.Location.AlignH = AlignH.Center;
            myText.Location.AlignV = AlignV.Top;
            myPane.GraphObjList.Add(myText);
            ArrowObj myArrow = new ArrowObj(Color.Red, 12F, 230F, 70F, 280F, 55F);
            myPane.GraphObjList.Add(myArrow);

            myPane.AxisChange();
            zedGraphControl1.Refresh();
        }
示例#11
0
        public override void AddPreCurveAnnotations(MSGraphPane graphPane, Graphics g,
            MSPointList pointList, GraphObjList annotations)
        {
            if (Chromatogram == null)
                return;

            // Give priority to showing the best peak text object above all other annotations
            if (DragInfo != null || (!HideBest && TransitionChromInfo != null) || CurveAnnotation != null)
            {
                // Show text and arrow for the best peak
                double intensityBest = 0;
                if (_bestPeakTimeIndex != -1)
                {
                    ScaledRetentionTime timeBest = new ScaledRetentionTime(_measuredTimes[_bestPeakTimeIndex], _displayTimes[_bestPeakTimeIndex]);
                    float xBest = graphPane.XAxis.Scale.Transform(timeBest.DisplayTime);
                    intensityBest = _intensities[_bestPeakTimeIndex];
                    float yBest = graphPane.YAxis.Scale.Transform(intensityBest);

                    if (GraphChromatogram.ShowRT != ShowRTChrom.none || DragInfo != null)
                    {
                        // Best peak gets its own label to avoid curve overlap detection
                        double intensityLabel = graphPane.YAxis.Scale.ReverseTransform(yBest - 5);
                        float? massError = Settings.Default.ShowMassError && TransitionChromInfo != null
                                               ? TransitionChromInfo.MassError
                                               : null;
                        double dotProduct = _dotProducts != null ? _bestProduct : 0;

                        TextObj text;
                        if (CurveAnnotation != null)
                        {
                            // Darken peptide name a little so light colors stand out against the white background.
                            var color = FontSpec.FontColor;
                            if (!GraphInfo.IsSelected)
                                color = Color.FromArgb(color.R*7/10, color.G*7/10, color.B*7/10);
                            var fontSpec = new FontSpec(FontSpec) { FontColor = color, Angle = 90 };
                            if (GraphInfo.IsSelected)
                                fontSpec = new FontSpec(fontSpec) {IsBold = true, Size = fontSpec.Size + 2, IsAntiAlias = true};

                            // Display peptide name label using vertical text.
                            text = new TextObj(CurveAnnotation, timeBest.DisplayTime, intensityLabel,
                                CoordType.AxisXYScale, AlignH.Left, AlignV.Center)
                            {
                                ZOrder = ZOrder.A_InFront,
                                IsClippedToChartRect = true,
                                FontSpec = fontSpec,
                                Tag = new GraphObjTag(this, GraphObjType.best_peak, timeBest),
                            };
                        }
                        else
                        {
                            string label = FormatTimeLabel(timeBest.DisplayTime, massError, dotProduct);

                            text = new TextObj(label, timeBest.DisplayTime, intensityLabel,
                                CoordType.AxisXYScale, AlignH.Center, AlignV.Bottom)
                            {
                                ZOrder = ZOrder.A_InFront,
                                IsClippedToChartRect = true,
                                FontSpec = FontSpec,
                                Tag = new GraphObjTag(this, GraphObjType.best_peak, timeBest),
                            };
                        }

                        annotations.Add(text);
                    }

                    // If showing multiple peptides, skip the best peak arrow indicator.
                    if (CurveAnnotation == null)
                    {
                        // Show the best peak arrow indicator
                        double timeArrow = graphPane.XAxis.Scale.ReverseTransform(xBest - 4);
                        double intensityArrow = graphPane.YAxis.Scale.ReverseTransform(yBest - 2);

                        ArrowObj arrow = new ArrowObj(COLOR_BEST_PEAK, 12f,
                            timeArrow, intensityArrow, timeArrow, intensityArrow)
                        {
                            Location = {CoordinateFrame = CoordType.AxisXYScale},
                            IsArrowHead = true,
                            IsClippedToChartRect = true,
                            ZOrder = ZOrder.A_InFront
                        };
                        annotations.Add(arrow);
                    }
                }

                // Show the best peak boundary lines
                if (CurveAnnotation == null)
                {
                    double startTime = 0, endTime = 0;
                    if (DragInfo != null)
                    {
                        startTime = DragInfo.StartTime.MeasuredTime;
                        endTime = DragInfo.EndTime.MeasuredTime;
                    }
                    else if (TransitionChromInfo != null)
                    {
                        var tranPeakInfo = TransitionChromInfo;
                        startTime = tranPeakInfo.StartRetentionTime;
                        endTime = tranPeakInfo.EndRetentionTime;
                    }
                    AddPeakBoundaries(graphPane, annotations, true,
                        ScaleRetentionTime(startTime), ScaleRetentionTime(endTime), intensityBest);
                }
            }
        }
示例#12
0
文件: ArrowObj.cs 项目: Rupan/BDInfo
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="ArrowObj"/> object from which to copy</param>
 public ArrowObj( ArrowObj rhs )
     : base(rhs)
 {
     _size = rhs.Size;
     _isArrowHead = rhs.IsArrowHead;
 }
示例#13
0
        public ModInitialSampleDemo()
            : base("Code Project Modified Initial Sample",
			"Modified Initial Sample", DemoType.Tutorial)
        {
            GraphPane myPane = base.GraphPane;

            // Set up the title and axis labels
            myPane.Title.Text = "My Test Graph\n(For CodeProject Sample)";
            myPane.XAxis.Title.Text = "My X Axis";
            myPane.YAxis.Title.Text = "My Y Axis";

            // Make up some data arrays based on the Sine function
            PointPairList list1 = new PointPairList();
            PointPairList list2 = new PointPairList();
            for ( int i=0; i<36; i++ )
            {
                double x = (double) i + 5;
                double y1 = 1.5 + Math.Sin( (double) i * 0.2 );
                double y2 = 3.0 * ( 1.5 + Math.Sin( (double) i * 0.2 ) );
                list1.Add( x, y1 );
                list2.Add( x, y2 );
            }

            // Generate a red curve with diamond
            // symbols, and "Porsche" in the legend
            LineItem myCurve = myPane.AddCurve( "Porsche",
                list1, Color.Red, SymbolType.Diamond );

            // Generate a blue curve with circle
            // symbols, and "Piper" in the legend
            LineItem myCurve2 = myPane.AddCurve( "Piper",
                list2, Color.Blue, SymbolType.Circle );

            // Change the color of the title
            myPane.Title.FontSpec.FontColor = Color.Green;

            // Add gridlines to the plot, and make them gray
            myPane.XAxis.MajorGrid.IsVisible = true;
            myPane.YAxis.MajorGrid.IsVisible = true;
            myPane.XAxis.MajorGrid.Color = Color.LightGray;
            myPane.YAxis.MajorGrid.Color = Color.LightGray;

            // Move the legend location
            base.Pane.Legend.Position = ZedGraph.LegendPos.Bottom;

            // Make both curves thicker
            myCurve.Line.Width = 2.0F;
            myCurve2.Line.Width = 2.0F;

            // Fill the area under the curves
            myCurve.Line.Fill = new Fill( Color.White, Color.Red, 45F );
            myCurve2.Line.Fill = new Fill( Color.White, Color.Blue, 45F );

            // Increase the symbol sizes, and fill them with solid white
            myCurve.Symbol.Size = 8.0F;
            myCurve2.Symbol.Size = 8.0F;
            myCurve.Symbol.Fill = new Fill( Color.White );
            myCurve2.Symbol.Fill = new Fill( Color.White );

            // Add a background gradient fill to the axis frame
            myPane.Chart.Fill = new Fill( Color.White,
                Color.FromArgb( 255, 255, 210), -45F );

            // Add a caption and an arrow
            TextObj myText = new TextObj( "Interesting\nPoint", 230F, 70F );
            myText.FontSpec.FontColor = Color.Red;
            myText.Location.AlignH = AlignH.Center;
            myText.Location.AlignV = AlignV.Top;
            myPane.GraphObjList.Add( myText );
            ArrowObj myArrow = new ArrowObj( Color.Red, 12F, 230F, 70F, 280F, 55F );
            myPane.GraphObjList.Add( myArrow );

            base.ZedGraphControl.AxisChange();
        }
示例#14
0
        private void DisplayCalibrationCurve()
        {
            CalibrationCurveOptions options = Settings.Default.CalibrationCurveOptions;
            zedGraphControl.GraphPane.YAxis.Type = zedGraphControl.GraphPane.XAxis.Type
                = options.LogPlot ? AxisType.Log : AxisType.Linear;
            zedGraphControl.GraphPane.Legend.IsVisible = options.ShowLegend;
            _scatterPlots = null;
            CalibrationCurve = null;
            SrmDocument document = DocumentUiContainer.DocumentUI;
            if (!document.Settings.HasResults)
            {
                zedGraphControl.GraphPane.Title.Text =
                    QuantificationStrings.CalibrationForm_DisplayCalibrationCurve_No_results_available;
                return;
            }
            PeptideDocNode peptide = null;
            PeptideGroupDocNode peptideGroup = null;
            SequenceTree sequenceTree = _skylineWindow.SequenceTree;
            if (null != sequenceTree)
            {
                PeptideTreeNode peptideTreeNode = sequenceTree.GetNodeOfType<PeptideTreeNode>();
                if (null != peptideTreeNode)
                {
                    peptide = peptideTreeNode.DocNode;
                }
                PeptideGroupTreeNode peptideGroupTreeNode = sequenceTree.GetNodeOfType<PeptideGroupTreeNode>();
                if (null != peptideGroupTreeNode)
                {
                    peptideGroup = peptideGroupTreeNode.DocNode;
                }
            }

            if (null == peptide)
            {
                zedGraphControl.GraphPane.Title.Text =
                    QuantificationStrings
                        .CalibrationForm_DisplayCalibrationCurve_Select_a_peptide_to_see_its_calibration_curve;
                return;
            }
            PeptideQuantifier peptideQuantifier = PeptideQuantifier.GetPeptideQuantifier(document.Settings, peptideGroup,
                peptide);
            CalibrationCurveFitter curveFitter = new CalibrationCurveFitter(peptideQuantifier, document.Settings);
            if (peptideQuantifier.QuantificationSettings.RegressionFit == RegressionFit.NONE)
            {
                if (string.IsNullOrEmpty(
                    peptideQuantifier.QuantificationSettings.NormalizationMethod.IsotopeLabelTypeName))
                {
                    zedGraphControl.GraphPane.Title.Text =
                        QuantificationStrings.CalibrationForm_DisplayCalibrationCurve_Use_the_Quantification_tab_on_the_Peptide_Settings_dialog_to_control_the_conversion_of_peak_areas_to_concentrations_;
                }
                else
                {
                    if (!peptide.InternalStandardConcentration.HasValue)
                    {
                        zedGraphControl.GraphPane.Title.Text =
                            string.Format(QuantificationStrings.CalibrationForm_DisplayCalibrationCurve_To_convert_peak_area_ratios_to_concentrations__specify_the_internal_standard_concentration_for__0__, peptide);
                    }
                    else
                    {
                        zedGraphControl.GraphPane.Title.Text = null;
                    }
                }
            }
            else
            {
                if (curveFitter.GetStandardConcentrations().Any())
                {
                    zedGraphControl.GraphPane.Title.Text = null;
                }
                else
                {
                    zedGraphControl.GraphPane.Title.Text = QuantificationStrings.CalibrationForm_DisplayCalibrationCurve_To_fit_a_calibration_curve__set_the_Sample_Type_of_some_replicates_to_Standard__and_specify_their_concentration_;
                }
            }

            zedGraphControl.GraphPane.XAxis.Title.Text = curveFitter.GetXAxisTitle();
            zedGraphControl.GraphPane.YAxis.Title.Text = curveFitter.GetYAxisTitle();
            CalibrationCurve = curveFitter.GetCalibrationCurve();
            double minX = double.MaxValue, maxX = double.MinValue;
            _scatterPlots = new CurveList();
            foreach (var sampleType in SampleType.ListSampleTypes())
            {
                if (!Options.DisplaySampleType(sampleType))
                {
                    continue;
                }
                PointPairList pointPairList = new PointPairList();
                for (int iReplicate = 0;
                    iReplicate < document.Settings.MeasuredResults.Chromatograms.Count;
                    iReplicate++)
                {
                    ChromatogramSet chromatogramSet = document.Settings.MeasuredResults.Chromatograms[iReplicate];
                    if (!Equals(sampleType, chromatogramSet.SampleType))
                    {
                        continue;
                    }
                    double? y = curveFitter.GetYValue(iReplicate);
                    double? x = curveFitter.GetSpecifiedXValue(iReplicate)
                                ?? curveFitter.GetCalculatedXValue(CalibrationCurve, iReplicate);
                    if (y.HasValue && x.HasValue)
                    {
                        PointPair point = new PointPair(x.Value, y.Value) {Tag = iReplicate};
                        pointPairList.Add(point);
                        if (!Options.LogPlot || x.Value > 0)
                        {
                            minX = Math.Min(minX, x.Value);
                        }
                        maxX = Math.Max(maxX, x.Value);
                    }
                }
                if (pointPairList.Any())
                {
                    var lineItem = zedGraphControl.GraphPane.AddCurve(sampleType.ToString(), pointPairList,
                        sampleType.Color, sampleType.SymbolType);
                    lineItem.Line.IsVisible = false;
                    lineItem.Symbol.Fill = new Fill(sampleType.Color);
                    _scatterPlots.Add(lineItem);
                }
            }
            List<string> labelLines = new List<String>();
            RegressionFit regressionFit = document.Settings.PeptideSettings.Quantification.RegressionFit;
            if (regressionFit != RegressionFit.NONE)
            {
                if (minX <= maxX)
                {
                    int interpolatedLinePointCount = 100;
                    if (!options.LogPlot)
                    {
                        if (regressionFit == RegressionFit.LINEAR_THROUGH_ZERO)
                        {
                            minX = Math.Min(0, minX);
                        }
                        if (regressionFit != RegressionFit.QUADRATIC)
                        {
                            interpolatedLinePointCount = 2;
                        }
                    }
                    LineItem interpolatedLine = CreateInterpolatedLine(CalibrationCurve, minX, maxX,
                        interpolatedLinePointCount, Options.LogPlot);
                    if (null != interpolatedLine)
                    {
                        zedGraphControl.GraphPane.CurveList.Add(interpolatedLine);
                    }
                }
                labelLines.Add(CalibrationCurve.ToString());

                if (CalibrationCurve.RSquared.HasValue)
                {
                    labelLines.Add(QuantificationStrings.CalibrationForm_DisplayCalibrationCurve_ +
                                   CalibrationCurve.RSquared.Value.ToString("0.####")); // Not L10N
                }
                if (!Equals(curveFitter.QuantificationSettings.RegressionWeighting, RegressionWeighting.NONE))
                {
                    labelLines.Add(string.Format("{0}: {1}", // Not L10N
                        QuantificationStrings.Weighting, curveFitter.QuantificationSettings.RegressionWeighting));
                }
            }

            if (options.ShowSelection)
            {
                double? ySelected = curveFitter.GetYValue(_skylineWindow.SelectedResultsIndex);
                double? xSelected = curveFitter.GetCalculatedXValue(CalibrationCurve, _skylineWindow.SelectedResultsIndex);
                if (xSelected.HasValue && ySelected.HasValue)
                {
                    ArrowObj arrow = new ArrowObj(xSelected.Value, ySelected.Value, xSelected.Value,
                        ySelected.Value) {Line = {Color = GraphSummary.ColorSelected}};
                    zedGraphControl.GraphPane.GraphObjList.Insert(0, arrow);
                }

                var quantificationResult = curveFitter.GetQuantificationResult(_skylineWindow.SelectedResultsIndex);
                if (quantificationResult.CalculatedConcentration.HasValue)
                {
                    labelLines.Add(string.Format("{0} = {1}", // Not L10N
                        QuantificationStrings.Calculated_Concentration, quantificationResult));
                }
                else if (!quantificationResult.NormalizedArea.HasValue)
                {
                    labelLines.Add(QuantificationStrings.CalibrationForm_DisplayCalibrationCurve_The_selected_replicate_has_missing_or_truncated_transitions);
                }
            }
            if (labelLines.Any())
            {
                TextObj text = new TextObj(TextUtil.LineSeparate(labelLines), .01, 0,
                    CoordType.ChartFraction, AlignH.Left, AlignV.Top)
                {
                    IsClippedToChartRect = true,
                    ZOrder = ZOrder.E_BehindCurves,
                    FontSpec = GraphSummary.CreateFontSpec(Color.Black),
                };
                zedGraphControl.GraphPane.GraphObjList.Add(text);
            }
        }
示例#15
0
 /// <summary>
 /// The Copy Constructor
 /// </summary>
 /// <param name="rhs">The <see cref="ArrowObj"/> object from which to copy</param>
 public ArrowObj(ArrowObj rhs) : base(rhs)
 {
     _size            = rhs.Size;
     _isArrowHead     = rhs.IsArrowHead;
     _arrowHeadFactor = rhs._arrowHeadFactor;
 }