Results 1 to 2 of 2

Thread: SetAxisScale() and setAxisScaleDraw()

  1. #1
    Join Date
    Nov 2019
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default SetAxisScale() and setAxisScaleDraw()

    Hi, I made plot X axis with my own time labels (Qwt 5.0.0):
    Qt Code:
    1. class TimeScaleDraw: public QwtScaleDraw
    2. {
    3. public:
    4. TimeScaleDraw(const QTime &base):
    5. baseTime(base)
    6. {
    7. }
    8.  
    9. virtual QwtText label(double v) const
    10. {
    11. QString msg1="";
    12. if(b_time_list.size()>0)
    13. {
    14. if(v<b_time_list.size() && v>0)
    15. {
    16. msg1=b_time_list[v];
    17. }
    18. }
    19. return msg1;
    20. }
    21.  
    22. private:
    23. QTime baseTime;
    24.  
    25. };
    To copy to clipboard, switch view to plain text mode 

    In print to paper slot I see X axis with labels:
    Qt Code:
    1. double xn11=0, xk11=1200;
    2.  
    3. qwtPlot->setAxisScale(QwtPlot::xBottom, xn11, xk11);//x
    4.  
    5. qwtPlot->replot();
    6.  
    7. painter.setViewport(xp-40, yp+hp, wp, hp*3);
    8. qwtPlot->print(&painter,rect,filter);
    To copy to clipboard, switch view to plain text mode 

    But than I add setAxisScaleDraw() I see X axis without time labels:
    Qt Code:
    1. qwtPlot->setAxisScale(QwtPlot::xBottom, xn11, xk11);//x
    2. qwtPlot->setAxisScaleDraw(QwtPlot::xBottom, new TimeScaleDraw(QTime::fromString("00:00:00","hh,mm,ss")));
    3.  
    4. qwtPlot->replot();
    5.  
    6. painter.setViewport(xp-40, yp+hp, wp, hp*3);
    7. qwtPlot->print(&painter,rect,filter);
    To copy to clipboard, switch view to plain text mode 

    How can I print X axis with time labels?
    Last edited by Eugene K; 4th January 2021 at 12:38.

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

    Default Re: SetAxisScale() and setAxisScaleDraw()

    Are you sure you want to use Qwt 5.0.0 - this version is from 2007 ?

    Uwe

Similar Threads

  1. Replies: 5
    Last Post: 12th July 2012, 19:37
  2. Multiple setAxisScaleDraw classes
    By KenJustKen in forum Qwt
    Replies: 2
    Last Post: 13th November 2011, 19:25
  3. setAxisScale(1) doesn't do anything
    By rakkar in forum Qwt
    Replies: 1
    Last Post: 19th September 2009, 10:42
  4. SetAxisScale problem
    By emrares in forum Qwt
    Replies: 2
    Last Post: 12th August 2009, 17:45
  5. custom axis (setAxisScaleDraw) questions
    By MrGarbage in forum Qwt
    Replies: 7
    Last Post: 11th January 2008, 10:08

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.