public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); if (_timer == null) { _timer = NSTimer.CreateRepeatingScheduledTimer(0.01, (timer) => { _i++; _lineDataSeries.Append(_i, Math.Sin(_i * 0.1 + _phase)); _scatterDataSeries.Append(_i, Math.Cos(_i * 0.1 + _phase)); _phase += 0.01; if (_i % 100 == 0) { var customAnnotation = new SCICustomAnnotation(); customAnnotation.CustomView = new UILabel(new CoreGraphics.CGRect(0, 0, 10, 10)) { Text = "Y", BackgroundColor = UIColor.LightGray }; customAnnotation.X1Value = _i; customAnnotation.Y1Value = 0.5; customAnnotation.CoordinateMode = SCIAnnotationCoordinateMode.RelativeY; // adding new custom annotation into the annotationGroup property _annotationCollection.Add(customAnnotation); // removing annotations that are out of visible range var customAn = _annotationCollection[0] as SCICustomAnnotation; if (customAn != null) { if (customAn.X1Value.CompareTo(_i - 500) == 0) { // since the contentView is UIView element - we have to call removeFromSuperView method to remove it from screen customAn.CustomView.RemoveFromSuperview(); _annotationCollection.Remove(customAn); } } } _surface.ZoomExtents(); }); } }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); if (_timer == null) { _timer = NSTimer.CreateRepeatingScheduledTimer(0.01, (timer) => { _i++; _lineDataSeries.Append(_i, Math.Sin(_i * 0.1 + _phase)); _scatterDataSeries.Append(_i, Math.Cos(_i * 0.1 + _phase)); _phase += 0.01; _surface.ZoomExtents(); }); } }