‎2021-03-21 09:24 PM
I've adopted the Dynamic Graph widget on my application but when I change the screen from Graph screen to another screen, the data point of the Dynamic Graph widget will free all the data points due to the MVP of TouchGFX will release all resource on the presenter and view objects when changing the screen to another screen.
Now, I store the Graph data points in the Model, and when the screen has transited to the Graph screen, I will copy all data points in the Model to Dynamic Graph widget by using addDataPoint() function but the execution time when copying data from Model to the Dynamic Graph widget has consumed too high (I want to avoid this).
In practically, how can I make the data points statically or making a pointer to point to static data points when changing the screen?
Solved! Go to Solution.
‎2021-03-22 10:52 PM
Hi Soda,
Unfortunately passing an array of data to the Dynamic Graph is not possible. The reason is because it's a dynamic graph and not a static graph.
I think a static graph would match better what you are trying to do.
This widget is currently being made but I don't know the actual roadmap of it. I'll keep you updated when I get more information.
/Alexandre
‎2021-03-22 06:55 AM
Hi Soda,
when you change the screen, the previous screen is destroyed and the memory freed is reused for the new screen.
All data on the old screen are lost. this is to save memory space.
What you need to do is save the graph data in a static buffer in your application or in the model and then use the app->model->presenter->view system to repopulate the graph when the screen presenter gets activated.
Have a look at the Model-View-Presenter pattern, and there are several online tutorials on how to use it.
‎2021-03-22 09:11 PM
Many thanks Franck23, for the suggestion. Actually, I store the graph data in the Model, but I need to avoid the copying process when the Dynamic Graph widget. Is there possible to avoid this by passing the graph data through to the Dynamic Graph object in the View by pointer instead of using addDataPoint() function?
‎2021-03-22 10:52 PM
Hi Soda,
Unfortunately passing an array of data to the Dynamic Graph is not possible. The reason is because it's a dynamic graph and not a static graph.
I think a static graph would match better what you are trying to do.
This widget is currently being made but I don't know the actual roadmap of it. I'll keep you updated when I get more information.
/Alexandre
‎2021-03-23 02:26 AM
Many thanks Alexandre. Actually, the dynamic graph is a new widget and needs more time for developing some of the features in the future, and I'm glad to hear you will keep me updated!😊
‎2022-02-21 03:53 PM
Hello @Soda​ ,
​
I know it's been a while and I'm sorry for this, but I didn't forget you ^^
A new static Graph will finally be released with the next version of TouchGFX 4.19 that should be out around next month :D
Let's see then if it matches your needs
Best regards,
Alexandre
‎2022-02-21 07:15 PM
Good news to hear from you!😊 For sure, I will try in the TouchGFX next version 4.19.
Thank you.