protected override void InitExample() { using (Surface.SuspendUpdates()) { Surface.XAxes.Add(new SCINumericAxis { GrowBy = new SCIDoubleRange(0.1, 0.1), VisibleRange = new SCIDoubleRange(0.0, 10.0) }); Surface.YAxes.Add(new SCINumericAxis { GrowBy = new SCIDoubleRange(0.1, 0.1), VisibleRange = new SCIDoubleRange(0.0, 10.0) }); var horizontalLine1 = new SCIHorizontalLineAnnotation { X1Value = 5.0, Y1Value = 3.2, HorizontalAlignment = SCIHorizontalLineAnnotationAlignment.Right, Style = new SCILineAnnotationStyle { LinePen = new SCISolidPenStyle(UIColor.Orange, 2f) }, }; horizontalLine1.AddLabel(new SCILineAnnotationLabel { Text = "Right Aligned, with text on left", Style = { TextStyle = new SCITextFormattingStyle { Color = UIColor.Orange }, LabelPlacement = SCILabelPlacement.TopLeft, BackgroundColor = UIColor.Clear } }); var horizontalLine2 = new SCIHorizontalLineAnnotation { X1Value = 7.0, Y1Value = 2.8, HorizontalAlignment = SCIHorizontalLineAnnotationAlignment.Stretch, Style = new SCILineAnnotationStyle { LinePen = new SCISolidPenStyle(UIColor.Orange, 2f) } }; horizontalLine2.AddLabel(new SCILineAnnotationLabel { Style = { TextStyle = new SCITextFormattingStyle { Color = UIColor.Black }, LabelPlacement = SCILabelPlacement.Axis, BackgroundColor = UIColor.Orange } }); var verticalLine1 = new SCIVerticalLineAnnotation { X1Value = 9.0, Y1Value = 4.0, VerticalAlignment = SCIVerticalLineAnnotationAlignment.Bottom, Style = new SCILineAnnotationStyle { LinePen = new SCISolidPenStyle(ColorUtil.Brown.ToColor(), 2f) } }; verticalLine1.AddLabel(new SCILineAnnotationLabel { TextColor = UIColor.White, Style = { LabelPlacement = SCILabelPlacement.Axis, BackgroundColor = ColorUtil.Brown.ToColor() } }); var verticalLine2 = new SCIVerticalLineAnnotation { X1Value = 9.5, Y1Value = 3.0, VerticalAlignment = SCIVerticalLineAnnotationAlignment.Stretch, Style = new SCILineAnnotationStyle { LinePen = new SCISolidPenStyle(ColorUtil.Brown.ToColor(), 2f) } }; verticalLine2.AddLabel(new SCILineAnnotationLabel { TextColor = UIColor.White, Style = { LabelPlacement = SCILabelPlacement.Axis, BackgroundColor = ColorUtil.Brown.ToColor() } }); verticalLine2.AddLabel(new SCILineAnnotationLabel { Text = "Bottom-aligned", Style = { TextStyle = new SCITextFormattingStyle { Color = ColorUtil.Brown.ToColor() }, LabelPlacement = SCILabelPlacement.TopRight, BackgroundColor = UIColor.Clear } }); Surface.Annotations = new SCIAnnotationCollection { // Watermark new SCITextAnnotation { X1Value = 0.5, Y1Value = 0.5, Text = "Create \nWatermarks", Style = new SCITextAnnotationStyle { TextColor = 0x22FFFFFF.ToColor(), TextStyle = new SCITextFormattingStyle { FontSize = 42 } }, CoordinateMode = SCIAnnotationCoordinateMode.Relative, HorizontalAnchorPoint = SCIHorizontalAnchorPoint.Center, VerticalAnchorPoint = SCIVerticalAnchorPoint.Center }, // Text annotations new SCITextAnnotation { X1Value = 0.3, Y1Value = 9.7, Style = new SCITextAnnotationStyle { TextColor = UIColor.White, TextStyle = new SCITextFormattingStyle { FontSize = 24 }, }, Text = "Annotations are Easy!", }, new SCITextAnnotation { X1Value = 1.9, Y1Value = 9.0, Style = new SCITextAnnotationStyle { TextColor = UIColor.White, TextStyle = new SCITextFormattingStyle { FontSize = 10 }, }, Text = "You can create text", }, // Text with Anchor Points new SCITextAnnotation { X1Value = 5, Y1Value = 8, Style = new SCITextAnnotationStyle { TextColor = UIColor.White }, HorizontalAnchorPoint = SCIHorizontalAnchorPoint.Center, VerticalAnchorPoint = SCIVerticalAnchorPoint.Bottom, Text = "Anchor Center (X1, Y1)", }, new SCITextAnnotation { X1Value = 5, Y1Value = 8, Style = new SCITextAnnotationStyle { TextColor = UIColor.White }, HorizontalAnchorPoint = SCIHorizontalAnchorPoint.Right, VerticalAnchorPoint = SCIVerticalAnchorPoint.Top, Text = "Anchor Right", }, new SCITextAnnotation { X1Value = 5, Y1Value = 8, Style = new SCITextAnnotationStyle { TextColor = UIColor.White }, HorizontalAnchorPoint = SCIHorizontalAnchorPoint.Left, VerticalAnchorPoint = SCIVerticalAnchorPoint.Top, Text = "or Anchor Left", }, // Line and TODO LineArrow annotaiton new SCITextAnnotation { X1Value = 0.3, Y1Value = 6.1, Style = new SCITextAnnotationStyle { TextColor = UIColor.White }, VerticalAnchorPoint = SCIVerticalAnchorPoint.Bottom, Text = "Draw Lines with \nor without arrows", }, new SCILineAnnotation { X1Value = 1.0, Y1Value = 4.0, X2Value = 2.0, Y2Value = 6.0, Style = new SCILineAnnotationStyle { LinePen = new SCISolidPenStyle(0xFF555555, 2f) } }, new SCILineAnnotation { X1Value = 1.2, Y1Value = 3.8, X2Value = 2.5, Y2Value = 6.0, Style = new SCILineAnnotationStyle { LinePen = new SCISolidPenStyle(0xFF555555, 2f) } }, // Boxes new SCITextAnnotation { X1Value = 3.5, Y1Value = 6.1, Text = "Draw Boxes", Style = new SCITextAnnotationStyle { TextColor = UIColor.White }, VerticalAnchorPoint = SCIVerticalAnchorPoint.Bottom }, new SCIBoxAnnotation { X1Value = 3.5, Y1Value = 4.0, X2Value = 5.0, Y2Value = 5.0, Style = new SCIBoxAnnotationStyle { BorderPen = new SCISolidPenStyle(0xFF279B27, 1f), FillBrush = new SCILinearGradientBrushStyle(0x550000FF, 0x55FFFF00, SCILinearGradientDirection.Horizontal) } }, new SCIBoxAnnotation { X1Value = 4.0, Y1Value = 4.5, X2Value = 5.5, Y2Value = 5.5, Style = new SCIBoxAnnotationStyle { BorderPen = new SCISolidPenStyle(0xFFFF1919, 1f), FillBrush = new SCISolidBrushStyle(0x55FF1919) } }, new SCIBoxAnnotation { X1Value = 4.5, Y1Value = 5.0, X2Value = 6.0, Y2Value = 6.0, Style = new SCIBoxAnnotationStyle { BorderPen = new SCISolidPenStyle(0xFF279B27, 1f), FillBrush = new SCISolidBrushStyle(0x55279B27) } }, // Custom chapes new SCITextAnnotation { X1Value = 7.0, Y1Value = 6.1, Style = new SCITextAnnotationStyle { TextColor = UIColor.White }, VerticalAnchorPoint = SCIVerticalAnchorPoint.Bottom, Text = "Or Custom Shapes" }, new SCICustomAnnotation { CustomView = new UIImageView(UIImage.FromBundle("GreenArrow")), X1Value = 8, Y1Value = 5.5 }, new SCICustomAnnotation { CustomView = new UIImageView(UIImage.FromBundle("RedArrow")), X1Value = 7.5, Y1Value = 5 }, // Horizontal Lines horizontalLine1, horizontalLine2, // Vertical Lines verticalLine1, verticalLine2 }; Surface.ChartModifiers = new SCIChartModifierCollection { new SCIZoomPanModifier(), new SCIPinchZoomModifier(), new SCIZoomExtentsModifier() }; } }
protected override void InitExample() { var dataSeries = new OhlcDataSeries <DateTime, double>(); var marketDataService = new MarketDataService(new DateTime(2000, 08, 01, 12, 00, 00), 5, 5); var data = marketDataService.GetHistoricalData(200); dataSeries.Append(data.Select(x => x.DateTime), data.Select(x => x.Open), data.Select(x => x.High), data.Select(x => x.Low), data.Select(x => x.Close)); Surface.XAxes.Add(new SCICategoryDateTimeAxis()); Surface.YAxes.Add(new SCINumericAxis { VisibleRange = new SCIDoubleRange(30, 37) }); Surface.RenderableSeries.Add(new SCIFastCandlestickRenderableSeries { DataSeries = dataSeries }); Surface.ChartModifiers = new SCIChartModifierCollection { new SCIZoomPanModifier(), new SCIPinchZoomModifier(), new SCIZoomExtentsModifier() }; SCIThemeManager.ApplyDefaultTheme(Surface); var horizontalLine1 = new SCIHorizontalLineAnnotation { X1Value = 150, Y1Value = 32.2, HorizontalAlignment = SCIHorizontalLineAnnotationAlignment.Right, Style = new SCILineAnnotationStyle { LinePen = new SCISolidPenStyle(ColorUtil.Red, 2f) }, IsEditable = true }; horizontalLine1.AddLabel(new SCILineAnnotationLabel { Style = { TextStyle = new SCITextFormattingStyle { Color = UIColor.White }, LabelPlacement = SCILabelPlacement.Axis, BackgroundColor = ColorUtil.Red.ToColor() } }); var horizontalLine2 = new SCIHorizontalLineAnnotation { X1Value = 130, X2Value = 160, Y1Value = 33.9, HorizontalAlignment = SCIHorizontalLineAnnotationAlignment.Center, Style = new SCILineAnnotationStyle { LinePen = new SCISolidPenStyle(ColorUtil.Blue, 2f) }, IsEditable = true, }; horizontalLine2.AddLabel(new SCILineAnnotationLabel { Style = { TextStyle = new SCITextFormattingStyle { Color = UIColor.Blue }, LabelPlacement = SCILabelPlacement.Top, BackgroundColor = UIColor.Clear }, Text = "Top", }); horizontalLine2.AddLabel(new SCILineAnnotationLabel { Style = { TextStyle = new SCITextFormattingStyle { Color = UIColor.Blue }, LabelPlacement = SCILabelPlacement.Left, BackgroundColor = UIColor.Clear }, Text = "Left", }); horizontalLine2.AddLabel(new SCILineAnnotationLabel { Style = { TextStyle = new SCITextFormattingStyle { Color = UIColor.Blue }, LabelPlacement = SCILabelPlacement.Right, BackgroundColor = UIColor.Clear }, Text = "Right", }); var verticalLine1 = new SCIVerticalLineAnnotation { X1Value = 40, Y1Value = 34, VerticalAlignment = SCIVerticalLineAnnotationAlignment.Top, Style = new SCILineAnnotationStyle { LinePen = new SCISolidPenStyle(ColorUtil.Green, 2f) }, IsEditable = true, }; verticalLine1.AddLabel(new SCILineAnnotationLabel { Style = { TextStyle = new SCITextFormattingStyle { Color = UIColor.Green }, LabelPlacement = SCILabelPlacement.Top, BackgroundColor = UIColor.Clear }, }); Surface.Annotations = new SCIAnnotationCollection { new SCITextAnnotation { CoordinateMode = SCIAnnotationCoordinateMode.Relative, HorizontalAnchorPoint = SCIHorizontalAnchorPoint.Center, Text = "EUR.USD", X1Value = 0.5, Y1Value = 0.5, Style = new SCITextAnnotationStyle { TextColor = 0x77FFFFFF.ToColor(), TextStyle = new SCITextFormattingStyle { FontSize = 72 }, BackgroundColor = UIColor.Clear }, }, new SCITextAnnotation { CoordinateMode = SCIAnnotationCoordinateMode.Absolute, IsEditable = true, EditableText = false, Text = "Buy!", X1Value = 10d, Y1Value = 30.5d, VerticalAnchorPoint = SCIVerticalAnchorPoint.Bottom, HorizontalAnchorPoint = SCIHorizontalAnchorPoint.Left, Style = { TextStyle = { FontSize = 20 }, TextColor = ColorUtil.White.ToColor(), BackgroundColor = UIColor.Clear }, }, new SCITextAnnotation { CoordinateMode = SCIAnnotationCoordinateMode.Absolute, IsEditable = true, EditableText = false, Text = "Sell!", X1Value = 50d, Y1Value = 34d, Style = { TextStyle = { FontSize = 20 }, TextColor = ColorUtil.White.ToColor(), BackgroundColor = 0x33FF3333.ToColor() }, }, new SCIBoxAnnotation { IsEditable = true, Style = { FillBrush = new SCISolidBrushStyle(UIColor.FromRGBA(0xFF, 0x66, 0x00, 0x33)), BorderPen = new SCISolidPenStyle(UIColor.FromRGBA(0xFF, 0x66, 0x00, 0x77), 1.0f) }, X1Value = 50, Y1Value = 35.5, X2Value = 120, Y2Value = 32, }, new SCILineAnnotation { IsEditable = true, Style = { LinePen = new SCISolidPenStyle(0xAAFF6600, 2f) }, X1Value = 40, Y1Value = 30.5, X2Value = 60, Y2Value = 33.5, }, new SCILineAnnotation { IsEditable = true, Style = { LinePen = new SCISolidPenStyle(0xAAFF6600, 2f) }, X1Value = 120, Y1Value = 30.5, X2Value = 175, Y2Value = 36, }, // TODO LineArrow annotaiton new SCILineAnnotation { IsEditable = true, Style = { LinePen = new SCISolidPenStyle(0xAAFF6600, 2f) }, X1Value = 50, Y1Value = 35, X2Value = 80, Y2Value = 31.4, }, new SCIAxisMarkerAnnotation { CoordinateMode = SCIAnnotationCoordinateMode.Absolute, IsEditable = true, Position = 32.7, }, new SCIAxisMarkerAnnotation { Style = { AnnotationSurface = SCIAnnotationSurfaceEnum.XAxis }, FormattedValue = "Horizontal", IsEditable = true, Position = 100, }, horizontalLine1, horizontalLine2, new SCIVerticalLineAnnotation { X1Value = 20, Y1Value = 35, Y2Value = 33, VerticalAlignment = SCIVerticalLineAnnotationAlignment.Center, Style = new SCILineAnnotationStyle { LinePen = new SCISolidPenStyle(ColorUtil.DarkGreen, 2f) }, IsEditable = true, }, verticalLine1, new SCITextAnnotation { X1Value = 50, Y1Value = 37, IsEditable = true, EditableText = false, Text = "Rotated text", Style = { TextStyle = { FontSize = 20 }, TextColor = ColorUtil.White.ToColor(), BackgroundColor = UIColor.Clear }, //RotationAngle = 30 } }; }