예제 #1
1
        private void Annotation_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            Chart1.Annotations.Clear();

            AnnotationStyle.Items.Clear();
            AnnotationStyle.Enabled = false;

            AnnotationStyle1.Items.Clear();
            AnnotationStyle1.Enabled = false;
            AnnotationStyle2.Items.Clear();
            AnnotationStyle2.Visible = false;

            if(Annotation.SelectedItem.ToString() == "Line")
            {
                LineAnnotation annotation = new LineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Height = -25;
                annotation.Width = -25;
                annotation.LineWidth = 2;

                Chart1.Annotations.Add(annotation);

                SetLineControls(true);

            }
            else if(Annotation.SelectedItem.ToString() == "Vertical Line")
            {
                VerticalLineAnnotation annotation = new VerticalLineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Height = -25;
                annotation.LineWidth = 2;

                Chart1.Annotations.Add(annotation);

                SetLineControls(true);

            }
            else if(Annotation.SelectedItem.ToString() == "Horizontal Line")
            {
                HorizontalLineAnnotation annotation = new HorizontalLineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Width = -25;
                annotation.LineWidth = 2;

                Chart1.Annotations.Add(annotation);

                SetLineControls(true);
            }
            else if(Annotation.SelectedItem.ToString() == "Polyline")
            {
                PolylineAnnotation annotation = new PolylineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];

                // explicitly set the relative height and width
                annotation.Height = 50;
                annotation.Width = 30;

                PointF [] points = new PointF[5];
                points[0].X = 0;
                points[0].Y = 0;

                points[1].X = 100;
                points[1].Y = 0;

                points[2].X = 0;
                points[2].Y = 100;

                points[3].X = 100;
                points[3].Y = 100;

                points[4].X = 0;
                points[4].Y = 50;

                annotation.GraphicsPath.AddPolygon(points);

                Chart1.Annotations.Add(annotation);

                SetLineControls(false);
            }
            else if(Annotation.SelectedItem.ToString() == "Text")
            {
                TextAnnotation annotation = new TextAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text = "I am a TextAnnotation";
                annotation.ForeColor = Color.Black;
                annotation.Font = new Font("Arial", 12);;

                Chart1.Annotations.Add(annotation);
                SetTextControls();

            }
            else if(Annotation.SelectedItem.ToString() == "Rectangle")
            {
                RectangleAnnotation annotation = new RectangleAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text = "I am a\nRectangleAnnotation";
                annotation.ForeColor = Color.Black;
                annotation.Font = new Font("Arial", 12);;
                annotation.LineWidth = 2;

                Chart1.Annotations.Add(annotation);

                SetTextControls();
                SetColorLineControls();
                AnnotationStyle1.SelectedIndex = 2;
            }
            else if(Annotation.SelectedItem.ToString() == "Ellipse")
            {
                EllipseAnnotation annotation = new EllipseAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text = "I am an EllipseAnnotation";
                annotation.ForeColor = Color.Black;
                annotation.Font = new Font("Arial", 12);;
                annotation.LineWidth = 2;
                annotation.Height = 35;
                annotation.Width = 60;

                Chart1.Annotations.Add(annotation);

                SetTextControls();
                SetColorLineControls();
                AnnotationStyle1.SelectedIndex = 2;

            }
            else if(Annotation.SelectedItem.ToString() == "Arrow")
            {
                ArrowAnnotation annotation = new ArrowAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Height = -25;
                annotation.Width = -25;
                annotation.LineWidth = 2;

                Chart1.Annotations.Add(annotation);

                SetArrowControls();

            }
            else if(Annotation.SelectedItem.ToString() == "Border3D")
            {
                Border3DAnnotation annotation = new Border3DAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text = "I am a Border3DAnnotation";
                annotation.ForeColor = Color.Black;
                annotation.Font = new Font("Arial", 12);
                annotation.Height = 40;
                annotation.Width = 50;

                Chart1.Annotations.Add(annotation);

                SetBorder3DControls();

            }
            else if(Annotation.SelectedItem.ToString() == "Callout")
            {
                CalloutAnnotation annotation = new CalloutAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text = "I am a\nCalloutAnnotation";
                annotation.ForeColor = Color.Black;
                annotation.Font = new Font("Arial", 10);;
                annotation.Height = 35;
                annotation.Width = 50;

                Chart1.Annotations.Add(annotation);

                SetCalloutControls();

            }
            else if(Annotation.SelectedItem.ToString() == "Polygon")
            {
                PolygonAnnotation annotation = new PolygonAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];

                // explicitly set the relative height and width
                annotation.Height = 50;
                annotation.Width = 30;

                annotation.BackColor = Color.FromArgb(128, Color.Orange);

                // define relative value points for a polygon
                PointF [] points = new PointF[5];
                points[0].X = 0;
                points[0].Y = 0;

                points[1].X = 100;
                points[1].Y = 0;

                points[2].X = 100;
                points[2].Y = 100;

                points[3].X = 0;
                points[3].Y = 100;

                points[4].X = 50;
                points[4].Y = 50;

                annotation.GraphicsPath.AddPolygon(points);

                Chart1.Annotations.Add(annotation);

                SetColorControl();
                SetColorLineControls();

            }
            else if(Annotation.SelectedItem.ToString() == "Image")
            {
                if(Chart1.Images.IndexOf("MyBmp") < 0)
                {
                    Bitmap Bmp = new Bitmap(200, 75);
                    Graphics g = Graphics.FromImage(Bmp);
                    g.FillRectangle(new SolidBrush(Color.Transparent), 0, 0, Bmp.Width, Bmp.Height);
                    g.FillRectangle(new SolidBrush(Color.PaleGoldenrod), Bmp.Width/2, 0, Bmp.Width/2, Bmp.Height);
                    g.FillRectangle(new SolidBrush(Color.PaleVioletRed), 0, 0, Bmp.Width/2, Bmp.Height);
                    g.FillRectangle(new SolidBrush(Color.FromArgb(128, Color.DarkOrange)), 0, Bmp.Height/2, Bmp.Width, Bmp.Height/2);
                    g.DrawString("I am an ImageAnnotation", new Font("Arial", 12),
                        new SolidBrush(Color.Black),
                        new Rectangle( 0, 0, Bmp.Width, Bmp.Height));

                    g.Dispose();

                    Chart1.Images.Add(new NamedImage("MyBmp", Bmp));
                }

                ImageAnnotation annotation = new ImageAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Image = "MyBmp";

                Chart1.Annotations.Add(annotation);
                StyleLabel1.Text = "";
                StyleLabel2.Text = "";
            }
        }
