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; }
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" }); }