Results 1 to 9 of 9

Thread: How can I add title of the QwtPlotCurve(line) which situated abive the QwtPlotCurve?

  1. #1
    Join Date
    Jul 2012
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default How can I add title of the QwtPlotCurve(line) which situated abive the QwtPlotCurve?

    Hi)I have QwtPlot , QwtPlotCurve which consist of 2 points - line. I'd like to add title for QwtPlotCurve which situated above the line , like the title of QwtPlotmarker. How can I do it???I saw the documentation and examples and I didn't find it!Please, help!

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

    Default Re: How can I add title of the QwtPlotCurve(line) which situated abive the QwtPlotCur

    You can add a marker ( without a symbol ) at the center ( or wherever you want to align your title ) of the line. To avoid that the marker text intersects the line you have to feed QwtPlotMarker::setLabelAlignment() depending on the gradient of your line.

    Uwe

  3. #3
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can I add title of the QwtPlotCurve(line) which situated abive the QwtPlotCur

    Quote Originally Posted by Uwe View Post
    You can add a marker ( without a symbol ) at the center ( or wherever you want to align your title ) of the line.
    Uwe
    can anyone please show how we can add or attache the marker to the "curve" line ???

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

    Default Re: How can I add title of the QwtPlotCurve(line) which situated abive the QwtPlotCur

    You can't attach a marker to a curve, but you can set the position of the marker to something that is related to the coordinates of the curve points. Instead you can use the legend what is the usual concept for showing a textual information about a curve.

    If you want to "attach" some text according to a line ( rotated in direction of this line with some pixels distance ) you have to derive from QwtPlotCurve overloading the draw method. But please don't ask for an algorithm how to align a text label to a polygon ( not only a line ) - I don't have one.

    Uwe

  5. #5
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can I add title of the QwtPlotCurve(line) which situated abive the QwtPlotCur

    I tried to set the position of the marker using

    [CODE] mymarker->setAxes(4000,1000); [CODE/]

    but the marker keep showing in the (0,0) coordinates. so how can i set the position of the marker ?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How can I add title of the QwtPlotCurve(line) which situated abive the QwtPlotCur

    Quote Originally Posted by jesse_mark View Post
    I tried to set the position of the marker using

    Qt Code:
    1. mymarker->setAxes(4000,1000);
    To copy to clipboard, switch view to plain text mode 
    This associates X and Y axes (as in xBottom and yLeft) with the marker, it doesn't set its position.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can I add title of the QwtPlotCurve(line) which situated abive the QwtPlotCur

    Thanks,

    I was using the wrong method and wondering, there is not much explanation in the qwt documents so we end up asking too many simple questions.

    marker->setValue was the right method to set the marker position.

    Sorry, what is the difference between the x,y Axes and the position ?? I'm kinda confused , or if you could point me the place where i can read about this and under stand this more.

    f.e in the documentation the

    " setAxis method : The item will painted according to the coordinates its Axes. "

    so what is the x and y Axis if it is not the x and y position ??

    Thank you so much,

    Jesse.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How can I add title of the QwtPlotCurve(line) which situated abive the QwtPlotCur

    Quote Originally Posted by jesse_mark View Post
    Sorry, what is the difference between the x,y Axes and the position ??
    Axes are "top", "bottom", "left", "right" and value/position is the value of a respective axis a particular item has. It's classic cartesian math, you know...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    Default Re: How can I add title of the QwtPlotCurve(line) which situated abive the QwtPlotCur

    Quote Originally Posted by jesse_mark View Post
    Sorry, what is the difference between the x,y Axes and the position ??
    Well you are the first one in 15 years who was running in this misunderstanding.

    The reason for it is that the axes parameters are not declared as QwtPlot::Axis. Qwt 0.1 had a lot of C type code - probably because of the personal background of the author - and I always hesitated to clean it up, because it is a modification for so many APis and I would have to fix all code that loops from i to QwtPlot::axisCnt.

    At least I have extended the documentation.

    Uwe

Similar Threads

  1. How add new point to QwtPlotCurve
    By dqrest in forum Qt Programming
    Replies: 5
    Last Post: 16th July 2012, 10:43
  2. Replies: 1
    Last Post: 11th May 2012, 09:02
  3. Replies: 1
    Last Post: 26th November 2011, 05:56
  4. QwtPlotCurve
    By kishorer in forum Newbie
    Replies: 0
    Last Post: 6th September 2011, 17:05
  5. HOWTO: limit title in QwtPlotCurve?
    By Astronomy in forum Qwt
    Replies: 6
    Last Post: 20th July 2010, 10:04

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.