Refresh data in a component reloadData()


#1

Within an UiViewUsageAndEvents component I want to put the below function at the end of the initialize() to refresh the data every x seconds.
How can I access the component itself to call the reloadData then? I have this.relaodData() is not a function error.

setInterval(function() {
  this.reloadData();
}, 30000)

#2

I did remix the initialize() function adding this

setInterval(function() {
_.each(self.get(‘series’), function(series) {

   var now= DateTime.now();
   var before = DateTime.now().plusHours(-6);

    series.dataSource.c3arguments.spec.start =   before.toString();
    series.dataSource.c3arguments.spec.end =    now.toString();

});
self.loadSeries();
}, 30000)