If you have a series of points (x,y). Is there a mathematical measurement that represents how consistent the slope of the line is.
Like, a straight line with a constant slope would be the highest rating possible using this measurement.
But, a line like the picture attached would be worse, because it flattens out during part of the plot.
In statistics, one often uses the Pearson correlation coefficient $r$. $r = 1$ for a linear function with positive slope, and $r = -1$ for a linear function with negative slope. This has the disadvantage of not being defined when the slope is $0$, but if not then $r^2$ is a good measure of "how consistent" the slope is.
Another possibility is, given points $(x_0, y_0), (x_1, y_1), (x_2, y_2), \ldots, (x_n, y_n)$, to simply take the standard deviation of the $n$ slopes. That is, let $$ m_i = \frac{y_{i+1} - y_i}{x_{i+1} - x_i} $$ and find the standard deviation of $m_0, m_1, m_2, \ldots, m_{n-1}$.
Finally, maybe you want to consider longer intervals to be more significant than shorter intervals. In this case, you could find the weighted standard deviation of $m_0, m_1, m_2, \ldots, m_{n-1}$ with weights $w_i = (x_{i+1} - x_i)$.