cancel
Showing results for 
Search instead for 
Did you mean: 

How to make X-axis of DynamicGraph widget for real time measurement

BParh.1
Senior III

Hi Folks,

I am developing a prototype for real time measurement of particular analog value. The intention is to show graph showing real time measurement, it take data every 0.1s but the X-axis would show label 0 - 9 s (fixed) This mean, every 1s contains 10 data points, total 100 points.

But when I tried Touchgfx designer DynamicGraph widget, it shows 2 problems:

  1. The X-axis label is by data point count, so in this case, it show 0 - 99 data point instead of 0 -9s.
  2. The X-axis label grows as data point increased while what I want is fixed.

What I want is like this; X-axis label is fixed 0 - 9s ( I draw manually the X-axis by hand, not generated by touchgfx)

0693W000008yphSQAQ.png 

But what Touchgfx gives me is this:

0693W000008ypgaQAA.pngAs we can see from above, X axis label show data point instead of time in seconds and the label grows instead of fixed.

Setting:

0693W000008yphcQAA.pngMy development board is:

STM32F769 Dicovery Kit.

Could someone give me some pointers/direction please?

1 ACCEPTED SOLUTION

Accepted Solutions
Michael K
Senior III

Problem 1: keeping the x-axis fixed. See my thread on how to reset the X-axis. Call this every 10 seconds / 100 points / whenever the graph rolls over.

Problem 2: mapping the x-axis values to something that isn't the datapoint index. You're looking for the x-axis scale. Change it to 0.1 - that way for each datapoint you add, the x-axis number it maps to increases by 0.1. Edit: increase the level of precision above 1 so that the graph can properly represent your data.

View solution in original post

7 REPLIES 7
Lagodolio
Senior

If I have correctly understood your problem, I think you have to modify your ScreenXXX.cpp and insert :

dynamicGraphXXX.setGraphRangeX(min+range, max+range);
 
range=range+9;

I never used this function, but I think it is the right one (.. I hope) 😉

Thank you @MM.22aino​ , however that does not really the intention here. Function setGraphRangeX() is to zoom out part f the graph, but here I still want to display the entire graph (100 points) but with x-axis label fixed 0-9s. So the Y major grid will be in step of 10 points, but instead of showing 0, 10, 20, ...90, I want it to show 0,1,2 ...9. Basically I want my graph to tell user that the X-axis showing data in the span of 10s

Michael K
Senior III

Problem 1: keeping the x-axis fixed. See my thread on how to reset the X-axis. Call this every 10 seconds / 100 points / whenever the graph rolls over.

Problem 2: mapping the x-axis values to something that isn't the datapoint index. You're looking for the x-axis scale. Change it to 0.1 - that way for each datapoint you add, the x-axis number it maps to increases by 0.1. Edit: increase the level of precision above 1 so that the graph can properly represent your data.

Thanks @Michael K​ ,

But for problem 2, I set the Scale to 0.1, it ends up X-label show all 0s.

0693W000008yyRYQAY.png 

Result:

0693W000008yyRsQAI.png

Two things to try. Select the graph widget in TouchGFX designer and:

  1. Increase the Level of Precision (under Data Points)
  2. Increase the number of Decimal Points (under X-Axis Labels -> Major Labels)

Edit: just tried it, to fix the zeros you only need to increase the level of precision. Then you can add as many or as few decimals as you want to the x-axis labels.

BParh.1
Senior III

Thank you so much @Michael K​ , it works great 🙂

You're welcome! Glad to help.