Refreshing Mobile Charts

Refreshing Mobile Charts

  

I am struggling to get my Mobile Charts to refresh. In my screen with the graph, the user can push a button to select a date range (week, month, year etc) for the graph. When a button is clicked, I refresh my aggregate based on the new range and once the new data are fetched, I run a client action to create new datapoints. The linegraph using these datapoints never refreshes though. How do I make it redraw? I thought this was automatically done in Mobile?

Thanks!

Just to clarify: I am not developing a web app, but a mobile app

Hi Denis,

It is automatically done in a mobile app. Could you share a sample oml where that issue happens?

Cheers,

José

Hi José,

Thanks for responding!

By now, I understand the issue. The chart indeed is refreshed automatically; however, the rendering of the chart immediately starts, before the dataaction that recalculates the datapoints is completed (IMHO it should wait until the 'on render'). This causes an error and the chart does not get refreshed.

My solution is to have the chart in a block and in the block, I put the chart within the true branch of an "if" widget that checks for GetDataPoints.IsDataFetched.

Maybe this Outsystems documentation should warn for this issue.....it took me days to figure it out.

Hi Denis,

It's good you find the answer because most of them confuse in mobile app how to refresh the page but it will done automatically. You can play with on_render, on_init/on_load part. If you find any more difficulties in mobile app then let us know we can help you.


Regards,

Rajat Agrawal

It was good to get pointed in the right direction for this, thanks.  I used a slightly different approach:

  1. Created screen variable MyDataPointsList.
  2. Based the chart on MyDataPointsList.
  3. Set the aggregate's "On After Fetch" event to call a client action that appends the aggregate's data using DataPoints to the MyDataPointsList variable.

Just to add a solution for anyone finding this thread, since you have no control over when the app framework refreshes the data, never update a list that's directly bound to a screen element (whether it's a chart, a table, a list etc.) - your app's user may see intermedaite results, which may not be desirable.

The solution I use is to create a seperate list, then assign the list bound to the screen element that list, so the framework can update it.

Kilian Hekhuis wrote:

Just to add a solution for anyone finding this thread, since you have no control over when the app framework refreshes the data, never update a list that's directly bound to a screen element (whether it's a chart, a table, a list etc.) - your app's user may see intermedaite results, which may not be desirable.

The solution I use is to create a seperate list, then assign the list bound to the screen element that list, so the framework can update it.

Good advice Kilian, thanks.  I'd like to see an example module of this approach.  When I was looking for an example to follow, I could not find any best practice module.  Unfortunately the Silk 2.0 example project uses mock data created in an action to populate the chart, so that provides nothing on which to base a module that actually pulls data from a server or local storage.