Created a function to calculate the last displayed value of a graph.