private void SetupAnnotations()
        {
            annotationLayer = new AnnotationLayer(flexChart1);
            var greenRect = new C1.Win.Chart.Annotation.Rectangle("", 10580, 1285)
            {
                Location   = new PointF((float)dataList[20].Date.ToOADate(), 100),
                Attachment = AnnotationAttachment.DataCoordinate,
                Position   = AnnotationPosition.Right,
            };

            greenRect.ContentStyle.StrokeColor = Color.Black;
            greenRect.ContentStyle.Font        = new System.Drawing.Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
            greenRect.Style.FillColor          = Color.FromArgb(25, Color.Green);
            greenRect.Style.StrokeColor        = Color.Transparent;
            greenRect.Style.StrokeWidth        = 1;
            annotationLayer.Annotations.Add(greenRect);

            foreach (var data in dataList)
            {
                if (data.Volume >= 9)
                {
                    var dSquare = new C1.Win.Chart.Annotation.Square("D", 20)
                    {
                        SeriesIndex = 1,
                        PointIndex  = dataList.IndexOf(data),
                        Attachment  = AnnotationAttachment.DataIndex,
                        TooltipText = "Dividend"
                    };
                    dSquare.ContentStyle.StrokeColor = Color.White;
                    dSquare.ContentStyle.Font        = new System.Drawing.Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
                    dSquare.Style.FillColor          = Color.FromArgb(150, Color.Blue);
                    dSquare.Style.StrokeColor        = Color.Transparent;
                    dSquare.Style.StrokeWidth        = 1;
                    annotationLayer.Annotations.Add(dSquare);
                }
                if (data.Date.Day % 10 == 0)
                {
                    var eSquare = new C1.Win.Chart.Annotation.Square("E", 20)
                    {
                        SeriesIndex = 0,
                        PointIndex  = dataList.IndexOf(data),
                        Attachment  = AnnotationAttachment.DataIndex,
                        TooltipText = "Close"
                    };
                    eSquare.ContentStyle.StrokeColor = Color.Black;
                    eSquare.ContentStyle.Font        = new System.Drawing.Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
                    eSquare.Style.FillColor          = Color.FromArgb(150, Color.Aqua);
                    eSquare.Style.StrokeColor        = Color.Black;
                    eSquare.Style.StrokeWidth        = 1;
                    annotationLayer.Annotations.Add(eSquare);
                }
            }

            var lineRising = new C1.Win.Chart.Annotation.Line("Rising wedge")
            {
                Start      = new Point((int)dataList[10].Date.ToOADate(), 20),
                End        = new Point((int)dataList[40].Date.ToOADate(), 100),
                Attachment = AnnotationAttachment.DataCoordinate,
            };

            lineRising.ContentStyle.StrokeColor = Color.Black;
            lineRising.ContentStyle.Font        = new System.Drawing.Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
            lineRising.Style.StrokeColor        = Color.Aqua;
            lineRising.Style.StrokeWidth        = 1;
            annotationLayer.Annotations.Add(lineRising);
            var lineEmpty = new C1.Win.Chart.Annotation.Line("")
            {
                Start      = new Point((int)dataList[20].Date.ToOADate(), 0),
                End        = new Point((int)dataList[50].Date.ToOADate(), 80),
                Attachment = AnnotationAttachment.DataCoordinate,
            };

            lineEmpty.ContentStyle.StrokeColor = Color.Black;
            lineEmpty.ContentStyle.Font        = new System.Drawing.Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
            lineEmpty.Style.StrokeColor        = Color.Aqua;
            lineEmpty.Style.StrokeWidth        = 1;
            annotationLayer.Annotations.Add(lineEmpty);

            annotationLayer.Annotations.Add(new C1.Win.Chart.Annotation.Image(AnnotationExplorer.Properties.Resources.flag)
            {
                SeriesIndex = 0,
                PointIndex  = 20,
                Attachment  = AnnotationAttachment.DataIndex,
                Position    = AnnotationPosition.Top
            });
            var txtFB = new C1.Win.Chart.Annotation.Text("Facebook inc to acquire LifeRail.")
            {
                SeriesIndex = 0,
                PointIndex  = 20,
                Attachment  = AnnotationAttachment.DataIndex,
                Position    = AnnotationPosition.Left,
            };

            txtFB.Style.StrokeColor = Color.Black;
            txtFB.Style.Font        = new Font(FontFamily.GenericSansSerif, 12);
            annotationLayer.Annotations.Add(txtFB);

            annotationLayer.Annotations.Add(new C1.Win.Chart.Annotation.Image(AnnotationExplorer.Properties.Resources.flag)
            {
                SeriesIndex = 0,
                PointIndex  = 70,
                Attachment  = AnnotationAttachment.DataIndex,
                Position    = AnnotationPosition.Top,
            });
            var txtAli = new C1.Win.Chart.Annotation.Text("Alibaba Group Holding Ltd")
            {
                SeriesIndex = 0,
                PointIndex  = 70,
                Attachment  = AnnotationAttachment.DataIndex,
                Position    = AnnotationPosition.Left,
            };

            txtAli.Style.StrokeColor = Color.Black;
            txtAli.Style.Font        = new Font(FontFamily.GenericSansSerif, 12);
            annotationLayer.Annotations.Add(txtAli);

            annotationLayer.Annotations.Add(new C1.Win.Chart.Annotation.Image(AnnotationExplorer.Properties.Resources.arrowDOWN)
            {
                SeriesIndex = 0,
                PointIndex  = 30,
                Attachment  = AnnotationAttachment.DataIndex,
                TooltipText = "Bid: $73.59"
            });
            annotationLayer.Annotations.Add(new C1.Win.Chart.Annotation.Image(AnnotationExplorer.Properties.Resources.arrowUP)
            {
                SeriesIndex = 0,
                PointIndex  = 50,
                Attachment  = AnnotationAttachment.DataIndex,
                TooltipText = "Bid: $73.59"
            });

            infoAnnotation = new C1.Win.Chart.Annotation.Rectangle("", 120, 100)
            {
                Location   = new PointF(130, 60),
                Attachment = AnnotationAttachment.Absolute,
            };
            infoAnnotation.ContentStyle.StrokeColor = Color.Brown;
            infoAnnotation.ContentStyle.Font        = new System.Drawing.Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
            infoAnnotation.Style.FillColor          = Color.FromArgb(200, Color.SandyBrown);
            infoAnnotation.Style.StrokeColor        = Color.Chocolate;
            infoAnnotation.Style.StrokeWidth        = 1;
        }
