2021-03-22 10:36 PM
I need to make application of pressure measurement across time by using dynamic graph feature. The X axis is time from 0 - 10 s. But as times go by beyond 10s, I want the X axis label remain as 0...10s instead of incremented for every data point added i.e. addDataPoint(float newData)
How to do this?
Solved! Go to Solution.
2021-04-01 10:52 AM
Perhaps my forum post on this topic from a few months ago will help you.
2021-03-23 05:55 PM
Hello BParh.1,
Unfortunately you cannot because it's a Dynamic Graph not a Static graph. Meaning that if the number of points goes above the number that can be shown at once on the screen, the x axis will be incremented.
One way is to modify the Graph widget and prevent it from updating the x axis when the graph is cleared. I'll come back to you when I discover how.
/Alexandre
2021-03-23 06:44 PM
thank you @Alexandre RENOUX , looking forward for it :smiling_face_with_smiling_eyes: .
2021-03-23 10:38 PM
@BParh.1 This is a good question, I'm looking for the solution too.
2021-03-24 06:46 PM
Hello BParh.1,
You will find enclosed a project that does not update the X axis.
Since we need to modify the graph widget, it's mandatory to create your own widget (I put the files in the /common folder). Consequently, you cannot visualize the graph in the Designer anymore.
I had to copy/paste the files AbstractDataGraph.cpp/hpp and GraphWrapAndClear.cpp/hpp rename them to MyAbstractDataGraph and MyGraphWrapAndClear.
And I simply commented the content of invalidateXAxisPointAt(int16_t index) and invalidateAllXAxisPoints().
For simplicity in the initialization of the custom graph, I created a graph in Designer and set it to Visible(false).
When your question is answered, please close this topic by choosing Select as Best.
/Alexandre
2021-03-30 01:23 AM
Thank you @Alexandre RENOUX , could you point me where in the code this happens:
"One way is to modify the Graph widget and prevent it from updating the x axis when the graph is cleared"
2021-03-30 07:32 PM
Hello BParh.1,
This is exactly what I explained before : "commented the content of invalidateXAxisPointAt(int16_t index) and invalidateAllXAxisPoints()"
/Alexandre
2021-03-30 10:11 PM
Thank you @Alexandre RENOUX , I take a look the implementation, but I would probably explore more with hope a simpler approach exist instead of making a custom behavior change to the platform code (i.e. The code changes remain in user code section).
Basically what I want to achieve is create dynamic graph for real time analog measurement for every 0.1s where the X axis showing normalized value 0 - 10s (i.e for every 1s interval there are actually 10 data points).
2021-04-01 10:52 AM
Perhaps my forum post on this topic from a few months ago will help you.
2021-04-05 11:46 PM
thank you @Michael K , could you share the code snippet please? I would like to understand how you manage to reset the X-label counter