Results 1 to 3 of 3

Thread: How to directly plot 'short' type data rather than 'double' type in QwtPlotCurve

  1. #1
    Join Date
    Nov 2013
    Posts
    2
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default How to directly plot 'short' type data rather than 'double' type in QwtPlotCurve

    Hello everybody,
    I come from china, hope my expression is not too bad.
    Currenty I am in a project and my job is programming a software to show and analyze data collected from one 14 bits AD converter.The software is done with
    qt5.1.0 and qwt6.1.0.
    The type of data received from AD converter is 'short', two bytes long. But now I find that when I trying to plot the data with QwtPlotCurve, I must transfer the
    data from 'short' to 'double'. Because all the interfaces I can find in QwtPlotCurve to plot data are only working with 'double' type. So this process is really memory consuming. For example , When I receive one megabytes data from AD converter, I need extra four megabytes memory to transfer data from short
    to double and then plot the data with the transtered double type data.
    In extreme case, I need to receive eighty megabytes data one time. So with this transfer process, my software often faces memory allocation failure bacause I
    also have other memory consuming work to do in other place in the software.
    I tried my best to find a way to directly plot 'short' type data but I failed.So cound anybody to tell me how to directly plot 'short' type data?

    Thank you
    Ben

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

    Default Re: How to directly plot 'short' type data rather than 'double' type in QwtPlotCurve

    You can store your samples however you like, all you need to do is to implement a bridge for QwtPlotCurve how to iterate over them by deriving a class from QwtSeriesData<QPointF>.
    So for example you could store your samples in 2 vectors of shorts, returning a temporary QPointF in the implementation of "YourData::sample (size_t i) const".

    When you are low on memory you might also want to play with the paint attributes of the curve ( QwtPlotCurve::PaintAttribute ) - f.e QwtPlotCurve::MinimizeMemory - to avoid that too much memory is used for the temporary buffers during rendering.

    Uwe

  3. The following user says thank you to Uwe for this useful post:

    songx6688 (27th November 2013)

  4. #3
    Join Date
    Nov 2013
    Posts
    2
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to directly plot 'short' type data rather than 'double' type in QwtPlotCurve

    Thank you Uwe, it works.

Similar Threads

  1. Replies: 2
    Last Post: 26th April 2013, 15:23
  2. Replies: 0
    Last Post: 25th April 2013, 11:30
  3. Replies: 0
    Last Post: 25th April 2013, 10:52
  4. QtOpenCL does not support type double?
    By Caius Aérobus in forum Qt Programming
    Replies: 0
    Last Post: 7th May 2012, 22:05
  5. Replies: 2
    Last Post: 10th October 2010, 16:38

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.