Use Refresh Data API
By leveraging the refresh data API in analytic applications or optimized stories, you can let viewers trigger data refresh either at widget, data source, application or story level.
Refresh All or Specific Data Sources of an Application or Story
You can use the following API to refresh all data sources of an application or story, which updates all the widgets associated with each data source:
Application.refreshData(dataSources?: DataSource[]): void
Currently, R visualization isn't supported.
The script is fully executed without waiting for all the associated widgets to be updated.
Refresh a Specific Data Source
You can use the following API, which triggers the data refresh of a specific data source and updates the widgets associated with it at the same time. The supported widgets are chart, table and geo map.
DataSource.refreshData(): void
Refresh Data of a Specific Widget
You can use the following API to refresh the data of a specific widget:
Widget.getDataSource().refreshData();
Example
Application.refreshData();
var ds1 = Chart_1.getDataSource(); var ds2 = Table_1.getDataSource(); Application.refreshData([ds1, ds2]);
In this example, you'd like to refresh data of Chart_1 and Chart_2 every one minute at runtime. You can use refresh data API together with timer API for the onTimeout event of Timer_1:
Chart_1.getDataSource().refreshData(); Chart_2.getDataSource().refreshData(); Timer_1.start(60);
For more information about how to set up and use a timer, see Set up Timers.