reloadData method not working


#1

Hi everyone, I’ve been using the Shinobicontrols API to create graphs for an app i’m currently developing. I’m really happy with it so far. I have a little problem trying to reload the data for one graph. This is my escenario :

I create a graph and everything works as expected then i have a button that resets the graph’s data source and the i call the “reloadData” method but the only thing that changes on the graph is the xAxis, the yAxis doesn’t change even though when I NSLog the datasource datapoint i see that it has different values (the new values i want to plot). This behaviour results in an empty graph.

This is the method i call to reload the graph

  • (void)reloadDataWithHelper:(LineGraphHelper *)helper{
    [self setHelper:helper];
           
        dataSource.helper = _helper;
        lineChart.datasource = dataSource;
       
        [lineChart reloadData];
        [lineChart redrawChartAndGL:NO];
       
        NSLog(@“Reloaded Data”);
    }

Any help would be appreciated,

Thanks


#2

Hi Oscar.save,

It looks to me like you are updating the datasource of your chart and then preventing the chart from being redrawn by setting [lineChart redrawChartAndGL:NO];. Is there a specific reason you need to prevent the graphic layer from redrawing itself?

My recommendation would be to replace this line:

[lineChart redrawChartAndGL:NO];

with this line:

[lineChart redrawChart];

Kind regards,

Daniel Allsop