Exemplo n.º 2
0
        private void SetupAnnotations()
        {
            _annotationLayer = new C1.Win.Chart.Annotation.AnnotationLayer(this.flexChart1);
            var orderedByAmount = _data.OrderBy(x => x.Amount).ToList();
            var orderedByReturn = _data.OrderBy(x => x.Return).ToList();

            //line annotation
            _line = new C1.Win.Chart.Annotation.Line("Range Of Investment Amount")
            {
                Attachment  = AnnotationAttachment.DataCoordinate,
                Start       = new PointF(orderedByAmount[0].Age, (float)orderedByAmount[0].Amount),
                End         = new PointF(orderedByAmount[_data.Count - 1].Age, (float)orderedByAmount[_data.Count - 1].Amount),
                TooltipText = "This is Line Annotation\nAttachment : DataCoordinate",
            };
            _line.TooltipText              = string.Concat(_line.TooltipText, string.Format("\nStart=({0}, {1:0}), End=({2}, {3:0})", _line.Start.X, _line.Start.Y * 100, _line.End.X, _line.End.Y * 100));
            _line.Style.StrokeColor        = Color.SandyBrown;
            _line.Style.StrokeWidth        = 3;
            _line.ContentStyle.Font        = new Font("Segoe UI", 10, FontStyle.Bold);
            _line.ContentStyle.StrokeColor = Color.SandyBrown;
            //Circle annotation
            _circle = new C1.Win.Chart.Annotation.Circle()
            {
                Attachment  = AnnotationAttachment.DataIndex,
                SeriesIndex = 0,
                PointIndex  = _data.IndexOf(orderedByAmount[0]),
                Content     = "Min Amount -\n" + orderedByAmount[0].Amount.ToString("c0"),
                Radius      = 40,
                TooltipText = "This is Circle Annotation\nAttachment : DataIndex\nRadius : 40",
            };
            _circle.TooltipText              = string.Concat(_circle.TooltipText, "\nSeries Index= 0, Point Index= " + _circle.PointIndex);
            _circle.Style.FillColor          = Color.FromArgb(200, Color.OrangeRed);
            _circle.Style.StrokeColor        = Color.Red;
            _circle.ContentStyle.StrokeColor = Color.White;
            //Ellipse annotation
            _ellipse = new C1.Win.Chart.Annotation.Ellipse()
            {
                Attachment  = AnnotationAttachment.DataIndex,
                SeriesIndex = 0,
                PointIndex  = _data.IndexOf(orderedByAmount[_data.Count - 1]),
                Content     = "Max Amount -\n" + orderedByAmount[_data.Count - 1].Amount.ToString("c0"),
                Width       = 100, Height = 50,
                TooltipText = "This is Ellipse Annotation\nAttachment : DataIndex\n Height : 50, Width=100",
            };
            _ellipse.TooltipText              = string.Concat(_ellipse.TooltipText, "\nSeries Index= 0, Point Index= " + _ellipse.PointIndex);
            _ellipse.Style.FillColor          = Color.FromArgb(200, Color.Green);
            _ellipse.Style.StrokeColor        = Color.Green;
            _ellipse.ContentStyle.StrokeColor = Color.White;
            //Rectangle annotations
            for (int i = 1; i < _data.Count - 1; i += 5)
            {
                if (_data[i].Amount != orderedByAmount[0].Amount && _data[i].Amount != orderedByAmount[_data.Count - 1].Amount)
                {
                    var _rect = new C1.Win.Chart.Annotation.Rectangle(_data[i].Amount.ToString("c0"), 70, 21)
                    {
                        Attachment  = AnnotationAttachment.DataIndex,
                        SeriesIndex = 0,
                        PointIndex  = i,
                        TooltipText = "This is Rectangle Annotation\nAttachment : DataIndex\nWidth=70, Height=21",
                    };
                    _rect.TooltipText       = string.Concat(_rect.TooltipText, "\nSeries Index= 0, Point Index= " + _rect.PointIndex);
                    _rect.Style.FillColor   = Color.FromArgb(200, Color.LightBlue);
                    _rect.Style.StrokeColor = Color.LightBlue;
                    _annotationLayer.Annotations.Add(_rect);
                }
            }
            //Polygon annotation
            _poly = new C1.Win.Chart.Annotation.Polygon("Chart Shows Investment \nAmount,Invested By Various\nInvestors For Different Periods.")
            {
                Attachment = AnnotationAttachment.Absolute,
                Points     =
                {
                    new PointF(140,  30),
                    new PointF(220,  20),
                    new PointF(300,  30),
                    new PointF(300, 100),
                    new PointF(140, 100),
                },
                ContentCenter = new PointF(220, 60),
                TooltipText   = "This is Polygon Annotation\nAttachment : Absolute\nPoints : [(140,30),(220,20),(300,30),(300,100),(140,100)]",
            };
            _poly.Style.FillColor          = Color.FromArgb(60, Color.CornflowerBlue);
            _poly.Style.StrokeColor        = Color.DodgerBlue;
            _poly.ContentStyle.StrokeColor = Color.DodgerBlue;
            _poly.ContentStyle.Font        = new Font("Segoe UI", 8);
            //Image Annotation
            _img = new C1.Win.Chart.Annotation.Image()
            {
                Attachment  = AnnotationAttachment.Relative,
                SourceImage = Properties.Resources.C1,
                Width       = 80,
                Height      = 80,
                Location    = new PointF(1, 0.11f),
                TooltipText = "This is Image Annotation\nAttachment : Relative\nLocation : {x:0.96, y:0.1}\nWidth=100, Height=100",
            };
            //Text Annotation
            _text = new C1.Win.Chart.Annotation.Text("Equity Investment Analysis")
            {
                Attachment  = AnnotationAttachment.Relative,
                Location    = new PointF(0.5f, 0.05f),
                TooltipText = "This is Text Annotation\nAttachment : Relative\nLocation : {x:0.45, y:0.1}",
            };
            _text.Style.Font        = StyleInfo.ChartHeaderFont;
            _text.Style.StrokeColor = Color.Black;

            //Add Annotations to Annotation-layer
            _annotationLayer.Annotations.Add(_line);
            _annotationLayer.Annotations.Add(_circle);
            _annotationLayer.Annotations.Add(_ellipse);
            _annotationLayer.Annotations.Add(_poly);
            _annotationLayer.Annotations.Add(_img);
            _annotationLayer.Annotations.Add(_text);
        }
