This question pertains to programing but is really a math question.
I am building an application that draws a line graph, similar to a stock line graph. The problem is I am not starting with a known set of numbers. The values will come in based on an altitude value. So, when I start the graph I have no idea what the max and min values of my data set will be, because they max might not come along for some time.
Like I mentioned, these values will be added to the graph when I receive and elevation value but I don't know these until they are received from my device (iPhone).
Is there a formula used to calculate a line graph for unknown values? How can I know what x and y values to use for each new value received? And how can I calculate the min and max of the graph?