Skip to main content
BParh.1
Senior III
June 4, 2021
Question

How to plot y value given index in Dynamic Graph Widget?

  • June 4, 2021
  • 3 replies
  • 864 views

It seems in Dynamic Graph widget, the only way to plot data is by:

addDataPoint(float y)

which automatically just add a data point to the next index from previous plot. But this might not suitable for real time monitoring.

In real time monitoring, we want to position the data according to timeline of x axis. So if for some reason say we miss acquiring data for two beats, then the next plot should not be on next index, instead it should be on next index + 2. Is there anyway we can do this? i.e. plotting the data given index so like:

addDataPoint(int index)

This topic has been closed for replies.

3 replies

ktrofimo
Senior III
June 4, 2021

You may:

1) add same value twice

or

2) take source code of the graph class, extend it with required functionality and use as a custom widget

BParh.1
BParh.1Author
Senior III
June 7, 2021

Thank you @ktrofimo​ , I am interested approach 2. Could you tell me what is the graph class name to extend and what class member associated with the index plotting?

ktrofimo
Senior III
June 7, 2021

DynamicGraph class itself is not​ published in sources, but it consists of many elements. For scrolling graphs data is stored in GraphScroll class with private yValues[CAPACITY] member. You might try to inherit your own class based on GraphScroll class, but he problem is that yValues[] array is declared as private and I see no methods for accessing this data. Probably it has to be completely your own custom widget.