private void PinSavedLocations(MKMapView map) { var MapItems = new List <SavedLocation>(); var documentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string pathToDatabase = Path.Combine(documentsFolder, "locations_db.db"); using (var connection = new SQLite.SQLiteConnection(pathToDatabase)) { var query = connection.Table <SavedLocation>(); foreach (SavedLocation mapItem in query) { MapItems.Add(mapItem); } } var userLocations = UserManager.GetUserLocations(); foreach (SavedLocation item in MapItems) { CLLocationCoordinate2D coord = new CLLocationCoordinate2D() { Longitude = item.Longitude, Latitude = item.Latitude }; var userCount = getUserCount(coord, userLocations); var customItem = new CustomAnnotation(item.Name, coord, userCount); map.AddAnnotation(customItem); } }
private void AddFractal(int currentIndex) { int size = 20; var qqq = Fractals.Calculate(candlesList, currentIndex); if (qqq.Item1) { CustomAnnotation annotation = null; if (qqq.Item2 == Fractals.Type.Top) { var uri = new Uri(AppDomain.CurrentDomain.BaseDirectory + "up.png", UriKind.RelativeOrAbsolute); BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = uri; bi.EndInit(); Image arrow = new Image() { Source = bi, Width = size, Height = size }; annotation = new CustomAnnotation() { X1 = currentIndex, Y1 = candlesList[currentIndex].High, Content = arrow, ContentTemplate = (DataTemplate)sciChart.Resources["AnnotationTemplate"], VerticalAnchorPoint = VerticalAnchorPoint.Bottom, HorizontalAnchorPoint = HorizontalAnchorPoint.Center }; } else if (qqq.Item2 == Fractals.Type.Bottom) { var uri = new Uri(AppDomain.CurrentDomain.BaseDirectory + "down.png", UriKind.RelativeOrAbsolute); BitmapImage bi = new BitmapImage(); bi.BeginInit(); bi.UriSource = uri; bi.EndInit(); Image arrow = new Image() { Source = bi, Width = size, Height = size }; annotation = new CustomAnnotation() { X1 = currentIndex, Y1 = candlesList[currentIndex].Low, Content = arrow, ContentTemplate = (DataTemplate)sciChart.Resources["AnnotationTemplate"], VerticalAnchorPoint = VerticalAnchorPoint.Top, HorizontalAnchorPoint = HorizontalAnchorPoint.Center }; } sciChart.Annotations.Add(annotation); } }
private void UpdatePins() { Control.RemoveAnnotations(Control.Annotations); IList <IMapModel> pins = Element.Items; foreach (IMapModel current in pins) { var pin = new CustomAnnotation(current); Control.AddAnnotation(pin); } }
protected override void InitExample() { View.FindViewById <Button>(Resource.Id.start).Click += (sender, args) => Start(); View.FindViewById <Button>(Resource.Id.pause).Click += (sender, args) => Pause(); View.FindViewById <Button>(Resource.Id.reset).Click += (sender, args) => Reset(); var xAxis = new NumericAxis(Activity) { AutoRange = AutoRange.Always }; var yAxis = new NumericAxis(Activity) { AutoRange = AutoRange.Always }; var rs1 = new FastLineRenderableSeries { DataSeries = _mainSeries, StrokeStyle = new SolidPenStyle(0xFF4083B7, 2f.ToDip(Activity)) }; var rs2 = new FastLineRenderableSeries { DataSeries = _maLowSeries, StrokeStyle = new SolidPenStyle(0xFFFFA500, 2f.ToDip(Activity)) }; var rs3 = new FastLineRenderableSeries { DataSeries = _maHighSeries, StrokeStyle = new SolidPenStyle(0xFFE13219, 2f.ToDip(Activity)) }; _textView = new TextView(Activity); _textView.SetPadding(20, 20, 20, 20); var annotation = new CustomAnnotation(Activity) { CoordinateMode = AnnotationCoordinateMode.Relative, ZIndex = -1, X1Value = 0, Y1Value = 0, }; annotation.SetContentView(_textView); using (Surface.SuspendUpdates()) { Surface.XAxes.Add(xAxis); Surface.YAxes.Add(yAxis); Surface.RenderableSeries.Add(rs1); Surface.RenderableSeries.Add(rs2); Surface.RenderableSeries.Add(rs3); Surface.Annotations.Add(annotation); } Start(); }
private void AddNameFormation(FormationInfo formation, TrackToShow trackToShow) { var annotationText = formation.FormationName.Length > 20 ? formation.FormationName.Substring(0, 20) : formation.FormationName; var textAnnotation = new CustomAnnotation { Content = annotationText, X1 = 0, X2 = 1, Y1 = double.Parse(formation.Depth.ToString()), Y2 = double.Parse(formation.Depth.ToString()), FontFamily = new FontFamily("Arial"), FontSize = 12, Height = 30, HorizontalAlignment = HorizontalAlignment.Right, HorizontalContentAlignment = HorizontalAlignment.Right, Padding = new Thickness(0, -20, 25, 0), CoordinateMode = AnnotationCoordinateMode.RelativeX, Tag = "Formation" }; textAnnotation.XAxisId = "Formation"; Binding binding = new Binding("Width") { Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = trackToShow.TrackObject }; textAnnotation.SetBinding(CustomAnnotation.WidthProperty, binding); AddFTNameBinding(textAnnotation); trackToShow.Annotations.Add(textAnnotation); }
private void AddFTNameBinding(CustomAnnotation customAnnotation) { var binding = new MultiBinding(); binding.Converter = new FTVisibilityConverter(); binding.Bindings.Add(new Binding("IsFTNameVisible") { Source = IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.GeologyMenu, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); binding.Bindings.Add(new Binding("IsFormationVisible") { Source = IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.GeologyMenu, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); customAnnotation.SetBinding(CustomAnnotation.IsHiddenProperty, binding); }
protected override void InitExample() { using (Surface.SuspendUpdates()) { Surface.XAxes.Add(new NumericAxis(Activity) { VisibleRange = new DoubleRange(0, 10), GrowBy = new DoubleRange(0.1, 0.1), TextFormatting = "0.0#" }); Surface.YAxes.Add(new NumericAxis(Activity) { VisibleRange = new DoubleRange(0, 10), GrowBy = new DoubleRange(0.1, 0.1), TextFormatting = "0.0#" }); var customAnnotation1 = new CustomAnnotation(Activity) { X1Value = 8d, Y1Value = 5.5, }; customAnnotation1.SetContentId(Resource.Layout.Example_Custom_Annotation_View); var customAnnotation2 = new CustomAnnotation(Activity) { X1Value = 7.5, Y1Value = 5d, }; customAnnotation2.SetContentView(new CustomView2(Activity)); Surface.Annotations = new AnnotationCollection() { // Watermark new TextAnnotation(Activity) { X1Value = 0.5, Y1Value = 0.5, FontStyle = new FontStyle(Activity, Typeface.DefaultBold, 42, 0x22FFFFFF.ToColor()), Text = "Create \nWatermarks", CoordinateMode = AnnotationCoordinateMode.Relative, HorizontalAnchorPoint = HorizontalAnchorPoint.Center, VerticalAnchorPoint = VerticalAnchorPoint.Center }, // Text annotations new TextAnnotation(Activity) { X1Value = 0.3, Y1Value = 9.7, FontStyle = new FontStyle(Activity, 24, Color.White), Text = "Annotations are Easy!" }, new TextAnnotation(Activity) { X1Value = 1.9, Y1Value = 9.0, FontStyle = new FontStyle(Activity, 10, Color.White), Text = "You can create text" }, // Text with Anchor Points new TextAnnotation(Activity) { X1Value = 5d, Y1Value = 8d, HorizontalAnchorPoint = HorizontalAnchorPoint.Center, VerticalAnchorPoint = VerticalAnchorPoint.Bottom, Text = "Anchor Center (X1, Y1)" }, new TextAnnotation(Activity) { X1Value = 5d, Y1Value = 8d, HorizontalAnchorPoint = HorizontalAnchorPoint.Right, VerticalAnchorPoint = VerticalAnchorPoint.Top, Text = "Anchor Right" }, new TextAnnotation(Activity) { X1Value = 5d, Y1Value = 8d, HorizontalAnchorPoint = HorizontalAnchorPoint.Left, VerticalAnchorPoint = VerticalAnchorPoint.Top, Text = "or Anchor Left" }, // Line and LineArrow annotation new TextAnnotation(Activity) { X1Value = 0.3, Y1Value = 6.1, FontStyle = new FontStyle(Activity, 12, Color.White), VerticalAnchorPoint = VerticalAnchorPoint.Bottom, Text = "Draw Lines with \nor without arrows" }, new LineAnnotation(Activity) { X1Value = 1d, Y1Value = 4d, X2Value = 2d, Y2Value = 6d, Stroke = new SolidPenStyle(Activity, Color.Argb(0xFF, 0x55, 0x55, 0x55), thickness: 2) }, new LineArrowAnnotation(Activity) { X1Value = 1.2, Y1Value = 3.8, X2Value = 2.5, Y2Value = 6d, Stroke = new SolidPenStyle(Activity, Color.Argb(0xFF, 0x55, 0x55, 0x55), thickness: 2) }, // Boxes new TextAnnotation(Activity) { X1Value = 3.5, Y1Value = 6.1, Text = "Draw Boxes", VerticalAnchorPoint = VerticalAnchorPoint.Bottom }, new BoxAnnotation(Activity) { X1Value = 3.5, Y1Value = 4d, X2Value = 5d, Y2Value = 5d, Background = Activity.GetDrawableCompat(Resource.Drawable.example_box_annotation_background_1) }, new BoxAnnotation(Activity) { X1Value = 4d, Y1Value = 4.5, X2Value = 5.5, Y2Value = 5.5, Background = Activity.GetDrawableCompat(Resource.Drawable.example_box_annotation_background_2) }, new BoxAnnotation(Activity) { X1Value = 4.5, Y1Value = 5d, X2Value = 6d, Y2Value = 6d, Background = Activity.GetDrawableCompat(Resource.Drawable.example_box_annotation_background_3) }, // Custom Shapes new TextAnnotation(Activity) { X1Value = 7d, Y1Value = 6.1, FontStyle = new FontStyle(Activity, 12, Color.White), VerticalAnchorPoint = VerticalAnchorPoint.Bottom, Text = "Or Custom Shapes" }, customAnnotation1, customAnnotation2, // Horizontal Lines new HorizontalLineAnnotation(Activity) { X1Value = 5d, Y1Value = 3.2, HorizontalGravity = GravityFlags.Right, Stroke = new SolidPenStyle(Activity, Color.Orange, thickness: 2), AnnotationLabels = new AnnotationLabelCollection { new AnnotationLabel(Activity) { LabelPlacement = LabelPlacement.TopLeft, Text = "Right Aligned, with text on left" } } }, new HorizontalLineAnnotation(Activity) { X1Value = 7d, Y1Value = 2.8, Stroke = new SolidPenStyle(Activity, Color.Orange, thickness: 2), AnnotationLabels = new AnnotationLabelCollection { new AnnotationLabel(Activity) { LabelPlacement = LabelPlacement.Axis } } }, // Vertical Lines new VerticalLineAnnotation(Activity) { X1Value = 9d, Y1Value = 4d, VerticalGravity = GravityFlags.Bottom, Stroke = new SolidPenStyle(Activity, Color.Brown, thickness: 2), AnnotationLabels = new AnnotationLabelCollection { new AnnotationLabel(Activity) } }, new VerticalLineAnnotation(Activity) { X1Value = 9.5d, Y1Value = 3d, Stroke = new SolidPenStyle(Activity, Color.Brown, thickness: 2), AnnotationLabels = new AnnotationLabelCollection { new AnnotationLabel(Activity), new AnnotationLabel(Activity) { LabelPlacement = LabelPlacement.TopRight, Text = "Bottom-aligned", RotationAngle = 90 } } } }; Surface.ChartModifiers = new ChartModifierCollection { new ZoomPanModifier(), new PinchZoomModifier(), new ZoomExtentsModifier(), }; } }