Exemplo n.º 3
0
        private void SetupAnnotations()
        {
            annotationLayer = new AnnotationLayer(flexChart1);

            var txtRelative = new C1.Win.Chart.Annotation.Text("Relative")
            {
                Location    = new PointF(0.55f, 0.15f),
                Attachment  = AnnotationAttachment.Relative,
                TooltipText = "This is a content annotation\r\nLocation: { x:0.55, y:0.15 }\r\nAttachment: Relative"
            };

            txtRelative.Style.StrokeColor = Color.Black;
            txtRelative.Style.Font        = new System.Drawing.Font(FontFamily.GenericSansSerif, 15);
            annotationLayer.Annotations.Add(txtRelative);

            var ellipseRelative = new Ellipse("Relative", 120, 80)
            {
                Location    = new PointF(0.4f, 0.45f),
                Attachment  = AnnotationAttachment.Relative,
                TooltipText = "This is a ellipse annotation\r\nLocation: { x:0.4, y:0.45 }\r\nAttachment: Relative"
            };

            ellipseRelative.ContentStyle.StrokeColor = Color.Black;
            ellipseRelative.ContentStyle.Font        = new System.Drawing.Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
            ellipseRelative.Style.FillColor          = Color.FromArgb(200, Color.Goldenrod);
            ellipseRelative.Style.StrokeColor        = Color.DarkGoldenrod;
            ellipseRelative.Style.StrokeWidth        = 2;
            annotationLayer.Annotations.Add(ellipseRelative);

            var circle = new Circle("DataIndex", 50)
            {
                SeriesIndex = 0,
                PointIndex  = 27,
                Attachment  = AnnotationAttachment.DataIndex,
                TooltipText = "This is a circle annotation\r\nRadius: 50\r\nPointIndex: 27\r\nAttachment: DataIndex"
            };

            circle.ContentStyle.StrokeColor = Color.Black;
            circle.ContentStyle.Font        = new System.Drawing.Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
            circle.Style.FillColor          = Color.FromArgb(200, Color.LightSeaGreen);
            circle.Style.StrokeColor        = Color.DarkCyan;
            circle.Style.StrokeWidth        = 2;
            annotationLayer.Annotations.Add(circle);

            var rectangle = new C1.Win.Chart.Annotation.Rectangle("DataCoordinate", 130, 100)
            {
                Location    = new PointF(37, 30),
                Attachment  = AnnotationAttachment.DataCoordinate,
                TooltipText = "This is a rectangle annotation\r\nLocation: { x:37, y:30 }\r\nAttachment: DataCoordinate"
            };

            rectangle.ContentStyle.StrokeColor = Color.Black;
            rectangle.ContentStyle.Font        = new System.Drawing.Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
            rectangle.Style.FillColor          = Color.FromArgb(200, Color.SlateBlue);
            rectangle.Style.StrokeColor        = Color.DarkSlateBlue;
            rectangle.Style.StrokeWidth        = 2;
            annotationLayer.Annotations.Add(rectangle);

            var square = new C1.Win.Chart.Annotation.Square("DataIndex", 80)
            {
                SeriesIndex = 0,
                PointIndex  = 45,
                Attachment  = AnnotationAttachment.DataIndex,
                TooltipText = "This is a square annotation\r\nLength: 80\r\nPointIndex: 45\r\nAttachment: DataIndex"
            };

            square.ContentStyle.StrokeColor = Color.Black;
            square.ContentStyle.Font        = new System.Drawing.Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
            square.Style.FillColor          = Color.FromArgb(200, Color.SandyBrown);
            square.Style.StrokeColor        = Color.Chocolate;
            square.Style.StrokeWidth        = 2;

            annotationLayer.Annotations.Add(square);

            var polygon = new C1.Win.Chart.Annotation.Polygon("Absolute")
            {
                Attachment = AnnotationAttachment.Absolute,
                Points     =
                {
                    new PointF(200,  25),
                    new PointF(150,  70),
                    new PointF(175, 115),
                    new PointF(225, 115),
                    new PointF(250, 70)
                },
                TooltipText = "This is a points annotation\r\nPoints: [(200, 25),(150, 70),(175, 115),(225, 115),(250, 70)]\r\nAttachment: Absolute"
            };

            polygon.ContentStyle.StrokeColor = Color.Black;
            polygon.ContentStyle.Font        = new System.Drawing.Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
            polygon.Style.FillColor          = Color.FromArgb(200, Color.Red);
            polygon.Style.StrokeColor        = Color.DarkTurquoise;
            polygon.Style.StrokeWidth        = 3;
            annotationLayer.Annotations.Add(polygon);

            var line = new C1.Win.Chart.Annotation.Line("Absolute", new Point(50, 200), new Point(300, 350))
            {
                Attachment  = AnnotationAttachment.Absolute,
                TooltipText = "This is a line annotation\r\nPoints: [(50, 200),(300, 350)]\r\nAttachment: Absolute"
            };

            line.ContentStyle.StrokeColor = Color.Black;
            line.ContentStyle.Font        = new System.Drawing.Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold);
            line.Style.StrokeWidth        = 4;
            line.Style.StrokeColor        = Color.DarkTurquoise;
            annotationLayer.Annotations.Add(line);

            annotationLayer.Annotations.Add(new C1.Win.Chart.Annotation.Image()
            {
                SourceImage = AnnotationExplorer.Properties.Resources.Image,
                Location    = new PointF(22, 30),
                Attachment  = AnnotationAttachment.DataCoordinate,
                TooltipText = "This is a image annotation\r\nLocation: { x:22, y:30 }\r\nAttachment: DataCoordinate"
            });
        }