cancel
Showing results for 
Search instead for 
Did you mean: 

How to Increase/Decrease Graph plotting speed in TouchGFX Dynamic Graph?

SMour.2
Associate III

Hi,

I'm using STM32F746 MCU on my custom Board. My application uses TouchGFX Dynamic Graph widget on a 480x272 capacitive touch display.

I want to know is it possible to change the Number of Data Points in runtime of the application?

If the above method is not possible then How can I Increase or Decrease the Graph Plotting speed in application Run Time? I want that user can change the graph plotting speed in the application.

For Eg. Suppose My ADC sampling rate is 500 Samples per second. I want to show 5 seconds or 10 seconds of ADC data on the display from start pixel to end pixel.

8 REPLIES 8
SMour.2
Associate III

Can Somebody Help me with this?

MM..1
Chief II

Try read Dynamic Graph | TouchGFX Documentation part Data points, and ...

SMour.2
Associate III

I read the Dynamic Graph | TouchGFX Documentation  , but couldn't find any way to change the number of data points during run time. There is not inbuilt function in touchgfx to change Datapoints during run time.

What is displayed is controlled with

xxgraph.setGraphRangeX(0,200);

but your 10s samples is 5000 samples and your display is 480 then ?

Capacity maybe can be changed as renew instance object , but isnt necesary, simply set capacity to max you need and switch only visible area...

For example capacity 1000 and view 200, add dummy 201-999 sample...

SMour.2
Associate III

Hi,MM..1,

Thanks for your reply, But this Does not help me with changing graph speed. It is only showing the the values till the graph range is set. For eg, I set the number of data points to 1000, and view 480 points, it takes further time to process values from 481-1000(though they are not visible Of course). So basically there is a pause (of processing points 481-1000) before the graph restarts from 0th pixel.

I guess I have to take multiple dynamic graphs with different number of data points, Then I will make the dynamic graph visible which I want to show and make others invisible.

I Show 5000 or 2500 or 1250 samples in 480 pixels or whatever pixels you have, traditionally by using drawline. You have to adjust the x-value between two points.

Also I want to ask If I use X-Axis Label in 480 pixels and make interval of 48 , I'm getting 10 labels as multiples of 48(49,96,144.....). But how to change to format like 00:00:01. i.e 48 should correspond to 00:00:01 then 96 to 00:00:02 ......... goes on.

MM..1
Chief II

Try my test code and maybe you understand how is speed defined and based on screen refresh ticks my graph have capacity 44

void Screen1View::setupScreen()
{
    Screen1ViewBase::setupScreen();
 
    dynamicGraph1.setGraphRangeX(0, 22);
}
 
void Screen1View::tearDownScreen()
{
    Screen1ViewBase::tearDownScreen();
}
 
void Screen1View::handleTickEvent()
{
    tickCounter++;
 
    if (tickCounter > 600)
    	return;               //stop
 
    
    if (tickCounter % 100 == 0)
    	dynamicGraph1.setGraphRangeX(0, 22);
    if (tickCounter % 200 == 0)
    	dynamicGraph1.setGraphRangeX(0, 50);
    {
      // Insert data point
      dynamicGraph1.addDataPoint(25*(tickCounter%4));
      dynamicGraph1.addDataPoint(4+25*(tickCounter%4));
      dynamicGraph1.addDataPoint(8+25*(tickCounter%4));
    }
}

SMour.2
Associate III

Hi MM1,

I couldn't try your solution as I figured one myself by using multiple dynamic graphs. I'm in a hurry with my application . But will try your idea soon.

Did you find any solution?