I wrote a class "Waterfallplot" that uses QwtPlotSpectrogram to show a "Waterfall", this last has an history (the number of horizontal layers in it, 64 layers => y range : 0 - 64 excluded) and each history corresponds to a number of points (let's call this last layerPoints).

I also wrote a subclass of "QwtMatrixRasterData" named "WaterfallData" to store spectrogram's data (fixed 2D buffer - size = waterfall history) and that is shifted to the left by "layerPoints when data (1-D) is appended.

In "WaterfallData", I also keep track of the insert times of layers (data) so I can show them in the Y axis.

The problem is, unlike the "cpluplot" example, the Y axis labels doesn't seem "to fall" over time. I think it's nice to have this fall over time effect but I failed to achieve it. Instead, I have something similar to this video https://youtu.be/Ma_fNlouBGk?t=310 whereas, I'm wondering if it's possible to have something like this one : https://youtu.be/ZHvraLfV5kU?t=30

Below, the QwtScaleDraw subclass to generate Y labels strings with some comments :
Qt Code:
  1. class WaterfallTimeScaleDraw: public QwtScaleDraw
  2. {
  3. const Waterfallplot& m_waterfallPlot;
  4. mutable QDateTime m_dateTime;
  6. public:
  7. WaterfallTimeScaleDraw(const Waterfallplot& waterfall) :
  8. m_waterfallPlot(waterfall)
  9. {
  10. }
  12. // When I add data, I need to invalidate y axis cache, so I need to make invalidateCache public !
  13. // and use : static_cast<WaterfallTimeScaleDraw*>(m_plot->axisScaleDraw(QwtPlot::yLeft))->invalidateCache();
  14. using QwtScaleDraw::invalidateCache;
  16. // I noticed that for a waterfall having 64 layers (history), v is called with 0, 10, 20, 30, 40, 50 and 60
  17. // Thus, it's clear that we can't have a "fall" effect with such values
  18. virtual QwtText label(double v) const
  19. {
  20. time_t ret = m_waterfallPlot.getLayerDate(v);
  21. if (ret > 0)
  22. {
  23. m_dateTime.setTime_t(ret);
  24. //return m_dateTime.toString("hh:mm:ss:zzz"); // change time_t => zzz
  25. return m_dateTime.toString("hh:mm:ss");
  26. }
  27. return QwtText(); // this is only executed when the waterfall is not completely filled
  28. }
  29. };
To copy to clipboard, switch view to plain text mode 

If someone is interested in such project (Waterfall view based on Qwt), let me know so I will share my current source code with you on github.