To calculate the gradient of a straight line we choose two points on the line itself. The difference in height (y co-ordinates) รท The difference in width (x co-ordinates). If the answer is a positive value then the line is uphill in direction. If the answer is a negative value then the line is downhill in direction.