cancel
Showing results for 
Search instead for 
Did you mean: 

How to make Fixed X-Label axis

BParh.1
Senior III

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Michael K
Senior III

Perhaps my forum post on this topic from a few months ago will help you.

Embedded UI/UX Consulting: cadenza.design

View solution in original post

9 REPLIES 9
Alexandre RENOUX
Principal

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

BParh.1
Senior III

thank you @Alexandre RENOUX​ , looking forward for it :smiling_face_with_smiling_eyes: .

@BParh.1​  This is a good question, I'm looking for the solution too.

Alexandre RENOUX
Principal

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

BParh.1
Senior III

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"

Hello BParh.1,

This is exactly what I explained before : "commented the content of invalidateXAxisPointAt(int16_t index) and invalidateAllXAxisPoints()"

/Alexandre

BParh.1
Senior III

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).

Michael K
Senior III

Perhaps my forum post on this topic from a few months ago will help you.

Embedded UI/UX Consulting: cadenza.design
BParh.1
Senior III

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