Results 1 to 2 of 2

Thread: Unit conversion in QwtPlot

  1. #1
    Join Date
    Jul 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Unit conversion in QwtPlot

    I'm plotting the time evolution of some system in a QwtPlot and would like to be able to easily
    change to labels of the time axis between hours, days and years.

    In the thermo widget one can get this conversion through the setRange() and setScale() functions, I'm wondering if QwtPlot has something analogous.

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

    Default Re: Unit conversion in QwtPlot

    All Qwt widgets with scales use the same classes to calculate and render them. So you can do the same with the scales of a QwtPlot and of a QwtThermo. See all methods starting with QwtPlot::setAxisScale....

    Unfortunately Qwt doesn't have a date/time scale engine, that calculates ticks according to minutes/hours or weeks/months. Its on my TODO list for years so I would be glad for a contribution: "simply" derive from QwtScaleEngine and implement divideScale/autoScale.

    Without having such a time/date scale engine you have calculate your ticks manually and use QwtPlot::setAxisScaleDiv or you have to live with scales aligned to decades.

    Uwe

Similar Threads

  1. Qt unit testing
    By chandan in forum Newbie
    Replies: 3
    Last Post: 13th July 2010, 19:20
  2. Unit tests
    By leoalvesmachado in forum Newbie
    Replies: 1
    Last Post: 13th April 2010, 20:50
  3. Unit always visible in QLineEdit
    By zack in forum Qt Programming
    Replies: 2
    Last Post: 13th January 2010, 08:58
  4. Replies: 6
    Last Post: 14th May 2009, 12:02
  5. How to unit test a Qt Gui
    By mitskits in forum Qt Programming
    Replies: 1
    Last Post: 20th January 2006, 07:36

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
  •  
Qt is a trademark of The Qt Company.