Results 1 to 2 of 2

Thread: Multiple axes with a relation

  1. #1
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Multiple axes with a relation

    I have an x axis which has its units in metres. I want to attach another x axes which shows units in foot. Right now I have 2 curves, 1 for each of the axes, getting painted one over the other.
    Is it possible to have 2 axes with a known relation(like foot - metre) and have a single curve?

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

    Default Re: Multiple axes with a relation

    Qt Code:
    1. class YourPlot: public QwtPlot
    2. {
    3. YourPlot( ... ):
    4. QwtPlot( ... )
    5. {
    6. ....
    7. enableAxis( QwtPlot::xTop );
    8. connect( axisWidget( QwtPlot::xBottom ),
    9. SIGNAL( scaleDivChanged() ), SLOT( syncScales() ) );
    10. }
    11.  
    12. void syncScales()
    13. {
    14. const QwtScaleDiv scaleDiv = axisScaleDiv( QwtPlot::xBottom );
    15.  
    16. const double min = scaleDiv.lowerBound() * ...;
    17. const double max = scaleDiv.upperBound() * ...;
    18.  
    19. setAxisScale( QwtPlot::xTop, min, max );
    20. }
    21. }
    To copy to clipboard, switch view to plain text mode 
    Then attach your curve to xBottom.

    Uwe

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

    pkj (21st February 2011)

Similar Threads

  1. Zoom and pan with two y-axes
    By mjfj in forum Qwt
    Replies: 1
    Last Post: 19th October 2010, 11:39
  2. Replies: 1
    Last Post: 18th March 2009, 22:26
  3. QComboBox QSqlQueryModel & relation.
    By matheww in forum Qt Programming
    Replies: 2
    Last Post: 20th June 2007, 05:56
  4. Replies: 0
    Last Post: 7th June 2007, 15:15
  5. Is there a relation between Qt and Quick Time?
    By Mariane in forum General Discussion
    Replies: 18
    Last Post: 24th January 2006, 22:23

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.