Skip to main content
Senior
January 3, 2025
Solved

Dynamic Graph Changing Gridlines

  • January 3, 2025
  • 1 reply
  • 785 views

I am having trouble finding how to change the interval of the major gridlines dynamically. I am using the scrolling graph and have implemented dynamic Y-axis range, but I want to be able to change the intervals of the gridlines as well. Is this possible using touchGFX tools or do I need to make a custom widget?

Best answer by EthanMankins

Thank you. 
I discovered that the labels and grids are not manipulated through the graph object, but look like they are their own separate objects.

I was originally trying to find something like graph.setYinterval();


My solution was to use graphMajorYAxisGrid.setInterval();

Eventually added graphMajorYAxisLabel.setInterval(); To make labels match

 

1 reply

Graduate II
January 7, 2025

Hello Ethan

Have you simply try to use setInterval- function for to grid you need to manipulate dynamically ?

https://support.touchgfx.com/docs/development/ui-development/ui-components/miscellaneous/dynamic-graph

If you look your generated xxxxBase.cpp code, you will see how interval is set initially (and also other dynamic graph parameters, like setGraphRangeY which is also closely involved to your issue).

Hope this help

Br JTP

 

ps. this might also intrest you

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/how-to-edit-dynamic-graph-in-touchgfx-to-print-time-in-x-axis/m-p/637258

EthanMankinsAuthorBest answer
Senior
January 7, 2025

Thank you. 
I discovered that the labels and grids are not manipulated through the graph object, but look like they are their own separate objects.

I was originally trying to find something like graph.setYinterval();


My solution was to use graphMajorYAxisGrid.setInterval();

Eventually added graphMajorYAxisLabel.setInterval(); To make labels match