Results 1 to 6 of 6

Thread: QwtPlot Change Axis Title Alignment

  1. #1
    Join Date
    Jun 2010
    Posts
    2
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QwtPlot Change Axis Title Alignment

    Hello,

    I'm trying to put the axis title in the top of the yLeft axis (instead of the default behaviour which is on the left) and I can't figure out how this can be done. I have seen that in qwt 4.2 used to be a method called QwtPlot::setAxisTitleAlignment, I guess it did what I need but I haven't found any equivalent in qwt 5.2.1. Does anybody know if this can be done?

    Thank you very much
    César

  2. #2
    Join Date
    Oct 2009
    Posts
    28
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPlot Change Axis Title Alignment

    Try with this:
    Qt Code:
    1. plot->axisScaleDraw(QwtPlot::yLeft)->setAlignment(Qt::AlignTop);
    To copy to clipboard, switch view to plain text mode 

    I hope that helps.
    Regards.

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

    deepy (27th July 2010)

  4. #3
    Join Date
    Jun 2010
    Posts
    2
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlot Change Axis Title Alignment

    Thank you for your answer gutiory , unfortunately it doesn't work as I expected, I have used:

    plot->axisScaleDraw(QwtPlot::yLeft)->setAlignment(QwtScaleDraw::TopScale)

    But the result is that the entire alignment of the axes change, I would like to change the alignment of the title, in fact I have been thinking that I was wrong, more than the alignment, I would like to change the position of the title to the top of the yLeft axes vertical line (I guess this can not be done with the alignment, I'm not sure). I have attached a few pictures to show my idea. What I would like to obtain is 'desired_result.jpg'. In 'result_setAlignment.jpg' is what I get when I use the setAligment method of the QwtScaleDraw and the current aspect of my plots is in 'result_without_setAlignment.jpg'

    Anyway thanks a lot for your help!

    result_setAlignment.jpg:
    result_setAlignment.jpg

    result_without_setAlignment.jpg:
    result_without_setAlignment.jpg

    desired_result.jpg:
    desired_result.jpg

  5. #4
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPlot Change Axis Title Alignment

    I'm facing the same problem, does anyone has an answer?

  6. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,244
    Thanked 860 Times in 809 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlot Change Axis Title Alignment

    The alignment of the scaleDraw is about how the scaleDraw is aligned to the plot canvas. If you want to align the axis title of a scale widget you have to change the alignment flags of the corresponding QwtText object ( QwtText::setRenderFlags() ).

    But even if you have aligned the title somehow you can't rotate it.

    Uwe

  7. The following 2 users say thank you to Uwe for this useful post:

    deepy (20th October 2010), FelixB (20th October 2010)

  8. #6
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPlot Change Axis Title Alignment

    thank you. I solved the problem by painting the "axis title" with QPainter::drawText in MyPlot : : paintEvent().

  9. The following user says thank you to FelixB for this useful post:

    deepy (20th October 2010)

Similar Threads

  1. QGroupBox title alignment
    By binaural in forum Newbie
    Replies: 2
    Last Post: 9th April 2010, 21:56
  2. Replies: 1
    Last Post: 5th January 2010, 21:00
  3. QwtPlot axis decmials/notation
    By dfirestone in forum Qwt
    Replies: 1
    Last Post: 1st May 2009, 10:42
  4. Set axis title on the right side
    By pospiech in forum Qwt
    Replies: 1
    Last Post: 14th March 2008, 07:26
  5. Title Bar Alignment and mainwindow options
    By Krish_ng in forum Qt Programming
    Replies: 6
    Last Post: 16th July 2007, 08:10

Tags for this Thread

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.