Results 1 to 10 of 10

Thread: is it possible to make spectrogram's Y axis labels "fall" over time (waterfall case)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2019
    Location
    France, Pau
    Posts
    60
    Thanks
    32
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: is it possible to make spectrogram's Y axis labels "fall" over time (waterfall ca

    What you propose allows, may be, to reduce rendering time : instead of computing colors for all spectrogram's data's points, we compute the colors only for the first/new (top) line of the waterfall and we append it to the current QImage shifted to the bottom by 1. It's just an optimization ! Apparently, you didn't see what I have already done : https://github.com/embeddedmz/QwtWaterfallplot I already achieved the waterfall effect, not optimized but it doesn't matter for now (and it has the advantage to apply a new color map to all the lines).

    But, it doesn't answer my question : how to have the Y axis labels falls down like cpuplot example (waterfall effect also on Y axis labels with the right terms).

    In the cpuplot example :
    setAxisScale( QwtPlot::xBottom, timeData[HISTORY - 1], timeData[0] );
    setAxisScale bounds are shifted by 1 when the timer fires its event (e.g. 1-60, 2-61, 3-62, 4-63, etc...) that allows to have the axis falling down effect.

    data[c].curve->setRawSamples(timeData, data[c].data, dataCount );
    and curve's data X axis bounds matches those fed to setAxisScale.

    In spectrogram/waterfall case, in order to achieve something similar, I think I will have to call setInterval(Qt::YAxis...) on the spectrogram's data and take in account the new bounds in the overriden double value(double x, double y) const : it's really a messy code.

    And in my use case, the waterfall timestamps aren't monotonic like the cpuplot example, I will have to compute the min/max of timestamps before setting Qt::YAxis bounds.
    Moreover, when the waterfall isn't completely filled, the unfilled part (mapped to the lowest representable double value - unfilled parts of spectrogram's data) must not be labelled by the Y axis.
    It's not easy. It would be nice to have a complete waterfall widget in Qwt (curve/histogram + waterfall and with time labels falling).

    If the Y axis labels (time) are not following the waterfall they are pretty useless IMO.
    UPDATE:
    When all the waterfall lines(of 64 layers or [0 - 63] for Y axis bounds) aren't filled, is it possible to render only the filled ones (from 63 -> 53 for example) but keep the Y axis bounds (from 64 - 0) and leave the unfilled layers blank (52 - 0) ? but even I do this, I will not have a waterfall effect in the Y axis, it's too hard. I give up !
    Last edited by embeddedmz; 11th August 2019 at 21:18.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: is it possible to make spectrogram's Y axis labels "fall" over time (waterfall ca

    Not 100% sure why you are struggling with this, but o.k. let me elaborate one possible implementation.

    Assuming, that you always have 100 rows of data. Every second you receive a new row, that is added on top, while the most bottom row is thrown away.

    Then you can manually set up an inverted scale turning autoscaling off:
    Qt Code:
    1. plot->setAxis( QwtPlot::yLeft, 100, 0 );// not 0, 100 !
    To copy to clipboard, switch view to plain text mode 
    The y-interval of your data also always stays at 0-100.

    Finally you have:
    Qt Code:
    1. class YourScaleDraw : public QwtScaleDraw
    2. {
    3. public:
    4. void increment()
    5. {
    6. m_offset++;
    7. invalidateCache();
    8. }
    9.  
    10. QwtText label (double value ) const override
    11. {
    12. return QwtScaleDraw::label( value - m_offset );
    13. }
    14. private:
    15. double m_offset = 0;
    16. };
    17.  
    18. plot->setAxisScaleDraw( new YourScaleDraw() );
    To copy to clipboard, switch view to plain text mode 

    Now whenever a new row arrives you simply shift your data down by one row and add the new row add the top. Next you increment the scale draw offset and call replot.

    You probably don't want to have labels like -11, but you are free to return whatever makes sense in your case from YourScaleDraw::label.

    Of course there are other ways to implement the effect where you don't have a mismatch between the label and the actual value, but maybe try this first to get things started.

    Uwe

  3. #3
    Join Date
    Jun 2019
    Location
    France, Pau
    Posts
    60
    Thanks
    32
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: is it possible to make spectrogram's Y axis labels "fall" over time (waterfall ca

    I still can't achieve the falling effect with your last solution : the labels are not falling smoothly (continuously) with the layers, they are jumping (persistent gaps between Y labels) ! so maybe you misunderstood what I meant by "falling labels" : what I want to achieve with Qwt is this : http://www.youtube.com/watch?v=2jCO1F9b6cY&t=18m41s and I think it's impossible without putting big resources and a good knowledge of how Qwt works.

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: is it possible to make spectrogram's Y axis labels "fall" over time (waterfall ca

    What you call "falling labels" is simply an inverted y axis, with an interval, where its min/max values are increasing by time. This is not that different to what you can see in the cpuplot example - beside, that it is a horizontal axis.
    To change the range of an axis all you have to do is calling QwtPlot::setAxisScale and I really don't get why you consider this as being "deep knowledge".

    Uwe

Similar Threads

  1. Replies: 0
    Last Post: 19th October 2016, 10:05
  2. Replies: 4
    Last Post: 10th April 2012, 14:09
  3. Replies: 4
    Last Post: 18th April 2010, 00:37
  4. "make install" and "make clean" on Windows for Qt
    By Berberis in forum Installation and Deployment
    Replies: 0
    Last Post: 29th November 2009, 23:02
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.