Exemplo n.º 1
0
        private void OnPlotPinch(UIPinchGestureRecognizer recognizer)
        {
            var location = recognizer.LocationInView(Plot);

            if (recognizer.State == UIGestureRecognizerState.Began)
            {
                anchorPoint = location;
            }

            if (recognizer.State == UIGestureRecognizerState.Ended)
            {
                Plot.ZoomTo(recognizer.Scale, anchorPoint);
                PrimaryYAxis.ZoomTo(recognizer.Scale, anchorPoint.Y);
                PrimaryXAxis.ZoomTo(recognizer.Scale, anchorPoint.X);
                Grid.ZoomTo(recognizer.Scale, anchorPoint);

                anchorPoint = CGPoint.Empty;
            }
            else
            {
                Plot.ZoomBy(recognizer.Scale, anchorPoint);
                PrimaryYAxis.ZoomBy(recognizer.Scale, anchorPoint.Y);
                PrimaryXAxis.ZoomBy(recognizer.Scale, anchorPoint.X);
                Grid.ZoomBy(recognizer.Scale, anchorPoint);
            }
        }
Exemplo n.º 2
0
        private void OnPlotPan(UIPanGestureRecognizer recognizer)
        {
            var translation = recognizer.TranslationInView(Plot);

            if (recognizer.State == UIGestureRecognizerState.Ended)
            {
                Plot.PanTo(translation);
                PrimaryYAxis.PanTo(translation.Y);
                PrimaryXAxis.PanTo(translation.X);
                Grid.PanTo(translation);
            }
            else
            {
                Plot.PanBy(translation);
                PrimaryYAxis.PanBy(translation.Y);
                PrimaryXAxis.PanBy(translation.X);
                Grid.PanBy(translation);
            }
        }