My core plot graph in my iPhone app is drawing nicely. However, one thing I can’t seem to figure out. How can I get the graph to scroll to the end of its x axis after the view loads, rather than starting at the origin? I would like the last data point upon the x axis to be visible when the graph appears. How?
I saw the plotSpace:willDisplaceBy: delegate method, which is “close” to what I need, but I need to be able to tell the graph to displace itself to the end of its x axis when its view loads. I haven’t found any relevant example code for core plot to do this.
You need to set the
xRangeof the plot space so that the last point is visible. If you know the ending value and the length of the range you want to be visible, you can do something like this:The example assumes that the desired length is positive and your values are doubles. You can of course do the calculations using NSDecimal values if needed.