How to refresh chart

0
Hi, i'm new on Mendix i try to refresh a chart that display real time data ( 3 axes of an acceleromter). It works when I close the page and reopen it with a Microflow -> Refresh microflow : Chart parameters : data source for my chart :  microflow i use for the dataview : The problem I'm having is that when the page reloads, I get a white flashing that's not at all pleasant to look at and causes display overlap.Is there a solution to refresh the data in my line chart in real time without having to refresh the entire page? Thank you in advance, have a nice day!  
asked
5 answers
5

Hello Julien,

Did you tried refresh interval if that will help, also if required to refresh after some action you can try to refresh Daata view object where line chart is puuted.

 

image.png

answered
1

Eline Bijkerk

Answered 1 day ago

If your chart is in a data view, refreshing the object of the data view in a microflow should be sufficient to do a "refresh in page" of that object. If not, let us know and we can come up with some other solutions!

 

Hi, thank you for your answer! I tried to place a refresh object in the microflow of my data view but it doesn't change anything, the data displayed on the line chart is not refreshed.

image.png

 

RAJU PATEL

Answered 1 day ago

Hello Julien,

Did you tried refresh interval if that will help, also if required to refresh after some action you can try to refresh Daata view object where line chart is puuted.

 

Hi, thank you for your answer but I don't have this feature in the settings tab of my line chart, I'm using version 10.23.0 maybe this option is somewhere else?

image.png

 

If anyone else has any ideas on how to refresh the data without having to do a full refresh, I'd love to hear it!

Thank you!

answered
0

If your chart is in a data view, refreshing the object of the data view in a microflow should be sufficient to do a "refresh in page" of that object. If not, let us know and we can come up with some other solutions!

answered
0

Hi , Did you able to solve this problem ? If yes please share the solution here once , I am also trying to do the same thing

answered
0

Hi Julien,

You do not need to close and reopen the page to refresh the chart. Since your Line Chart is already using Microflow data sources, you can refresh the chart without reloading the entire page.

I recommend using a periodic refresh approach.

Solution: Use a Microflow Timer to refresh the chart

1. Keep the existing chart configuration

You can retain your three series (X, Y, and Z axes) and their respective Microflow data sources.

2. Create a refresh microflow

Create a microflow, for example ACT_RefreshSensorChart, which accepts the Data View context object (LatestSample) as a parameter.

Inside this microflow:

  • Retrieve the latest sensor data from the database.

  • Ensure the latest sensor records have been committed.

  • Add a Refresh in Client action for the Data View context object (LatestSample).

3. Add a Microflow Timer

Use the Microflow Timer widget to execute ACT_RefreshSensorChart at a suitable interval, for example every 1 second if your sensor data is updated every second.

Configure the timer to pass the current Data View object as its parameter.

4. Verify the chart data source

Ensure that each chart series uses a Microflow that retrieves the latest committed sensor records. The chart should refresh its data when its containing Data View is refreshed.

Expected flow

Sensor sends new data
        |
        v
Save / Commit SensorData
        |
        v
Microflow Timer (1 second)
        |
        v
ACT_RefreshSensorChart
        |
        v
Refresh LatestSample in Client
        |
        v
Chart retrieves latest X, Y, Z values

This avoids closing and reopening the page, so the entire page does not need to reload for each sensor update.

Important: If your Charts widget version provides a built-in refresh-time setting, you can use that instead of the timer. The available settings depend on the Charts widget version.

References:

Hope this helps! If you find this answer helpful, please mark it as the accepted answer.

answered