cancel
Showing results for 
Search instead for 
Did you mean: 

Any sample code for Zoom in Zoom Out feature in X Axis for TouchGFX Designer?

BParh.1
Senior III

So if we use TouchGFX Designer, it provides a sample template project code for zoom in and zoom out feature for dynamic graph in Y axis. However it does not seem to have sample fox X-axis.

I tried to experiment this by using setGraphRangeX() but it does not achieve what I want. In here, the X-axis range will be changed accordingly, but the graph still sweep the entire data points.

E.g. originally I setup a dynamic graph with data point 100 and x axis 0 - 99. Then I call setGraphRangeX(0, 50) with intention now to display half of the graph range. The X axis does show only to 50 but the graph still sweeping 100 data points instead of 50 point and back again.

This result the after graph sweep 50 points, then the graph animation will be idle a while as it is sweeping rest of 50 points and only then back again to x = 0 to restart (in wrap and overwrite setting)

So as a start , is there any sample code to do zoom out zoom in in X axis?

5 REPLIES 5
Alexandre RENOUX
Principal

Hello BParh.1,

Thank you for your feedback.

From what I know, we don't have any sample code. The reason why is that you cannot have this behavior with the current widget because the number of points is set at the initialization and this number of point is not currently modifiable. You can change the widget or create a child class to add this feature.

I will notify the dev team and see if they can update it in the future. (Might be complicated for this summer I believe but will keep you updated)

Sorry for the inconvenience.

/Alexandre

Thank you @Alexandre RENOUX​  for the response, unfortunately the project already kicked in so I could not afford to wait.

This means I need to do work around, I wonder if you could give me some pointer.

What I am thinking is capability to instruct the graphics engine at any time to render the data point back from index 0. Could you point me to the right class or variable to modify please? And anyway, what do you mean by adding child class to the feature?

Hello BParh.1,

You can look at GraphWrapAndClear.cpp and AbstractDataGraph.cpp.

In AbstractDataGraph.cpp, there's an attribute called maxCapacity. This is the variable to modify if you want to perform what you want. So you need to create a setter. Modifying the class means that you need to copy the files to your gui/ folder for it to be taken into account. this also means that you will not be able to use the designer for your custom graph widget.

Creating a child class is a common way in object oriented programming to add features without changing the existing files. The child will inherit all the characteristics and functionalities of its parent and can modify them and add some. But in your case just copy-pasting to the gui/ folder and renaming them as MyAbstractDataGraph.cpp and MyGraphWrapAndClear.cpp should do the trick.

/Alexandre

BParh.1
Senior III

Thank you @Alexandre RENOUX​ , I think I understand what you meant.

How can I ensure to get notified for future release that would include this X axis zooming feature?

Hi BParh.1,

There's no way to get notified of a certain bug fix but what you can do is check regularly if a new version of TouchGFX is available on st.com (or see if a new version of the documentation website came out), download and install it. Then you go to C:\TouchGFX\<new version>\ and open the changelog.txt file. All the fixes are mentioned in this file.

I can also tell you that a big new release will be available normally next month but I don't know if they will change the widget for this release.

/Alexandre