Results 1 to 13 of 13

Thread: Time/Date Axis

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Jul 2008
    Posts
    1
    Thanked 5 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Time/Date Axis

    I wrote code for this stuff, based on the provided Qwt examples.
    For the time/date axis, the following simple class was used (it assumes the time is stored in the time_t form):
    Qt Code:
    1. class StockTimeScaleDraw: public QwtScaleDraw
    2. {
    3. public:
    4. StockTimeScaleDraw(QString fmt) : format(fmt) { }
    5.  
    6. virtual QwtText label(double v) const
    7. {
    8. QDateTime t = QDateTime::fromTime_t((int)v);
    9. return t.toString(format);
    10. }
    11. private:
    12. const QString format;
    13. }
    To copy to clipboard, switch view to plain text mode 

    The attached program contains a plot item to draw candlesticks based on OHLC data. This example generates random data each second, aggregating and creating bars every 10 seconds. Another feature that might be useful is the ability to adjust the scale by clicking and dragging the axes.
    Hopefully some of this will be helpful to others.
    Attached Files Attached Files

  2. The following 5 users say thank you to dinojerm for this useful post:

    joro (19th March 2009), philwinder (14th March 2009), praseodym (27th November 2010), skater (13th March 2012), uppu (18th November 2009)

Similar Threads

  1. Relocating axis labels
    By malcom2073 in forum Qwt
    Replies: 0
    Last Post: 9th May 2008, 13:01
  2. Set axis title on the right side
    By pospiech in forum Qwt
    Replies: 1
    Last Post: 14th March 2008, 07:26
  3. Qwt and custom axis
    By jiveaxe in forum Qwt
    Replies: 3
    Last Post: 14th November 2007, 15:50
  4. Qwt - extra axis
    By steg90 in forum Qwt
    Replies: 2
    Last Post: 10th July 2007, 14:41

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.