Results 1 to 5 of 5

Thread: How can I tell which scale is used on an axis?

  1. #1
    Join Date
    Jan 2011
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How can I tell which scale is used on an axis?

    Hi! I've created a Qwt Plot with the ability to switch between log scale and arithmetic scale. I'd like to be able to exclude any 0s in the data when I am in log scale mode. I set the scale this way:
    Qt Code:
    1. plot->setAxisScaleEngine(QwtPlot::yLeft, new QwtLog10ScaleEngine());
    To copy to clipboard, switch view to plain text mode 
    Then later on when data comes in, I need to filter out the zeros. How can I figure out which scale engine is currently in use? Thanks!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,015
    Thanks
    280
    Thanked 816 Times in 805 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: How can I tell which scale is used on an axis?

    How do you switch? Using a push button or other GUI component that the user clicks? Connect to its clicked() signal and record which scale type is being used in some member variable.

    The other, ugly way is to call plot->axisScaleEngine() and dynamic_cast<> it to determine the type.

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,278
    Thanked 872 Times in 820 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How can I tell which scale is used on an axis?

    Or: plot->axisScaleEngine()->transformation()->type()

    Uwe

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,015
    Thanks
    280
    Thanked 816 Times in 805 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: How can I tell which scale is used on an axis?

    Quote Originally Posted by Uwe View Post
    Or: plot->axisScaleEngine()->transformation()->type()
    I should have guessed there would be something like that... Next time, I should use a shovel with a longer handle so I can dig deeper. This one was too short - I could only go one level down in the method hierarchy.

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

    Default Re: How can I tell which scale is used on an axis?

    By the way: I don't have bad feelings about dynamic casts or consider them as ugly.

    But for ( nowadays maybe obsolete ) memory reasons I take care, that Qwt doesn't need to be compiled with RTTI. So you can always expect to find a solution without dynamic casts.

    Uwe

Similar Threads

  1. Replies: 2
    Last Post: 30th December 2010, 17:32
  2. Refresh axis scale drawing
    By jmsbc in forum Qwt
    Replies: 1
    Last Post: 14th June 2009, 14:45
  3. qwp plot axis scale
    By Cal in forum Qwt
    Replies: 1
    Last Post: 11th May 2009, 17:10
  4. Axis with a probability scale
    By Lister in forum Qwt
    Replies: 1
    Last Post: 5th May 2009, 06:45
  5. 4 axis auto scale..
    By Vincenzo in forum Qwt
    Replies: 0
    Last Post: 22nd March 2009, 01:12

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.