Search code examples
dynamicgraphcore-plotreloaddata

How to Refresh Whole Graph of Core Plot


I try to update Core Plot graph with [self.hostView.hostGraph reloadData], but it did not work properly because after some research, I found (tell me if I am mistaken) that this method update only the charts, not the range or other things.

So, people that configure the graph dynamically based on retrieved data (for example, for plot range, orthogonalCoordinateDecimal, exclusionRange etc.), will have a lot of troubles when the new values change a lot from the previous ones (for example, when we set up the graph in viewDidLoad, and process data in viewDidAppear).

My question is : is there a way to update the whole graph dynamically?

Thanks


Solution

  • You are correct, -reloadData only updates the plot data. You can call -scaleToFitPlots: afterwards to adjust the plot ranges to fit the new plot data.

    Consider using axisConstraints instead of the orthogonalCoordinateDecimal to position the axes. That way the axes stay in position as the plot ranges change.