예제 #2
0
            public void EllipseAnnotation()
            {
                var s1 = new EllipseAnnotation();
                var s2 = new Annotations.EllipseAnnotation();

                OxyAssert.PropertiesAreEqual(s2, s1);
            }
예제 #3
0
 public CircleCursor(PlotModel model)
 {
     this.model        = model;
     this.ellipse      = new EllipseAnnotation();
     this.radiusLine   = new LineSeries();
     this.MousePressed = false;
     this.InitCircleCursorEvent();
 }
예제 #4
0
        private void SetAnnotationStyle2()
        {
            if (AnnotationStyle2 == null || AnnotationStyle2.SelectedIndex == -1)
            {
                return;
            }

            if (Annotation.SelectedItem.Value == "Line")
            {
                LineAnnotation annotation = (LineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Vertical Line")
            {
                VerticalLineAnnotation annotation = (VerticalLineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Horizontal Line")
            {
                HorizontalLineAnnotation annotation = (HorizontalLineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Polyline")
            {
                PolylineAnnotation annotation = (PolylineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Rectangle")
            {
                RectangleAnnotation annotation = (RectangleAnnotation)Chart1.Annotations[0];

                annotation.LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle2.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Ellipse")
            {
                EllipseAnnotation annotation = (EllipseAnnotation)Chart1.Annotations[0];

                annotation.LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle2.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Polygon")
            {
                PolygonAnnotation annotation = (PolygonAnnotation)Chart1.Annotations[0];

                annotation.LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle2.SelectedItem.Value);
            }
        }
예제 #5
0
        private void AnnotationStyle2_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (Annotation.SelectedItem.ToString() == "Line")
            {
                LineAnnotation annotation = (LineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Vertical Line")
            {
                VerticalLineAnnotation annotation = (VerticalLineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Horizontal Line")
            {
                HorizontalLineAnnotation annotation = (HorizontalLineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Polyline")
            {
                PolylineAnnotation annotation = (PolylineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Rectangle")
            {
                RectangleAnnotation annotation = (RectangleAnnotation)Chart1.Annotations[0];

                annotation.LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle2.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Ellipse")
            {
                EllipseAnnotation annotation = (EllipseAnnotation)Chart1.Annotations[0];

                annotation.LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle2.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Polygon")
            {
                PolygonAnnotation annotation = (PolygonAnnotation)Chart1.Annotations[0];

                annotation.LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle2.SelectedItem.ToString());
            }
        }
        /// <summary>
        /// Метод, выполняющий рисование точек торможения (если каноническая область является окружностью)
        /// </summary>
        /// <param name="r">Правая точка торможения</param>
        /// <param name="l">Левая точка торможения</param>
        public void DrawStagnationPoints(Complex r, Complex l)
        {
            EllipseAnnotation rsp, lsp;

            rsp = new EllipseAnnotation()
            {
                X = r.Re, Y = r.Im, Width = 2 * StagnationPointsRadius, Height = 2 * StagnationPointsRadius, Stroke = OxyColors.Black, StrokeThickness = 1, Fill = OxyColors.Red
            };
            lsp = new EllipseAnnotation()
            {
                X = l.Re, Y = l.Im, Width = 2 * StagnationPointsRadius, Height = 2 * StagnationPointsRadius, Stroke = OxyColors.Black, StrokeThickness = 1, Fill = OxyColors.Red
            };
            PlotModel.Annotations.Add(rsp);
            PlotModel.Annotations.Add(lsp);
        }
예제 #7
0
        private void AnnotationStyle1_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (Annotation.SelectedItem.ToString() == "Line")
            {
                LineAnnotation annotation = (LineAnnotation)Chart1.Annotations[0];

                annotation.StartCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle1.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Vertical Line")
            {
                VerticalLineAnnotation annotation = (VerticalLineAnnotation)Chart1.Annotations[0];

                annotation.StartCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle1.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Horizontal Line")
            {
                HorizontalLineAnnotation annotation = (HorizontalLineAnnotation)Chart1.Annotations[0];

                annotation.StartCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle1.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Polyline")
            {
                PolylineAnnotation annotation = (PolylineAnnotation)Chart1.Annotations[0];

                annotation.StartCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle1.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Rectangle")
            {
                RectangleAnnotation annotation = (RectangleAnnotation)Chart1.Annotations[0];

                annotation.BackColor = Color.FromArgb(128, Color.FromName(AnnotationStyle1.SelectedItem.ToString()));
            }
            else if (Annotation.SelectedItem.ToString() == "Ellipse")
            {
                EllipseAnnotation annotation = (EllipseAnnotation)Chart1.Annotations[0];

                annotation.BackColor = Color.FromArgb(128, Color.FromName(AnnotationStyle1.SelectedItem.ToString()));
            }
            else if (Annotation.SelectedItem.ToString() == "Arrow")
            {
                ArrowAnnotation annotation = (ArrowAnnotation)Chart1.Annotations[0];

                if (AnnotationStyle1.SelectedItem.ToString() != "")
                {
                    annotation.ArrowSize = int.Parse(AnnotationStyle1.SelectedItem.ToString());
                }
            }
            else if (Annotation.SelectedItem.ToString() == "Border3D")
            {
                Border3DAnnotation annotation = (Border3DAnnotation)Chart1.Annotations[0];

                annotation.BorderSkin.BackColor = Color.FromArgb(128, Color.FromName(AnnotationStyle1.SelectedItem.ToString()));
            }
            else if (Annotation.SelectedItem.ToString() == "Callout")
            {
                CalloutAnnotation annotation = (CalloutAnnotation)Chart1.Annotations[0];

                annotation.BackColor = Color.FromArgb(128, Color.FromName(AnnotationStyle1.SelectedItem.ToString()));
            }
            else if (Annotation.SelectedItem.ToString() == "Polygon")
            {
                PolygonAnnotation annotation = (PolygonAnnotation)Chart1.Annotations[0];

                annotation.LineColor = Color.FromName(AnnotationStyle1.SelectedItem.ToString());
            }
        }
예제 #8
0
        private void Annotation_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            Chart1.Annotations.Clear();

            AnnotationStyle.Items.Clear();
            AnnotationStyle.Enabled = false;

            AnnotationStyle1.Items.Clear();
            AnnotationStyle1.Enabled = false;
            AnnotationStyle2.Items.Clear();
            AnnotationStyle2.Visible = false;

            if (Annotation.SelectedItem.ToString() == "Line")
            {
                LineAnnotation annotation = new LineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Height          = -25;
                annotation.Width           = -25;
                annotation.LineWidth       = 2;

                Chart1.Annotations.Add(annotation);

                SetLineControls(true);
            }
            else if (Annotation.SelectedItem.ToString() == "Vertical Line")
            {
                VerticalLineAnnotation annotation = new VerticalLineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Height          = -25;
                annotation.LineWidth       = 2;

                Chart1.Annotations.Add(annotation);

                SetLineControls(true);
            }
            else if (Annotation.SelectedItem.ToString() == "Horizontal Line")
            {
                HorizontalLineAnnotation annotation = new HorizontalLineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Width           = -25;
                annotation.LineWidth       = 2;

                Chart1.Annotations.Add(annotation);

                SetLineControls(true);
            }
            else if (Annotation.SelectedItem.ToString() == "Polyline")
            {
                PolylineAnnotation annotation = new PolylineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];

                // explicitly set the relative height and width
                annotation.Height = 50;
                annotation.Width  = 30;

                PointF [] points = new PointF[5];
                points[0].X = 0;
                points[0].Y = 0;

                points[1].X = 100;
                points[1].Y = 0;

                points[2].X = 0;
                points[2].Y = 100;

                points[3].X = 100;
                points[3].Y = 100;

                points[4].X = 0;
                points[4].Y = 50;

                annotation.GraphicsPath.AddPolygon(points);

                Chart1.Annotations.Add(annotation);

                SetLineControls(false);
            }
            else if (Annotation.SelectedItem.ToString() == "Text")
            {
                TextAnnotation annotation = new TextAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text            = "I am a TextAnnotation";
                annotation.ForeColor       = Color.Black;
                annotation.Font            = new Font("Arial", 12);;

                Chart1.Annotations.Add(annotation);
                SetTextControls();
            }
            else if (Annotation.SelectedItem.ToString() == "Rectangle")
            {
                RectangleAnnotation annotation = new RectangleAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text            = "I am a\nRectangleAnnotation";
                annotation.ForeColor       = Color.Black;
                annotation.Font            = new Font("Arial", 12);;
                annotation.LineWidth       = 2;

                Chart1.Annotations.Add(annotation);

                SetTextControls();
                SetColorLineControls();
                AnnotationStyle1.SelectedIndex = 2;
            }
            else if (Annotation.SelectedItem.ToString() == "Ellipse")
            {
                EllipseAnnotation annotation = new EllipseAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text            = "I am an EllipseAnnotation";
                annotation.ForeColor       = Color.Black;
                annotation.Font            = new Font("Arial", 12);;
                annotation.LineWidth       = 2;
                annotation.Height          = 35;
                annotation.Width           = 60;

                Chart1.Annotations.Add(annotation);

                SetTextControls();
                SetColorLineControls();
                AnnotationStyle1.SelectedIndex = 2;
            }
            else if (Annotation.SelectedItem.ToString() == "Arrow")
            {
                ArrowAnnotation annotation = new ArrowAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Height          = -25;
                annotation.Width           = -25;
                annotation.LineWidth       = 2;

                Chart1.Annotations.Add(annotation);

                SetArrowControls();
            }
            else if (Annotation.SelectedItem.ToString() == "Border3D")
            {
                Border3DAnnotation annotation = new Border3DAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text            = "I am a Border3DAnnotation";
                annotation.ForeColor       = Color.Black;
                annotation.Font            = new Font("Arial", 12);
                annotation.Height          = 40;
                annotation.Width           = 50;

                Chart1.Annotations.Add(annotation);

                SetBorder3DControls();
            }
            else if (Annotation.SelectedItem.ToString() == "Callout")
            {
                CalloutAnnotation annotation = new CalloutAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text            = "I am a\nCalloutAnnotation";
                annotation.ForeColor       = Color.Black;
                annotation.Font            = new Font("Arial", 10);;
                annotation.Height          = 35;
                annotation.Width           = 50;

                Chart1.Annotations.Add(annotation);

                SetCalloutControls();
            }
            else if (Annotation.SelectedItem.ToString() == "Polygon")
            {
                PolygonAnnotation annotation = new PolygonAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];

                // explicitly set the relative height and width
                annotation.Height = 50;
                annotation.Width  = 30;

                annotation.BackColor = Color.FromArgb(128, Color.Orange);

                // define relative value points for a polygon
                PointF [] points = new PointF[5];
                points[0].X = 0;
                points[0].Y = 0;

                points[1].X = 100;
                points[1].Y = 0;

                points[2].X = 100;
                points[2].Y = 100;

                points[3].X = 0;
                points[3].Y = 100;

                points[4].X = 50;
                points[4].Y = 50;

                annotation.GraphicsPath.AddPolygon(points);

                Chart1.Annotations.Add(annotation);

                SetColorControl();
                SetColorLineControls();
            }
            else if (Annotation.SelectedItem.ToString() == "Image")
            {
                if (Chart1.Images.IndexOf("MyBmp") < 0)
                {
                    Bitmap   Bmp = new Bitmap(200, 75);
                    Graphics g   = Graphics.FromImage(Bmp);
                    g.FillRectangle(new SolidBrush(Color.Transparent), 0, 0, Bmp.Width, Bmp.Height);
                    g.FillRectangle(new SolidBrush(Color.PaleGoldenrod), Bmp.Width / 2, 0, Bmp.Width / 2, Bmp.Height);
                    g.FillRectangle(new SolidBrush(Color.PaleVioletRed), 0, 0, Bmp.Width / 2, Bmp.Height);
                    g.FillRectangle(new SolidBrush(Color.FromArgb(128, Color.DarkOrange)), 0, Bmp.Height / 2, Bmp.Width, Bmp.Height / 2);
                    g.DrawString("I am an ImageAnnotation", new Font("Arial", 12),
                                 new SolidBrush(Color.Black),
                                 new Rectangle(0, 0, Bmp.Width, Bmp.Height));

                    g.Dispose();

                    Chart1.Images.Add(new NamedImage("MyBmp", Bmp));
                }

                ImageAnnotation annotation = new ImageAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Image           = "MyBmp";

                Chart1.Annotations.Add(annotation);
                StyleLabel1.Text = "";
                StyleLabel2.Text = "";
            }
        }
예제 #9
0
        private void SetAnnotationStyle1()
        {
            if (AnnotationStyle1 == null || AnnotationStyle1.SelectedIndex == -1)
            {
                return;
            }

            if (Annotation.SelectedItem.Value == "Line")
            {
                LineAnnotation annotation = (LineAnnotation)Chart1.Annotations[0];

                annotation.StartCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle1.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Vertical Line")
            {
                VerticalLineAnnotation annotation = (VerticalLineAnnotation)Chart1.Annotations[0];

                annotation.StartCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle1.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Horizontal Line")
            {
                HorizontalLineAnnotation annotation = (HorizontalLineAnnotation)Chart1.Annotations[0];

                annotation.StartCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle1.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Polyline")
            {
                PolylineAnnotation annotation = (PolylineAnnotation)Chart1.Annotations[0];

                annotation.StartCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle1.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Rectangle")
            {
                RectangleAnnotation annotation = (RectangleAnnotation)Chart1.Annotations[0];

                annotation.BackColor = Color.FromArgb(128, Color.FromName(AnnotationStyle1.SelectedItem.Value));
            }
            else if (Annotation.SelectedItem.Value == "Ellipse")
            {
                EllipseAnnotation annotation = (EllipseAnnotation)Chart1.Annotations[0];

                annotation.BackColor = Color.FromArgb(128, Color.FromName(AnnotationStyle1.SelectedItem.Value));
            }
            else if (Annotation.SelectedItem.Value == "Arrow")
            {
                ArrowAnnotation annotation = (ArrowAnnotation)Chart1.Annotations[0];

                if (AnnotationStyle1.SelectedItem.Value != "")
                {
                    annotation.ArrowSize = int.Parse(AnnotationStyle1.SelectedItem.Value);
                }
            }
            else if (Annotation.SelectedItem.Value == "Border3D")
            {
                Border3DAnnotation annotation = (Border3DAnnotation)Chart1.Annotations[0];

                annotation.BorderSkin.BackColor = Color.FromArgb(128, Color.FromName(AnnotationStyle1.SelectedItem.Value));
            }
            else if (Annotation.SelectedItem.Value == "Callout")
            {
                CalloutAnnotation annotation = (CalloutAnnotation)Chart1.Annotations[0];

                annotation.BackColor = Color.FromArgb(128, Color.FromName(AnnotationStyle1.SelectedItem.Value));
            }
            else if (Annotation.SelectedItem.Value == "Polygon")
            {
                PolygonAnnotation annotation = (PolygonAnnotation)Chart1.Annotations[0];

                annotation.LineColor = Color.FromName(AnnotationStyle1.SelectedItem.Value);
            }
        }
        public ChartAnnotation()
        {
            SFChart chart = new SFChart();

            chart.AreaBackgroundColor = UIColor.FromRGB(245, 245, 245);
            chart.PrimaryAxis         = new SFNumericalAxis()
            {
                Minimum            = new NSNumber(0),
                Maximum            = new NSNumber(4),
                ShowMajorGridLines = false
            };
            chart.SecondaryAxis = new SFNumericalAxis()
            {
                Minimum            = new NSNumber(20),
                Maximum            = new NSNumber(70),
                ShowMajorGridLines = false,
            };

            VerticalLineAnnotation VerticalLineAnnotation = new VerticalLineAnnotation();

            VerticalLineAnnotation.X1            = 2;
            VerticalLineAnnotation.LineCap       = ChartLineCap.Arrow;
            VerticalLineAnnotation.Text          = "Vertical Line";
            VerticalLineAnnotation.ShowAxisLabel = true;

            HorizontalLineAnnotation horizontalLineAnnotation = new HorizontalLineAnnotation();

            horizontalLineAnnotation.Y1            = 45;
            horizontalLineAnnotation.LineCap       = ChartLineCap.Arrow;
            horizontalLineAnnotation.Text          = "Horizontal Line";
            horizontalLineAnnotation.ShowAxisLabel = true;

            LineAnnotation lineAnnotation = new LineAnnotation();

            lineAnnotation.X1      = 2.5;
            lineAnnotation.X2      = 3.5;
            lineAnnotation.Y1      = 52;
            lineAnnotation.Y2      = 63;
            lineAnnotation.LineCap = ChartLineCap.Arrow;
            lineAnnotation.Text    = "Line";

            RectangleAnnotation rectangleAnnotation = new RectangleAnnotation();

            rectangleAnnotation.Text = "Rectangle";
            rectangleAnnotation.X1   = 0.5;
            rectangleAnnotation.X2   = 1.5;
            rectangleAnnotation.Y1   = 25;
            rectangleAnnotation.Y2   = 35;

            EllipseAnnotation ellipseAnnotation = new EllipseAnnotation();

            ellipseAnnotation.Text = "Ellipse";
            ellipseAnnotation.X1   = 2.5;
            ellipseAnnotation.X2   = 3.5;
            ellipseAnnotation.Y1   = 25;
            ellipseAnnotation.Y2   = 35;

            TextAnnotation textAnnotation = new TextAnnotation();

            textAnnotation.X1   = 1;
            textAnnotation.Y1   = 57.5;
            textAnnotation.Text = "Text Annotation";

            chart.Annotations.Add(VerticalLineAnnotation);
            chart.Annotations.Add(horizontalLineAnnotation);
            chart.Annotations.Add(lineAnnotation);
            chart.Annotations.Add(rectangleAnnotation);
            chart.Annotations.Add(ellipseAnnotation);
            chart.Annotations.Add(textAnnotation);
            this.AddSubview(chart);
        }
        public override View GetSampleContent(Context context)
        {
            chart = new SfChart(context);
            chart.SetBackgroundColor(Color.White);
            chart.AreaBackgroundColor = Color.Rgb(245, 245, 245);

            NumericalAxis categoryaxis = new NumericalAxis();

            categoryaxis.ShowMajorGridLines    = false;
            categoryaxis.Minimum               = 0;
            categoryaxis.Maximum               = 4;
            categoryaxis.LineStyle.StrokeColor = Color.White;
            chart.PrimaryAxis = categoryaxis;

            NumericalAxis numericalaxis = new NumericalAxis();

            numericalaxis.ShowMajorGridLines    = false;
            numericalaxis.Minimum               = 20;
            numericalaxis.Maximum               = 70;
            numericalaxis.LineStyle.StrokeColor = Color.White;
            chart.SecondaryAxis = numericalaxis;

            LineAnnotation lineAnnotation = new LineAnnotation();

            lineAnnotation.Text = "Line";
            lineAnnotation.X1   = 2.5;
            lineAnnotation.X2   = 3.5;
            lineAnnotation.Y1   = 52;
            lineAnnotation.Y2   = 63;
            lineAnnotation.LabelStyle.MarginTop    = 5;
            lineAnnotation.LabelStyle.MarginRight  = 5;
            lineAnnotation.LabelStyle.MarginLeft   = 5;
            lineAnnotation.LabelStyle.MarginBottom = 5;
            lineAnnotation.LineCap = ChartLineCap.Arrow;

            HorizontalLineAnnotation horizontalAnnotation = new HorizontalLineAnnotation();

            horizontalAnnotation.Y1            = 45;
            horizontalAnnotation.Text          = "Horizontal Line";
            horizontalAnnotation.LineCap       = ChartLineCap.Arrow;
            horizontalAnnotation.ShowAxisLabel = true;

            VerticalLineAnnotation verticalAnnotation = new VerticalLineAnnotation();

            verticalAnnotation.X1            = 2;
            verticalAnnotation.Text          = "Vertical Line";
            verticalAnnotation.LineCap       = ChartLineCap.Arrow;
            verticalAnnotation.ShowAxisLabel = true;

            RectangleAnnotation RectAnnotation = new RectangleAnnotation();

            RectAnnotation.X1   = 0.5;
            RectAnnotation.X2   = 1.5;
            RectAnnotation.Y1   = 25;
            RectAnnotation.Y2   = 35;
            RectAnnotation.Text = "Rectangle";

            EllipseAnnotation eleAnnotation = new EllipseAnnotation();

            eleAnnotation.X1   = 2.5;
            eleAnnotation.X2   = 3.5;
            eleAnnotation.Y1   = 25;
            eleAnnotation.Y2   = 35;
            eleAnnotation.Text = "Ellipse";

            TextAnnotation textAnnotation = new TextAnnotation();

            textAnnotation.X1   = 1;
            textAnnotation.Y1   = 57.5;
            textAnnotation.Text = "Text Annotation";

            chart.Annotations.Add(textAnnotation);
            chart.Annotations.Add(eleAnnotation);
            chart.Annotations.Add(RectAnnotation);
            chart.Annotations.Add(verticalAnnotation);
            chart.Annotations.Add(horizontalAnnotation);
            chart.Annotations.Add(lineAnnotation);
            return(chart);
        }
예제 #12
0
파일: Ball.cs 프로젝트: TovarnovM/IT_lect1
        public Ball(OxyColor color, LineStyle ls, string name = "ball")
        {
            Name     = name;
            AnnotPos = new EllipseAnnotation()
            {
                ToolTip = name,
                Width   = 1,
                Height  = 1,
                Fill    = color
            };
            AnnotVel = new ArrowAnnotation()
            {
                Color = color,
                Text  = "V = 0"
            };
            SerPos = new LineSeries()
            {
                Color           = color,
                StrokeThickness = 1,
                Title           = $"[{name}]X, m",
                LineStyle       = LineStyle.Dash
            };

            SerX = new LineSeries()
            {
                Color           = OxyColors.Green,
                StrokeThickness = 2,
                Title           = $"[{name}]X, m"
            };
            SerY = new LineSeries()
            {
                Color           = OxyColors.Blue,
                StrokeThickness = 2,
                Title           = $"[{name}]Y, m",
                LineStyle       = ls
            };
            SerV = new LineSeries()
            {
                Color           = OxyColors.DarkOrange,
                StrokeThickness = 2,
                Title           = $"[{name}]V, m/s",
                LineStyle       = ls
            };
            SerP = new LineSeries()
            {
                Color           = OxyColors.DarkViolet,
                StrokeThickness = 2,
                Title           = $"[{name}]p, m*s",
                LineStyle       = ls
            };
            SerE = new LineSeries()
            {
                Color           = OxyColors.Green,
                StrokeThickness = 2,
                Title           = $"[{name}]E, Дж",
                LineStyle       = ls
            };
            SerAll = new List <LineSeries>();
            SerAll.Add(SerX);
            SerAll.Add(SerY);
            SerAll.Add(SerV);
            //SerAll.Add(SerP);
            //SerAll.Add(SerE);
        }
예제 #13
0
 public void EllipseAnnotation()
 {
     var s1 = new EllipseAnnotation();
     var s2 = new Annotations.EllipseAnnotation();
     OxyAssert.PropertiesAreEqual(s1, s2);
 }
        private void addErrorPoint(SkeletonJoint series, int x, double y, Statistics.MarkerType markerType)
        {
            String seriesName = JointDictionary.GetTranslation(series).name;
            DataPoint newPoint = new DataPoint(x, y);

            if (markerType == Statistics.MarkerType.FalseNegative)
            {
                EllipseAnnotation marker = new EllipseAnnotation();
                marker.AnchorDataPoint = newPoint;
                marker.AnchorAlignment = ContentAlignment.MiddleCenter;
                marker.Width = 0.8;
                marker.Height = 1.6;
                marker.BackColor = markerColorFalsePositive;
                marker.LineColor = Color.Black;
                marker.LineWidth = 1;

                AnnotationSmartLabelStyle markerLocation = new AnnotationSmartLabelStyle();
                markerLocation.IsMarkerOverlappingAllowed = true;
                markerLocation.IsOverlappedHidden = false;
                markerLocation.MaxMovingDistance = 0;
                markerLocation.MinMovingDistance = 0;
                marker.SmartLabelStyle = markerLocation;
                chartErrors.Annotations.Add(marker);
                annotations[series].Add(marker);
            }
            if (markerType == Statistics.MarkerType.FalsePositive)
            {
                RectangleAnnotation marker = new RectangleAnnotation();
                marker.AnchorDataPoint = newPoint;
                marker.AnchorAlignment = ContentAlignment.MiddleCenter;
                marker.Width = 0.8;
                marker.Height = 1.6;
                marker.BackColor = markerColorFalseNegative;
                marker.LineColor = Color.Black;
                marker.LineWidth = 1;

                AnnotationSmartLabelStyle markerLocation = new AnnotationSmartLabelStyle();
                markerLocation.IsMarkerOverlappingAllowed = true;
                markerLocation.IsOverlappedHidden = false;
                markerLocation.MaxMovingDistance = 0;
                markerLocation.MinMovingDistance = 0;
                marker.SmartLabelStyle = markerLocation;
                chartErrors.Annotations.Add(marker);
                annotations[series].Add(marker);
            }
            if (markerType == Statistics.MarkerType.NotAvailable)
            {
                EllipseAnnotation marker = new EllipseAnnotation();
                marker.AnchorDataPoint = newPoint;
                marker.AnchorAlignment = ContentAlignment.MiddleCenter;
                marker.Width = 0.8;
                marker.Height = 1.6;
                marker.BackColor = markerColorNA;
                marker.LineColor = Color.Black;
                marker.LineWidth = 1;

                AnnotationSmartLabelStyle markerLocation = new AnnotationSmartLabelStyle();
                markerLocation.IsMarkerOverlappingAllowed = true;
                markerLocation.IsOverlappedHidden = false;
                markerLocation.MaxMovingDistance = 0;
                markerLocation.MinMovingDistance = 0;
                marker.SmartLabelStyle = markerLocation;
                chartErrors.Annotations.Add(marker);
                annotations[series].Add(marker);
            }
            Series insertionSeries = chartErrors.Series[seriesName];
            int insertion_index = 0;
            for (int index = 0; index < insertionSeries.Points.Count; index++)
            {
                if (insertionSeries.Points[index].XValue > x) break;
                else insertion_index++;
            }

            chartErrors.Series[seriesName].Points.Insert(insertion_index, newPoint);
        }
        private void addErrorPoint(SkeletonJoint series, int x, double y, Statistics.MarkerType markerType)
        {
            String    seriesName = JointDictionary.GetTranslation(series).name;
            DataPoint newPoint   = new DataPoint(x, y);

            if (markerType == Statistics.MarkerType.FalseNegative)
            {
                EllipseAnnotation marker = new EllipseAnnotation();
                marker.AnchorDataPoint = newPoint;
                marker.AnchorAlignment = ContentAlignment.MiddleCenter;
                marker.Width           = 0.8;
                marker.Height          = 1.6;
                marker.BackColor       = markerColorFalsePositive;
                marker.LineColor       = Color.Black;
                marker.LineWidth       = 1;

                AnnotationSmartLabelStyle markerLocation = new AnnotationSmartLabelStyle();
                markerLocation.IsMarkerOverlappingAllowed = true;
                markerLocation.IsOverlappedHidden         = false;
                markerLocation.MaxMovingDistance          = 0;
                markerLocation.MinMovingDistance          = 0;
                marker.SmartLabelStyle = markerLocation;
                chartErrors.Annotations.Add(marker);
                annotations[series].Add(marker);
            }
            if (markerType == Statistics.MarkerType.FalsePositive)
            {
                RectangleAnnotation marker = new RectangleAnnotation();
                marker.AnchorDataPoint = newPoint;
                marker.AnchorAlignment = ContentAlignment.MiddleCenter;
                marker.Width           = 0.8;
                marker.Height          = 1.6;
                marker.BackColor       = markerColorFalseNegative;
                marker.LineColor       = Color.Black;
                marker.LineWidth       = 1;

                AnnotationSmartLabelStyle markerLocation = new AnnotationSmartLabelStyle();
                markerLocation.IsMarkerOverlappingAllowed = true;
                markerLocation.IsOverlappedHidden         = false;
                markerLocation.MaxMovingDistance          = 0;
                markerLocation.MinMovingDistance          = 0;
                marker.SmartLabelStyle = markerLocation;
                chartErrors.Annotations.Add(marker);
                annotations[series].Add(marker);
            }
            if (markerType == Statistics.MarkerType.NotAvailable)
            {
                EllipseAnnotation marker = new EllipseAnnotation();
                marker.AnchorDataPoint = newPoint;
                marker.AnchorAlignment = ContentAlignment.MiddleCenter;
                marker.Width           = 0.8;
                marker.Height          = 1.6;
                marker.BackColor       = markerColorNA;
                marker.LineColor       = Color.Black;
                marker.LineWidth       = 1;

                AnnotationSmartLabelStyle markerLocation = new AnnotationSmartLabelStyle();
                markerLocation.IsMarkerOverlappingAllowed = true;
                markerLocation.IsOverlappedHidden         = false;
                markerLocation.MaxMovingDistance          = 0;
                markerLocation.MinMovingDistance          = 0;
                marker.SmartLabelStyle = markerLocation;
                chartErrors.Annotations.Add(marker);
                annotations[series].Add(marker);
            }
            Series insertionSeries = chartErrors.Series[seriesName];
            int    insertion_index = 0;

            for (int index = 0; index < insertionSeries.Points.Count; index++)
            {
                if (insertionSeries.Points[index].XValue > x)
                {
                    break;
                }
                else
                {
                    insertion_index++;
                }
            }

            chartErrors.Series[seriesName].Points.Insert(insertion_index, newPoint);
        }