Refresh chart in mobile block

  

When I pull down on mobile screen, offline data sync is triggered. 

In the screen, I have a Block with a chart. The block is refreshed with succes and the data is up to date, but in some cases the chart is not redrawing and is showing no values. 

How can I force it to refresh? 

Is it possible with JavaScript?

Hello,

Did you try to add an input parameter on the block (like a datetime) and after sync you update the value to the current date time? Then OnParameterChange of the block you refresh the data of the chart?

EFreitas wrote:

Hello,

Did you try to add an input parameter on the block (like a datetime) and after sync you update the value to the current date time? Then OnParameterChange of the block you refresh the data of the chart?

Hi,

I refresh the block with success, but I think if data is not changing, the chart is not redrawing, even if I re-assign the list

Hi Ivan,

But why should the chart redraw if there's no change in the data at all?

Kilian Hekhuis wrote:

Hi Ivan,

But why should the chart redraw if there's no change in the data at all?

Hi Kilian,


I want to force the redrawing because in some cases the chart is showing no data even if the Local DB has data. 


Hi Ivan,

If the chart isn't showing data, while the dataset doesn't change, you likely have a bug in your program. Bugs should be solved, not circumvented with a forced refresh :).

Kilian Hekhuis wrote:

Hi Ivan,

If the chart isn't showing data, while the dataset doesn't change, you likely have a bug in your program. Bugs should be solved, not circumvented with a forced refresh :).

Hi Kilian,


Thanks for the response, I fixed the bugs.

However, If there is a possibility to refresh the chart it may be useful in future.


Hi Ivan,

There is no need or requirement to refresh the chart.

The Outsystems Mobile implementation uses React under the covers, so if the data used by a component gets updated, then the component (in this case the chart) will automatically be rendered again.  So if the data changes, the component will be refreshed.

Killian makes a good point, which is, if the chart's data doesn't change, we wouldn't expect the chart to be rerendered.  

Emanuel also made a good point, which is, if the chart is in a block which has it's own data, we may have updated data in local storage or on the screen level, but the aggregate or local variables in the block would need to be refreshed to detect that data change and cause it to render again.