Results 1 to 2 of 2

Thread: Sharing on QwtPlotPicker showing values of dual Y axes

Threaded View

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

    Default Re: Sharing on QwtPlotPicker showing values of dual Y axes

    Quote Originally Posted by davey View Post
    For the implementation of trackerText(), all I need is to return a text with both Y axes value but the problem is how.
    You can use the canvas maps:

    Qt Code:
    1. virtual QwtText YourPicker::trackerText(const QwtDoublePoint &pos) const
    2. {
    3. QPointF p = transform(pos);
    4.  
    5. int axis = (yAxis() == QwtPlot::yRight) ? QwtPlot::yLeft : QwtPlot::yRight:
    6. double y2 = plot()->canvasMap(axis).invTransform(p.y());
    7.  
    8. ...
    9. }
    To copy to clipboard, switch view to plain text mode 

    In your special situation, where you simple append the second y value to the text you could also do the following:

    Qt Code:
    1. virtual QwtText YourPicker::trackerText(const QPoint &pos) const
    2. {
    3. int axis = (yAxis() == QwtPlot::yRight) ? QwtPlot::yLeft : QwtPlot::yRight:
    4. double y2 = plot()->canvasMap(axis).transform(p.y());
    5.  
    6. QwtText text = QwtPlotPicker::trackerText(pos);
    7. text += ...
    8. return text:
    9. }
    To copy to clipboard, switch view to plain text mode 

    Uwe

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

    C403 (25th January 2015)

Similar Threads

  1. Replies: 2
    Last Post: 25th February 2010, 11:28
  2. Replies: 4
    Last Post: 17th October 2009, 23:31
  3. Dual frame buffers /dev/fb0 and /dev/fb1
    By ghassett in forum Qt Programming
    Replies: 0
    Last Post: 28th May 2009, 19:57
  4. changing values for one class and showing it ..!
    By salmanmanekia in forum General Programming
    Replies: 6
    Last Post: 14th August 2008, 14:13
  5. Dual TCP/IP Client/Server
    By jimroos in forum Qt Programming
    Replies: 1
    Last Post: 29th June 2007, 22:58

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
  •  
Qt is a trademark of The Qt Company.