Results 1 to 5 of 5

Thread: adding plotmarkers for two different axises scales

  1. #1
    Join Date
    Jun 2009
    Location
    AKL | New Zealand
    Posts
    62
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question adding plotmarkers for two different axises scales

    Hi,

    I created a plot which got two y-axises in different scale. as you see in the picture:



    I have added a marker y=0.5 referring to yLeft axis.

    Qt Code:
    1. QwtPlotMarker *markerX = new QwtPlotMarker();
    2. markerX->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
    3. markerX->setLineStyle(QwtPlotMarker::HLine);
    4. markerX->setLinePen(Qt::DotLine);
    5. markerX->setYValue(0.5);
    6. markerX->attach(ui->qwtPlot);
    To copy to clipboard, switch view to plain text mode 

    Now, I want to add a second marker y=50 referring to yRight axis.

    can anyone give me a hint, please?
    Thanks in advance.

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

    Default Re: adding plotmarkers for two different axises scales

    marker->setYAxis(QwtPlotItem::yRight);

    Uwe

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

    cooper (3rd November 2010)

  4. #3
    Join Date
    Jun 2009
    Location
    AKL | New Zealand
    Posts
    62
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: adding plotmarkers for two different axises scales

    Hi Uwe,

    Thanks for your reply.
    I got an error message after I edited my program

    error: ‘yRight’ is not a member of ‘QwtPlotItem’

    Here is my code:
    Qt Code:
    1. QwtPlotMarker *markerX = new QwtPlotMarker();
    2. markerX->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
    3. markerX->setLineStyle(QwtPlotMarker::HLine);
    4. markerX->setLinePen(Qt::DotLine);
    5. markerX->setYValue(50);
    6. markerX->setYAxis(QwtPlotItem::yRight);
    7. markerX->attach(ui->qwtPlot);
    To copy to clipboard, switch view to plain text mode 

    I am using qwt-5.2.1.
    I read the following documentation:
    http://qwt.sourceforge.net/class_qwt_plot_marker.html

    It looks like QwtPlotMarker class does not have a "setYAxis" member.

    Can you tell where does the "setYAxis" come from, please?

    Thanks again

  5. #4
    Join Date
    Sep 2010
    Posts
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: adding plotmarkers for two different axises scales

    use QwtPlot::yRight instead of QwtPlotItem::yRight.

    QwtPlotMarker does not have setYAxis(), but its parent QwtPlotItem has.
    http://qwt.sourceforge.net/class_qwt...25d5ae8f01db9a

  6. The following user says thank you to davey for this useful post:

    cooper (4th November 2010)

  7. #5
    Join Date
    Jun 2009
    Location
    AKL | New Zealand
    Posts
    62
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: adding plotmarkers for two different axises scales

    Thanks "davey". solved it : )

Similar Threads

  1. Replies: 1
    Last Post: 8th September 2010, 07:53
  2. Replies: 0
    Last Post: 1st January 2009, 18:47
  3. fixed axis scales
    By oskarmellow in forum Qwt
    Replies: 1
    Last Post: 17th December 2008, 06:20
  4. Equal scales
    By sukram in forum Qwt
    Replies: 1
    Last Post: 22nd July 2008, 07:44
  5. Problem with scales
    By fear in forum Qwt
    Replies: 2
    Last Post: 5th May 2008, 22:18

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.