I have a graph in unity, I want to drag it just up-down and left-right to see upcoming coordinates. 

I wrote this code to drag the graph object but it drags it all around without a limit. I just want it to go just up-down and left-right.

```
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DragGraph : MonoBehaviour {

    float OffsetX;
    float OffsetY;

    public void BeginDrag(){
        OffsetX = transform.position.x - Input.mousePosition.x;
        OffsetY = transform.position.y - Input.mousePosition.y;
    }

    public void OnDrag(){

        transform.position = new Vector3 (OffsetX + Input.mousePosition.x, OffsetY + Input.mousePosition.y);

    }

}

```