public void DrawChart()
        {
            if (_data == null || _data.Length <= 0)
            {
                return;
            }
            CanvasDevice device = CanvasDevice.GetSharedDevice();

            //rendering options are calculating min & max values & value texts
            RenderingOptions renderingOptions = CreateRenderingOptions(_data);

            //_offscreenBackGround is created in here
            DrawBackGround(device, renderingOptions);
            //_offscreenChartImage is created in here
            DrawCharData(device, renderingOptions, _data);

            //forces re-draw
            ChartWin2DCanvas.Invalidate();
        }
        private void MoveZoom(double changeX, double changeY)
        {
            if (_currentDirection == MoveDirection.Done ||
                _currentDirection == MoveDirection.Determining ||
                _offscreenChartImage == null)
            {
                //Nothing will change on drawing
                return;
            }

            if (_currentDirection == MoveDirection.Horizontal)
            {
                if (changeX == 0)
                {
                    //Nothing will change on drawing
                    return;
                }
                //we simply move the start point according to finger movement
                _graphDrawingPoint.X += changeX;

                //and make sure that we don't go over the actual beginning point
                if (_graphDrawingPoint.X < 0)
                {
                    _graphDrawingPoint.X = 0;
                }
            }
            else if (_currentDirection == MoveDirection.Vertical)
            {
                if (changeY == 0)
                {
                    //Nothing will change on drawing
                    return;
                }

                // use different divider to adjust the zoomefect
                _zoomFactor += (int)(changeY / 2);

                //and lets keep the zoom level in defined range
                if (_zoomFactor < _minZoomFactor)
                {
                    _zoomFactor = _minZoomFactor;
                }
                else if (_zoomFactor > 100)
                {
                    _zoomFactor = 100;
                }

                //zoom efect simply changes the width part of the size what we draw
                _graphDrawingSource = new Size(((_offscreenChartImage.Size.Width * _zoomFactor) / 100), _offscreenChartImage.Size.Height);
            }

            double maxChange = _offscreenChartImage.Size.Width - _graphDrawingSource.Width;

            //the max value changes on zoom, and move value in move
            //so we need to check the max value for movement after each action
            if (_graphDrawingPoint.X > maxChange)
            {
                _graphDrawingPoint.X = maxChange;
            }

            //invalidate forces re-draw
            ChartWin2DCanvas.Invalidate();
        }